/* FitTube — static, build-free styles. Mobile-first; dark/light via prefers-color-scheme. */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #efeff1;
  --surface-3: #e4e4e8;
  --text: #121214;
  --text-2: #55555e;
  --text-3: #8a8a94;
  --border: rgba(18, 18, 20, 0.09);
  --accent: #f0441f;
  --accent-hover: #d9370f;
  --accent-soft: rgba(240, 68, 31, 0.1);
  --accent-text: #ffffff;
  --work: #1f9d55;
  --rest: #2b6fd6;
  --prep: #c78a00;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --topbar-h: 60px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --surface: #18181b;
    --surface-2: #222226;
    --surface-3: #2d2d32;
    --text: #f2f2f4;
    --text-2: #b0b0ba;
    --text-3: #7c7c87;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #ff5a36;
    --accent-hover: #ff7556;
    --accent-soft: rgba(255, 90, 54, 0.14);
    --work: #3ccf7c;
    --rest: #5b9bff;
    --prep: #f2b51d;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.85);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px;
  font: 600 12px/1.5 var(--mono); text-align: center;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-soft { background: var(--surface-2); }
.btn-soft:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost[aria-pressed="true"], .btn-ghost[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn[aria-pressed="true"].btn-soft { background: var(--accent); color: var(--accent-text); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm svg { width: 16px; height: 16px; }

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-text);
  font-size: 12px; font-weight: 700; line-height: 1;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1600px; margin: 0 auto; padding: 10px 16px;
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "brand actions" "search search";
  align-items: center; gap: 10px 12px;
}
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.brand img { border-radius: 8px; }
.brand b { color: var(--accent); font-weight: 800; }
.actions { grid-area: actions; display: flex; justify-content: flex-end; gap: 2px; }
.actions .btn { padding: 0 10px; }
.actions .btn-label { display: none; }
.actions .badge { margin-left: -2px; }

