/* =====================================================================
   THEME: change the colours of the whole site here.
   ★ Change --hue (0 to 360) and save. Everything else follows.
     262 blue-violet (default) · 250 blue · 195 teal · 150 green
      95 olive · 55 orange · 25 red · 350 pink · 305 purple
   Light and dark modes both use it. Good/warning/bad colours stay fixed.
   ===================================================================== */
:root {
  --hue: 262;

  /* Light mode */
  --brand: oklch(0.52 0.2 var(--hue));            /* buttons, links, highlights */
  --brand-2: oklch(0.4 0.15 calc(var(--hue) + 30)); /* second colour in gradients */
  --on-brand: #ffffff;                              /* text on top of --brand */
  --brand-soft: oklch(0.955 0.03 var(--hue));       /* light tinted areas */
  --bg: oklch(0.975 0.012 var(--hue));              /* page background */
  --surface: #ffffff;                               /* cards */
  --text: oklch(0.22 0.03 var(--hue));
  --muted: oklch(0.45 0.03 var(--hue));
  --line: oklch(0.9 0.02 var(--hue));
  --night: oklch(0.93 0.03 var(--hue));             /* shading for dark hours */

  /* Fixed meaning colours (not affected by --hue) */
  --good: #15803d; --warn: #b45309; --bad: #dc2626; --on-tone: #ffffff;
  --shadow: 0 8px 28px rgb(15 23 42 / .07);
  color-scheme: light;
}
/* Dark mode: the same names with dark values. Used when the device is dark or the visitor picks Dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: oklch(0.74 0.14 var(--hue)); --brand-2: oklch(0.55 0.15 calc(var(--hue) + 30));
    --on-brand: oklch(0.18 0.03 var(--hue)); --brand-soft: oklch(0.3 0.05 var(--hue));
    --bg: oklch(0.18 0.03 var(--hue)); --surface: oklch(0.23 0.035 var(--hue));
    --text: oklch(0.95 0.01 var(--hue)); --muted: oklch(0.76 0.03 var(--hue));
    --line: oklch(0.33 0.04 var(--hue)); --night: oklch(0.27 0.045 var(--hue));
    --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --on-tone: #0b1020;
    --shadow: 0 8px 28px rgb(0 0 0 / .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: oklch(0.74 0.14 var(--hue)); --brand-2: oklch(0.55 0.15 calc(var(--hue) + 30));
  --on-brand: oklch(0.18 0.03 var(--hue)); --brand-soft: oklch(0.3 0.05 var(--hue));
  --bg: oklch(0.18 0.03 var(--hue)); --surface: oklch(0.23 0.035 var(--hue));
  --text: oklch(0.95 0.01 var(--hue)); --muted: oklch(0.76 0.03 var(--hue));
  --line: oklch(0.33 0.04 var(--hue)); --night: oklch(0.27 0.045 var(--hue));
  --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --on-tone: #0b1020;
  --shadow: 0 8px 28px rgb(0 0 0 / .35); color-scheme: dark;
}

/* ---------- Basics ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1040px; margin: auto; padding: 24px 16px 48px; }
h1 { margin: 0 0 4px; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
h3 { margin: 16px 0 6px; font-size: .95rem; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lead, .status, .hint { color: var(--muted); }
.status:empty { display: none; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: space-between; padding: 10px max(16px, calc((100% - 1008px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.3rem; }
.brand b { color: var(--brand); }
.logo { width: 36px; height: 36px; color: var(--brand); }
nav { display: flex; gap: 4px; }
nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; }
nav a:hover { background: var(--brand-soft); color: var(--text); }
nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); }

/* ---------- Shared pieces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; }
.button { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; padding: 11px 16px; margin: 0 6px 6px 0;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; }
.button:hover { border-color: var(--brand); }
.button:disabled { opacity: .5; cursor: default; }
.button.primary, .button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.banner { margin: 0 0 14px; padding: 10px 16px; border-radius: 12px; background: var(--brand-soft); border: 1px solid var(--line); }
.band-Great { --tone: var(--good); } .band-Good { --tone: var(--good); }
.band-Fair { --tone: var(--warn); } .band-Rough { --tone: var(--bad); } .band-Avoid { --tone: var(--bad); }

/* ---------- Search ---------- */
.search-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.search-row .button { margin: 0; }
.search { position: relative; flex: 1 1 260px; }
#search { width: 100%; font: inherit; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); }
#results { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px;
  list-style: none; max-height: 330px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgb(0 0 0 / .25); }
#results li { padding: 9px 12px; border-radius: 9px; cursor: pointer; }
#results li small { display: block; color: var(--muted); }
#results li[aria-selected="true"], #results li[role="option"]:hover { background: var(--brand-soft); }
#results .note { cursor: default; color: var(--muted); font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips:empty { display: none; }
.chips button { font: inherit; font-size: .9rem; padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }

