:root {
  --bg-main: #eef4f7;
  --bg-panel: #ffffff;
  --bg-panel-soft: linear-gradient(180deg, #ffffff 0%, #eef8f7 100%);
  --text-main: #1f2a37;
  --text-sub: #5f6f7f;
  --text-muted: #92a0ad;
  --border-soft: #d9e3e8;
  --border-strong: #bcccd6;
  --primary: #0f6c82;
  --primary-strong: #0b586a;
  --primary-soft: #e5f5f8;
  --success: #2f9e5b;
  --success-soft: #eef9f1;
  --danger: #d94242;
  --danger-strong: #b92f2f;
  --danger-soft: #fff1f1;
  --shadow-soft: 0 18px 45px rgba(27, 43, 56, 0.09);
  --shadow-strong: 0 24px 60px rgba(18, 42, 58, 0.14);
  --radius-panel: 24px;
  --radius-item: 20px;
  --radius-pill: 999px;
  --content-width: 760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 108, 130, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(84, 160, 131, 0.1), transparent 24%),
    linear-gradient(180deg, #f9fcfd 0%, var(--bg-main) 100%);
  color: var(--text-main);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(calc(100% - 24px), var(--content-width));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 16px;
}

.screen-header-home {
  padding: 18px 18px 22px;
  border: 1px solid rgba(217, 227, 232, 0.9);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(15, 108, 130, 0.92) 0%, rgba(37, 139, 163, 0.88) 54%, rgba(111, 183, 165, 0.82) 100%);
  box-shadow: var(--shadow-strong);
}

.screen-header-home .eyebrow,
.screen-header-home .screen-title {
  color: #ffffff;
}

.screen-header-home .eyebrow {
  opacity: 0.78;
}

.screen-header > :first-child,
.task-heading > :first-child {
  min-width: 0;
}

.screen-body {
  display: grid;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen-title {
  margin: 0;
  font-size: clamp(28px, 6vw, 36px);
  line-height: 1.15;
}

.screen-title-small {
  font-size: clamp(24px, 5vw, 32px);
}

.panel-text,
.task-description {
  margin: 10px 0 0;
  color: var(--text-sub);
  font-size: 16px;
  line-height: 1.6;
}

.date-label {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(217, 227, 232, 0.9);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(34, 55, 89, 0.06);
}

.screen-header-home .date-label {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: none;
}

.panel {
  position: relative;
  padding: 20px;
  border: 1px solid rgba(217, 227, 232, 0.9);
  border-radius: var(--radius-panel);
  background: var(--bg-panel);
  box-shadow: var(--shadow-soft);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent 24%);
}

.panel-accent {
  background: var(--bg-panel-soft);
}

.panel-heading {
  margin-bottom: 16px;
}

.section-toolbar {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.section-toolbar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.panel-title {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.01em;
}

.task-button-list,
.todo-list,
.memo-list {
  display: grid;
  gap: 14px;
}

.task-button-list {
  gap: 10px;
}

.button {
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  transition: transform 0.12s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.button:active {
  transform: scale(0.99);
}

.button:focus-visible,
.text-input:focus-visible,
.note-input:focus-visible,
.check-input:focus-visible {
  outline: 3px solid rgba(36, 107, 219, 0.24);
  outline-offset: 2px;
}

.button-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1f8aa2 100%);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(15, 108, 130, 0.2);
}

.button-primary:hover {
  background: linear-gradient(135deg, var(--primary-strong) 0%, #17778c 100%);
  box-shadow: 0 16px 32px rgba(15, 108, 130, 0.24);
}

.button-secondary {
  background: #ffffff;
  border-color: var(--border-soft);
  color: var(--text-main);
}

.button-secondary:hover {
  border-color: var(--border-strong);
  background: #f8fbff;
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(217, 66, 66, 0.16);
}

.button-danger:hover {
  background: #ffe5e5;
  color: var(--danger-strong);
}

.button-large {
  width: 100%;
  justify-content: center;
}

.button-inline {
  min-width: 88px;
}

.button-small {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
}

.button-ghost-danger {
  background: #ffffff;
  border-color: rgba(217, 66, 66, 0.2);
  color: var(--danger);
}

.button-ghost-danger:hover {
  background: #fff5f5;
  border-color: rgba(217, 66, 66, 0.32);
}

.button-edit-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  background: #ffffff;
  border-color: rgba(15, 108, 130, 0.18);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.button-edit-trigger:hover {
  background: #eef9fb;
  border-color: rgba(15, 108, 130, 0.3);
}

.button-delete-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  background: #ffffff;
  border-color: rgba(217, 66, 66, 0.18);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.button-delete-trigger:hover {
  background: #fff5f5;
  border-color: rgba(217, 66, 66, 0.3);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 31, 41, 0.34);
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(100%, 520px);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 18px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(18, 42, 58, 0.22);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-title {
  margin: 0;
  font-size: 22px;
}

.modal-list {
  display: grid;
  gap: 10px;
}

.modal-delete-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fbfdfe;
}

