/* ---------- Tokens ---------- */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font);
  --radius: 16px;
  --accent: #3fbf74;
  --on-accent: #0b0e1a;
}

:root,
:root[data-theme="dark"] {
  --bg: #080b16;
  --glow-1: rgba(88, 101, 242, 0.18);
  --glow-2: rgba(236, 120, 80, 0.12);
  --panel: #11152a;
  --panel-2: #181d38;
  --field: #0c1023;
  --border: #262c4d;
  --orbit: rgba(160, 170, 230, 0.22);
  --text: #e9ebf8;
  --muted: #9aa1c7;
  --star: rgba(255, 255, 255, 0.7);
  --star-opacity: 1;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f2f3f9;
  --glow-1: rgba(88, 101, 242, 0.1);
  --glow-2: rgba(236, 120, 80, 0.08);
  --panel: #ffffff;
  --panel-2: #f6f7fc;
  --field: #eef0f8;
  --border: #dde0ee;
  --orbit: rgba(70, 80, 140, 0.22);
  --text: #171a30;
  --muted: #5c6285;
  --star: rgba(60, 70, 140, 0.25);
  --star-opacity: 0.6;
  --shadow: 0 8px 24px rgba(30, 40, 90, 0.08);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { font-size: 106.25%; } /* 17px base: everything sized in rem scales with it */
body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, var(--glow-2), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: var(--star-opacity);
  background-image:
    radial-gradient(1px 1px at 12% 22%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 28% 68%, var(--star), transparent 60%),
    radial-gradient(1.5px 1.5px at 41% 14%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 57% 82%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 66% 38%, var(--star), transparent 60%),
    radial-gradient(1.5px 1.5px at 79% 61%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 88% 18%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 94% 88%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 6% 90%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 50% 50%, var(--star), transparent 60%);
}

button, input, select, textarea { font: inherit; color: inherit; }
/* iPhones zoom the whole page into any text box under 16px and stay zoomed, which left new students stuck zoomed in
   on the first-run setup after typing their sign-up details. 16px stops that. */
@media (pointer: coarse), (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: max(16px, 1em); }
}
h1, h2, h3, h4 { line-height: 1.2; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); font-size: 0.82rem; }
.push { margin-left: auto; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, filter 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-size: inherit;
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm svg { width: 15px; height: 15px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
}
textarea { resize: vertical; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: var(--muted); }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.inline-field select { width: auto; padding: 0.4rem 0.55rem; }

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  max-width: 1360px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: url(../img/logo.svg) center / cover no-repeat;
  box-shadow: 0 0 16px -4px rgba(255, 170, 40, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.login-card .brand-mark, .offline-card .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.badge {
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Tabs and pages ---------- */
.topbar { display: grid; grid-template-columns: auto 1fr auto; }
.tabbar { display: flex; justify-content: center; gap: 4px; }
.tabbar a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.tabbar a svg { width: 17px; height: 17px; }
.tabbar a:hover { color: var(--text); background: var(--panel-2); }
.tabbar a.is-active { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 1px var(--border), 0 -2px 0 var(--accent) inset; }
.tabbar a.is-active svg { color: var(--accent); }

main { max-width: 1360px; margin: 0 auto; padding: 0 24px 40px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 4px 0 16px; }
.page-head h1 { font-family: var(--font-display); font-size: 1.5rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; max-width: 62ch; }
.page > .card, .page > .grid-2 { margin-bottom: 20px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  align-items: start;
}
/* Hub: the solar system across the full width, Today as a strip underneath */
.hub-layout { grid-template-columns: minmax(0, 1fr); }
.today-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin-bottom: 8px; }
.today-exams { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.today-exams .today-exam { margin: 0; }
.today-top .today-progress { flex: 1 1 260px; max-width: 420px; margin: 0; }
.today-top .today-actions { margin: 0 0 0 auto; }
.today-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.today-day { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: var(--panel-2); min-width: 0; display: grid; gap: 8px; }
/* Compact session cards in the strip: tick and time on top, what to do underneath (details are one click away) */
.today-day .tt-row { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "tick time" "what what"; gap: 6px 10px; padding: 9px 11px; margin: 0; }
.today-day .tt-what span { display: block; }
.today-day .tt-row .tick { grid-area: tick; }
.today-day .tt-row .tt-time { grid-area: time; align-self: center; }
.today-day .tt-row .tt-what { grid-area: what; }
.today-day .tt-row .icon-btn, .today-day .why-topic, .today-day .practise-link { display: none; }
.today-day.is-today { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.today-day .tt-day-label { margin-top: 0; }
@media (max-width: 760px) {
  .today-days { grid-auto-flow: row; grid-auto-columns: auto; }
  .today-top .today-actions { margin-left: 0; }
}
.today-progress { margin: 4px 0 12px; }
.today-progress-head { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 6px; color: var(--muted); }
.today-progress-head b { color: var(--text); }
/* Focus tab: big timer on the left; time revised (with this week's chart) and up next on the right; ideas underneath */
.focus-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.focus-grid .ideas-card { grid-column: 1 / -1; }
.focus-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.focus-side > .card:last-child { flex: 1; }
.timer-card { display: flex; flex-direction: column; }
/* Circular progress ring in the subject's colour */
.timer-ring {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
  margin: auto;
  margin-top: 24px;
  margin-bottom: 24px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  justify-items: center;
  background: conic-gradient(var(--mc, var(--accent)) var(--p, 0%), color-mix(in srgb, var(--field) 85%, var(--border)) 0);
  box-shadow: 0 0 40px -12px var(--mc, var(--accent));
  transition: box-shadow 0.3s;
}
.timer-ring::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.35); }
.timer-ring > * { position: relative; }
.timer-ring.is-running { box-shadow: 0 0 60px -6px var(--mc, var(--accent)); }
.timer-card .timer-face { font-size: clamp(3.2rem, 6vw, 4.6rem); }
.timer-sub { font-size: 0.85rem; color: var(--muted); margin-top: -2px; }
.timer-card .timer-bar { display: none; }
.timer-card .timer-controls { margin-top: auto; }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 150px; margin: 14px 0 6px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.wk-bar { flex: 1; width: 100%; max-width: 36px; display: flex; flex-direction: column-reverse; border-radius: 8px; background: var(--field); overflow: hidden; }
.wk-bar i { display: block; width: 100%; }
.wk-min { font-size: 0.68rem; color: var(--muted); min-height: 1em; white-space: nowrap; }
.wk-label { font-size: 0.74rem; color: var(--muted); }
.wk-day.is-today .wk-label { color: var(--text); font-weight: 700; }
.wk-day.is-today .wk-bar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent); }
.wk-day.is-future { opacity: 0.45; }
.wk-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.wk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wk-legend .dot { background: var(--mc); }
.up-next { border-left: 3px solid var(--mc); padding-left: 10px; }
.up-later { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.up-later li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--field); font-size: 0.86rem; cursor: pointer; min-width: 0; }
.up-later li b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.up-later li span { white-space: nowrap; font-size: 0.8rem; }
.up-later li:hover b { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 760px) {
  .focus-grid { grid-template-columns: 1fr; }
}
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.main-col, .col-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.below-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) {
  .below-stage { grid-template-columns: 1fr; }
}
.grid-tt { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
@media (max-width: 1080px) {
  .grid-2, .grid-tt { grid-template-columns: 1fr; }
}

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mc, var(--accent)); flex: none; }

/* Subject picker chips (Tests) */
.subject-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
}
.picker-chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--mc); }
.picker-chip:hover { border-color: var(--mc); }
.picker-chip.is-on { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 18%, var(--panel)); font-weight: 600; }

