/* ---------- カラー・書体 ---------- */
:root {
  --bg: #f6f3ec;
  --bg-glow: #efe7d6;
  --surface: #ffffff;
  --surface-soft: #faf8f3;
  --text: #1d2233;
  --text-soft: #4a5063;
  --muted: #8b8f9c;
  --line: #e7e2d7;
  --ink: #1f2a44;
  --ink-hover: #2c3a5c;
  --gold: #b08a4a;
  --gold-soft: #f3ead9;
  --done: #4f8a6b;
  --done-soft: #e5efe8;
  --danger: #c0504d;
  --danger-soft: #f8e7e6;
  --shadow: 0 1px 2px rgba(31, 42, 68, 0.04), 0 8px 24px -12px rgba(31, 42, 68, 0.12);
  --radius: 16px;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171f;
    --bg-glow: #1c2130;
    --surface: #1b1f2a;
    --surface-soft: #202533;
    --text: #eceae4;
    --text-soft: #b9bac2;
    --muted: #7f8392;
    --line: #2b3040;
    --ink: #d9c39a;
    --ink-hover: #e6d3ae;
    --gold: #d2b27a;
    --gold-soft: #2e2a22;
    --done: #7fb996;
    --done-soft: #1f2e27;
    --danger: #e0807d;
    --danger-soft: #3a2323;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--bg-glow), transparent 70%),
    var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

/* ---------- ヘッダー ---------- */
.hero { margin-bottom: 32px; }
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.04em;
  margin: 6px 0 4px;
}
.today { color: var(--muted); font-size: 0.95rem; letter-spacing: 0.04em; }

/* ---------- ダッシュボード ---------- */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 16px;
  margin-bottom: 48px;
}
.stat {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}
.stat-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stat-accent .stat-icon { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.08em; }
.stat-value {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}
.progress {
  height: 6px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--done));
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress-label { margin-top: 6px; font-size: 0.75rem; color: var(--muted); }

/* ---------- レイアウト ---------- */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.column { min-width: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}
.list-heading {
  margin: 28px 0 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 入力欄 ---------- */
.composer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within {
  border-color: var(--gold);
  box-shadow: var(--shadow), 0 0 0 4px var(--gold-soft);
}
.composer-inline { flex-direction: row; align-items: center; }
.composer-inline .field { flex: 1; }
.composer-actions { display: flex; justify-content: flex-end; padding: 4px; }

.field {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  resize: vertical;
}
.field::placeholder { color: var(--muted); }
.field-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 1px dashed var(--line);
}

/* ---------- ボタン ---------- */
.btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: var(--ink-hover); }

.icon-btn {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }

button:focus-visible, .check:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- メモ一覧 ---------- */
.memo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.memo {
  position: relative;
  padding: 18px 22px 16px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.35s ease both;
}
.memo::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}
.memo-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
  word-break: break-word;
}
.memo-body {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.93rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.meta svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- タスク一覧 ---------- */
.task-list { list-style: none; margin: 0; padding: 6px; }
.task {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 12px;
  border-radius: 12px;
  transition: background 0.2s;
  animation: rise 0.35s ease both;
}
.task + .task { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.task:hover { background: var(--surface-soft); }

.check {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}
.check svg {
  width: 14px; height: 14px;
  fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0; transform: scale(0.6);
  transition: all 0.2s;
}
.check:hover { border-color: var(--done); background: var(--done-soft); }
.task.done .check { background: var(--done); border-color: var(--done); }
.task.done .check svg { opacity: 1; transform: scale(1); }

.task-main { flex: 1; min-width: 0; }
.task-text { word-break: break-word; transition: color 0.2s; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.task .meta { margin-top: 4px; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
}
.badge.done { background: var(--done-soft); color: var(--done); }

.task .icon-btn { opacity: 0.35; }
.task:hover .icon-btn, .task .icon-btn:focus-visible { opacity: 1; }

/* ---------- 空の状態 ---------- */
.empty {
  list-style: none;
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.task-list .empty { border: none; }
.empty strong {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--text-soft);
  font-size: 1rem;
  margin-bottom: 2px;
}

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.88rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- スマホ ---------- */
@media (hover: none) {
  .task .icon-btn { opacity: 0.7; }
}
@media (max-width: 820px) {
  .page { padding: 36px 16px 64px; }
  .dashboard { grid-template-columns: 1fr 1fr; }
  .stat-accent { grid-column: 1 / -1; }
  .columns { grid-template-columns: 1fr; gap: 48px; }
}
@media (max-width: 420px) {
  .stat { padding: 16px; gap: 12px; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 1.7rem; }
}
