:root {
  --bg: #14161a; --card: #1d2026; --card2: #272b33; --text: #e8e4dc; --muted: #8f8a80;
  --accent: #c98b3a; --green: #6fa36b; --red: #c7574a; --blue: #5f8fb4; --purple: #9b7fb6;
  --line: #2f333c;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: 76px; font-size: 15px; line-height: 1.4; }
header { position: sticky; top: 0; z-index: 10; background: rgba(20,22,26,.94); backdrop-filter: blur(8px);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 12px; }
header h1 { font-size: 17px; }
.hdr { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }

main { max-width: 760px; margin: 0 auto; padding: 14px 12px; }
a { color: var(--blue); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.card-body { padding: 0 14px 14px; }
.muted { color: var(--muted); font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.title { font-size: 14px; font-weight: 600; }
p { margin: 0 0 8px; }
.prose { font-size: 13.5px; line-height: 1.55; color: var(--text); white-space: pre-line; }

input[type="text"], textarea, select {
  background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; width: 100%; font-family: inherit; }
textarea { min-height: 60px; resize: vertical; }
label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  display: block; margin: 10px 0 4px; }
button.btn { background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; font-weight: 600; }
button.btn.primary { background: var(--accent); color: #14161a; border: none; }
button.btn.danger { color: var(--red); }
button.btn.small { padding: 4px 10px; font-size: 12px; }
button.btn.on { background: rgba(201,139,58,.2); border-color: var(--accent); color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; background: none; border: none; color: var(--muted); font-size: 20px;
  padding: 8px 0 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tabs button span { font-size: 10px; font-weight: 600; }
.tabs button.active { color: var(--accent); }

.chip { font-size: 11px; padding: 3px 9px; border-radius: 12px; font-weight: 700; white-space: nowrap;
  background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.chip.show { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.chip.k-drill { color: var(--purple); border-color: rgba(155,127,182,.4); }
.chip.k-film-study { color: var(--blue); border-color: rgba(95,143,180,.4); }
.chip.k-extra { color: var(--muted); }
.chip.k-task { color: var(--accent); border-color: rgba(201,139,58,.4); }
.chip.rep { color: var(--green); border-color: rgba(111,163,107,.4); }

.group-head { display: flex; align-items: center; gap: 8px; padding: 12px 4px 6px; cursor: pointer; }
.group-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.group-head .count { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }

.phase { margin-bottom: 14px; }
.phase-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.phase-head .num { font-size: 11px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.phase-head .t { font-size: 15px; font-weight: 700; }
.bar { height: 6px; background: var(--card2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar.green i { background: var(--green); }
.cue { font-size: 13px; color: var(--accent); padding: 0 14px 10px; font-style: italic; }
.sub { border-top: 1px solid var(--line); }
.sub-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; cursor: pointer; }
.sub-head .t { font-size: 13px; font-weight: 700; }
.sub-head .ord { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.sub-intro { padding: 0 14px 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }

.item { display: flex; gap: 10px; padding: 10px 12px; align-items: flex-start; border-top: 1px solid var(--line); }
.item .st { width: 30px; height: 30px; border-radius: 15px; border: 2px solid var(--line); background: none;
  color: var(--muted); font-size: 14px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.item.s-listened .st { border-color: var(--blue); color: var(--blue); }
.item.s-practiced .st { border-color: var(--green); background: rgba(111,163,107,.18); color: var(--green); }
.item.s-skipped .st { border-color: var(--line); color: var(--muted); }
.item.s-practiced .title, .item.s-skipped .title { color: var(--muted); }
.item.s-skipped .title { text-decoration: line-through; }
.item .meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.item .min { font-size: 11px; color: var(--muted); white-space: nowrap; }
.item-body { padding: 0 12px 12px 52px; border-top: none; }
.item-body .why { font-size: 13.5px; line-height: 1.55; }
.item-body .asg { font-size: 13.5px; line-height: 1.55; margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--accent);
  background: rgba(201,139,58,.08); border-radius: 0 8px 8px 0; }
.item-body .asg b { color: var(--accent); }
.sp { display: inline-flex; align-items: center; gap: 6px; background: #1db954; color: #0b0f0c; font-weight: 800;
  padding: 7px 12px; border-radius: 20px; text-decoration: none; font-size: 13px; }
.thumbs button { font-size: 16px; padding: 4px 10px; }

.next .item { border-top: none; border-bottom: 1px solid var(--line); }
.next .item:last-child { border-bottom: none; }
.big { font-size: 26px; font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--card2); border-radius: 10px; padding: 10px 12px; }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; }

.journal .entry { padding: 10px 14px; border-top: 1px solid var(--line); }
.journal .entry .d { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.journal .entry .x { font-size: 13.5px; white-space: pre-wrap; line-height: 1.5; }
table.snap { width: 100%; border-collapse: collapse; font-size: 12px; }
table.snap th, table.snap td { padding: 6px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.snap th:first-child, table.snap td:first-child { text-align: left; }
table.snap th { color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; }
.scroll-x { overflow-x: auto; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.offline-banner { position: fixed; top: calc(env(safe-area-inset-top) + 50px); left: 0; right: 0; background: var(--red); color: #fff;
  text-align: center; font-size: 13px; font-weight: 700; padding: 6px; z-index: 20; }
.foot { text-align: center; color: var(--muted); font-size: 11px; padding: 20px 0 8px; }

.sp.pend { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