/* Results */
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.results li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--field); }
.result-score { flex: none; width: 64px; text-align: center; }
.result-score b { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.result-score span { font-size: 0.7rem; color: var(--muted); }
.result-score.low b { color: #ff7b7b; }
.result-score.mid b { color: #f2b94b; }
.result-score.high b { color: #4fd18b; }
.result-meta { flex: 1; min-width: 0; }
.result-meta strong { display: block; font-size: 0.88rem; }
.result-meta > span { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 0.76rem; color: var(--muted); }
.acc-list { display: flex; flex-direction: column; gap: 6px; }
.acc-row { display: grid; grid-template-columns: minmax(0, 1fr) 1.2fr 42px; align-items: center; gap: 10px; font-size: 0.84rem; }
.acc-row span:last-child { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.acc-bar { height: 8px; border-radius: 99px; background: var(--field); overflow: hidden; }
.acc-bar i { display: block; height: 100%; border-radius: 99px; }
.acc-bar i.low { background: #ff7b7b; }
.acc-bar i.mid { background: #f2b94b; }
.acc-bar i.high { background: #4fd18b; }

/* Library */
.lib-filters { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto; gap: 8px; align-items: center; margin-bottom: 12px; }
.lib-filters .seg { margin: 0; }
.lib-count { margin: 0 0 8px; }
.files .file-meta > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.files .dot { width: 8px; height: 8px; }

/* Progress */
.stats.stats-wide { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 8px; }
.stats-wide .stat { background: var(--panel); border: 1px solid var(--border); }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.prog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.prog-card { border-top: 3px solid var(--mc); display: flex; flex-direction: column; gap: 10px; }
.prog-card .panel-head { margin-bottom: 0; }
.prog-card .btn { align-self: flex-start; }
.grade-track { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; }
.grade-track span {
  display: grid;
  place-items: center;
  height: 24px;
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  position: relative;
}
.grade-track .is-done { background: color-mix(in srgb, var(--mc) 55%, var(--field)); color: var(--text); }
.grade-track .is-gap { background: color-mix(in srgb, var(--mc) 18%, var(--field)); color: var(--text); }
.grade-track .is-target { box-shadow: inset 0 0 0 2px var(--mc); }
.grade-track .is-last::after { content: ""; position: absolute; bottom: -5px; width: 6px; height: 6px; border-radius: 50%; background: var(--text); }
.prog-line { margin: 4px 0 0; font-size: 0.84rem; }
.prog-foot { margin: 0; font-size: 0.76rem; }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 38px; }
.trend span { flex: 1; max-width: 26px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--mc) 70%, transparent); }
.weak-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wchip { padding: 0.18rem 0.55rem; border-radius: 999px; background: var(--field); border: 1px solid var(--border); font-size: 0.74rem; }
.wchip.test { border-color: color-mix(in srgb, #ff7b7b 60%, var(--border)); background: color-mix(in srgb, #ff7b7b 14%, var(--field)); }

/* Settings */
.ai-status { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-status li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: var(--field); }
.ai-status strong { font-size: 0.86rem; }
.ai-status span { font-size: 0.76rem; color: var(--muted); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-row > div:first-child { display: flex; flex-direction: column; }
.setting-row strong { font-size: 0.9rem; }
.setting-row span { font-size: 0.78rem; color: var(--muted); }
.setting-row .seg { margin: 0; min-width: 150px; }

/* Sign-in screen (server version) */
.login {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(900px 500px at 20% 0%, var(--glow-1), transparent 60%),
    radial-gradient(700px 400px at 100% 20%, var(--glow-2), transparent 60%),
    var(--bg);
}
.login-card { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card .brand { font-size: 1.3rem; }
.login-card p { margin: 0; }
.login-card .btn { width: 100%; padding: 0.7rem; }
.login-error { color: #ff8a8a; font-size: 0.86rem; }
body.is-locked { overflow: hidden; }

/* Ticks on planned sessions */
.tick {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  border: 1.5px solid color-mix(in srgb, var(--mc, var(--accent)) 70%, var(--border));
  background: none;
  color: transparent;
  cursor: pointer;
}
.tick svg { width: 16px; height: 16px; }
.tick:hover { color: color-mix(in srgb, var(--mc, var(--accent)) 60%, transparent); }
.tt-row.is-done .tick { background: var(--mc, var(--accent)); border-color: transparent; color: #0b0e1a; }
.tt-row.is-done .tt-what strong { text-decoration: line-through; text-decoration-thickness: 1.5px; opacity: 0.7; }
.tt-row.is-done { opacity: 0.85; }
.tt-row.is-missed .tick { border-color: #ff7b7b; }
.tt-row.is-missed .tt-time { color: #ff7b7b; }

/* Calendar */
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .icon-btn { font-size: 1.1rem; }
.cal-label { min-width: 130px; text-align: center; font-weight: 600; font-size: 0.92rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.cal-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-height: 84px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--field);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.cal-day:hover { border-color: var(--border); }
.cal-day.is-other { opacity: 0.45; }
.cal-day.is-today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-day.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-num { align-self: flex-start; min-width: 22px; padding: 0 5px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; text-align: center; line-height: 20px; }
.cal-exam {
  display: block;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: color-mix(in srgb, #ff6b6b 22%, var(--panel));
  border-left: 3px solid var(--mc);
}
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dots i, .cal-legend .lg { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--mc, var(--muted)); display: inline-block; }
.cal-dots i.is-done, .cal-legend .lg.is-done { background: var(--mc, var(--muted)); }
.cal-dots i.is-missed, .cal-legend .lg.is-missed { border-color: #ff7b7b; }
.cal-min { margin-top: auto; font-size: 0.66rem; color: var(--muted); }
.cal-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cal-detail { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.cal-detail h3 { margin: 0; font-size: 1rem; }
.cal-detail .tt-row + .tt-row { margin-top: 6px; }
.cal-detail .tt-row, .recent-time .tt-row { margin-top: 6px; }

/* Revision time (Progress) */
.time-panel { margin-bottom: 12px; }
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.time-grid { gap: 20px; }
.day-bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; height: 110px; align-items: end; }
.day-bars span { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 3px; }
.day-bars i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); }
.day-bars small { font-size: 0.62rem; color: var(--muted); }
.time-entry .tt-time { width: auto; min-width: 46px; }
.timer-subject { margin-bottom: 4px; }

.cal-test {
  display: block;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: color-mix(in srgb, var(--mc) 20%, var(--panel));
  border-left: 3px solid var(--mc);
}
.tt-row.is-result { background: color-mix(in srgb, var(--mc) 10%, var(--field)); }
.tt-row.is-result .tt-time { font-weight: 700; }
.log-time-hint { align-self: end; margin: 0 0 10px; }
.stat-wide { grid-column: 1 / -1; }
.stat-wide b { font-size: 1rem; white-space: normal; }

/* Planner balance option */
.check-field { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--field); font-size: 0.84rem; cursor: pointer; }
.check-field span { color: var(--muted); }
.check-field b { display: block; color: var(--text); }
.span-all { grid-column: 1 / -1; }
.tag.done { border-color: #4fd18b; color: var(--text); }
.tag.strong { border-color: #7aa7ff; color: var(--text); }
.for-exam { display: block; margin-top: 2px; font-size: 0.72rem; color: color-mix(in srgb, #7aa7ff 80%, var(--text)); }

/* Timetable focus (Settings) */
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; gap: 3px; }
.switch-row strong { font-size: 0.92rem; }
.switch-row span span { font-size: 0.8rem; color: var(--muted); }
input.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 44px;
  height: 24px;
  margin: 2px 0 0;
  border-radius: 99px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
input.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(20px); }
.focus-sources { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.focus-sources legend { padding: 0 6px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.focus-sources.is-off { opacity: 0.5; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; cursor: pointer; }
.why-topic { display: block; margin-top: 2px; font-size: 0.72rem; color: color-mix(in srgb, #f2b94b 80%, var(--text)); }

/* Clickable sessions + catch-up */
.tt-what[data-practice] { cursor: pointer; border-radius: 8px; }
.tt-what[data-practice]:hover strong { text-decoration: underline; text-underline-offset: 2px; }
.tt-what[data-practice]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.practise-link { display: block; margin-top: 2px; font-size: 0.72rem; color: var(--accent); opacity: 0; transition: opacity 0.15s; }
.tt-what[data-practice]:hover .practise-link, .tt-what[data-practice]:focus-visible .practise-link { opacity: 1; }
@media (hover: none) { .practise-link { opacity: 1; } }
.note.catchup { border-left: 3px solid #f2b94b; color: var(--text); }
.note.catchup .btn-row { margin-top: 8px; }

/* Moving sessions */
.tt-row.can-drag { cursor: grab; }
.tt-row.is-dragging-row { opacity: 0.45; }
.is-moving .cal-day { outline: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent); }
.cal-day.is-drop { background: color-mix(in srgb, var(--accent) 22%, var(--field)); box-shadow: 0 0 0 2px var(--accent); }
.moved-tag { display: inline-block; margin-top: 2px; font-size: 0.7rem; color: var(--muted); font-style: italic; }
.move-row { display: grid; grid-template-columns: minmax(0, 220px) auto; gap: 8px; align-items: end; margin-top: 12px; }

/* Anki settings */
.anki-status { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 600; font-size: 0.9rem; }
.anki-status i { width: 10px; height: 10px; border-radius: 50%; background: #ff7b7b; }
.anki-status.on i { background: #4fd18b; box-shadow: 0 0 8px #4fd18b; }
.setup-steps { margin-top: 6px; font-size: 0.86rem; }
.setup-steps summary { cursor: pointer; color: var(--muted); }
.anki-decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.anki-decks .field > span { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.86em; padding: 0.05rem 0.3rem; border-radius: 5px; background: var(--field); }
pre.code { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--field); font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; overflow-x: auto; white-space: pre; }

/* Why this split (planner) */
/* Folding sections (planner settings, why this split, calendar, weeks) */
.fold { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.fold > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
  flex: none;
}
.fold[open] > summary::before { transform: rotate(45deg); }
.fold > summary:hover { color: var(--accent); }
.fold-meta { font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.fold-dots { display: inline-flex; gap: 3px; margin-left: auto; }
.fold-dots .dot { width: 8px; height: 8px; }
.fold > :not(summary) { margin-left: 14px; margin-right: 14px; }
.fold > :last-child { margin-bottom: 14px; }
.fold .tt-grid { margin-top: 2px; }
.tt-weeks .fold { margin-top: 8px; }
.tt-weeks .tt-days { margin-top: 0; }

.why { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.why li { display: grid; grid-template-columns: 150px 1fr 44px; grid-template-areas: "name bar share" "tags tags tags"; align-items: center; gap: 4px 10px; font-size: 0.82rem; }
.why-name { grid-area: name; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.why-bar { grid-area: bar; height: 8px; border-radius: 999px; background: var(--field); overflow: hidden; }
.why-bar i { display: block; height: 100%; border-radius: inherit; background: var(--mc); }
.why-tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 4px; padding-left: 16px; }
.why-tags .tag { margin: 0; border-style: solid; font-size: 0.7rem; padding: 1px 7px; }
.why-share { grid-area: share; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tag.prio-top { border-color: #ff7b7b; color: var(--text); }
.tag.prio-high { border-color: #f2b94b; color: var(--text); }
.tag.prio-low { opacity: 0.7; }
.tag.behind { border-color: #ff7b7b; color: #ff9a9a; }

/* Log a score */
.log-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.log-form .span-2 { grid-column: 1 / -1; }
.log-form .btn-row { margin-top: 0; }
.log-preview { justify-content: flex-end; padding: 0.55rem 0.7rem; border-radius: 9px; background: var(--field); color: var(--muted); font-size: 0.86rem; }
.log-preview b { color: var(--text); }
.score-tag { border-style: solid; color: var(--text); }
.exams .btn-sm { flex: none; }

/* Hub "Today" */
.today-exam { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 0.88rem; }
#todayBody .tt-day-label:first-child { margin-top: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Stage ---------- */
.stage { padding: 22px; position: relative; overflow: hidden; }
.stage > :not(.starfield) { position: relative; z-index: 1; }
.starfield { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 14px; }
.stage-head h1 { font-family: var(--font-display); font-size: 1.4rem; margin: 0; }
.stage-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; max-width: 50ch; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.system {
  position: relative;
  width: 100%;
  aspect-ratio: 11 / 5; /* orbit maths in app.js (ASPECT) assumes this */
  margin: 0 auto;
  /* Pan/zoom (--px/--py/--zoom) and a gentle pointer tilt (--rx/--ry), all set by space.js */
  transform:
    translate(var(--px, 0px), var(--py, 0px)) scale(var(--zoom, 1))
    perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.system.is-animating { transition: transform 0.38s cubic-bezier(.2, .8, .3, 1); }

/* The window you move around in */
.viewport {
  position: relative;
  overflow: hidden;
  margin: 8px -22px 0;
  padding: 26px 22px 40px;
  cursor: grab;
  touch-action: none;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}
.viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 12px; }
.viewport.is-panning { cursor: grabbing; }
.viewport.is-panning * { cursor: grabbing; }
.zoom-controls {
  position: absolute;
  right: 18px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  z-index: 4;
  cursor: default;
}
.zoom-controls button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.zoom-controls button:hover { background: var(--field); }
.zoom-controls [data-z="reset"] { font-size: 1rem; opacity: 0.5; }
.viewport.is-moved .zoom-controls [data-z="reset"] { opacity: 1; color: var(--accent); }
.zoom-level { min-width: 42px; text-align: center; font-size: 0.74rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.view-hint {
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.4s;
}
.viewport.has-explored .view-hint { opacity: 0; }
.viewport .view-hint.is-shown { opacity: 1; color: var(--text); }
.planets, .moons { display: contents; }

/* Sun's rays, slowly turning */
.corona {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--sun-size, 11.5%) * 1.83);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255, 190, 80, 0.35) 30%, rgba(255, 150, 50, 0.12) 50%, transparent 68%),
    repeating-conic-gradient(from 0deg, rgba(255, 200, 110, 0.14) 0deg 3deg, transparent 3deg 11deg, rgba(255, 200, 110, 0.08) 11deg 13deg, transparent 13deg 19deg);
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 36%, transparent 70%);
  mask: radial-gradient(circle, transparent 30%, #000 36%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: coronaSpin 70s linear infinite;
  z-index: 1;
}

/* Beams from the sun to each planet: shown on hover and while dragging */
.beams { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 1; }
.beams line {
  stroke: var(--c);
  stroke-width: 0.7;
  stroke-linecap: round;
  stroke-dasharray: 0.9 1.6;
  opacity: 0;
  transition: opacity 0.25s;
}
.beams line.is-active, .is-dragging .beams line { opacity: 0.85; animation: beamFlow 0.9s linear infinite; }
.is-dragging .beams line:not(.is-active) { opacity: 0.35; }

/* One-off effects created by space.js */
.comet {
  position: absolute;
  width: 74px;
  height: 6px;
  margin: -3px 0 0 -70px;
  border-radius: 6px;
  background: linear-gradient(90deg, transparent, var(--c) 65%, #fff);
  filter: drop-shadow(0 0 6px var(--c));
  transform-origin: 70px 3px;
  pointer-events: none;
  z-index: 3;
}
.ripple {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid var(--c);
  box-shadow: 0 0 18px var(--c);
  pointer-events: none;
  z-index: 1;
}
.ripple.sm { width: 70px; height: 70px; border-width: 1.5px; }
.spark {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #ffd870;
  box-shadow: 0 0 8px #ffb020;
  pointer-events: none;
  z-index: 3;
}

/* Orbits: ellipses (the plane is tilted back), the far half fainter. Sizes match orbitStyle() in app.js. */
.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 1px dashed var(--orbit);
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-mask: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), #000 70%);
  mask: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), #000 70%);
}
.orbit-inner { width: 66%; height: 61%; }
.orbit-outer { width: 91%; height: 84%; border-style: solid; opacity: 0.7; }
/* A faint asteroid belt between the planets and the moons (fills the gap when there are only a few of each). */
.belt { position: absolute; left: 50%; top: 50%; width: 78.5%; height: 72.5%; transform: translate(-50%, -50%); pointer-events: none;
  -webkit-mask: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), #000 75%); mask: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), #000 75%); }
.belt i { position: absolute; inset: 0; border-radius: 50%; border: 2px dotted color-mix(in srgb, var(--orbit) 80%, #c9b48a); opacity: 0.45; }
.belt i + i { inset: -1.6% -1.2%; border-width: 1px; opacity: 0.35; }
:root[data-theme="light"] .belt i { opacity: 0.25; }

/* Fine noise, used as surface texture on the sun and planets */
:root {
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 1.6 -0.45'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Sun: hot core, darker limb, boiling surface, glow */
.sun {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--sun-size, 11.5%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #4a2100;
  background: radial-gradient(circle at 46% 44%, #fffbe8 0%, #ffe98a 16%, #ffc441 42%, #ff951f 70%, #f0661a 88%, #c94512 100%);
  box-shadow:
    0 0 30px 6px rgba(255, 170, 50, 0.55),
    0 0 90px 20px rgba(255, 130, 30, 0.28),
    0 0 180px 40px rgba(255, 110, 20, 0.12),
    inset 0 0 22px rgba(255, 255, 220, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  display: grid;
  place-items: center;
  z-index: 3;
  animation: sunBreath 4.5s ease-in-out infinite;
}
.sun::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--noise), var(--noise);
  background-size: 70px 70px, 110px 110px;
  mix-blend-mode: overlay;
  filter: contrast(2.2) sepia(1) saturate(3) hue-rotate(-12deg);
  opacity: 0.55;
  animation: sunBoil 60s linear infinite;
  pointer-events: none;
}
.sun::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 58%, rgba(170, 50, 0, 0.35) 92%, rgba(130, 30, 0, 0.5) 100%);
  pointer-events: none;
}
.sun:hover, .sun.is-hover {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 0 40px 10px rgba(255, 180, 50, 0.75), 0 0 120px 30px rgba(255, 130, 30, 0.38), 0 0 200px 50px rgba(255, 110, 20, 0.16), inset 0 0 22px rgba(255, 255, 220, 0.4);
}
.sun.is-pulse { animation: sunPulse 0.5s ease-out; }
.sun-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; font-size: 0.86rem; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5); }
.sun-inner svg { width: 26px; height: 26px; }
.sun-count { font-size: 0.72rem; opacity: 0.8; }

.satellites { position: absolute; inset: -16%; pointer-events: none; animation: spin 22s linear infinite; }
.satellites > span { position: absolute; inset: 0; transform: rotate(var(--a)); }
.satellites i {
  position: absolute;
  left: 50%;
  top: 0;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Planets: shaded spheres lit from the sun, with a slowly turning surface. Depth (size, brightness,
   in front of / behind the sun) comes from orbitStyle() in app.js. */
.planet {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--planet-size, 7%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  scale: var(--depth, 1);
  filter: brightness(var(--bright, 1));
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  z-index: var(--z, 2);
  animation: bob 7s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.planet-body {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), var(--c1), var(--c2) 80%);
  box-shadow:
    0 0 14px -2px color-mix(in srgb, var(--c1) 70%, transparent),
    0 0 34px -6px color-mix(in srgb, var(--c1) 55%, transparent),
    0 14px 30px -10px rgba(0, 0, 0, 0.6);
  transition: transform 0.18s, box-shadow 0.18s;
}
.planet-surface, .planet-clouds, .planet-shade { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; overflow: hidden; }
/* Surface and clouds are twice as wide as the planet and scroll sideways, so the planet looks like it's turning. */
.planet-surface {
  background-image: var(--surface, none), var(--noise);
  background-size: 200% 100%, 60px 60px;
  background-repeat: repeat-x, repeat;
  animation: planetTurn var(--turn, 50s) linear infinite;
  opacity: 0.95;
}
.planet-clouds {
  background-image: var(--clouds, none);
  background-size: 200% 100%;
  background-repeat: repeat-x;
  animation: planetTurn calc(var(--turn, 50s) * 0.6) linear infinite;
  filter: blur(0.6px);
}
/* Sunlit side, a soft terminator into the night side, and the darker edge (limb). */
.planet-shade {
  background:
    radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), rgba(255, 255, 255, 0.5) 0, rgba(255, 255, 255, 0.12) 14%, transparent 30%),
    radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), transparent 36%, rgba(0, 0, 12, 0.35) 58%, rgba(0, 0, 12, 0.82) 82%, rgba(0, 0, 12, 0.92) 100%),
    radial-gradient(circle, transparent 70%, rgba(0, 0, 0, 0.25) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
/* Atmosphere: a thin glowing rim, brightest on the side facing the sun. */
.planet-atmo {
  position: absolute;
  inset: -5%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), color-mix(in srgb, var(--c1) 70%, white) 0, color-mix(in srgb, var(--c1) 55%, transparent) 45%, transparent 75%);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 66%, #000 68%, transparent 73%);
  mask: radial-gradient(circle, transparent 62%, #000 66%, #000 68%, transparent 73%);
  opacity: 0.9;
}
.planet-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-style: normal;
  background: color-mix(in srgb, var(--c2) 55%, var(--panel)); box-shadow: 0 0 8px -2px var(--c1); }
.planet-ico svg { width: 12px; height: 12px; color: #fff; }

/* Each planet's own world: base colours come from --c1/--c2 (data.js); these add land, bands, craters and clouds. */
.planet[data-tool="claude"] { /* rusty desert world: dark plains, a canyon, polar ice */
  --surface:
    radial-gradient(ellipse 10% 8% at 12% 40%, rgba(90, 28, 8, 0.55), transparent 70%),
    radial-gradient(ellipse 14% 7% at 31% 63%, rgba(90, 28, 8, 0.5), transparent 70%),
    radial-gradient(ellipse 18% 2.4% at 47% 47%, rgba(70, 18, 4, 0.6), transparent 80%),
    radial-gradient(ellipse 8% 6% at 66% 31%, rgba(90, 28, 8, 0.45), transparent 70%),
    radial-gradient(ellipse 12% 9% at 84% 60%, rgba(90, 28, 8, 0.5), transparent 70%),
    radial-gradient(circle at 22% 28%, rgba(255, 220, 190, 0.25) 0 1.5%, transparent 2.5%),
    radial-gradient(circle at 74% 72%, rgba(255, 220, 190, 0.22) 0 2%, transparent 3%),
    linear-gradient(180deg, rgba(255, 246, 240, 0.85) 0 4%, rgba(255, 246, 240, 0.25) 8%, transparent 13% 91%, rgba(255, 246, 240, 0.6) 96%);
  --clouds: radial-gradient(ellipse 20% 4% at 30% 35%, rgba(255, 230, 210, 0.22), transparent 70%), radial-gradient(ellipse 16% 3% at 78% 70%, rgba(255, 230, 210, 0.18), transparent 70%); }
.planet[data-tool="chatgpt"] { /* ocean world: teal sea, green continents, white cloud swirls */
  --surface:
    radial-gradient(ellipse 11% 16% at 15% 42%, rgba(46, 120, 52, 0.85), transparent 70%),
    radial-gradient(ellipse 7% 10% at 28% 68%, rgba(70, 140, 60, 0.75), transparent 70%),
    radial-gradient(ellipse 14% 10% at 64% 34%, rgba(46, 120, 52, 0.8), transparent 70%),
    radial-gradient(ellipse 6% 12% at 84% 64%, rgba(160, 140, 80, 0.7), transparent 70%),
    linear-gradient(180deg, rgba(240, 250, 255, 0.85) 0 5%, transparent 11% 92%, rgba(240, 250, 255, 0.7) 97%);
  --clouds:
    radial-gradient(ellipse 18% 4% at 20% 30%, rgba(255, 255, 255, 0.6), transparent 70%),
    radial-gradient(ellipse 22% 5% at 58% 58%, rgba(255, 255, 255, 0.5), transparent 70%),
    radial-gradient(ellipse 12% 3% at 86% 40%, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(ellipse 15% 4% at 40% 80%, rgba(255, 255, 255, 0.4), transparent 70%); }
.planet[data-tool="gemini"] { /* violet gas giant with soft bands (and its ring) */
  --surface:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0 8%, rgba(60, 20, 120, 0.22) 8% 14%, rgba(255, 255, 255, 0.08) 14% 22%,
      rgba(90, 40, 160, 0.3) 22% 27%, rgba(255, 255, 255, 0.14) 27% 38%, rgba(60, 20, 120, 0.2) 38% 46%, rgba(255, 220, 255, 0.16) 46% 55%,
      rgba(90, 40, 160, 0.3) 55% 61%, rgba(255, 255, 255, 0.1) 61% 72%, rgba(60, 20, 120, 0.26) 72% 80%, rgba(255, 255, 255, 0.16) 80% 100%); }
.planet[data-tool="notebooklm"] { /* icy moon-like world: craters with bright rims, faint cracks */
  --surface:
    radial-gradient(circle at 16% 36%, rgba(30, 40, 60, 0.38) 0 4%, rgba(255, 255, 255, 0.28) 5%, transparent 7%),
    radial-gradient(circle at 34% 66%, rgba(30, 40, 60, 0.32) 0 6%, rgba(255, 255, 255, 0.24) 7%, transparent 9%),
    radial-gradient(circle at 61% 27%, rgba(30, 40, 60, 0.34) 0 3%, rgba(255, 255, 255, 0.22) 4%, transparent 6%),
    radial-gradient(circle at 79% 60%, rgba(30, 40, 60, 0.3) 0 5%, rgba(255, 255, 255, 0.22) 6%, transparent 8%),
    radial-gradient(circle at 47% 82%, rgba(30, 40, 60, 0.28) 0 2.5%, transparent 3.5%),
    repeating-linear-gradient(115deg, transparent 0 11%, rgba(120, 170, 230, 0.18) 11.3% 11.8%, transparent 12.1% 23%),
    radial-gradient(ellipse 16% 12% at 50% 46%, rgba(40, 60, 90, 0.2), transparent 70%); }
.planet[data-tool="anki"] { /* blue ice giant: banded, with a dark storm */
  --surface:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0 10%, rgba(0, 30, 100, 0.2) 10% 18%, rgba(255, 255, 255, 0.06) 18% 30%,
      rgba(0, 30, 100, 0.24) 30% 36%, rgba(180, 220, 255, 0.14) 36% 52%, rgba(0, 30, 100, 0.18) 52% 60%, rgba(255, 255, 255, 0.08) 60% 74%,
      rgba(0, 30, 100, 0.26) 74% 82%, rgba(255, 255, 255, 0.12) 82% 100%),
    radial-gradient(ellipse 9% 5.5% at 70% 62%, rgba(0, 10, 60, 0.7), rgba(120, 170, 255, 0.25) 75%, transparent 85%);
  --clouds: radial-gradient(ellipse 14% 2% at 26% 33%, rgba(255, 255, 255, 0.45), transparent 70%), radial-gradient(ellipse 10% 2% at 64% 55%, rgba(255, 255, 255, 0.4), transparent 70%); }
.planet[data-tool="sme"] { /* rose gas giant: bands and a great red spot */
  --surface:
    linear-gradient(180deg, rgba(255, 235, 225, 0.24) 0 7%, rgba(120, 20, 40, 0.24) 7% 13%, rgba(255, 235, 225, 0.1) 13% 24%,
      rgba(140, 30, 50, 0.32) 24% 30%, rgba(255, 235, 225, 0.16) 30% 47%, rgba(120, 20, 40, 0.2) 47% 55%, rgba(255, 235, 225, 0.1) 55% 70%,
      rgba(140, 30, 50, 0.3) 70% 77%, rgba(255, 235, 225, 0.18) 77% 100%),
    radial-gradient(ellipse 9% 6% at 30% 64%, rgba(150, 20, 30, 0.8), rgba(255, 170, 160, 0.3) 70%, transparent 82%); }

/* Saturn-style ring: the back half passes behind the planet, the front half in front */
.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-16deg) rotateX(74deg);
  background: radial-gradient(circle, transparent 47%, rgba(230, 215, 255, 0.55) 49%, rgba(190, 160, 255, 0.3) 55%, rgba(230, 215, 255, 0.5) 58%, rgba(170, 140, 240, 0.18) 64%, transparent 67%);
}
.ring-back { z-index: 0; clip-path: inset(0 0 50% 0); }
.ring-front { z-index: 2; clip-path: inset(50% 0 0 0); }
/* A tiny moonlet circling each planet */
.planet-body::after {
  content: "";
  position: absolute;
  inset: -16%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 4%, rgba(255, 255, 255, 0.9) 0 2.5px, transparent 3.5px);
  animation: spin var(--spin, 9s) linear infinite;
  pointer-events: none;
}
.planet:hover .planet-label { text-shadow: 0 0 12px var(--c1); }
.planet.is-hit .planet-body { animation: planetHit 0.7s ease-out; }
.planet-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
kbd {
  font-family: inherit;
  font-size: 0.64rem;
  font-weight: 500;
  padding: 0 0.32rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}
.planet:hover { filter: brightness(calc(var(--bright, 1) + 0.15)); }
.planet:hover .planet-body { transform: scale(1.08); }
.planet.is-hover .planet-body {
  transform: scale(1.14);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 55%, transparent), 0 0 34px var(--c1), 0 14px 30px -10px rgba(0, 0, 0, 0.6);
}
.is-dragging .planet:not(.is-hover) .planet-body { animation: planetPulse 1.3s ease-in-out infinite; }

/* Moons (subjects) */
.moon {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--moon-size, 2.6%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  scale: var(--depth, 1);
  filter: brightness(var(--bright, 1));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: var(--z, 1);
  animation: bobSmall 5s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.moon-body {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* A small rocky world in the subject's colour: lit side, night side, a few craters, a soft halo. */
  background:
    radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), rgba(255, 255, 255, 0.55) 0, transparent 28%),
    radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), transparent 34%, rgba(0, 0, 12, 0.5) 72%, rgba(0, 0, 12, 0.8) 100%),
    radial-gradient(circle at 30% 62%, rgba(0, 0, 0, 0.22) 0 9%, rgba(255, 255, 255, 0.18) 11%, transparent 14%),
    radial-gradient(circle at 66% 38%, rgba(0, 0, 0, 0.2) 0 7%, rgba(255, 255, 255, 0.16) 9%, transparent 12%),
    radial-gradient(circle at 58% 74%, rgba(0, 0, 0, 0.18) 0 5%, transparent 8%),
    var(--noise),
    radial-gradient(circle, color-mix(in srgb, var(--mc) 65%, white), var(--mc) 70%, color-mix(in srgb, var(--mc) 70%, black));
  background-size: auto, auto, auto, auto, auto, 30px 30px, auto;
  box-shadow: 0 0 12px -2px var(--mc), 0 0 0 1px color-mix(in srgb, var(--mc) 35%, transparent);
  transition: transform 0.15s, box-shadow 0.15s;
}
.moon-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  font-size: var(--moon-label, 0.72rem);
  color: var(--muted);
  white-space: nowrap;
}
.moon:hover .moon-body { transform: scale(1.2); }
.moon.is-active .moon-body { transform: scale(1.4); box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--mc), 0 0 18px var(--mc); }
.moon.is-active .moon-label { color: var(--text); font-weight: 600; margin-top: 9px; }

.stage-hint { margin: 0; text-align: center; color: var(--muted); font-size: 0.86rem; min-height: 1.3em; }
.stage-hint b { color: var(--text); }

/* Tray */
.tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.tray-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.tray-empty { margin: 0; color: var(--muted); font-size: 0.88rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 5px 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 0.85rem;
  cursor: grab;
  user-select: none;
}
.chip:active { cursor: grabbing; }
.chip.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.chip-kind {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.chip-dots { display: flex; gap: 3px; }
.chip-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip-x {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.chip-x:hover { background: var(--border); color: var(--text); }

/* ---------- Side panels ---------- */
.side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 0; }
.subject-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; }

.tabs, .seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--field);
  margin-bottom: 14px;
}
.tabs button, .seg button {
  flex: 1;
  padding: 0.42rem 0.5rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"], .seg button.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.seg { margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat { padding: 10px 12px; border-radius: 11px; background: var(--field); min-width: 0; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-size: 0.74rem; color: var(--muted); }

.weak-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.weak-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.weak-item:hover { background: var(--field); }
.weak-name { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; font-weight: 600; }
.weak-name small { font-weight: 400; font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.meter { grid-column: 2; height: 6px; border-radius: 99px; background: var(--field); overflow: hidden; }
.weak-item:hover .meter { background: var(--border); }
.meter i { display: block; height: 100%; width: var(--w); border-radius: 99px; background: linear-gradient(90deg, var(--accent), #ff6b6b); }

.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--field); }
.file-kind {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.file-meta { flex: 1; min-width: 0; }
.file-meta strong { display: block; font-size: 0.86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { font-size: 0.74rem; color: var(--muted); }
.path { font-family: ui-monospace, Consolas, monospace; font-size: 0.74rem; }
.empty { margin: 0; padding: 16px; text-align: center; color: var(--muted); font-size: 0.86rem; border: 1px dashed var(--border); border-radius: 10px; }

.exams { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.exams li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--field); }
.days { min-width: 52px; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1.1; color: var(--accent); }
.days small { display: block; font-family: var(--font); font-size: 0.62rem; font-weight: 500; color: var(--muted); }
.exam-meta { flex: 1; min-width: 0; }
.exam-meta strong { display: block; font-size: 0.88rem; }
.exam-meta span { font-size: 0.74rem; color: var(--muted); }
.tag { font-size: 0.64rem; padding: 0.08rem 0.4rem; border-radius: 5px; border: 1px dashed var(--border); color: var(--muted); margin-left: 6px; font-weight: 500; vertical-align: 1px; }
.exams li { border-left: 3px solid var(--mc); }
.exam-meta > span { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.type-tag { font-size: 0.64rem; font-weight: 600; padding: 0.08rem 0.4rem; border-radius: 5px; background: color-mix(in srgb, var(--mc, var(--accent)) 22%, transparent); color: var(--text); }
.type-tag.gcse { background: color-mix(in srgb, #ff6b6b 24%, transparent); }
.exams .tag { margin-left: 0; }
.exam-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.exam-form .btn { grid-column: 1 / -1; }

/* Spec chip + My GCSEs */
.spec-chip {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.spec-chip:hover { color: var(--text); border-color: var(--accent); }
.gcse-list { display: flex; flex-direction: column; gap: 8px; }
.gcse-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--field);
  border-left: 3px solid var(--mc);
}
@media (min-width: 641px) {
  .gcse-row.has-alt { grid-template-columns: minmax(150px, 1.3fr) repeat(6, minmax(0, 1fr)); } /* Geography A/B: one more column */
}
.gcse-name { display: flex; flex-direction: column; align-self: center; min-width: 0; }
.gcse-name i { display: none; }
.gcse-name strong { font-size: 0.92rem; }
.gcse-name small { font-size: 0.74rem; color: var(--muted); }
.gcse-row select { padding: 0.4rem 0.5rem; background: var(--panel); }
.no-tier { padding: 0.45rem 0; color: var(--muted); font-size: 0.82rem; }
.gcse-options { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.gcse-options .opt-title { grid-column: 1 / -1; margin: 0; font-size: 0.78rem; color: var(--muted); }
.warn { grid-column: 1 / -1; margin: 0; font-size: 0.78rem; color: #ff8a8a; }

/* Build a test */
.block-label { margin: 16px 0 8px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.quick-add { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--text);
  font-size: 0.83rem;
  cursor: pointer;
}
.topic-chip small { font-size: 0.68rem; color: var(--muted); }
.topic-chip:hover { border-color: var(--accent); }
.topic-chip.is-on { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.topic-chip.is-on small { color: color-mix(in srgb, var(--on-accent) 70%, transparent); }
.quick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

/* Ideas */
.ideas { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.idea { padding: 12px; border-radius: 12px; background: var(--field); border-left: 3px solid var(--accent); }
.idea-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.idea-head strong { font-size: 0.9rem; }
.idea p { margin: 5px 0 0; font-size: 0.85rem; }
.idea .link { margin-top: 6px; font-size: 0.8rem; }
.my-ideas { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.my-ideas li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 6px 8px 12px; border-radius: 10px; background: var(--field); font-size: 0.86rem; }
.my-ideas li span { flex: 1; }
.panel .empty { margin-top: 10px; }

/* NotebookLM */
.nb-top { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; align-items: start; }
.nb-top .seg { margin: 0; }
.sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sources li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--field); }
.sources li > div { flex: 1; min-width: 0; }
.sources strong { display: block; font-size: 0.88rem; }
.sources span:not(.src-kind) { font-size: 0.76rem; color: var(--muted); }
.src-kind {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.58rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--tool) 25%, transparent);
}
#nbPrompt { font-size: 0.88rem; line-height: 1.5; }

/* Timetable */
.tt-day-label { margin: 10px 0 4px; font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.tt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
  border-radius: 10px;
  background: var(--field);
  border-left: 3px solid var(--mc);
}
.tt-row + .tt-row { margin-top: 6px; }
.tt-row.is-exam { background: color-mix(in srgb, var(--mc) 16%, var(--field)); }
.tt-time { flex: none; width: 42px; font-family: var(--font-display); font-weight: 600; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.tt-what { flex: 1; min-width: 0; }
.tt-what strong { display: block; font-size: 0.86rem; }
.tt-what span { font-size: 0.76rem; color: var(--muted); }
.tt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.exam-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.exam-chips li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--field); font-size: 0.82rem; }
.exam-chips i { width: 9px; height: 9px; border-radius: 50%; background: var(--mc); }
.exam-chips span:not(.type-tag) { color: var(--muted); }
.tt-summary { margin: 0 0 10px; }
.share { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.share li { display: grid; grid-template-columns: 140px 1fr 64px; align-items: center; gap: 10px; font-size: 0.82rem; }
.share li span:last-child { text-align: right; color: var(--muted); }
.share-bar { height: 8px; border-radius: 99px; background: var(--field); overflow: hidden; }
.share-bar i { display: block; height: 100%; border-radius: 99px; background: var(--mc); }
.tt-days { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.tt-day h4 { margin: 0 0 6px; font-size: 0.85rem; }
#ttBody .btn-row .btn { flex: 1; }

.timer-face { font-family: var(--font-display); font-size: 3rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.timer-bar { height: 6px; border-radius: 99px; background: var(--field); overflow: hidden; margin: 4px 0 14px; }
.timer-bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); transition: width 0.25s linear; }
.timer-controls { display: flex; justify-content: center; gap: 8px; }
.timer-controls .btn { min-width: 90px; }

/* ---------- Sheet (dialog) ---------- */
.sheet {
  width: min(640px, calc(100vw - 32px));
  max-height: min(88vh, 920px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  --tool: var(--accent);
}
.sheet.is-wide { width: min(840px, calc(100vw - 32px)); }
.sheet::backdrop { background: rgba(5, 7, 15, 0.6); backdrop-filter: blur(3px); }
.sheet[open] { display: flex; flex-direction: column; overflow: hidden; animation: sheetIn 0.18s ease-out; }
.sheet-inner { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 4px 0 var(--tool);
}
.sheet-titles { flex: 1; min-width: 0; }
.sheet-title { font-family: var(--font-display); font-size: 1.12rem; margin: 0; }
.sheet-sub { margin: 3px 0 0; color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.sheet-body { padding: 18px 20px 22px; overflow: auto; }
.sheet-label { margin: 16px 0 8px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.sheet-body > :first-child { margin-top: 0; }
.sheet .btn-primary { background: var(--tool); color: var(--on-tool, #fff); }
.sheet .btn:hover { border-color: color-mix(in srgb, var(--tool) 60%, var(--border)); }

.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.action {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
}
.action strong { font-size: 0.92rem; }
.action span { font-size: 0.78rem; color: var(--muted); }
.action:hover { border-color: var(--tool); background: color-mix(in srgb, var(--tool) 10%, var(--panel-2)); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-row.end { justify-content: flex-end; }
.fine { margin: 12px 0 0; font-size: 0.78rem; color: var(--muted); }
.note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--field); font-size: 0.82rem; color: var(--muted); }
.note b { color: var(--text); }

.doc {
  padding: 4px 18px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--field);
  font-size: 0.92rem;
  max-height: 48vh;
  overflow: auto;
}
.doc h3 { font-family: var(--font-display); font-size: 1.15rem; margin: 14px 0 6px; }
.doc h4 { font-size: 0.98rem; margin: 16px 0 6px; }
.doc h5 { font-size: 0.9rem; margin: 14px 0 4px; }
.doc p { margin: 8px 0; }
.doc ul, .doc ol { margin: 6px 0; padding-left: 1.3rem; }
.doc li { margin: 3px 0; }
.doc blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--tool);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--tool) 9%, transparent);
  color: var(--muted);
  font-size: 0.84rem;
}
.doc code { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; }

.card-list { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow: auto; }
.card-item { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--field); font-size: 0.88rem; }
.card-item b { display: block; margin-bottom: 2px; font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

.steps { list-style: none; counter-reset: step; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
/* Block, not grid: a step with links or <code> in it would otherwise split into grid cells. */
.steps li { counter-increment: step; position: relative; padding-left: 38px; min-height: 26px; font-size: 0.9rem; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tool) 25%, transparent);
  font-size: 0.8rem;
  font-weight: 700;
}

.checklist { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.checklist li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--field); font-size: 0.86rem; font-weight: 500; }

.form-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 12px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.paper-head h3 { font-family: var(--font-display); margin: 0; font-size: 1.1rem; }
.paper-head p { margin: 3px 0 0; }
.paper { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 16px; }
.q { display: flex; justify-content: space-between; gap: 12px; }
.q p { margin: 0; }
.marks { font-weight: 700; color: var(--muted); white-space: nowrap; }
.q-topic { margin: 2px 0 6px; font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.scheme { margin-top: 16px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); }
.scheme summary { cursor: pointer; font-weight: 600; }
.scheme ol { padding-left: 1.3rem; font-size: 0.88rem; }
.scheme ul { padding-left: 1.1rem; color: var(--muted); }

.score { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 12px; background: var(--field); margin-bottom: 12px; }
.score-num { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--tool); }
.score p { margin: 0; }
.feedback { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.feedback li { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 0.88rem; }
.fb-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 3px; }

.loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 10px; color: var(--muted); font-size: 0.9rem; text-align: center; }
.loading.sm { padding: 18px 10px; }
.loading p { margin: 0; }
.orbit-spinner {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px dashed color-mix(in srgb, var(--tool, var(--accent)) 55%, transparent);
  animation: spin 2.2s linear infinite;
}
.orbit-spinner::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--tool, var(--accent));
  box-shadow: 0 0 10px var(--tool, var(--accent));
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sunPulse { 50% { transform: translate(-50%, -50%) scale(1.1); } }
@keyframes sunBreath {
  50% { box-shadow: 0 0 60px rgba(255, 170, 40, 0.65), 0 0 130px rgba(255, 120, 30, 0.3); }
}
@keyframes coronaSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes orbitSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes planetTurn { to { background-position: -200% 0, -60px 0; } }
@keyframes sunBoil { to { background-position: 70px 70px, -110px 110px; } }
@keyframes beamFlow { to { stroke-dashoffset: -2.5; } }
@keyframes bob { 50% { translate: 0 -7px; } }
@keyframes bobSmall { 50% { translate: 0 -3px; } }
@keyframes planetHit {
  0% { box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.28), 0 0 0 0 var(--c1); transform: scale(1.18); }
  100% { box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.28), 0 0 0 26px transparent; transform: scale(1); }
}
@keyframes planetPulse { 50% { transform: scale(1.06); } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

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

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
  /* Tabs drop to their own row under the brand */
  .topbar { grid-template-columns: 1fr auto; row-gap: 10px; }
  .tabbar { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; }
  .stats.stats-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; grid-template-columns: 1fr auto; }
  .badge { display: none; }
  main { padding: 0 16px 96px; }
  .layout { gap: 16px; }
  /* Tabs move to a bar along the bottom of the screen */
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    justify-content: space-around;
    gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .tabbar a { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 0.66rem; flex: 1; justify-content: center; }
  .tabbar a span { display: block; }
  .tabbar a.is-active { box-shadow: none; background: none; }
  .page-head h1 { font-size: 1.3rem; }
  .lib-filters { grid-template-columns: 1fr 1fr; }
  .lib-filters input { grid-column: 1 / -1; }
  .stats.stats-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prog-grid { grid-template-columns: 1fr; }
  .setting-row { flex-direction: column; align-items: stretch; }
  .cal-day { min-height: 54px; padding: 4px; }
  .cal-exam { font-size: 0; padding: 0; height: 5px; }
  .cal-min { display: none; }
  .cal-label { min-width: 0; }
  .stats.stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .why li { grid-template-columns: 110px 1fr 40px; }
  .why-tags { padding-left: 0; }
  .toasts { bottom: 84px; }
  .stage { padding: 16px; }
  .stage-actions { width: 100%; }
  .stage-actions .btn { flex: 1; }

  .system {
    aspect-ratio: auto;
    width: 100%;
    margin: 16px 0 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 8px;
  }
  .orbit, .corona, .beams, .zoom-controls, .view-hint { display: none; }
  .planet, .moon { scale: none; filter: none; }
  .system { transform: none; }
  .viewport { margin: 0; padding: 0; overflow: visible; cursor: auto; touch-action: auto; }
  .sun { position: relative; left: auto; top: auto; transform: none; grid-column: 1 / -1; justify-self: center; width: 140px; margin: 10px 0 8px; }
  .sun:hover, .sun.is-hover { transform: scale(1.05); }
  .sun.is-pulse { animation: none; }
  .planet { position: relative; left: auto; top: auto; transform: none; justify-self: center; width: 62px; margin-bottom: 24px; }
  .planet-label { font-size: 0.76rem; }
  .planet-label kbd { display: none; }
  .moons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .moon {
    position: static;
    transform: none;
    width: auto;
    aspect-ratio: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-2);
  }
  .moon-body { width: 11px; height: 11px; }
  .moon-label { position: static; transform: none; margin: 0; color: var(--text); }
  .moon:hover .moon-body { transform: none; }
  .moon.is-active { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 16%, var(--panel-2)); }
  .moon.is-active .moon-body { transform: none; box-shadow: 0 0 8px var(--mc); }
  .moon.is-active .moon-label { margin: 0; }

  .chip-name { max-width: 160px; }
  .gcse-row { grid-template-columns: 1fr 1fr; }
  .gcse-name { grid-column: 1 / -1; }
  .nb-top { grid-template-columns: 1fr; }
  .tt-grid { grid-template-columns: 1fr 1fr; }
  .tt-grid > span { display: none; }
  .share li { grid-template-columns: 100px 1fr 52px; }
  .topbar-actions { flex-wrap: wrap; }
  .card-item { grid-template-columns: 1fr; gap: 6px; }
  .sheet-head { flex-wrap: wrap; }
  .sheet-titles { flex-basis: calc(100% - 46px); }
  .sheet-head .btn-sm { order: 3; }
}

