/* Prepkite. Warm paper + kite colours, light and dark. One font (Manrope, 24 KB). Mobile first; side rail on PC. */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #f7f3ec; --bg-2: #efe8dc; --card: #fffdf9; --ink: #1d2433; --ink-2: #434c60; --muted: #6b7284;
  --line: #e6ddcf; --line-2: #d9cfbf;
  --accent: #dc4f33; --accent-ink: #fff; --accent-soft: #fbe3db; --accent-text: #b8391f;
  --sun: #f0a531; --sun-soft: #fdf0d7; --sun-text: #8a5a06;
  --good: #198f6d; --good-soft: #dcf2ea; --good-text: #11694f;
  --sky-1: #d9e8fb; --sky-2: #fbefdd;
  --kite-a: #dc4f33; --kite-b: #f0a531; --kite-line: #434c60;
  --s-phy: #4b67e8; --s-chem: #0f9b84; --s-math: #e0862a; --s-bio: #3a9b48; --s-sci: #2a83bd;
  --s-eng: #8f55d8; --s-soc: #c24b81; --s-lang: #cf6136; --s-other1: #7a8396; --s-other2: #9b7b6d;
  --shadow: 0 1px 2px rgb(60 40 10 / .05), 0 4px 16px rgb(60 40 10 / .06);
  --r: 18px; --r-sm: 12px;
  --tabs-h: 64px; --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141d; --bg-2: #171b26; --card: #1a1f2b; --ink: #edf0f6; --ink-2: #c3c9d6; --muted: #949cae;
    --line: #272d3b; --line-2: #343b4c;
    --accent: #ff7556; --accent-ink: #1a0d08; --accent-soft: #3b231e; --accent-text: #ff9a80;
    --sun: #f6bd55; --sun-soft: #3a2f1a; --sun-text: #f8cf80;
    --good: #3cc79d; --good-soft: #163a31; --good-text: #6fe0bd;
    --sky-1: #1b2443; --sky-2: #2d2238;
    --kite-a: #ff7556; --kite-b: #f6bd55; --kite-line: #c3c9d6;
    --s-phy: #7c93ff; --s-chem: #3cc9b0; --s-math: #f2a54e; --s-bio: #6cc777; --s-sci: #5eb0e6;
    --s-eng: #b48af0; --s-soc: #e57aaa; --s-lang: #ef8a60; --s-other1: #a0a8ba; --s-other2: #c2a497;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11141d; --bg-2: #171b26; --card: #1a1f2b; --ink: #edf0f6; --ink-2: #c3c9d6; --muted: #949cae;
  --line: #272d3b; --line-2: #343b4c;
  --accent: #ff7556; --accent-ink: #1a0d08; --accent-soft: #3b231e; --accent-text: #ff9a80;
  --sun: #f6bd55; --sun-soft: #3a2f1a; --sun-text: #f8cf80;
  --good: #3cc79d; --good-soft: #163a31; --good-text: #6fe0bd;
  --sky-1: #1b2443; --sky-2: #2d2238;
  --kite-a: #ff7556; --kite-b: #f6bd55; --kite-line: #c3c9d6;
  --s-phy: #7c93ff; --s-chem: #3cc9b0; --s-math: #f2a54e; --s-bio: #6cc777; --s-sci: #5eb0e6;
  --s-eng: #b48af0; --s-soc: #e57aaa; --s-lang: #ef8a60; --s-other1: #a0a8ba; --s-other2: #c2a497;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding: calc(var(--top-h) + 12px) 0 calc(var(--tabs-h) + 24px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 16px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 8px; }
/* fixed, not absolute: an absolute one inside a sideways scroller escapes it and widens the page on phones */
.vh, .skip:not(:focus) { position: fixed !important; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: var(--card); padding: 8px 12px; border-radius: 8px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }

/* ---------------------------------------------------------------- frame */
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.02em; margin-right: auto; }
.kite-mark { width: 28px; height: 28px; flex: none; }
.exam-switch {
  display: inline-flex; align-items: center; gap: 6px; max-width: 46vw; height: 36px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--card); font-weight: 700; font-size: 14px;
}
.exam-switch:disabled { cursor: default; opacity: 1; }
.exam-switch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.exam-switch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-switch .ic { width: 16px; height: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; color: var(--ink-2); flex: none;
}
.icon-btn:hover, .icon-btn.on { background: var(--bg-2); color: var(--ink); }
.icon-btn.sm { width: 36px; height: 36px; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 20; height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding: 0 4px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  font-size: 11.5px; font-weight: 700; color: var(--muted); position: relative;
}
.tab .ic { width: 23px; height: 23px; }
.tab.on { color: var(--accent-text); }
.tab.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
body[data-view="welcome"] .tabs, body[data-view="welcome"] .exam-switch, body[data-view="welcome"] #nav-settings { display: none; }