.modal-check {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.modal-delete-text {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-footer {
  margin-top: 16px;
}

.edit-row {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #fbfdfe;
}

.edit-row-label {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
}

.edit-row-input {
  width: 100%;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.task-list-item {
  display: block;
}

.task-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: 0;
  padding: 14px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
  border-color: var(--border-soft);
  color: var(--text-main);
  box-shadow: 0 8px 18px rgba(22, 36, 48, 0.055);
}

.task-button:hover {
  border-color: #9bc8d2;
  background: linear-gradient(180deg, #ffffff 0%, #f1fbfd 100%);
  box-shadow: 0 14px 28px rgba(15, 108, 130, 0.1);
  transform: translateY(-1px);
}

.task-button-content {
  display: grid;
  gap: 0;
  min-width: 0;
}

.task-button-title {
  display: block;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.task-button-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
}

.task-detail-panel .button-danger {
  margin-top: 16px;
}

.task-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}

.todo-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-item);
  background: linear-gradient(180deg, #ffffff 0%, #fcfefe 100%);
  box-shadow: 0 8px 18px rgba(26, 41, 53, 0.045);
  overflow: hidden;
}

.todo-card.is-complete {
  border-color: rgba(47, 158, 91, 0.3);
  background: linear-gradient(180deg, #ffffff 0%, var(--success-soft) 100%);
}

.todo-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
}

.check-input {
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  accent-color: var(--success);
  flex: 0 0 auto;
}

.todo-text-wrap {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.todo-text {
  display: block;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  flex: 1 1 220px;
}

.todo-card.is-complete .todo-text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.todo-note-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef6fb;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  justify-self: start;
}

.note-toggle {
  min-width: 58px;
  padding-inline: 8px;
}

.todo-actions {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.note-toggle.has-note {
  border-color: rgba(36, 107, 219, 0.28);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.text-input,
.note-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 16px;
}

.note-input {
  background: #f7fbfc;
}

.note-inline-input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  font-size: 14px;
}

.memo-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 16px;
}

.memo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.memo-item {
  display: block;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-item);
  background: linear-gradient(180deg, #ffffff 0%, #fafdfd 100%);
  box-shadow: 0 10px 22px rgba(26, 41, 53, 0.05);
}

.memo-text {
  min-width: 0;
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.memo-empty {
  padding: 20px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-item);
  color: var(--text-sub);
  background: #f9fbff;
  text-align: center;
}

.empty-state {
  padding: 20px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-item);
  color: var(--text-sub);
  background: #f7fbfc;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 620px) {
  .app-shell {
    width: min(calc(100% - 24px), var(--content-width));
  }

  .memo-form,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .screen-header,
  .task-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .section-toolbar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
  }

  .toolbar-actions {
    gap: 6px;
  }

  .screen-header-home {
    padding: 16px;
  }

  .memo-form {
    display: grid;
  }

  .memo-form .button {
    width: 100%;
  }

  .todo-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .todo-row .todo-actions {
    grid-column: auto;
    justify-self: end;
  }

  .todo-actions {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .todo-text {
    font-size: 14px;
    line-height: 1.35;
  }

  .note-toggle {
    min-width: 56px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .button-delete-trigger {
    min-width: 56px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .button-edit-trigger {
    min-width: 56px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .task-button-list {
    gap: 8px;
  }

  .task-button {
    gap: 10px;
    padding: 12px 14px;
  }

  .task-button-title {
    font-size: 15px;
    line-height: 1.3;
  }

  .task-button-arrow {
    width: 28px;
    height: 28px;
    font-size: 20px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-panel {
    width: 100%;
    padding: 16px;
    border-radius: 20px 20px 16px 16px;
  }

  .todo-note-chip,
  .note-inline-input {
    width: 100%;
    border-radius: 14px;
  }
}

@media (min-width: 768px) {
  .app-shell {
    padding-top: 28px;
    padding-bottom: 52px;
  }

  .panel {
    padding: 24px;
  }
}