/* ---------- Claude (Settings → AI) ---------- */
.claude-body { margin: 12px 0 4px; }
.claude-body .field { margin-bottom: 4px; }
.cap-field { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.cap-field input { width: 5.5em; }
.spend { margin-top: 10px; }
.spend-bar { height: 8px; border-radius: 999px; background: var(--field); border: 1px solid var(--border); overflow: hidden; }
.spend-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.cost-line { margin: 8px 0 0; }

/* ---------- Official papers (Tests tab) ---------- */
.papers-card { margin-top: 18px; }
.spec-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.spec-row > div:first-child { flex: 1 1 320px; display: grid; gap: 2px; }
.spec-row span { color: var(--muted); font-size: 0.92rem; }
.spec-row .btn-row { margin: 0; }
.spec-points { margin: 10px 0 4px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; background: var(--panel-2); }
.spec-points summary { cursor: pointer; font-weight: 600; }
.spec-topic h4 { margin: 12px 0 4px; font-size: 0.98rem; }
.spec-topic ul { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.spec-topic ul.extras { color: var(--muted); }
.paper-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.paper-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.paper-list .btn-row { margin: 0; }
.older-papers { margin-top: 10px; }
.older-papers summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }

/* ---------- Exam-style papers ---------- */
.exam-paper { display: grid; gap: 14px; margin-top: 10px; }
.exam-q { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--panel-2); }
.exam-q-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.exam-q-row .q-num { font-weight: 700; min-width: 2.6em; }
.exam-q-row .q-text p { margin: 0 0 6px; }
.exam-q-row .marks { font-weight: 700; white-space: nowrap; }
.exam-q textarea { width: 100%; margin-top: 6px; }
.exam-q .q-topic { margin: 2px 0 0; }
.stimulus { border-left: 3px solid var(--accent); background: var(--field); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.stimulus p { margin: 0 0 6px; }
.q-diagram { margin: 0 0 10px; background: #fff; border-radius: 10px; padding: 10px; text-align: center; }
.q-diagram svg { max-width: 100%; height: auto; max-height: 300px; color: #111; }
.q-diagram figcaption { color: #111; font-weight: 700; font-size: 0.85rem; margin-top: 4px; }
.md-table { overflow-x: auto; margin: 6px 0; }
.md-table table { border-collapse: collapse; font-size: 0.92rem; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.md-table th { background: var(--field); }
.doc hr, .stimulus hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.pdf-scheme { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--muted); }
.paper-head .btn-row { margin: 0; }

/* What Claude found in a file (NotebookLM / Save My Exams sheets) */
.file-info { border: 1px solid var(--border); background: var(--panel-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.file-info p { margin: 0 0 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag.muted-tag { opacity: 0.7; }

/* ---------- Tests tab ---------- */
.tests-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: stretch; }
.anki-strip { display: flex; align-items: center; gap: 18px; padding: 12px 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--border); }
.anki-strip > div { display: grid; min-width: 0; }
.anki-strip b { font-size: 1.15rem; font-family: var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anki-strip span { font-size: 0.76rem; color: var(--muted); }
.anki-strip .anki-weakest { flex: 1; }
.anki-strip-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #93ccff, #2a78d6); color: #fff; flex: none; }
.anki-strip-icon svg { width: 20px; height: 20px; }
.anki-strip.is-off b { font-size: 0.95rem; }
.step-head { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px; }
.step-head h3 { margin: 0; font-size: 0.98rem; }
.step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 0.78rem; flex: none; }
.chip-group-label { flex-basis: 100%; margin: 8px 0 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
#lengthSeg button { display: grid; gap: 1px; line-height: 1.2; padding-top: 8px; padding-bottom: 8px; }
#lengthSeg small { font-size: 0.68rem; color: var(--muted); font-weight: 500; }
.build-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-lg { padding: 13px 16px; font-size: 0.95rem; justify-content: center; }
.result-ways { display: grid; gap: 10px; }
.result-ways > div { display: grid; gap: 3px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.result-ways b { font-size: 0.92rem; }
.result-ways span { font-size: 0.84rem; color: var(--muted); }
.result-stats { margin-bottom: 4px; }
.result-stats small { font-size: 0.7rem; margin-left: 6px; font-family: var(--font); }
.result-stats small.up { color: #4fd18b; }
.result-stats small.down { color: #ff7b7b; }
@media (min-width: 1100px) {
  .paper-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1080px) {
  .tests-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .build-row { grid-template-columns: 1fr; }
}
.timer-custom { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--field); }
.timer-custom .field { width: 110px; margin: 0; }
.timer-custom .check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; padding-bottom: 8px; }
.timer-custom[hidden] { display: none; }

/* ---------- My resources (Library) ---------- */
.res-filters { grid-template-columns: minmax(0, 1fr) 200px; }
.res-filters .chip-row { grid-column: 1 / -1; }
.res-filters .topic-chip { padding: 4px 10px; }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.res-list.compact { grid-template-columns: 1fr; margin-bottom: 6px; }
.res-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); border-left: 3px solid var(--mc); background: var(--panel-2); min-width: 0; }
.res-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.res-title { all: unset; cursor: pointer; font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.res-title:hover { text-decoration: underline; text-underline-offset: 2px; color: var(--accent); }
.res-title:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.res-sub { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.res-sub .dot { width: 8px; height: 8px; }
.res-tags { gap: 4px; }
.res-tags .tag { font-size: 0.7rem; padding: 1px 7px; margin: 0; }
.res-tags .tag.type { background: color-mix(in srgb, var(--mc) 20%, transparent); border-color: color-mix(in srgb, var(--mc) 50%, transparent); }
.res-actions { display: flex; gap: 4px; flex: none; }
.res-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; }
.res-form .span-2 { grid-column: 1 / -1; }
.res-form .fine { margin: -4px 0 0; }
.res-empty { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .res-filters { grid-template-columns: 1fr; }
  .res-form { grid-template-columns: 1fr; }
  .res-empty { grid-template-columns: 1fr; }
}
.btn-danger { color: #ff8a8a; border-color: color-mix(in srgb, #ff7b7b 45%, var(--border)); }
.btn-danger:hover { background: color-mix(in srgb, #ff7b7b 16%, transparent); }
.files [data-delete]:hover { color: #ff8a8a; }

/* ---------- My weak topics (timetable) ---------- */
.weak-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.weak-row-label { font-weight: 600; font-size: 0.9rem; }
.weak-row .chip-row { flex: 1; }
.weak-row .tag { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.weak-row .tag .dot { width: 8px; height: 8px; }
.weak-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.weak-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.weak-subject { border: 1px solid var(--border); border-left: 3px solid var(--mc); border-radius: 12px; padding: 10px 12px; background: var(--panel-2); }
.weak-subject-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 0.9rem; }
.weak-subject-head .muted { font-size: 0.78rem; }
.weak-quick { display: inline-flex; gap: 10px; font-size: 0.8rem; }
.weak-subject .topic-chips { gap: 6px; }
.weak-subject .topic-chip { font-size: 0.8rem; padding: 4px 10px; }
.weak-ask { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 0.88rem; }
/* "Check your priorities" before planning */
.prio-explain { padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); margin-bottom: 14px; font-size: 0.9rem; line-height: 1.5; }
.prio-explain p { margin: 0; }
.prio-explain p + p { margin-top: 6px; font-size: 0.85rem; }
.prio-list { display: grid; gap: 6px; }
.prio-row { display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(90px, 1fr) minmax(240px, 1.4fr); align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; border-left: 3px solid var(--mc); background: var(--field); }
.prio-name { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; min-width: 0; }
.prio-name .dot { background: var(--mc); }
.prio-share { position: relative; height: 18px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.prio-share i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--mc) 55%, transparent); border-radius: 9px; transition: width 0.3s ease; }
.prio-share small { position: relative; display: block; padding-left: 8px; line-height: 18px; font-size: 0.72rem; font-weight: 600; }
.prio-row .prio-seg { margin: 0; }
.prio-row .prio-seg button { padding: 0.32rem 0.4rem; font-size: 0.8rem; }
@media (max-width: 640px) {
  .prio-row { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .prio-share { grid-column: 2; grid-row: 1; width: 90px; }
  .prio-row .prio-seg { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .prio-share i { transition: none; } }
@media (max-width: 760px) {
  .weak-subjects { grid-template-columns: 1fr; }
}
.download-choices { display: grid; gap: 10px; }
.download-choice { all: unset; cursor: pointer; display: grid; gap: 3px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); }
.download-choice:hover, .download-choice:focus-visible { border-color: var(--accent); }
.download-choice span { font-size: 0.84rem; color: var(--muted); }
.rebuild-note { margin-top: 0; }
.rebuild-note .btn-row { margin: 8px 0 0; }
.login-sent { margin: 0 0 4px; font-size: 0.9rem; color: var(--muted); }
.login-sent b { color: var(--text); }
#loginCode { font-size: 1.4rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.login-links { margin: 6px 0 0; text-align: center; }

/* ---------- Sign-up (invite-only beta) ---------- */
.login { overflow-y: auto; }
#signupForm { width: min(440px, 100%); }
#signupForm .field small { color: var(--muted); font-size: 0.74rem; margin-bottom: 2px; }
#signupStep1 { display: grid; gap: 12px; }
#suCode { font-size: 1.4rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
#suInvite { text-transform: uppercase; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.su-agree { align-items: flex-start; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.su-agree a { color: var(--text); }
.login-switch { text-align: center; font-size: 0.86rem; color: var(--muted); }

/* ---------- First-run setup ---------- */
.onboard, .world {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px;
  overflow-y: auto; overscroll-behavior: contain; /* still reachable if a phone is zoomed in */
  background: radial-gradient(900px 500px at 20% 0%, var(--glow-1), transparent 60%),
    radial-gradient(700px 400px at 100% 30%, var(--glow-2), transparent 60%), var(--bg);
}
.onboard-stars { position: absolute; inset: 0; pointer-events: none; opacity: var(--star-opacity);
  background-image: radial-gradient(1px 1px at 12% 20%, var(--star), transparent), radial-gradient(1px 1px at 72% 12%, var(--star), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, var(--star), transparent), radial-gradient(1px 1px at 88% 60%, var(--star), transparent),
    radial-gradient(1px 1px at 25% 55%, var(--star), transparent), radial-gradient(1.5px 1.5px at 60% 35%, var(--star), transparent),
    radial-gradient(1px 1px at 8% 85%, var(--star), transparent), radial-gradient(1px 1px at 93% 25%, var(--star), transparent),
    radial-gradient(1px 1px at 52% 8%, var(--star), transparent), radial-gradient(1px 1px at 33% 30%, var(--star), transparent); }
.onboard { place-items: start center; } /* the card centres itself (margin auto) so a tall one still scrolls to its top */
.onboard-card { margin-block: auto; }
.onboard-card { position: relative; width: min(780px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px 28px 22px; display: flex; flex-direction: column; gap: 14px; }
.onboard-card h1 { font-family: var(--font-display); font-size: clamp(1.4rem, 3.4vw, 1.9rem); margin: 0; outline: none; }
.onboard-card .lead { color: var(--muted); margin: 6px 0 0; max-width: 60ch; }
.onboard-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; }
.onboard-steps li { flex: 1; height: 5px; border-radius: 3px; background: var(--border); }
.onboard-steps li span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.onboard-steps li.is-done, .onboard-steps li.is-now { background: var(--accent); }
.onboard-steps li.is-now { opacity: 0.6; }
.onboard-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.onboard-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.onboard-nav .btn { min-width: 120px; }
.ob-group { margin-top: 14px; }
.ob-group .block-label { margin: 0 0 8px; }
.ob-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer; }
.ob-chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--mc); box-shadow: 0 0 8px var(--mc); opacity: 0.5; }
.ob-chip:hover { border-color: var(--mc); }
.ob-chip.is-on { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 20%, var(--panel)); font-weight: 600; }
.ob-chip.is-on i { opacity: 1; }
.ob-details { display: grid; gap: 10px; margin-top: 14px; }
.ob-row { display: grid; grid-template-columns: minmax(150px, 1.3fr) repeat(auto-fit, minmax(96px, 1fr)); gap: 8px 10px; align-items: end; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--mc); border-radius: 12px; background: var(--panel-2); }
.ob-row > strong { display: flex; align-items: center; gap: 8px; align-self: center; }
.ob-row > strong i { width: 10px; height: 10px; border-radius: 50%; background: var(--mc); }
.ob-options { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 10px; }
.ob-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.ob-tool { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; position: relative; }
.ob-tool > input { position: absolute; top: 12px; right: 12px; }
.ob-tool.is-on { border-color: var(--c2); background: color-mix(in srgb, var(--c2) 14%, var(--panel)); }
.ob-tool.is-soon { opacity: 0.55; cursor: default; }
.ob-tool > span:last-child { display: grid; gap: 3px; padding-right: 22px; }
.ob-tool > span:last-child > span { font-size: 0.82rem; color: var(--muted); }
.ob-planet { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--c1), var(--c2) 70%); box-shadow: inset -5px -5px 9px rgba(0, 0, 10, 0.45), 0 0 12px -2px var(--c2); }
.ob-anki { margin-top: 12px; }
.ob-anki code { font-size: 0.82rem; }
.ob-mocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.ob-mocks .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mc); }
@media (max-width: 640px) {
  .onboard-card { padding: 20px 16px 16px; max-height: calc(100vh - 16px); }
  .onboard, .world { padding: 8px; }
  .ob-row { grid-template-columns: 1fr 1fr; }
  .ob-row > strong { grid-column: 1 / -1; }
}

