/* Homeset — warm paper by day, aubergine stage by night. */
:root {
  --bg: #fbf3e8;
  --bg-2: #f5e8d6;
  --surface: #fffcf7;
  --surface-2: #fdf6ec;
  --ink: #2b1d30;
  --ink-2: #5b4a5f;
  --muted: #6e5d70;
  --line: #e8d9c6;
  --accent: #d9482f;        /* coral (fills, rings) */
  --accent-ink: #b0341f;    /* coral for text: 5.6:1 on surface */
  --accent-soft: #fde3d8;
  --gold: #f0b23c;
  --gold-soft: #fbedc9;
  --calm: #1e7668;          /* break teal */
  --calm-soft: #d5efe9;
  --plum: #6b3f7a;
  --danger: #b3261e;
  --on-accent: #fff;
  --shadow: 0 1px 0 rgba(43, 29, 48, .04), 0 10px 30px -14px rgba(72, 38, 30, .28);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 0px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1c1523;
  --bg-2: #241b2d;
  --surface: #271e31;
  --surface-2: #2e2439;
  --ink: #f7ede2;
  --ink-2: #dccbd9;
  --muted: #b9a7b8;
  --line: #3e3149;
  --accent: #ff7a5c;
  --accent-ink: #ff9a80;
  --accent-soft: #4a2a2c;
  --gold: #f6c45c;
  --gold-soft: #463a22;
  --calm: #5fd0bd;
  --calm-soft: #1e3c3a;
  --plum: #cfa3dd;
  --danger: #ff8a80;
  --on-accent: #2b1012;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 14px 34px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 110% -10%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at -20% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
h2 { font-size: 1.25rem; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.visually-hidden, .sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) clamp(14px, 4vw, 32px) 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; stroke: none; }
.bm-bg { fill: var(--accent); }
.bm-lines { stroke: var(--on-accent); stroke-width: 3; fill: none; }
:root[data-theme="dark"] .bm-lines { stroke: #2b1012; }
.bm-dot { fill: var(--gold); }
.brand-name { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; font-style: italic; letter-spacing: -.01em; }
.topbar-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.mini-timer {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: .9rem; box-shadow: var(--shadow);
}
.mini-timer + .topbar-actions { margin-left: 0; }
.mini-timer b { font-variant-numeric: tabular-nums; }
.mini-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.mini-timer[data-phase="break"] .mini-dot { background: var(--calm); }
.mini-timer[data-running="1"] .mini-dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------------------------------------- tabs */
.tabs {
  display: flex; gap: 6px; justify-content: center;
  padding: 10px clamp(14px, 4vw, 32px) 0;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  color: var(--ink-2); padding: 9px 16px; border-radius: 999px; font-weight: 600; position: relative;
}
.tab:hover { background: var(--bg-2); color: var(--ink); }
.tab[aria-current="page"] { background: var(--ink); color: var(--bg); }
.tab-count { font-size: .72rem; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; padding: 0 6px; }
@media (max-width: 720px) {
  :root { --tabbar-h: 66px; }
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); justify-content: space-around; gap: 0;
  }
  .tab { flex-direction: column; gap: 2px; font-size: .74rem; padding: 6px 10px; border-radius: 14px; min-width: 64px; }
  .tab svg { width: 22px; height: 22px; }
  .tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
  .tab-count { position: absolute; top: 2px; right: 10px; }
  .brand-name { font-size: 1.2rem; }
}

/* ------------------------------------------------------------- layout */
main { max-width: 1120px; margin: 0 auto; padding: 18px clamp(14px, 4vw, 32px) 30px; outline: none; }
.view-head { margin: 8px 0 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 700; color: var(--accent-ink); margin-bottom: 4px; }
.lead { color: var(--ink-2); max-width: 60ch; margin-top: 8px; }
.today-strip { color: var(--ink-2); margin-top: 8px; }
.grid-2 { display: grid; gap: 18px; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: minmax(330px, 420px) 1fr; align-items: start; }
  .add-card, .window-card { position: sticky; top: 84px; }
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(16px, 3vw, 22px); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.muted { color: var(--muted); font-weight: 400; font-family: var(--sans); font-size: .9rem; }
.hint { color: var(--muted); font-size: .9rem; }
.small { font-size: .82rem; }
.opt { color: var(--muted); font-weight: 400; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 6px 16px 26px; }
.footer svg { vertical-align: -3px; }