/* ---------- The day card ---------- */
.day { background: linear-gradient(160deg, var(--brand-soft), var(--surface) 55%); }
.day-head { text-align: center; }
.place { margin: 0; color: var(--muted); font-weight: 600; }
.meta { margin: 2px 0 0; color: var(--muted); }
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; margin: 18px 0; }
.score-box { display: flex; align-items: center; gap: 6px; }
.score-centre { text-align: center; min-width: 150px; }
.ring { --value: 0; --tone: var(--good); width: 118px; height: 118px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(var(--surface) 58%, transparent 60%), conic-gradient(var(--tone) calc(var(--value) * 1%), var(--line) 0); }
.ring span { font-size: 2.2rem; font-weight: 800; }
.score-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); }
.band { font-weight: 800; color: var(--tone, var(--text)); }
.arrow, .help { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.arrow { width: 34px; height: 34px; border-radius: 50%; font-size: 1.4rem; line-height: 1; padding: 0 0 3px; }
.arrow:hover:not(:disabled), .help:hover { border-color: var(--brand); color: var(--brand); }
.arrow:disabled { opacity: .3; cursor: default; }
.help { width: 22px; height: 22px; border-radius: 50%; font-size: .8rem; font-weight: 700; padding: 0; }
.mode { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: .85rem; }
.verdict-text h2 { margin: 8px 0 6px; font-size: clamp(1.5rem, 3.4vw, 2rem); text-transform: none; letter-spacing: 0; color: var(--text); line-height: 1.2; }
.verdict-text p { margin: 0; font-size: 1.05rem; }
.bring-block { border-top: 1px solid var(--line); padding-top: 4px; }
.bring { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 0; padding: 0; list-style: none; }
.bring li { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.bring .emoji { font-size: 1.6rem; line-height: 1; }
.bring b, .bring small { display: block; }
.bring small { color: var(--muted); }

/* ---------- School-day timeline ---------- */
.timeline-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.timeline-head h2 { margin: 0; }
.sun { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .9rem; }
.sun span { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.sun svg { width: 22px; height: 22px; }
.best-line { margin: 12px 0; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); font-weight: 600; }
.best-line::before { content: "★ "; color: var(--brand); }
.timeline { display: flex; gap: 6px; margin: 0; padding: 0 0 8px; list-style: none; overflow-x: auto; scroll-snap-type: x proximity; }
.slot { width: 62px; padding: 8px 4px; border-radius: 14px; border: 2px solid transparent; background: var(--surface);
  color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slot.dark { background: var(--night); }
.slot.passed { opacity: .45; }
.slot.best { background: var(--brand-soft); border-color: color-mix(in oklab, var(--brand) 45%, transparent); }
.slot[aria-pressed="true"] { border-color: var(--brand); }
.slot svg { width: 32px; height: 32px; }
.slot .track { width: 20px; height: 70px; border-radius: 10px; background: var(--line); display: flex; align-items: flex-end; overflow: hidden; }
.slot .fill { width: 100%; border-radius: 10px; background: var(--tone, var(--good)); }
.slot b { font-size: .95rem; }
.slot small { color: var(--muted); }
.timeline li { scroll-snap-align: center; flex: none; }

.hour-detail { display: grid; grid-template-columns: auto 1fr; gap: 16px 28px; align-items: center; margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.big { display: flex; align-items: center; gap: 12px; }
.big svg { width: 76px; height: 76px; }
.big .temp { font-size: clamp(3.4rem, 9vw, 4.8rem); font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.big small { display: block; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { padding: 10px 12px; border-radius: 14px; background: var(--bg); }
.stat span, .stat small { display: block; color: var(--muted); font-size: .85rem; }
.stat b { display: block; font-size: 1.3rem; overflow-wrap: anywhere; }
.card > .stats { margin-top: 8px; }

/* ---------- School week ---------- */
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.week button { width: 100%; padding: 12px 4px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.week button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.week button:disabled { opacity: .45; cursor: default; }
.week svg { width: 38px; height: 38px; }
.week small { color: var(--muted); white-space: nowrap; }
.week .hi { font-weight: 700; }
.pill { margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--tone, var(--muted)); color: var(--on-tone); font-weight: 800; font-size: .9rem; }
.credit { text-align: center; font-size: .85rem; }

/* ---------- Dialogs ---------- */
.modal { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 0 / .4); }
.modal::backdrop { background: rgb(8 10 25 / .6); }
.modal-body { padding: 24px; }
.modal-body h2 { font-size: 1.4rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.modal .card { box-shadow: none; padding: 14px; margin-bottom: 10px; border-radius: 14px; }
.modal-actions { margin-top: 8px; }
.bands { width: 100%; border-collapse: collapse; margin: 10px 0; }
.bands th { text-align: left; white-space: nowrap; padding: 6px 12px 6px 0; }
.bands td { padding: 6px 0; }
.bands tr + tr { border-top: 1px solid var(--line); }
#factorList { margin: 0 0 10px; padding-left: 20px; }

/* ---------- Settings ---------- */
fieldset.card { display: block; }
legend { float: left; width: 100%; font-weight: 700; margin-bottom: 6px; padding: 0; }
.hint { margin: 0 0 8px; font-size: .9rem; clear: both; }
.segmented { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.segmented input:checked + span { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.segmented input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.saved { list-style: none; margin: 0; padding: 0; }
.saved li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }

/* ---------- About ---------- */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
.pipeline li { counter-increment: step; background: var(--bg); border-radius: 14px; padding: 14px; }
.pipeline li::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 8px;
  border-radius: 50%; background: var(--brand); color: var(--on-brand); font-weight: 700; }
.pipeline span { display: block; color: var(--muted); font-size: .9rem; }

/* ---------- 404 ---------- */
.missing { text-align: center; padding: 48px 20px; }
.missing svg { width: 130px; height: 130px; }
.missing .code { margin: 0; font-size: 6rem; font-weight: 800; line-height: 1.1; color: var(--brand); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .verdict { grid-template-columns: 1fr; gap: 14px; }
  .score-box { justify-content: center; }
  .verdict-text { text-align: center; }
  .hour-detail { grid-template-columns: 1fr; }
  .week { gap: 4px; }
  .week svg { width: 30px; height: 30px; }
  .pill { padding: 2px 7px; }
}