/* ---------- Building your world ---------- */
.world { grid-template-rows: auto auto auto; align-content: center; gap: 18px; text-align: center; transition: opacity 0.7s ease; }
.world.is-done { opacity: 0; pointer-events: none; }
.world-sys { position: relative; width: min(900px, 92vw); aspect-ratio: 11 / 5; }
.world-orbit { position: absolute; left: 50%; top: 50%; border: 1px solid var(--orbit); border-radius: 50%; transform: translate(-50%, -50%) scale(0.2); opacity: 0;
  animation: world-orbit 1s ease-out forwards; }
.world-orbit.o-in { width: 66%; height: 61%; animation-delay: 0.5s; }
.world-orbit.o-out { width: 91%; height: 84%; animation-delay: 0.7s; border-style: dashed; }
@keyframes world-orbit { to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.world-sun { position: absolute; left: 50%; top: 50%; width: 15%; aspect-ratio: 1; border-radius: 50%; z-index: 3; transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle at 46% 44%, #fffbe8, #ffe98a 16%, #ffc441 42%, #ff951f 70%, #c94512);
  box-shadow: 0 0 40px 10px rgba(255, 170, 50, 0.55), 0 0 120px 30px rgba(255, 130, 30, 0.25);
  animation: world-sun 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) 0.1s forwards; }