/* ------------------------------------------------------------- forms */
.field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .88rem; margin-top: 6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-2 .field { margin-bottom: 6px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
@media (max-width: 460px) { .row-4 { grid-template-columns: 1fr 1fr; } }
.row-btns { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.row-btns.wrap { flex-wrap: wrap; }
#f-est-hint { margin: 4px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.field > .chips:first-child, .due-row .chips { margin-top: 0; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 999px;
  padding: 6px 12px; min-height: 36px; cursor: pointer; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chips input[type=date] { width: auto; min-height: 36px; padding: 4px 10px; border-radius: 999px; }
.due-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.due-row input { flex: 1 1 150px; width: auto; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 40px; border-radius: 10px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); }
.toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 8px 0 12px; font-size: .94rem; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { flex: none; width: 42px; height: 26px; border-radius: 13px; background: var(--line); position: relative; transition: background .2s; margin-top: 1px; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + .toggle-ui { background: var(--calm); }
.toggle input:checked + .toggle-ui::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-ui { outline: 3px solid var(--gold); outline-offset: 2px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; padding: 6px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "＋"; display: inline-block; width: 1.3em; color: var(--accent-ink); }
details[open] > summary::before { content: "－"; }
.notes-wrap, .more { margin: 4px 0 12px; }
.more { border-top: 1px dashed var(--line); padding-top: 8px; }
.more .field { margin-top: 8px; }
.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tz-note { color: var(--muted); margin-top: 10px; text-align: center; }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650;
  text-decoration: none; transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: transparent; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 12px; }
.btn.wide { width: 100%; }
.btn.round { width: 58px; height: 58px; padding: 0; border-radius: 50%; }
.btn.round.big { width: 84px; height: 84px; }
.btn.round.big svg { width: 34px; height: 34px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 6px 4px; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ------------------------------------------------------------- task list */
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.group-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); margin: 8px 2px -2px; }
.task {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  border-left: 5px solid var(--subj, var(--accent));
}
.task .check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink-2); background: transparent;
  display: grid; place-items: center; cursor: pointer; color: transparent; margin-top: 1px;
}
.task .check:hover { border-color: var(--calm); color: var(--calm); }
.task.is-done .check { background: var(--calm); border-color: var(--calm); color: #fff; }
.task.is-done .t-name { text-decoration: line-through; color: var(--muted); }
.t-name { font-weight: 650; overflow-wrap: anywhere; }
.t-info { font-size: .86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.t-notes { font-size: .86rem; color: var(--ink-2); margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.badge.heavy { background: var(--accent-soft); color: var(--accent-ink); }
.badge.light { background: var(--calm-soft); color: var(--calm); }
.badge.star { background: var(--gold-soft); color: var(--ink); }
.badge.star svg { width: 12px; height: 12px; fill: var(--gold); stroke: var(--gold); }
.due-soon { color: var(--accent-ink); font-weight: 600; }
.task-actions { display: flex; gap: 2px; }
.task-actions .icon-btn { width: 38px; height: 38px; }
.task-actions .icon-btn svg { width: 18px; height: 18px; }
.done-wrap { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 8px; }
.empty { text-align: center; padding: 22px 10px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { max-width: 36ch; }
.empty-art { width: 150px; height: auto; stroke: none; }
.ea-paper { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; }
.ea-line { stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.ea-sun { fill: var(--gold); }
.ea-note { stroke: var(--accent); stroke-width: 4; fill: none; }
.ea-tape { fill: color-mix(in srgb, var(--gold) 60%, transparent); }

/* ------------------------------------------------------------- plan */
.plan-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#plan-out { display: flex; flex-direction: column; gap: 14px; }
.plan-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; }
.plan-summary .big { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.plan-summary .stat { color: var(--ink-2); }
.plan-summary .stat b { color: var(--ink); }
.alert { border-radius: var(--radius); padding: 14px 16px; border: 1px solid; }
.alert h3 { font-family: var(--sans); font-size: 1rem; margin-bottom: 4px; }
.alert.over { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); }
.alert.note { background: var(--calm-soft); border-color: color-mix(in srgb, var(--calm) 40%, var(--line)); }
.alert ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.alert li { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stale { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); flex-wrap: wrap; }

.setlist {
  list-style: none; margin: 0; padding: 22px clamp(14px, 3vw, 26px) 18px; position: relative;
  background:
    repeating-linear-gradient(to bottom, transparent 0 35px, color-mix(in srgb, var(--line) 55%, transparent) 35px 36px),
    var(--surface);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  transform: rotate(-.35deg);
}
.setlist::before, .setlist::after {
  content: ""; position: absolute; top: -10px; width: 74px; height: 22px;
  background: color-mix(in srgb, var(--gold) 55%, transparent); border-radius: 2px;
}
.setlist::before { left: 18px; transform: rotate(-6deg); }
.setlist::after { right: 18px; transform: rotate(5deg); }
.sl-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; transform: rotate(.35deg); }
.sl-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .86rem; }
.sl-work .sl-main { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.sl-num { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 1.25rem; color: var(--accent-ink); min-width: 1.4em; }
.sl-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.sl-sub { display: block; font-family: var(--sans); font-size: .82rem; color: var(--muted); font-weight: 400; }
.sl-mins { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.sl-break { padding: 2px 0; }
.sl-break .sl-main { font-size: .86rem; color: var(--calm); font-style: italic; display: flex; align-items: center; gap: 8px; }
.sl-break .sl-main::before { content: ""; height: 0; border-top: 2px dotted currentColor; width: 28px; opacity: .7; }
.sl-meal .sl-main { color: var(--plum); font-weight: 600; }
.sl-row.is-done { opacity: .55; }
.sl-row.is-done .sl-title { text-decoration: line-through; }
.sl-row.is-now { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 10px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent); }
.sl-row.is-now .sl-time { color: var(--accent-ink); font-weight: 700; }
.sl-check { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; }
.sl-check:hover { border-color: var(--calm); color: var(--calm); }
.sl-row.task-done .sl-check { background: var(--calm); border-color: var(--calm); color: #fff; }
.sl-encore { border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 12px; }
.sl-encore .sl-title { color: var(--accent-ink); font-style: italic; }
.sl-over { color: var(--muted); font-size: .9rem; padding-top: 10px; border-top: 1px dashed var(--line); margin-top: 6px; }
.why ol { margin: 10px 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.why li b { font-weight: 650; }
.why li span { color: var(--ink-2); display: block; font-size: .92rem; }
.plan-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.plan-actions .btn { flex: 1 1 200px; }

/* ------------------------------------------------------------- timer */
#view-timer { display: grid; gap: 18px; justify-items: center; }
#view-timer[hidden] { display: none !important; }
.timer-stage {
  width: 100%; max-width: 640px; text-align: center; padding: 26px 18px 22px; border-radius: 28px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  --ring: var(--accent);
}
.timer-stage[data-phase="break"] { --ring: var(--calm); background: linear-gradient(180deg, var(--surface), var(--calm-soft)); }
.timer-stage[data-phase="break"] .eyebrow { color: var(--calm); }
.ring-wrap { position: relative; width: min(74vw, 300px); aspect-ratio: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: var(--bg-2); }
.ring-fill { stroke: var(--ring); stroke-linecap: round; stroke-dasharray: 603.19; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .4s; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; gap: 2px; }
.t-time { font-size: clamp(3rem, 15vw, 4.6rem); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1; }
.t-sub { color: var(--muted); font-size: .9rem; }
.t-task { display: flex; gap: 12px; align-items: center; text-align: left; max-width: 100%; }
.subj-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); flex: none; }
.t-title { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; overflow-wrap: anywhere; }
.t-meta { color: var(--muted); font-size: .9rem; }
.t-controls { display: flex; align-items: center; gap: 22px; }
.t-plus span { font-weight: 700; }
.t-extra { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.t-next { color: var(--ink-2); font-size: .92rem; }
.today-card { width: 100%; max-width: 640px; }
.today-card h2 { margin-bottom: 8px; }
.today-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.today-list li { display: flex; gap: 8px; align-items: center; }
.today-list svg { color: var(--calm); }

/* ------------------------------------------------------------- songs */
.search { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 4px 4px 4px 12px; }
.search:focus-within { border-color: var(--accent); }
.search > svg { color: var(--muted); }
.search input { border: 0 !important; background: transparent !important; box-shadow: none !important; min-height: 40px !important; padding: 6px !important; }
#s-status, #enc-status { margin: 10px 2px; min-height: 1.2em; }
.song-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.song { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.song img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--bg-2); }
.song-t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-a { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-links { display: flex; gap: 12px; font-size: .8rem; margin-top: 2px; flex-wrap: wrap; }
.song-links a { text-decoration: none; font-weight: 600; display: inline-flex; gap: 3px; align-items: center; }
.song-links svg { width: 12px; height: 12px; }
.song-btns { display: flex; gap: 4px; align-items: center; }
.song-btns .icon-btn { width: 40px; height: 40px; }
.song .min { min-width: 0; }
.e-tag { font-size: .66rem; font-weight: 800; background: var(--ink-2); color: var(--surface); border-radius: 3px; padding: 0 4px; margin-left: 4px; vertical-align: 2px; }
.icon-btn.playing { color: var(--accent-ink); background: var(--accent-soft); }
.credit { color: var(--muted); font-size: .82rem; margin-top: 14px; }

/* ------------------------------------------------------------- dialogs */
dialog.sheet {
  border: 0; padding: 22px; border-radius: 24px; background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(28, 16, 30, .5); backdrop-filter: blur(3px); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 24px 24px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; }
}
.small-sheet { width: min(420px, calc(100vw - 24px)); }
.small-sheet h2 { margin-bottom: 8px; }
.small-sheet p { color: var(--ink-2); margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 6px; }
.settings legend { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; padding: 0 0 8px; }

.encore { text-align: center; overflow: hidden; position: relative; }
.encore .close { position: absolute; top: 10px; right: 10px; }
.encore h2 { font-size: 2.2rem; font-style: italic; color: var(--accent-ink); }
.enc-inner { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.enc-msg { color: var(--ink-2); max-width: 38ch; }
.enc-player { display: flex; gap: 18px; align-items: center; text-align: left; background: var(--surface-2); border: 1px solid var(--line); padding: 14px; border-radius: 20px; width: 100%; }
.enc-art { position: relative; flex: none; }
.enc-art img { width: 120px; height: 120px; border-radius: 14px; object-fit: cover; background: var(--bg-2); box-shadow: 0 10px 24px -12px rgba(0,0,0,.5); }
.enc-eq { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 2px; align-items: flex-end; height: 18px; padding: 3px; border-radius: 6px; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
.enc-eq i { width: 3px; background: #fff; height: 30%; animation: eq 0.9s ease-in-out infinite; }
.enc-eq i:nth-child(2) { animation-delay: -.3s; } .enc-eq i:nth-child(3) { animation-delay: -.6s; } .enc-eq i:nth-child(4) { animation-delay: -.15s; }
.encore.is-playing .enc-eq { opacity: 1; }
@keyframes eq { 50% { height: 100%; } }
.enc-info { min-width: 0; flex: 1; }
.enc-song { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; overflow-wrap: anywhere; }
.enc-artist { color: var(--muted); }
.enc-btns { display: flex; gap: 8px; margin: 10px 0 6px; flex-wrap: wrap; }
.enc-links { display: flex; gap: 14px; font-size: .86rem; flex-wrap: wrap; }
.enc-links a { font-weight: 600; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.enc-links svg { width: 13px; height: 13px; }
.enc-pick { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.song-list.compact .song { grid-template-columns: 44px 1fr auto; }
.song-list.compact img { width: 44px; height: 44px; }
@media (max-width: 420px) { .enc-player { flex-direction: column; text-align: center; } .enc-btns, .enc-links { justify-content: center; } }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(620px) rotate(540deg); opacity: 0; } }

.onboarding { text-align: center; }
.ob-art { font-size: 3rem; margin: 6px 0 8px; }
.ob-step h2 { font-size: 1.6rem; margin-bottom: 8px; }
.ob-step p { color: var(--ink-2); max-width: 40ch; margin: 0 auto; }
.ob-dots { display: flex; justify-content: center; gap: 8px; margin: 20px 0 14px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width .2s, background .2s; }
.ob-dots i.on { width: 24px; background: var(--accent); }
.ob-actions { display: flex; justify-content: space-between; align-items: center; }
.ob-final { margin-top: 10px; }

/* ------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + var(--tabbar-h) + env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; z-index: 60;
  display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 24px); box-shadow: 0 12px 30px -10px rgba(0,0,0,.5);
  transition: transform .25s ease; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast .link-btn { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .setlist, .sl-row { transform: none; }
  .confetti { display: none; }
}
@media print {
  .topbar, .tabs, .footer, .window-card, .plan-actions, .stale, #view-homework, #view-timer, #view-encores { display: none !important; }
  #view-plan { display: block !important; }
}
.t-music { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .88rem; max-width: 100%; }
.t-music #t-music-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-music .enc-eq { position: static; opacity: 1; background: var(--accent); }
.t-music.paused .enc-eq i { animation-play-state: paused; }
.row-btns.tight { margin: 0; gap: 6px; }
.add-jump { display: none; }
@media (max-width: 899px) {
  .hw-grid.has-tasks .list-col { order: -1; }
  .hw-grid.has-tasks .add-jump { display: inline-flex; }
}
.card, #plan-out, form { scroll-margin-top: 80px; }
.enc-art { border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--gold)); width: 120px; height: 120px; }
.sl-title { line-height: 1.25; }
:root[data-theme="dark"] .seg input:checked + span { background: #46374f; box-shadow: none; }
.grid-2 { scroll-margin-top: 80px; }