main:focus-visible { outline: none; }
main { padding: 16px 14px calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; outline: none; }
body[data-view="welcome"] main { padding-bottom: 32px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
  .topbar { grid-column: 1 / -1; padding: 0 20px; }
  .tabs {
    position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); inset: auto; grid-template-columns: none; grid-auto-rows: 52px;
    align-content: start; gap: 4px; padding: 20px 14px; border-top: 0; border-right: 1px solid var(--line); background: transparent;
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  .tab:hover { background: var(--bg-2); color: var(--ink); }
  .tab.on { background: var(--accent-soft); }
  .tab.on::before { display: none; }
  main { padding: 28px 32px 48px; max-width: 1120px; width: 100%; margin: 0; }
  body[data-view="welcome"] .shell { grid-template-columns: 1fr; }
  body[data-view="welcome"] main { margin: 0 auto; max-width: 760px; }
}

/* ---------------------------------------------------------------- common pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card > h2, .card-head h2 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card > h2 { margin-bottom: 10px; }
.card > h2:not(:first-child) { margin-top: 18px; }
.card h3 { font-size: 15px; font-weight: 800; margin: 16px 0 6px; display: flex; gap: 6px; align-items: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 .ic { color: var(--accent); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 2px 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.page-sub { color: var(--muted); font-weight: 600; width: 100%; margin-top: -8px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; }
.pill { font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.foot-note { color: var(--muted); font-size: 12.5px; text-align: center; margin: 6px 12px 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; flex: none; vertical-align: 0; }
.sw-phy { background: var(--s-phy); } .sw-chem { background: var(--s-chem); } .sw-math { background: var(--s-math); } .sw-bio { background: var(--s-bio); }
.sw-sci { background: var(--s-sci); } .sw-eng { background: var(--s-eng); } .sw-soc { background: var(--s-soc); } .sw-lang { background: var(--s-lang); }
.sw-other1 { background: var(--s-other1); } .sw-other2 { background: var(--s-other2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1px solid transparent; font-weight: 800; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn.danger { background: #c8321c; color: #fff; }
.btn.danger-ghost { background: transparent; color: #c8321c; border-color: var(--line-2); margin-right: auto; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.btn.big { min-height: 54px; font-size: 17px; padding: 0 24px; border-radius: 16px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn .ic { width: 19px; height: 19px; }
.link-btn { border: 0; background: none; padding: 8px 0; color: var(--accent-text); font-weight: 800; display: inline-flex; gap: 6px; align-items: center; }
.danger-text { color: #c8321c !important; }
:root[data-theme="dark"] .danger-text, :root[data-theme="dark"] .btn.danger-ghost { color: #ff8a73 !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .danger-text, :root:not([data-theme="light"]) .btn.danger-ghost { color: #ff8a73 !important; } }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ext { color: var(--accent-text); font-weight: 800; overflow-wrap: anywhere; }

.pbar { display: block; height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.pbar > span { display: block; height: 100%; border-radius: inherit; background: var(--good); transition: width .4s ease; }
.pbar.lg { height: 12px; margin-top: 4px; }
.pbar.c-phy > span { background: var(--s-phy); } .pbar.c-chem > span { background: var(--s-chem); } .pbar.c-math > span { background: var(--s-math); }
.pbar.c-bio > span { background: var(--s-bio); } .pbar.c-sci > span { background: var(--s-sci); } .pbar.c-eng > span { background: var(--s-eng); }
.pbar.c-soc > span { background: var(--s-soc); } .pbar.c-lang > span { background: var(--s-lang); } .pbar.c-other1 > span { background: var(--s-other1); } .pbar.c-other2 > span { background: var(--s-other2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .chip-in {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--card); font-weight: 700; font-size: 14px;
}
.chip.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-check input:checked + .chip-in { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip-check input:focus-visible + .chip-in { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.chip-in em { font-style: normal; font-size: 12px; opacity: .7; margin-left: 6px; }
fieldset:disabled .chip { opacity: .5; cursor: default; }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--bg-2); border-radius: 14px; margin-top: 12px; }
.seg-btn { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: none; font-weight: 800; font-size: 13.5px; color: var(--ink-2); padding: 0 6px; }
.seg-btn.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.field { display: block; border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.field > span, .field > legend { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; padding: 0; }
.field em { font-style: normal; font-weight: 600; color: var(--muted); }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 0; }
.field.inline > span { margin: 0; font-weight: 700; color: var(--ink-2); }
.field.inline input { width: auto !important; }
.sub-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 600; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error, .dlg-error { color: #c8321c; font-weight: 700; margin: 8px 0; }

.range { width: 100%; accent-color: var(--accent); height: 32px; }
.hours-card { text-align: center; }
.hours-out { display: block; font-size: 22px; font-weight: 800; margin: 4px 0 6px; }

/* ---------------------------------------------------------------- onboarding */
.ob { max-width: 680px; margin: 0 auto; }
.ob-head { display: flex; gap: 14px; align-items: center; margin: 6px 0 18px; }
.ob-kite { width: 56px; height: 56px; }
.ob-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.ob-head p { color: var(--ink-2); margin-top: 4px; }
.ob-step { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ob-progress { height: 6px; border-radius: 99px; background: var(--bg-2); margin: 8px 0 20px; overflow: hidden; }
.ob-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }
.ob-q { font-size: 21px; font-weight: 800; letter-spacing: -.015em; }
.exam-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }
.exam-card {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 92px; padding: 14px; border-radius: 16px;
  border: 1.5px solid var(--line-2); background: var(--card); box-shadow: var(--shadow);
}
.exam-card strong { font-size: 16px; font-weight: 800; padding-right: 26px; }
.exam-card small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.exam-card-tick { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; }
.exam-card-tick .ic { width: 15px; height: 15px; stroke-width: 3; }
.exam-card.on { border-color: var(--accent); background: var(--accent-soft); }
.exam-card.on .exam-card-tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.exam-card:disabled { opacity: .5; }
.ob-exam h3 { font-size: 18px; margin: 0 0 14px; }
.subj-summary { margin-top: -4px; }
.ob-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.ob-actions .btn.primary { min-width: 150px; }
.ob-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: grid; gap: 8px; }
.ob-foot .ic { width: 16px; height: 16px; color: var(--good); }
@media (min-width: 600px) { .exam-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------------------------------------------------------------- home */
.home-grid { display: grid; gap: 0 14px; }
.hero {
  position: relative; overflow: hidden; min-height: 236px; padding: 20px 18px; display: flex; align-items: flex-end;
  background: linear-gradient(165deg, var(--sky-1), var(--sky-2) 78%); border: 0;
}
.sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sky .string { fill: none; stroke: var(--kite-line); stroke-width: 1.2; opacity: .55; }
.kite-fly { position: absolute; width: 64px; height: 64px; transform: translate(-50%, -30%); transform-origin: 50% 80%; }
.kite-fly svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 8px rgb(0 0 0 / .12)); }
.kite-fly.sway { animation: sway 4.5s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: translate(-50%, -30%) rotate(-5deg); } 50% { transform: translate(-48%, -36%) rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .kite-fly.sway { animation: none; } * { transition: none !important; } }
.hero-text { position: relative; max-width: 70%; }
.days-num { font-size: clamp(68px, 23vw, 124px); font-weight: 800; line-height: .9; letter-spacing: -.055em; font-variant-numeric: tabular-nums; color: var(--ink); }
.days-label { font-size: 20px; font-weight: 800; margin-top: 4px; color: var(--accent-text); }
.days-over { font-size: 24px; font-weight: 800; }
.hero-exam { font-weight: 700; margin-top: 10px; color: var(--ink-2); }
.hero-weeks { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.cheer { font-weight: 800; color: var(--good-text); margin-top: 8px; }
.big-pct { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.subj-bars { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.subj-bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; text-decoration: none; padding: 8px 4px; border-radius: 10px; }
.subj-bar:hover { background: var(--bg-2); }
.subj-bar .pbar { grid-column: 1 / -1; height: 6px; }
.subj-name { font-weight: 700; display: flex; align-items: center; }
.subj-num { font-weight: 800; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.streak-num { font-size: 18px; font-weight: 700; }
.streak-num strong { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin-right: 4px; color: var(--accent-text); }
.week-dots { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.week-dots .dot { display: block; width: 26px; height: 26px; margin: 0 auto 2px; border-radius: 50%; background: var(--bg-2); border: 2px solid transparent; }
.week-dots .on .dot { background: var(--sun); }
.week-dots .today .dot { border-color: var(--accent); }
.week-dots .wd { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.mini-card { display: grid; gap: 4px; padding: 6px 8px; }
.mini-link { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; text-decoration: none; padding: 10px 8px; border-radius: 12px; }
.mini-link:hover { background: var(--bg-2); }
.mini-link h2 { font-size: 15px; font-weight: 800; display: flex; gap: 8px; align-items: center; }
.mini-link h2 .ic { color: var(--accent); }
.mini-link strong { font-size: 17px; font-weight: 800; }
.mini-link > .ic { color: var(--muted); }
@media (min-width: 700px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .hero { min-height: 100%; grid-row: span 2; }
  .mini-card { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) { .hero { min-height: 330px; } .kite-fly { width: 84px; height: 84px; } }

/* ---------------------------------------------------------------- plan rows */
.plan-list { list-style: none; padding: 0; margin: 0; }
.plan-row { display: grid; grid-template-columns: 44px 4px 1fr auto; align-items: center; gap: 0 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }
.tick { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; padding: 0; }
.tick .ic { width: 30px; height: 30px; padding: 6px; border-radius: 50%; border: 2px solid var(--line-2); color: transparent; stroke-width: 3; box-sizing: border-box; }
.tick:hover .ic { border-color: var(--good); }
.plan-row.done .tick .ic { background: var(--good); border-color: var(--good); color: #fff; }
.bar { width: 4px; height: 36px; border-radius: 4px; margin-right: 0; }
.plan-main { min-width: 0; display: grid; gap: 3px; }
.plan-name { font-weight: 700; line-height: 1.3; }
.plan-row.done .plan-name { text-decoration: line-through; color: var(--muted); }
.plan-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; align-items: center; }
.kind { padding: 1px 8px; border-radius: 99px; font-weight: 800; font-size: 11.5px; display: inline-flex; align-items: center; gap: 3px; }
.kind .ic { width: 12px; height: 12px; }
.kind-learn { background: var(--accent-soft); color: var(--accent-text); }
.kind-r1, .kind-r2 { background: var(--sun-soft); color: var(--sun-text); }
.kind-weak { background: var(--bg-2); color: var(--ink-2); }
.plan-why .phase { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 99px; margin-bottom: 8px; }
.phase-learn { background: var(--accent-soft); color: var(--accent-text); }
.phase-revise, .phase-final { background: var(--sun-soft); color: var(--sun-text); }
.edited { display: flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- syllabus */
.subj-tabs { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -14px 4px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
.subj-tabs::-webkit-scrollbar { display: none; }
.subj-tab {
  display: inline-flex; align-items: center; gap: 2px; min-height: 42px; padding: 0 14px; border-radius: 99px; text-decoration: none;
  border: 1px solid var(--line-2); background: var(--card); font-weight: 800; font-size: 14px; white-space: nowrap; flex: none;
}
.subj-tab em { font-style: normal; color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.subj-tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.subj-tab.on em { color: inherit; opacity: .75; }
.subj-tab.add { padding: 0 12px; }
.subj-head .card-head h2 { font-size: 19px; }
.unit { font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 16px 4px 8px; }
.ch-list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.ch-row { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ch-row:last-child { border-bottom: 0; }
.ch-top { display: flex; align-items: flex-start; gap: 6px; }
.ch-name { flex: 1; text-align: left; border: 0; background: none; padding: 4px 0; font-weight: 700; line-height: 1.35; }
.ch-row.is-done .ch-name { color: var(--ink-2); }
.flag { width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; color: color-mix(in srgb, var(--muted) 55%, transparent); display: grid; place-items: center; flex: none; margin: -6px -8px 0 0; }
.flag.on { color: var(--accent); }
.flag.on .ic { fill: color-mix(in srgb, var(--accent) 25%, transparent); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.step {
  min-height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); font-weight: 800; font-size: 13px; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 4px;
}
.step .ic { width: 15px; height: 15px; stroke-width: 3; }
.step.on { background: var(--good-soft); border-color: var(--good); color: var(--good-text); }
.step[data-level="2"].on, .step[data-level="3"].on { background: var(--sun-soft); border-color: var(--sun); color: var(--sun-text); }
.source-card { margin-top: 18px; }
.check-box { background: var(--sun-soft); color: var(--ink); border-left: 4px solid var(--sun); border-radius: 10px; padding: 10px 12px; margin: 10px 0 12px; }
.check-box strong { display: flex; align-items: center; gap: 6px; color: var(--sun-text); }
.check-box p { margin-top: 4px; font-size: 14px; }
.check-note { border-left: 3px solid var(--sun); padding-left: 10px; }
.src-links { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
@media (min-width: 700px) {
  .ch-row { display: grid; grid-template-columns: 1fr 300px; grid-template-areas: "top steps"; align-items: center; gap: 0 16px; padding: 8px 14px; }
  .ch-top { grid-area: top; align-items: center; }
  .steps { grid-area: steps; margin: 0; }
  .flag { margin: 0; }
}
.source-card p { margin-top: 6px; }
@media (min-width: 900px) { .subj-tabs { margin: 0 0 4px; padding: 2px 2px 10px; flex-wrap: wrap; } }

/* ---------------------------------------------------------------- timer */
.timer-grid { display: grid; gap: 0 14px; }
.timer-card .field { margin-bottom: 12px; }
.dial { position: relative; width: min(74vw, 280px); aspect-ratio: 1; margin: 10px auto 14px; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-track { fill: none; stroke: var(--bg-2); stroke-width: 12; }
.dial-fill { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.dial-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 4px; padding: 0 30px; }
.dial-time { font-size: clamp(44px, 14vw, 64px); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.dial-status { font-size: 13.5px; color: var(--muted); font-weight: 700; }
.timer-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 12px; font-size: 14px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-row.four { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--bg); border-radius: 14px; padding: 10px 12px; }
.stat span { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stat strong { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stat strong.up { color: var(--good-text); } .stat strong.down { color: #c8321c; }
.chart-title { font-size: 14px !important; font-weight: 800; color: var(--ink-2); margin: 8px 0 6px !important; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 10px; font-weight: 600; font-family: inherit; }
.ch-sub { font-size: 8.5px; }
.ch-today { fill: var(--accent-text); font-weight: 800; }
.ch-val { fill: var(--ink-2); font-size: 9.5px; font-weight: 800; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.ch-dot { fill: var(--card); stroke: var(--accent); stroke-width: 2.2; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.legend li { display: flex; align-items: center; padding: 6px 2px; border-bottom: 1px dashed var(--line); font-weight: 600; }
.legend li:last-child { border-bottom: 0; }
.legend strong { margin-left: auto; font-weight: 800; }
@media (min-width: 900px) { .timer-grid { grid-template-columns: 1.1fr 1fr; align-items: start; } .stat-row.four { grid-template-columns: repeat(4, 1fr); } }

/* ---------------------------------------------------------------- mock tests */
.tests-grid { display: grid; gap: 0 14px; }
.mock-list { list-style: none; padding: 0; margin: 0; }
.mock-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mock-row:last-child { border-bottom: 0; }
.mock-row small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.mock-score { text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.mock-score b { color: var(--ink); font-size: 17px; }
.mock-score em { display: block; font-style: normal; font-size: 12.5px; font-weight: 800; color: var(--accent-text); }
.parts summary { cursor: pointer; font-weight: 800; padding: 6px 0 10px; }
.parts summary em { font-style: normal; color: var(--muted); font-weight: 600; }
.part .field { margin-bottom: 8px; }
@media (min-width: 900px) { .tests-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }

/* ---------------------------------------------------------------- settings */
.settings-grid { display: grid; gap: 0 14px; }
.exam-list { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 10px; }
.exam-item { border: 1px solid var(--line-2); border-radius: 14px; padding: 12px; background: var(--bg); }
.exam-item.on { border-color: var(--accent); }
.exam-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.about p { margin-top: 6px; }
.disclaimer { font-size: 14px; color: var(--ink-2); }
@media (min-width: 900px) { .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------------------------------------------------------------- dialog & toast */
.dlg {
  border: 0; padding: 0; background: var(--card); color: var(--ink); border-radius: 22px 22px 0 0; width: 100%; max-width: 100%;
  margin: auto 0 0; max-height: 88vh; box-shadow: 0 -8px 40px rgb(0 0 0 / .25);
}
.dlg::backdrop { background: rgb(15 18 28 / .45); }
.dlg-form { padding: 20px 18px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 4px; }
.dlg-title { font-size: 19px; font-weight: 800; margin-bottom: 10px; }
.dlg-body { max-height: 58vh; overflow-y: auto; padding: 2px 2px 4px; }
.dlg-body p { margin-bottom: 8px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
@media (min-width: 600px) {
  .dlg { margin: auto; width: min(520px, 92vw); border-radius: 22px; }
}
.pick-list { display: grid; gap: 2px; }
.pick-row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 8px; border-radius: 10px; font-weight: 600; }
.pick-row:hover { background: var(--bg-2); }
.pick-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.pick-row small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 700; text-align: right; }
.pick-row.off { opacity: .5; }
.pick-subj { border-bottom: 1px solid var(--line); }
.pick-subj summary { cursor: pointer; font-weight: 800; padding: 12px 4px; display: flex; align-items: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 14px; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14.5px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-btn { border: 0; background: none; color: var(--sun); font-weight: 800; padding: 6px 4px; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