@keyframes world-sun { 60% { transform: translate(-50%, -50%) scale(1.15); } to { transform: translate(-50%, -50%) scale(1); } }
.world-planet, .world-moon { position: absolute; left: var(--x); top: var(--y); z-index: var(--z); border-radius: 50%; opacity: 0;
  transform: translate(-50%, -50%) translate(var(--fx, 0), -60vh) scale(0.3); animation: world-in 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.15) var(--at) forwards; }
.world-planet { width: calc(6.2% * var(--depth)); aspect-ratio: 1; background: radial-gradient(circle at 35% 30%, var(--c1), var(--c2) 70%);
  box-shadow: inset -6px -6px 12px rgba(0, 0, 10, 0.5), 0 0 18px -3px var(--c2); }
.world-moon { width: calc(2.6% * var(--depth)); aspect-ratio: 1; background: radial-gradient(circle at 35% 30%, #fff8, var(--mc) 55%); box-shadow: 0 0 12px var(--mc); }
.world-moon b { position: absolute; top: 120%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 0.72rem; font-weight: 600; color: var(--text); opacity: 0.85; }
@keyframes world-in { to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.world-title { font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 2.2rem); margin: 0; }
.world-line { margin: 0; color: var(--muted); min-height: 1.5em; }
.world.is-calm .world-orbit, .world.is-calm .world-sun, .world.is-calm .world-planet, .world.is-calm .world-moon { animation: none; opacity: 1; transform: translate(-50%, -50%); }
@media (prefers-reduced-motion: reduce) {
  .world-orbit, .world-sun, .world-planet, .world-moon { animation: none !important; opacity: 1 !important; transform: translate(-50%, -50%) !important; }
}
@media (max-width: 640px) { .world-moon b { font-size: 0.6rem; } }

/* ---------- Plans: locked features, allowance, account, owner panel ---------- */
.plus-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.02em;
  background: linear-gradient(135deg, #f2b94b, #e07a3f); color: #1a1205; vertical-align: 1px; }
.btn.is-locked { opacity: 0.85; }
.is-locked-row { cursor: pointer; opacity: 0.8; }
.locked-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 12px; margin: 10px 0; font-size: 0.88rem; }
.locked-row span { color: var(--muted); }
.locked-row b { color: var(--text); margin-right: 4px; }
.allowance { margin: 6px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--field); font-size: 0.88rem; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.plan-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--panel-2); display: grid; gap: 4px; align-content: start; }
.plan-card.is-current { border-color: var(--accent); }
.plan-card .price { font-family: var(--font-display); font-size: 1.15rem; }
.plan-card ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.82rem; color: var(--muted); display: grid; gap: 3px; }
.danger-fold { margin-top: 12px; }
.btn-danger { background: #c9384a; border-color: transparent; color: #fff; font-weight: 600; }
.btn-danger:hover { filter: brightness(1.1); border-color: transparent; }
.gcse-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-invite { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.admin-invite .field.grow { flex: 1 1 220px; }
.admin-invite .field input[type="number"] { width: 80px; }
.invite-out code { font-size: 1rem; letter-spacing: 0.08em; color: var(--text); }
.admin-invites { margin: 0; padding-left: 18px; font-size: 0.84rem; color: var(--muted); display: grid; gap: 3px; }
.admin-table { overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.76rem; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table select { font: inherit; font-size: 0.82rem; }

/* ---------- Guided tour ---------- */
.tour-btn { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.tour { position: fixed; inset: 0; z-index: 400; }
.tour-shade { position: absolute; inset: 0; } /* catches clicks so the page underneath stays put during the tour */
.tour.is-centred .tour-shade { background: rgba(4, 6, 16, 0.62); }
.tour-spot { position: fixed; pointer-events: none; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(4, 6, 16, 0.62), 0 0 0 2px var(--accent), 0 0 24px 2px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s; }
.tour-card { position: fixed; width: min(360px, calc(100vw - 24px)); padding: 16px 18px 14px; background: var(--panel); backdrop-filter: none; display: grid; gap: 8px; outline: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); transition: left 0.3s ease, top 0.3s ease, opacity 0.2s; }
.tour.is-moving .tour-card { opacity: 0; }
.tour-card h3 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }
.tour-count { margin: 0; font-size: 0.74rem; color: var(--accent); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tour-text p { margin: 0 0 6px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.tour-text b { color: var(--text); }
.tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tour-nav .push { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }

/* ================= Motion (every look) ================= */
.tabbar { position: relative; }
.tab-ink { position: absolute; left: 0; bottom: 2px; height: 2px; width: 0; border-radius: 2px; opacity: 0; pointer-events: none;
  background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: transform 0.38s cubic-bezier(.3, 1.3, .5, 1), width 0.38s cubic-bezier(.3, 1.3, .5, 1), opacity 0.2s; }
.tabbar a.is-active { box-shadow: inset 0 0 0 1px var(--border); }
.tabbar a { transition: background 0.2s, color 0.2s, transform 0.2s; }
.tabbar a:hover { transform: translateY(-1px); }
.tabbar a svg { transition: transform 0.3s cubic-bezier(.3, 1.5, .5, 1); }
.tabbar a:hover svg { transform: scale(1.15) rotate(-6deg); }

/* Pages slide in; their cards follow one after another */
.page:not([hidden]) { animation: pageIn 0.4s cubic-bezier(.2, .8, .2, 1); }
.page:not([hidden]) .card { animation: cardIn 0.5s cubic-bezier(.2, .8, .2, 1) both; }
.page:not([hidden]) .card:nth-of-type(2) { animation-delay: 0.05s; }
.page:not([hidden]) .card:nth-of-type(3) { animation-delay: 0.1s; }
.page:not([hidden]) .card:nth-of-type(4) { animation-delay: 0.15s; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(0.99); } }

/* Buttons lift, press down, and primary ones get a light sweep */
.btn, .icon-btn { transition: border-color 0.2s, background 0.2s, filter 0.2s, transform 0.18s, box-shadow 0.25s; position: relative; overflow: hidden; }
.btn:hover:not(:disabled), .icon-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn:active:not(:disabled), .icon-btn:active { transform: translateY(0) scale(0.97); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.6s; pointer-events: none; }
.btn-primary:hover::after { transform: translateX(120%); }

/* Fields: hover and focus glow; a changed setting flashes and shows a tick */
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="email"], select, textarea {
  transition: border-color 0.2s, box-shadow 0.25s, background 0.2s, transform 0.15s; }
select:hover, input:not([type="checkbox"]):not([type="radio"]):hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
select { cursor: pointer; }
.just-changed { position: relative; animation: changedGlow 0.9s ease-out; }
.just-changed select, .just-changed input { animation: changedPop 0.4s cubic-bezier(.3, 1.6, .5, 1); border-color: var(--accent); }
.field.just-changed::after { content: "✓ saved"; position: absolute; right: 2px; top: 0; font-size: 0.66rem; font-weight: 600; color: var(--accent); animation: savedTag 0.9s ease-out forwards; }
@keyframes changedGlow { 0% { filter: drop-shadow(0 0 0 transparent); } 30% { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 60%, transparent)); } }
@keyframes changedPop { 40% { transform: scale(1.04); } }
@keyframes savedTag { 0% { opacity: 0; transform: translateY(4px); } 20%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Rows, chips and cards respond to the pointer */
.gcse-row, .tt-row, .setting-row, .res-card, .paper-list li, .today-day, .exam-list li, .action, .picker-chip, .topic-chip, .ob-chip, .download-choice, .plan-card {
  transition: transform 0.2s cubic-bezier(.3, 1.3, .5, 1), box-shadow 0.25s, border-color 0.2s, background 0.2s; }
.gcse-row:hover { transform: translateX(3px); box-shadow: -3px 0 14px -6px var(--mc); }
.tt-row:hover, .paper-list li:hover { transform: translateX(3px); }
.action:hover, .download-choice:hover, .plan-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--tool, var(--accent)) 70%, transparent); }
.picker-chip:hover, .topic-chip:hover, .ob-chip:hover { transform: translateY(-2px); }
.picker-chip:active, .topic-chip:active, .ob-chip:active, .action:active { transform: scale(0.96); }
.today-day:hover { transform: translateY(-2px); }