.search { grid-area: search; position: relative; display: flex; align-items: center; }
.search input {
  width: 100%; height: 42px; padding: 0 40px 0 40px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  font-size: 15px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-icon { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.search-kbd { position: absolute; right: 12px; pointer-events: none; display: none; }
.search input:placeholder-shown ~ .search-kbd { display: inline-block; }

@media (min-width: 720px) {
  .topbar-inner { grid-template-columns: auto minmax(240px, 620px) 1fr; grid-template-areas: "brand search actions"; gap: 20px; padding: 10px 24px; }
  .search { justify-self: center; width: 100%; }
}
@media (min-width: 1080px) {
  .actions .btn-label { display: inline; }
  .actions .btn { padding: 0 14px; }
}

/* ---------- Hero ---------- */
.hero { max-width: 1600px; margin: 0 auto; padding: 22px 16px 4px; }
.hero h1 { margin: 0; font-size: clamp(22px, 4.6vw, 34px); line-height: 1.15; letter-spacing: -0.03em; font-weight: 800; max-width: 22ch; }
.hero p { margin: 8px 0 0; color: var(--text-2); max-width: 60ch; font-size: 15px; }
@media (min-width: 720px) { .hero { padding: 32px 24px 6px; } .hero p { font-size: 16px; } }

/* ---------- Toolbar & filters ---------- */
.toolbar { max-width: 1600px; margin: 0 auto; padding: 14px 16px 6px; }
@media (min-width: 720px) { .toolbar { padding: 18px 24px 8px; } }
.toolbar-row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "toggle sort" "summary summary"; align-items: center; gap: 10px 12px; }
#filters-toggle { grid-area: toggle; justify-self: start; }
.sort { grid-area: sort; justify-self: end; min-width: 0; max-width: 100%; }
.sort select { min-width: 0; max-width: 100%; }
@media (min-width: 520px) { .toolbar-row { grid-template-columns: auto 1fr auto; grid-template-areas: "toggle summary sort"; } }
.summary { grid-area: summary; margin: 0; min-width: 0; color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary button { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.sort { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.sort-label { display: none; }
@media (min-width: 520px) { .sort-label { display: inline; } }
.sort select {
  height: 38px; padding: 0 34px 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  appearance: none; -webkit-appearance: none; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer;
}

.filters { display: grid; gap: 10px; margin-top: 14px; }
.filter-group { display: grid; grid-template-columns: 1fr; gap: 6px; }
.filter-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
@media (min-width: 720px) {
  .filter-group { grid-template-columns: 96px 1fr; align-items: center; gap: 12px; }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; scroll-padding: 16px; }
.filters .chips::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .filters .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; flex: none;
  transition: background-color .15s, border-color .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--text-3); }
.chip .count { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip[aria-pressed="true"] .count { color: inherit; opacity: .65; }
.chip.is-zero:not([aria-pressed="true"]) { opacity: .45; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag-level { background: var(--accent-soft); color: var(--accent); }

/* ---------- Grid & cards ---------- */
.main { max-width: 1600px; margin: 0 auto; padding: 12px 16px 40px; min-height: 50vh; }
@media (min-width: 720px) { .main { padding: 16px 24px 56px; } }
.grid { display: grid; grid-template-columns: 1fr; gap: 22px 18px; outline: none; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { position: relative; border-radius: var(--radius); animation: fade-in .3s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }
.card-link { display: block; text-decoration: none; color: inherit; border-radius: var(--radius); outline-offset: 4px; }
.thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius);
  background: var(--surface-2);
}
.thumb img { position: relative; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card-link:hover .thumb img, .card.is-selected .thumb img { transform: scale(1.04); }
.thumb-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.thumb-placeholder svg { width: 40px; height: 40px; }
.thumb-badge {
  position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.78); color: #fff;
  font-size: 12px; font-weight: 600;
}
.thumb-badge svg { width: 12px; height: 12px; }
.thumb-rank {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 700;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.card.is-selected .card-link .thumb { box-shadow: 0 0 0 3px var(--accent); }

.card-add {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 0;
  background: rgba(0, 0, 0, 0.62); color: #fff; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background-color .15s, transform .15s, opacity .15s;
}
.card-add:hover { background: var(--accent); transform: scale(1.06); }
.card-add[aria-pressed="true"] { background: var(--accent); }
@media (hover: hover) {
  .card-add { opacity: 0; }
  .card:hover .card-add, .card-add:focus-visible, .card.is-selected .card-add, .card-add[aria-pressed="true"] { opacity: 1; }
}

.card-body { padding: 10px 2px 0; }
.card-title {
  margin: 0; font-size: 15px; font-weight: 650; line-height: 1.35; letter-spacing: -0.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-summary {
  margin: 4px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.m-summary { margin: 8px 0 0; font-size: 15px; line-height: 1.45; max-width: 70ch; }
.card-channel { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.recs { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 600; flex: none; }
.card-subs { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.recs svg { width: 15px; height: 15px; color: var(--accent); }
.card-meta .dot { color: var(--text-3); }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.status { color: var(--text-2); text-align: center; }
.status:empty { display: none; }
.status { padding: 48px 0; }
.skeleton .thumb { animation: pulse 1.4s ease-in-out infinite; }
.skeleton .sk-line { height: 12px; border-radius: 6px; background: var(--surface-2); margin-top: 10px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.empty { text-align: center; padding: 64px 16px; color: var(--text-2); }
.empty svg { width: 44px; height: 44px; color: var(--text-3); }
.empty h2 { margin: 12px 0 4px; color: var(--text); font-size: 20px; }
.empty p { margin: 0 0 18px; }
.sentinel { height: 1px; }

.footer { max-width: 1600px; margin: 0 auto; padding: 24px 16px 40px; color: var(--text-3); font-size: 13px; border-top: 1px solid var(--border); }
.footer p { margin: 4px 0; }
@media (min-width: 720px) { .footer { padding: 24px 24px 48px; } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; overscroll-behavior: contain; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 6, 8, 0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal-panel {
  position: relative; width: 100%; max-width: 1080px; min-height: 100%;
  background: var(--surface); box-shadow: var(--shadow-lg); outline: none;
  animation: rise .25s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@media (min-width: 720px) {
  .modal { padding: 40px 24px; }
  .modal-panel { min-height: 0; border-radius: 20px; overflow: hidden; }
}
/* Mobile: a slim bar above the video so controls never sit on top of YouTube's own UI. */
.modal-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 12px 0 6px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.modal-bar .btn { padding: 0 10px 0 6px; gap: 4px; color: var(--text); }
.modal-bar-brand { font-weight: 600; letter-spacing: -0.02em; }
.modal-bar-brand b { color: var(--accent); font-weight: 800; }
/* Desktop: close button floats in the backdrop gutter, outside the panel. */
.modal-close { display: none; }
@media (min-width: 720px) {
  .modal-bar { display: none; }
  .modal-close {
    display: inline-grid; position: fixed; top: 2px; right: 8px; z-index: 2; width: 36px; height: 36px;
    color: rgba(255, 255, 255, 0.85);
  }
  .modal-close:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
}
body.timer-open .modal-body { padding-bottom: 240px; }
@media (min-width: 560px) { body.timer-open .modal-body { padding-bottom: 32px; } }
.player-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player-frame iframe, .player-frame #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #eee; padding: 16px; background: #000 center / cover; }
.player-fallback::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.player-fallback > * { position: relative; }

.modal-body { padding: 18px 16px 28px; }
@media (min-width: 720px) { .modal-body { padding: 22px 28px 32px; } }
.session-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 8px; margin-bottom: 14px; border-radius: 999px; background: var(--accent-soft);
  font-size: 13px; font-weight: 600; color: var(--accent);
}
.m-title { margin: 0; font-size: clamp(18px, 2.6vw, 24px); line-height: 1.25; letter-spacing: -0.02em; }
.m-meta { margin: 6px 0 0; color: var(--text-2); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.m-meta .recs svg { width: 16px; height: 16px; }
.m-sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.source-badge { text-decoration: none; }
a.source-badge:hover { background: var(--surface-3); color: var(--text); }
.source-wiki { background: var(--accent-soft); color: var(--accent); }
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 14px; }
.chips-static { gap: 6px; }

.m-columns { display: grid; gap: 8px 32px; margin-top: 8px; }
@media (min-width: 860px) { .m-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); } }
.m-section { padding-top: 18px; }
.m-section h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 700; }
.m-hint { margin: 4px 0 12px; color: var(--text-3); font-size: 13px; }

.ts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ts-item { display: flex; align-items: center; gap: 6px; }
.ts-jump {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: left;
}
.ts-jump:hover { border-color: var(--accent); }
.ts-jump .mono { color: var(--accent); font-weight: 700; font-size: 13px; }
.ts-jump .ts-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ts-loop { height: 38px; border-radius: var(--radius-sm); }
.ts-loop[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.loop-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.loop-controls .mono { color: var(--text-2); font-weight: 500; }
.loop-len { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.loop-len input, .timer-settings input[type="number"] {
  width: 64px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); font-family: var(--mono); text-align: right;
}
.loop-status { margin: 8px 0 0; color: var(--text-3); font-size: 13px; min-height: 1.5em; }

.comment-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.comment {
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.comment p { margin: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.comment-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.comment-foot a { color: var(--text-2); font-weight: 600; text-decoration: none; }
.comment-foot a:hover { color: var(--accent); text-decoration: underline; }
.comment-score { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.comment-score svg { width: 13px; height: 13px; }
.comment-empty { color: var(--text-3); font-size: 14px; }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 70; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(6, 6, 8, 0.5); animation: fade .2s ease both; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-lg); outline: none;
  animation: slide-in .25s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.drawer-sub { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.session-list { list-style: none; margin: 0; padding: 8px; flex: 1; overflow-y: auto; }
.session-item { display: grid; grid-template-columns: 22px 96px 1fr auto; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.session-item:hover { background: var(--surface-2); }
.session-item.is-playing { background: var(--accent-soft); }
.session-idx { color: var(--text-3); font-size: 13px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.session-thumb { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.session-open { min-width: 0; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.session-open strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; line-height: 1.3; }
.session-open span { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-btns { display: flex; flex-direction: column; gap: 0; }
.session-btns .icon-btn { width: 28px; height: 26px; border-radius: 6px; }
.session-btns .icon-btn svg { width: 15px; height: 15px; }
.session-btns .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.session-empty { padding: 40px 28px; text-align: center; color: var(--text-2); flex: 1; }
.session-empty p { margin: 0 0 6px; }
.drawer-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.drawer-foot .btn-primary { flex: 1; }

/* ---------- Timer dock ---------- */
.timer {
  position: fixed; z-index: 80; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 10px 12px 12px; animation: rise .25s cubic-bezier(.2, .8, .2, 1) both;
}
@media (min-width: 560px) { .timer { left: auto; right: 20px; bottom: 20px; width: 300px; } }
.timer-head { display: flex; align-items: center; justify-content: space-between; }
.timer-title { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding-left: 4px; }
.timer-head-actions { display: flex; gap: 2px; }
.timer-display {
  --phase: var(--text-3);
  display: grid; justify-items: center; padding: 6px 0 10px; text-align: center;
}
.timer-display[data-phase="work"] { --phase: var(--work); }
.timer-display[data-phase="rest"] { --phase: var(--rest); }
.timer-display[data-phase="prep"] { --phase: var(--prep); }
.timer-display[data-phase="done"] { --phase: var(--accent); }
.timer-phase { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--phase); }
.timer-clock { font-size: 64px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.timer-round { font-size: 13px; color: var(--text-2); font-weight: 600; }
.timer-progress { width: 100%; height: 6px; margin-top: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.timer-progress span { display: block; height: 100%; width: 0; background: var(--phase); border-radius: inherit; transition: width .1s linear; }
@media (max-width: 559px) {
  .timer-display { grid-template-columns: auto 1fr auto; align-items: center; justify-items: start; gap: 0 12px; padding: 2px 4px 8px; }
  .timer-clock { font-size: 44px; grid-column: 2; justify-self: center; }
  .timer-phase { grid-row: 1; grid-column: 1; }
  .timer-round { grid-row: 1; grid-column: 3; }
  .timer-progress { grid-column: 1 / -1; margin-top: 4px; }
}
.timer-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 10px 4px 12px; border-top: 1px solid var(--border); }
.timer-settings label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.timer-settings label span { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-weight: 500; }
.timer-settings .check { justify-content: flex-start; }
.timer-settings input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.timer-controls { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.timer.is-flash { animation: flash .5s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px var(--accent), var(--shadow-lg); } }

/* ---------- Help ---------- */
.help { align-items: center; padding: 16px; z-index: 90; }
.help-panel { position: relative; width: 100%; max-width: 420px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); outline: none; animation: rise .2s ease both; }
.shortcuts { margin: 0; padding: 10px 20px 20px; display: grid; gap: 2px; }
.shortcuts div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.shortcuts div:last-child { border-bottom: 0; }
.shortcuts dt { display: flex; gap: 4px; }
.shortcuts dd { margin: 0; color: var(--text-2); font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: rise .2s ease both;
  max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.timer-open .toast { bottom: 190px; }
@media (min-width: 560px) { body.timer-open .toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