/* Sheets open with a spring and their content fades up */
.sheet[open] { animation: sheetPop 0.32s cubic-bezier(.2, 1.2, .4, 1); }
.sheet::backdrop { animation: fadeIn 0.25s ease-out; }
.sheet-body > * { animation: cardIn 0.4s cubic-bezier(.2, .8, .2, 1) both; }
.sheet-body > :nth-child(2) { animation-delay: 0.04s; } .sheet-body > :nth-child(3) { animation-delay: 0.08s; } .sheet-body > :nth-child(n+4) { animation-delay: 0.12s; }
@keyframes sheetPop { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes fadeIn { from { opacity: 0; } }
.toast { animation: toastIn 0.35s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.95); } }

/* ================= AI at work ================= */
.ai-work { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 24px; align-items: center; padding: 18px 4px; }
.ai-page { position: relative; aspect-ratio: 0.78; border-radius: 10px; padding: 20px 16px; overflow: hidden; display: flex; flex-direction: column; gap: 9px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 90%, white 4%), var(--field)); border: 1px solid var(--border);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px color-mix(in srgb, var(--tool, var(--accent)) 15%, transparent); }
.ai-line { display: block; height: 7px; border-radius: 4px; width: 0; background: color-mix(in srgb, var(--text) 22%, transparent);
  animation: aiWrite 7.2s cubic-bezier(.4, 0, .2, 1) infinite; animation-delay: calc(var(--n) * 0.7s); }
.ai-line.is-head { height: 11px; background: color-mix(in srgb, var(--tool, var(--accent)) 70%, transparent); margin-bottom: 4px; }
@keyframes aiWrite { 0% { width: 0; opacity: 1; } 9% { width: var(--w); } 88% { width: var(--w); opacity: 1; } 100% { width: var(--w); opacity: 0; } }
.ai-scan { position: absolute; left: 0; right: 0; height: 40px; top: -40px; pointer-events: none;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--tool, var(--accent)) 30%, transparent) 70%, var(--tool, var(--accent)) 100%);
  opacity: 0.55; animation: aiScan 2.6s ease-in-out infinite; }
@keyframes aiScan { to { top: 100%; } }
.ai-spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 3px var(--tool, var(--accent));
  left: 16px; top: 20px; animation: aiSpark 7.2s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes aiSpark {
  0% { transform: translate(0, 0); } 9% { transform: translate(140px, 0); } 10% { transform: translate(0, 24px); } 19% { transform: translate(150px, 24px); }
  20% { transform: translate(0, 40px); } 29% { transform: translate(100px, 40px); } 30% { transform: translate(0, 56px); } 39% { transform: translate(150px, 56px); }
  40% { transform: translate(0, 72px); } 49% { transform: translate(110px, 72px); } 50% { transform: translate(0, 88px); } 59% { transform: translate(160px, 88px); }
  60% { transform: translate(0, 104px); } 69% { transform: translate(90px, 104px); } 70% { transform: translate(0, 120px); } 79% { transform: translate(130px, 120px); } 100% { transform: translate(130px, 120px); opacity: 0; } }
.ai-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 12px; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.ai-title small { flex-basis: 100%; padding-left: 34px; font-family: var(--font); font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.ai-orb { width: 22px; height: 22px; border-radius: 50%; flex: none; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff, var(--tool, var(--accent)) 55%, color-mix(in srgb, var(--tool, var(--accent)) 50%, black));
  box-shadow: 0 0 14px var(--tool, var(--accent)); animation: aiOrb 1.6s ease-in-out infinite; }
.ai-orb::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px dashed var(--tool, var(--accent)); animation: spin 3s linear infinite; }
@keyframes aiOrb { 50% { transform: scale(1.12); box-shadow: 0 0 22px var(--tool, var(--accent)); } }
.ai-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ai-steps li { position: relative; padding-left: 28px; font-size: 0.9rem; color: var(--muted); opacity: 0.45; transition: opacity 0.4s, color 0.4s; }
.ai-steps li::before { content: ""; position: absolute; left: 2px; top: 0.25em; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.ai-steps li.is-now { opacity: 1; color: var(--text); }
.ai-steps li.is-now::before { border-color: var(--tool, var(--accent)); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.ai-steps li.is-done { opacity: 0.85; color: var(--text); }
.ai-steps li.is-done::before { content: "✓"; display: grid; place-items: center; font-size: 0.6rem; font-weight: 700; color: var(--on-tool, #fff);
  background: var(--tool, var(--accent)); border-color: var(--tool, var(--accent)); animation: tickPop 0.35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tickPop { from { transform: scale(0.4); } }
.ai-time { margin: 14px 0 0; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .ai-work { grid-template-columns: 1fr; } .ai-page { width: 150px; margin: 0 auto; } }

/* ================= Mission control look ================= */
:root[data-style="scifi"] {
  --bg: #04060e; --glow-1: rgba(154, 123, 255, 0.16); --glow-2: rgba(94, 242, 255, 0.1);
  --panel: rgba(11, 16, 36, 0.8); --panel-2: rgba(16, 23, 52, 0.82); --field: rgba(4, 8, 22, 0.88);
  --border: rgba(110, 160, 255, 0.2); --orbit: rgba(120, 210, 255, 0.24); --text: #e8ecff; --muted: #8f99c6;
  --hud: #5ef2ff; --hud-2: #9a7bff; --laser: #5ef2ff; --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.8); --star: rgba(200, 230, 255, 0.8); --star-opacity: 1; color-scheme: dark;
}
:root[data-style="scifi"] body {
  background-color: var(--bg);
  background-image: radial-gradient(1000px 600px at 15% -10%, rgba(154, 123, 255, 0.18), transparent 60%),
    radial-gradient(800px 500px at 100% 20%, rgba(94, 242, 255, 0.1), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, rgba(255, 107, 179, 0.08), transparent 60%);
}
/* HUD grid and scanlines over the whole app */
:root[data-style="scifi"] body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(110, 160, 255, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(110, 160, 255, 0.07) 1px, transparent 1px);
  background-size: 56px 56px; -webkit-mask: radial-gradient(ellipse 90% 70% at 50% 20%, #000 30%, transparent 80%); mask: radial-gradient(ellipse 90% 70% at 50% 20%, #000 30%, transparent 80%); }
:root[data-style="scifi"] body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1000; opacity: 0.3;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px); }
:root[data-style="scifi"] .topbar, :root[data-style="scifi"] main { position: relative; z-index: 1; }

/* Cards: glass panels with cyan corner brackets */
:root[data-style="scifi"] .card {
  backdrop-filter: blur(10px);
  background:
    linear-gradient(var(--hud), var(--hud)) top 8px left 8px / 14px 1px no-repeat,
    linear-gradient(var(--hud), var(--hud)) top 8px left 8px / 1px 14px no-repeat,
    linear-gradient(var(--hud), var(--hud)) bottom 8px right 8px / 14px 1px no-repeat,
    linear-gradient(var(--hud), var(--hud)) bottom 8px right 8px / 1px 14px no-repeat,
    var(--panel);
  transition: border-color 0.3s, box-shadow 0.3s;
}
:root[data-style="scifi"] .card:hover { border-color: rgba(120, 220, 255, 0.32); box-shadow: 0 24px 60px -34px rgba(94, 242, 255, 0.5); }
:root[data-style="scifi"] .stage { --panel: rgba(6, 9, 22, 0.72); }

/* Type: mono HUD labels */
:root[data-style="scifi"] .panel-head h2, :root[data-style="scifi"] .page-head h1, :root[data-style="scifi"] .stage-head h1 { letter-spacing: -0.01em; }
:root[data-style="scifi"] .panel-head h2::before { content: "// "; font-family: var(--mono); font-size: 0.8em; color: var(--hud); opacity: 0.8; }
:root[data-style="scifi"] .sheet-label, :root[data-style="scifi"] .block-label, :root[data-style="scifi"] .tag, :root[data-style="scifi"] .badge,
:root[data-style="scifi"] .moon-label, :root[data-style="scifi"] .muted.push, :root[data-style="scifi"] kbd, :root[data-style="scifi"] .view-hint,
:root[data-style="scifi"] .zoom-level, :root[data-style="scifi"] .tour-count, :root[data-style="scifi"] .ai-time {
  font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
:root[data-style="scifi"] .field { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }
:root[data-style="scifi"] .field > select, :root[data-style="scifi"] .field > input, :root[data-style="scifi"] .field > textarea, :root[data-style="scifi"] .field > span:not(:first-child) {
  font-family: var(--font); font-size: 0.88rem; letter-spacing: 0; text-transform: none; }
:root[data-style="scifi"] .badge { color: var(--hud); border-color: rgba(120, 220, 255, 0.4); }
:root[data-style="scifi"] .moon-label { font-size: calc(var(--moon-label, 0.72rem) * 0.82); color: #c9d2ff; }
:root[data-style="scifi"] .planet-label { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* Tabs */
:root[data-style="scifi"] .tabbar a { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase; }
:root[data-style="scifi"] .tabbar a.is-active { background: rgba(94, 242, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(94, 242, 255, 0.35); }
:root[data-style="scifi"] .tabbar a.is-active svg { color: var(--hud); filter: drop-shadow(0 0 4px var(--hud)); }
:root[data-style="scifi"] .tab-ink { background: var(--hud); box-shadow: 0 0 12px var(--hud), 0 0 2px var(--hud); }

/* Buttons and fields */
:root[data-style="scifi"] .btn, :root[data-style="scifi"] .icon-btn { border-color: rgba(120, 200, 255, 0.3); background: rgba(10, 16, 36, 0.75); }
:root[data-style="scifi"] .btn:hover:not(:disabled), :root[data-style="scifi"] .icon-btn:hover { border-color: var(--hud); box-shadow: 0 0 0 1px rgba(94, 242, 255, 0.25), 0 10px 26px -12px rgba(94, 242, 255, 0.6); }
:root[data-style="scifi"] .btn-primary { border: 0; color: #031015; background: linear-gradient(135deg, var(--hud), #7cffc4 60%, #43e08a); box-shadow: 0 0 18px -6px rgba(94, 242, 255, 0.7); }
:root[data-style="scifi"] .sheet .btn-primary { background: linear-gradient(135deg, color-mix(in srgb, var(--tool) 70%, white), var(--tool)); color: var(--on-tool, #fff); }
:root[data-style="scifi"] select:focus-visible, :root[data-style="scifi"] input:focus-visible, :root[data-style="scifi"] textarea:focus-visible {
  border-color: var(--hud); box-shadow: 0 0 0 3px rgba(94, 242, 255, 0.2), 0 0 16px -4px var(--hud); }
:root[data-style="scifi"] .field.just-changed::after { color: var(--hud); font-family: var(--mono); }
:root[data-style="scifi"] .just-changed select, :root[data-style="scifi"] .just-changed input { border-color: var(--hud); box-shadow: 0 0 14px -4px var(--hud); }

/* Sheets: HUD frame */
:root[data-style="scifi"] .sheet { background: rgba(8, 12, 30, 0.94); border-color: rgba(120, 220, 255, 0.3); box-shadow: 0 0 0 1px rgba(94, 242, 255, 0.1), 0 40px 90px -30px rgba(94, 242, 255, 0.35); }
:root[data-style="scifi"] .sheet::backdrop { background: rgba(2, 4, 12, 0.7); backdrop-filter: blur(4px); }
:root[data-style="scifi"] .sheet-head { border-bottom-color: rgba(120, 200, 255, 0.2); }
:root[data-style="scifi"] .ai-page { background: linear-gradient(180deg, rgba(14, 22, 48, 0.9), rgba(4, 8, 22, 0.95)); border-color: rgba(120, 220, 255, 0.3); }
:root[data-style="scifi"] .ai-line { background: rgba(140, 220, 255, 0.28); }
:root[data-style="scifi"] .tour-card { background: rgba(8, 12, 30, 0.97); border-color: rgba(120, 220, 255, 0.35); }
:root[data-style="scifi"] .tour-spot { box-shadow: 0 0 0 9999px rgba(2, 4, 12, 0.7), 0 0 0 2px var(--hud), 0 0 24px 2px rgba(94, 242, 255, 0.6); }

/* Solar system: HUD rings */
:root[data-style="scifi"] .orbit { border-color: rgba(120, 210, 255, 0.28); }
:root[data-style="scifi"] .orbit-inner { border-style: dashed; }
:root[data-style="scifi"] .sun::after { box-shadow: 0 0 0 10px rgba(94, 242, 255, 0.05); }
:root[data-style="scifi"] .corona::after { content: ""; position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(94, 242, 255, 0.4); animation: spin 30s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .page:not([hidden]), .page:not([hidden]) .card, .sheet[open], .sheet-body > *, .toast, .just-changed, .ai-line, .ai-scan, .ai-spark, .ai-orb { animation: none !important; }
  .ai-line { width: var(--w); }
  .tab-ink { transition: none; }
}

/* ---------- First-run setup: pick your look (mini previews drawn in each look's own colours) ---------- */
.look-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.look-pick { display: grid; gap: 6px; padding: 10px 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform 0.2s cubic-bezier(.3, 1.3, .5, 1), border-color 0.2s, box-shadow 0.25s; }
.look-pick:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.look-pick.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent), 0 14px 30px -16px var(--accent); }
.look-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.look-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.look-demo { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; }
.look-demo i { position: absolute; display: block; }
.ld-orbit { left: 10%; right: 10%; top: 22%; bottom: 22%; border-radius: 50%; border: 1px dashed; }
.ld-sun { left: 50%; top: 50%; width: 18%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 45% 42%, #fffbe8, #ffc441 45%, #ff951f); box-shadow: 0 0 16px 3px rgba(255, 170, 50, 0.6); }
.ld-p { width: 9%; aspect-ratio: 1; border-radius: 50%; }
.ld-p.p1 { left: 18%; top: 38%; background: radial-gradient(circle at 35% 30%, #93ccff, #2a78d6); }
.ld-p.p2 { left: 72%; top: 24%; background: radial-gradient(circle at 35% 30%, #f2a483, #c15f3c); }
.ld-p.p3 { left: 64%; top: 64%; background: radial-gradient(circle at 35% 30%, #e6ebf5, #4b5878); }
.ld-card { left: 6%; bottom: 7%; width: 34%; height: 26%; border-radius: 5px; padding: 5% 6%; display: grid !important; gap: 12%; align-content: start; }
.ld-card b { display: block; height: 3px; border-radius: 2px; }
.ld-card b:nth-child(2) { width: 70%; }
.ld-card .ld-btn { width: 45%; height: 5px; }
.ld-grid { inset: 0; }
/* Dark space */
.d-dark { background: radial-gradient(120% 90% at 20% 0%, rgba(88, 101, 242, 0.35), transparent 60%), #080b16; }
.d-dark .ld-orbit { border-color: rgba(160, 170, 230, 0.3); }
.d-dark .ld-card { background: #11152a; border: 1px solid #262c4d; }
.d-dark .ld-card b { background: rgba(233, 235, 248, 0.5); } .d-dark .ld-card .ld-btn { background: #3fbf74; }
/* Light */
.d-light { background: radial-gradient(120% 90% at 20% 0%, rgba(88, 101, 242, 0.15), transparent 60%), #f2f3f9; }
.d-light .ld-orbit { border-color: rgba(70, 80, 140, 0.3); }
.d-light .ld-sun { box-shadow: 0 0 10px 2px rgba(255, 170, 50, 0.45); }
.d-light .ld-card { background: #fff; border: 1px solid #dde0ee; box-shadow: 0 4px 10px rgba(30, 40, 90, 0.1); }
.d-light .ld-card b { background: rgba(23, 26, 48, 0.4); } .d-light .ld-card .ld-btn { background: #3fbf74; }
/* Mission control */
.d-scifi { background: radial-gradient(120% 90% at 20% 0%, rgba(154, 123, 255, 0.35), transparent 60%), radial-gradient(90% 80% at 100% 40%, rgba(94, 242, 255, 0.18), transparent 60%), #04060e; }
.d-scifi .ld-grid { background-image: linear-gradient(rgba(110, 160, 255, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(110, 160, 255, 0.16) 1px, transparent 1px); background-size: 12px 12px; }
.d-scifi .ld-orbit { border-color: rgba(94, 242, 255, 0.5); }
.d-scifi .ld-sun::after { content: ""; position: absolute; inset: -40%; border-radius: 50%; border: 1px dashed rgba(94, 242, 255, 0.7); animation: spin 8s linear infinite; }
.d-scifi .ld-card { background: linear-gradient(#5ef2ff, #5ef2ff) top 2px left 2px / 6px 1px no-repeat, linear-gradient(#5ef2ff, #5ef2ff) top 2px left 2px / 1px 6px no-repeat,
  linear-gradient(#5ef2ff, #5ef2ff) bottom 2px right 2px / 6px 1px no-repeat, linear-gradient(#5ef2ff, #5ef2ff) bottom 2px right 2px / 1px 6px no-repeat, rgba(11, 16, 36, 0.9);
  border: 1px solid rgba(110, 160, 255, 0.3); }
.d-scifi .ld-card b { background: rgba(140, 220, 255, 0.55); } .d-scifi .ld-card .ld-btn { background: linear-gradient(90deg, #5ef2ff, #43e08a); box-shadow: 0 0 6px #5ef2ff; }
.d-scifi::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px #5ef2ff, 0 0 8px 2px #5ef2ff;
  left: 78%; top: 78%; animation: ldLaser 3s ease-in-out infinite; }
@keyframes ldLaser { 50% { left: 40%; top: 30%; } }
.tour-look { font-size: 0.82rem; color: var(--muted); margin-left: 6px; }
@media (max-width: 640px) { .look-picks { grid-template-columns: 1fr; } .look-demo { aspect-ratio: 16 / 7; } }

/* Setup: "Something else?" tool with a text box */
.ob-other #obOther { position: static; margin-top: 8px; font-size: 0.86rem; width: 100%; }
.ob-other .ob-planet { background: radial-gradient(circle at 35% 30%, #fff, #8a93b8 60%, #3a4060); }

/* ---------- Plan settings: summary on the Timetable tab + the popup ---------- */
.plan-summary { border: 1px solid var(--border); border-radius: 14px; background: var(--panel-2); padding: 14px; margin-bottom: 12px; }
.ps-pills { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ps-pill { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--field); border: 1px solid var(--border); min-width: 0; }
.ps-pill > i { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-style: normal; font-size: 0.85rem;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ps-pill > span { display: grid; min-width: 0; font-size: 0.86rem; font-weight: 600; }
.ps-pill small { font-size: 0.68rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ps-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ps-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-flags .tag { margin: 0; }
.sheet-body.is-static > * { animation: none; }
.ps-sheet { display: grid; gap: 14px; }
.ps-block { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--panel-2); }
.ps-block h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 1rem; display: flex; align-items: center; gap: 10px; }
.ps-n { font-family: var(--mono, monospace); font-size: 0.7rem; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 6px; padding: 2px 6px; }
.ps-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ps-two h3 { margin-bottom: 10px; }
.ps-days { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ps-label { margin: 0 0 6px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ps-label:not(:first-child) { margin-top: 12px; }
.ps-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ps-row input[type="date"], .ps-row input[type="time"] { width: auto; }
.pick-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-grid; justify-items: center; gap: 1px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--field);
  color: var(--text); font: inherit; font-size: 0.84rem; font-weight: 500; cursor: pointer;
  transition: transform 0.18s cubic-bezier(.3, 1.4, .5, 1), border-color 0.2s, background 0.2s, box-shadow 0.25s; }
.pick small { font-size: 0.66rem; color: var(--muted); font-weight: 400; }
.pick:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.pick:active { transform: scale(0.95); }
.pick.is-on { background: color-mix(in srgb, var(--accent) 20%, var(--field)); border-color: var(--accent); font-weight: 600;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); animation: changedPop 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.pick.is-on small { color: var(--text); }
.ps-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.ps-day { display: grid; justify-items: center; gap: 4px; font-size: 0.78rem; }
.ps-day small { color: var(--muted); font-size: 0.7rem; }
.ps-bar { position: relative; width: 100%; max-width: 38px; height: 70px; border-radius: 8px; background: var(--field); overflow: hidden; display: flex; align-items: flex-end; }
.ps-bar i { display: block; width: 100%; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white), var(--accent));
  box-shadow: 0 0 12px -2px var(--accent); transition: height 0.4s cubic-bezier(.3, 1.3, .5, 1); }
.ps-day.is-off b, .ps-day.is-off small { opacity: 0.45; }
.ps-switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.ps-switch + .ps-switch { border-top: 1px dashed var(--border); }
.ps-switch > span { display: grid; gap: 3px; }
.ps-switch small { color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.ps-switch .switch { flex: none; margin-top: 2px; }
.ps-total { position: sticky; bottom: -22px; margin: 16px -20px -22px; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--border); }
.ps-total b { font-family: var(--font-display); font-size: 1.1rem; color: var(--accent); }
@media (max-width: 700px) { .ps-days, .ps-two { grid-template-columns: 1fr; } .ps-week { gap: 4px; } }
:root[data-style="scifi"] .ps-pill > i, :root[data-style="scifi"] .ps-n { color: var(--hud); border-color: rgba(94, 242, 255, 0.4); }
:root[data-style="scifi"] .pick.is-on { border-color: var(--hud); background: rgba(94, 242, 255, 0.12); box-shadow: 0 0 0 3px rgba(94, 242, 255, 0.15), 0 0 14px -4px var(--hud); }
:root[data-style="scifi"] .ps-bar i { background: linear-gradient(180deg, #b6fbff, var(--hud)); box-shadow: 0 0 12px -2px var(--hud); }
:root[data-style="scifi"] .ps-total b { color: var(--hud); }

/* ---------- Plan slides (Plan / Edit plan settings) ---------- */
.slides { min-height: 360px; }
.slide-dots { display: flex; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; }
.slide-dots li { flex: 1; }
.slide-dots button { display: block; width: 100%; height: 5px; padding: 0; border: 0; border-radius: 3px; background: var(--border); cursor: pointer; transition: background 0.3s; }
.slide-dots li.is-done button, .slide-dots li.is-now button { background: var(--accent); }
.slide-dots li.is-now button { box-shadow: 0 0 10px var(--accent); }
.slide h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.35rem; }
.slide-lead { margin: 0 0 16px; color: var(--muted); }
.slide-lead b { color: var(--text); }
.slide.from-right { animation: slideFromRight 0.35s cubic-bezier(.2, .8, .2, 1); }
.slide.from-left { animation: slideFromLeft 0.35s cubic-bezier(.2, .8, .2, 1); }
@keyframes slideFromRight { from { opacity: 0; transform: translateX(28px); } }
@keyframes slideFromLeft { from { opacity: 0; transform: translateX(-28px); } }
.pick-pills.big .pick { padding: 12px 18px; font-size: 0.95rem; border-radius: 14px; }
.slide-field { max-width: 240px; margin-top: 16px; }
.day-rows { display: grid; gap: 6px; margin-top: 14px; }
.day-row { display: grid; grid-template-columns: 100px 1fr 64px 120px; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel-2); position: relative; overflow: hidden; transition: opacity 0.2s, border-color 0.2s; }
.day-row:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.day-row.is-off { opacity: 0.6; }
.day-row b { font-size: 0.9rem; }
.day-amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.day-start { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.day-start input { padding: 0.3rem 0.4rem; }
.day-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; pointer-events: none; }
.day-bar i { display: block; height: 100%; background: var(--accent); opacity: 0.5; transition: width 0.25s; }
/* Range sliders: a filled track with a glowing thumb */
.day-row input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; cursor: pointer; padding: 0; border: 0;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), var(--field) var(--fill, 0%)); }
.day-row input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  border: 3px solid var(--accent); box-shadow: 0 0 10px var(--accent); transition: transform 0.15s; }
.day-row input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 10px var(--accent); }
.day-row input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
.custom-len { display: inline-flex; align-items: center; gap: 8px; }
.custom-len span { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; }
.custom-len input { width: 64px; padding: 0.25rem 0.4rem; }
.slide-eg { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--field); list-style: none; display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.slide-eg b { color: var(--text); margin-right: 6px; }
.ps-day { animation: cardIn 0.4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 50ms); }
.ps-summary { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: end; }
.ps-summary .ps-pills { grid-template-columns: repeat(3, minmax(120px, auto)); }
.ps-mini-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 74px; }
.ps-mini { display: grid; grid-template-rows: 1fr auto auto; justify-items: center; height: 100%; font-size: 0.7rem; gap: 2px; }
.ps-mini i { align-self: end; width: 70%; max-width: 26px; min-height: 3px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white), var(--accent)); box-shadow: 0 0 8px -2px var(--accent); }
.ps-mini small { color: var(--muted); font-size: 0.66rem; }
.ps-mini.is-off { opacity: 0.45; }
:root[data-style="scifi"] .day-row input[type="range"] { background: linear-gradient(90deg, var(--hud) var(--fill, 0%), var(--field) var(--fill, 0%)); }
:root[data-style="scifi"] .day-row input[type="range"]::-webkit-slider-thumb { border-color: var(--hud); box-shadow: 0 0 10px var(--hud); }
:root[data-style="scifi"] .slide-dots li.is-done button, :root[data-style="scifi"] .slide-dots li.is-now button { background: var(--hud); box-shadow: 0 0 10px var(--hud); }
:root[data-style="scifi"] .ps-mini i, :root[data-style="scifi"] .day-bar i { background: var(--hud); }
@media (max-width: 760px) {
  .day-row { grid-template-columns: 1fr auto; }
  .day-row input[type="range"] { grid-column: 1 / -1; }
  .day-start { grid-column: 1 / -1; }
  .ps-summary { grid-template-columns: 1fr; }
  .ps-summary .ps-pills { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Beta hardening (2026-10-27): phones, getting started, offline screen, account forms ---------- */
.res-list { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
@media (max-width: 640px) {
  .seg { flex-wrap: wrap; }
  .seg button { flex: 1 1 auto; }
}
.onboard-card { max-height: calc(100dvh - 32px); }
.sheet { max-height: min(88dvh, 920px); }
@media (max-width: 640px) { .onboard-card { max-height: calc(100dvh - 16px); } }
.plan-why { align-self: center; margin-right: auto; }

.getting-started { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.getting-started li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); transition: border-color 0.2s, opacity 0.2s; }
.getting-started li.is-next { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.getting-started li.is-done { opacity: 0.6; }
.gs-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border)); color: var(--accent); }
.is-done .gs-n { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.gs-text { display: grid; gap: 2px; min-width: 0; }
.gs-text small { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 520px) { .getting-started li { grid-template-columns: 30px 1fr; } .getting-started li .btn { grid-column: 2; justify-self: start; } }

.offline { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.offline-card { width: min(420px, 100%); padding: 28px; display: grid; gap: 12px; text-align: center; justify-items: center; }
.offline-card h1 { font-family: var(--font-display); font-size: 1.4rem; margin: 6px 0 0; }
.offline-card p { margin: 0; }

.acct-form { display: grid; gap: 12px; }
.acct-form small { color: var(--muted); }
/* Show/hide button inside password boxes (js/peek.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 2.6rem; }
.pw-peek { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-peek:hover, .pw-peek[aria-pressed="true"] { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.pw-peek:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-peek svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ob-gcses { margin-top: 16px; align-items: flex-start; font-size: 0.86rem; color: var(--muted); }
.ob-gcses b { color: var(--text); }

/* ---------- Block tints (tintBlocks in app.js) ----------
   Every block on a page has its own colour: a soft wash from the top-left corner, a coloured top edge, a tinted border
   and a faint glow, so neighbouring blocks read as separate. AI blocks and AI sheets share the AI's coral (its planet). */
:root { --ai: #e8805e; --ai-2: #b48cff; }
.card.panel[data-tint], .card.panel.prog-card { position: relative; isolation: isolate; }
.card.panel.prog-card { --tint: var(--mc); }
.card.panel[data-tint="ai"] { --tint: var(--ai); }
.card.panel[data-tint], .card.panel.prog-card {
  border-color: color-mix(in srgb, var(--tint) 30%, var(--border));
  box-shadow: var(--shadow), 0 22px 56px -34px color-mix(in srgb, var(--tint) 60%, transparent);
}
.card.panel[data-tint]::before, .card.panel.prog-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background:
    linear-gradient(90deg, var(--tint), color-mix(in srgb, var(--tint) 30%, transparent) 55%, transparent) top / 100% 2px no-repeat,
    radial-gradient(130% 80% at 0% 0%, color-mix(in srgb, var(--tint) 12%, transparent), transparent 62%);
}
.card.panel[data-tint] .panel-head h2 { display: inline-flex; align-items: center; gap: 8px; }
/* AI blocks: coral to violet wash, and an "AI" tag after the heading. */
.card.panel[data-tint="ai"]::before {
  background:
    linear-gradient(90deg, var(--ai), var(--ai-2) 60%, transparent) top / 100% 2px no-repeat,
    radial-gradient(130% 80% at 0% 0%, color-mix(in srgb, var(--ai) 14%, transparent), transparent 60%),
    radial-gradient(90% 70% at 100% 0%, color-mix(in srgb, var(--ai-2) 9%, transparent), transparent 60%);
}
.card.panel[data-tint="ai"] .panel-head h2::after, .sheet.is-ai .sheet-title::after {
  content: "AI"; display: inline-block; padding: 2px 7px; border-radius: 999px; font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; line-height: 1.4; vertical-align: 0.18em; color: #fff;
  background: linear-gradient(135deg, var(--ai), var(--ai-2)); box-shadow: 0 0 12px -2px color-mix(in srgb, var(--ai) 70%, transparent);
}
.sheet.is-ai .sheet-title::after { margin-left: 8px; }
.sheet.is-ai.titled-ai .sheet-title::after { content: none; }

/* AI sheets: their own frame, glow and header wash; AI-made content sits in a tinted box with a "made by AI" note. */
.sheet.is-ai {
  border-color: color-mix(in srgb, var(--ai) 45%, var(--border));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px color-mix(in srgb, var(--ai) 22%, transparent),
    0 0 70px -18px color-mix(in srgb, var(--ai) 45%, transparent), 0 0 120px -40px color-mix(in srgb, var(--ai-2) 45%, transparent);
}
.sheet.is-ai .sheet-head {
  box-shadow: none; border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--ai), var(--ai-2)) 1;
  background: linear-gradient(100deg, color-mix(in srgb, var(--ai) 14%, transparent), color-mix(in srgb, var(--ai-2) 8%, transparent) 55%, transparent);
}
.sheet.is-ai .doc, .sheet.is-ai .exam-paper, .sheet.is-ai .card-list {
  position: relative; padding: 30px 16px 14px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--ai) 30%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--ai) 7%, transparent), transparent 220px);
}
.sheet.is-ai .doc::before, .sheet.is-ai .exam-paper::before, .sheet.is-ai .card-list::before {
  content: "Made by AI · check it against your notes"; position: absolute; top: 8px; left: 16px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: color-mix(in srgb, var(--ai) 75%, var(--text));
}
:root[data-theme="light"] .card.panel[data-tint]::before { opacity: 0.8; }

/* ---------- AI credits (creditTag / creditBar in app.js) ---------- */
.credit-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.02em; line-height: 1.5; vertical-align: 0.1em; white-space: nowrap; color: var(--text);
  background: color-mix(in srgb, var(--ai) 22%, transparent); border: 1px solid color-mix(in srgb, var(--ai) 45%, transparent); }
.btn-primary .credit-tag { color: inherit; background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.35); }
.credit-tag.is-short { opacity: 0.7; text-decoration: line-through; }
.action:disabled, .btn:disabled .credit-tag { cursor: not-allowed; }
.action:disabled { opacity: 0.55; transform: none; }
.credit-bar { height: 6px; border-radius: 999px; overflow: hidden; margin: 2px 0 6px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.credit-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ai), var(--ai-2)); transition: width 0.4s ease; }
.credit-costs { margin: 0 0 10px; }

/* ================= Space stations (shortcuts to tabs, when there are only a few tools) ================= */
.station {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(var(--planet-size, 7%) * 0.7);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  scale: var(--depth, 1);
  filter: brightness(var(--bright, 1));
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  z-index: var(--z, 2);
  animation: bob 8s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.station-body { position: relative; display: block; width: 100%; height: 100%; }
.station-core {
  position: absolute;
  inset: 14%;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at var(--hx, 35%) var(--hy, 30%), #f3f6ff 0, #a6b0c8 30%, #4a536b 72%, #232a3d 100%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc) 75%, transparent), 0 0 18px -2px var(--sc), 0 10px 22px -10px rgba(0, 0, 0, 0.7);
  transition: transform 0.18s, box-shadow 0.18s;
}
.station-core svg { width: 46%; height: 46%; color: color-mix(in srgb, var(--sc) 55%, #0b1020); stroke-width: 2.4; }
/* A beacon blinking on top */
.station-core::after {
  content: "";
  position: absolute;
  top: -9%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--sc);
  box-shadow: 0 0 8px 2px var(--sc);
  animation: stationBlink 2.4s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
/* The habitat ring, tilted like the orbits; its lights turn while the halves stay behind / in front of the core. */
.station-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 175%;
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-12deg) rotateX(66deg);
}
.station-ring::before, .station-ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.station-ring::after {
  border: 2px solid color-mix(in srgb, var(--sc) 70%, #c8d2e8);
  box-shadow: 0 0 10px color-mix(in srgb, var(--sc) 45%, transparent), inset 0 0 10px color-mix(in srgb, var(--sc) 30%, transparent);
}
.station-ring::before {
  inset: 6%;
  background: repeating-conic-gradient(color-mix(in srgb, var(--sc) 70%, white) 0 4deg, transparent 4deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 88%, #000 90% 97%, transparent 99%);
  mask: radial-gradient(circle, transparent 88%, #000 90% 97%, transparent 99%);
  animation: spin var(--spin, 30s) linear infinite;
}
.station:hover { filter: brightness(calc(var(--bright, 1) + 0.15)); }
.station:hover .station-core { transform: scale(1.1); box-shadow: 0 0 0 2px var(--sc), 0 0 26px var(--sc), 0 10px 22px -10px rgba(0, 0, 0, 0.7); }
.station:hover .planet-label { text-shadow: 0 0 12px var(--sc); }
.station .planet-label { font-weight: 500; color: var(--muted); }
.station:hover .planet-label, .station:focus-visible .planet-label { color: var(--text); }
.is-dragging .station { opacity: 0.35; transition: opacity 0.2s; }
@keyframes stationBlink { 0%, 60%, 100% { opacity: 0.25; } 75% { opacity: 1; } }
:root[data-theme="light"] .station-core { box-shadow: 0 0 0 2px var(--sc), 0 0 14px -4px var(--sc), 0 8px 18px -10px rgba(0, 0, 0, 0.5); }
@media (max-width: 640px) {
  .station { position: relative; left: auto; top: auto; transform: none; scale: none; filter: none; justify-self: center; width: 46px; margin: 8px 0 24px; }
}

/* ================= Payments ================= */
.plan-card:has(> .btn) { grid-template-rows: auto auto 1fr auto; align-content: stretch; }
.plan-card > .btn { margin-top: 10px; justify-self: stretch; align-self: end; }
.plan-card.is-current { box-shadow: 0 0 0 1px var(--accent), 0 0 22px -8px var(--accent); }
.billing-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn, #f2a33a) 55%, var(--border)); background: color-mix(in srgb, var(--warn, #f2a33a) 10%, transparent); }
.billing-note p { margin: 0; flex: 1 1 220px; font-size: 0.88rem; }
.bill-line { font-weight: 600; }
.paid-done { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: start; }
.paid-done p { margin: 0; grid-column: 2; }
.paid-tick { grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff;
  background: radial-gradient(circle at 35% 30%, #7ff0b5, #1f9d62); box-shadow: 0 0 22px -4px #3bd98a; animation: paidPop 0.5s cubic-bezier(.2, 1.6, .4, 1); }
.paid-tick svg { width: 24px; height: 24px; }
@keyframes paidPop { from { transform: scale(0.3); opacity: 0; } }
.gift-ctl { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.gift-ctl input[type="date"] { width: auto; padding: 2px 6px; font-size: 0.78rem; }
.paid-tag { background: color-mix(in srgb, #3bd98a 18%, transparent); color: color-mix(in srgb, #3bd98a 70%, var(--text)); }
.admin-billing p { margin: 4px 0; font-size: 0.86rem; }
.admin-billing .form-row { align-items: end; margin-top: 8px; }
