/* ============ Tokens ============ */
/* light = default (white page, near-black ink, grey hairlines, soft shadows); dark = optional */
:root, [data-theme="light"] {
  --bg: #f4f4f4; --ink: #0d0d0d; --ink-2: #333; --ink-3: #595959; --ink-4: #6b6b6b;
  --glass: #fff; --glass-2: #fafafa; --hover: rgba(0,0,0,.045);
  --line: rgba(0,0,0,.1); --line-2: rgba(0,0,0,.16); --line-3: rgba(0,0,0,.42);
  --solid: #0d0d0d; --on-solid: #fff; --bar: rgba(255,255,255,.86); --pop: #fff;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px -10px rgba(0,0,0,.14);
  --shadow-up: 0 2px 4px rgba(0,0,0,.05), 0 16px 32px -14px rgba(0,0,0,.22);
  --shadow-pop: 0 18px 40px -14px rgba(0,0,0,.25);
  --sheen: rgba(0,0,0,.035);
  /* viewer */
  --v-bg: #e6e6e6; --v-bar: rgba(255,255,255,.94); --v-side: #efefef; --v-ink: #111; --v-ink-2: #333; --v-ink-3: #5e5e5e;
  --v-line: rgba(0,0,0,.1); --v-line-2: rgba(0,0,0,.2); --v-hover: rgba(0,0,0,.06); --v-on: rgba(0,0,0,.1);
  --v-shadow: 0 2px 6px rgba(0,0,0,.08), 0 10px 30px -8px rgba(0,0,0,.22); --v-ph: #d6d6d6; --v-scroll: #b5b5b5;
  --radius: 12px; --wrap: 1280px; --ease: cubic-bezier(.2,.8,.2,1); --ease-out: cubic-bezier(.16,1,.3,1); --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cur: url('../img/cursor.png') 0 0, default;
  --cur-hand: url('../img/cursor.png') 0 0, pointer;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #000; --ink: #f2f2f2; --ink-2: #c4c4c4; --ink-3: #8f8f8f; --ink-4: #6a6a6a;
  --glass: rgba(18,18,18,.9); --glass-2: rgba(34,34,34,.6); --hover: rgba(255,255,255,.07);
  --line: rgba(255,255,255,.1); --line-2: rgba(255,255,255,.16); --line-3: rgba(255,255,255,.3);
  --solid: #f2f2f2; --on-solid: #000; --bar: rgba(0,0,0,.72); --pop: rgba(14,14,14,.98);
  --shadow: inset 0 1px 0 rgba(255,255,255,.05); --shadow-up: inset 0 1px 0 rgba(255,255,255,.06); --shadow-pop: 0 18px 40px -12px rgba(0,0,0,.7);
  --sheen: rgba(255,255,255,.08);
  --v-bg: #0b0b0b; --v-bar: rgba(0,0,0,.85); --v-side: #050505; --v-ink: #e8e8e8; --v-ink-2: #c8c8c8; --v-ink-3: #8f8f8f;
  --v-line: rgba(255,255,255,.09); --v-line-2: rgba(255,255,255,.22); --v-hover: rgba(255,255,255,.08); --v-on: rgba(255,255,255,.14);
  --v-shadow: 0 6px 28px rgba(0,0,0,.7); --v-ph: #1a1a1a; --v-scroll: #3a3a3a;
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
*, *::before, *::after { cursor: var(--cur); }
a, button, select, label, summary, [role="button"], a *, button *, label * { cursor: var(--cur-hand); }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; background: transparent; color: var(--ink); font: 500 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--solid); color: var(--on-solid); }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ============ Glass shatter (js/shatter.js) ============ */
.shatter { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; view-transition-name: shards; contain: strict; }
.shard { position: absolute; will-change: transform, opacity; contain: layout style; backface-visibility: hidden; }
.shard > .shard-face { position: absolute !important; inset: auto !important; top: 0 !important; left: 0 !important; margin: 0 !important; transform: none !important; transition: none !important; animation: none !important;
  visibility: visible !important; opacity: 1 !important; filter: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background-color: rgba(22,22,22,.78); flex: none; }
.shard-edge { position: absolute; top: 0; left: 0; overflow: visible; width: auto; height: auto; fill: none; stroke: rgba(255,255,255,.95); stroke-width: 1.1; stroke-linejoin: round; }
[data-theme="light"] .shard > .shard-face, :root:not([data-theme]) .shard > .shard-face { background-color: rgba(255,255,255,.9); }
[data-theme="light"] .shard-edge, :root:not([data-theme]) .shard-edge { stroke: rgba(0,0,0,.72); stroke-width: 1; }
[data-theme="light"] .shatter-flash { mix-blend-mode: multiply; }
.shatter-flash { position: absolute; mix-blend-mode: screen; will-change: opacity; }
::view-transition-group(shards), ::view-transition-old(shards), ::view-transition-new(shards) { animation: none; }
::view-transition-old(shards) { display: none; }

/* ============ Top bar ============ */
.topbar { position: sticky; top: 0; z-index: 20; padding: 10px clamp(12px, 3vw, 32px) 0; view-transition-name: topbar; }
.topbar-in { max-width: var(--wrap); margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 10px;
  background: var(--bar); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--glass-2);
  font: 800 13px/1 var(--font); letter-spacing: -.3px; transition: background .2s, color .2s, border-color .2s; }
.brand:hover .brand-mark { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.brand-text strong { font-weight: 700; font-size: 13.5px; letter-spacing: -.1px; }
.brand-text small { color: var(--ink-3); font-size: 11px; font-weight: 500; }
.search { position: relative; flex: 1; max-width: 340px; margin-left: auto; display: flex; align-items: center; }
.search > svg { position: absolute; left: 11px; color: var(--ink-3); width: 15px; height: 15px; pointer-events: none; }
.search input { width: 100%; height: 34px; padding: 0 30px 0 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--glass-2); color: var(--ink); font-size: 13px; font-weight: 500; transition: border-color .15s, background .15s; }
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--line-3); background: var(--hover); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 9px; font: 600 10.5px var(--font); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; line-height: 16px; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 260px; background: var(--pop); border: 1px solid var(--line-2); border-radius: 12px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); padding: 5px; max-height: 60vh; overflow: auto; box-shadow: var(--shadow-pop); animation: up .16s ease; }
.search-results a { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 13.5px; }
.search-results a:hover, .search-results a.active { background: var(--hover); }
.search-results small { color: var(--ink-3); white-space: nowrap; font-weight: 500; font-size: 12px; }
.search-results .empty { padding: 9px 10px; color: var(--ink-3); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.lang { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--glass-2); }
.lang button { border: 0; background: none; height: 28px; padding: 0 9px; border-radius: 7px; font-weight: 700; font-size: 11.5px; letter-spacing: .3px; color: var(--ink-3); transition: background .15s, color .15s; }
.lang button:hover { color: var(--ink); }
.lang button.on { background: var(--solid); color: var(--on-solid); }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--glass-2); color: var(--ink-2); transition: color .15s, border-color .15s; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-3); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .i-sun { display: none; } [data-theme="light"] .icon-btn .i-sun { display: block; } [data-theme="light"] .icon-btn .i-moon { display: none; }

main { flex: 1; width: 100%; max-width: calc(var(--wrap) + 2 * clamp(12px, 3vw, 32px)); margin: 0 auto; padding: 0 clamp(12px, 3vw, 32px) 48px; outline: none; display: flex; flex-direction: column; }
main > * { min-width: 0; }

/* ============ Motion ============ */
/* every block that enters gets .rise and a --i index → staggered fade/slide/blur in */
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); filter: blur(6px); } }
@keyframes rise-back { from { opacity: 0; transform: translateY(-14px) scale(.99); filter: blur(6px); } }
@keyframes up { from { opacity: 0; transform: translateY(6px); } }
@keyframes fadein { from { opacity: 0; } }
main.in .rise { animation: rise .44s var(--ease-out) calc(var(--i, 0) * 50ms) backwards; }
.nav-back main.in .rise { animation-name: rise-back; animation-duration: .38s; animation-delay: calc(var(--i, 0) * 35ms); }
.sections.refresh > * { animation: up .26s var(--ease) both; }

/* view transitions between steps: old page slips away, new one staggers in (see .rise) */
::view-transition-old(root) { animation: vt-out .2s var(--ease) both; }
::view-transition-new(root) { animation: none; }
.nav-back::view-transition-old(root) { animation-name: vt-out-back; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(.985); filter: blur(4px); } }
@keyframes vt-out-back { to { opacity: 0; transform: translateY(12px) scale(.985); filter: blur(4px); } }
::view-transition-group(topbar), ::view-transition-old(topbar), ::view-transition-new(topbar) { animation: none; }
/* the chosen option morphs into the pill (and back) */
::view-transition-group(crumb-c), ::view-transition-group(crumb-s) { animation-duration: .42s; animation-timing-function: var(--ease-out); }
::view-transition-old(crumb-c), ::view-transition-old(crumb-s) { animation: vt-fade-out .2s ease both; }
::view-transition-new(crumb-c), ::view-transition-new(crumb-s) { animation: vt-fade-in .3s ease .08s both; height: 100%; object-fit: none; }
::view-transition-old(crumb-c), ::view-transition-old(crumb-s) { height: 100%; object-fit: none; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

/* ============ Onboarding steps (angi.lol / bio-link style) ============ */
main[data-view="courses"], main[data-view="sems"] { padding-bottom: 0; }
.step { flex: 1; min-height: calc(100svh - 150px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0; padding: 32px 0 56px; }
.dots { display: flex; gap: 6px; margin-bottom: 22px; }
.dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--line-2); transition: width .3s var(--ease), background .3s; }
.dots i.done { background: var(--ink-3); }
.dots i.on { width: 20px; background: var(--ink); }
.ask { margin: 0; font-weight: 800; font-size: clamp(34px, 6.2vw, 68px); line-height: 1.02; letter-spacing: -.045em; text-wrap: balance; }
.ask.small { font-size: clamp(28px, 4.2vw, 46px); }
.step .ask { margin: 14px 0 34px; }
.picks { display: grid; gap: clamp(10px, 1.4vw, 16px); width: 100%; }
.picks-4 { grid-template-columns: repeat(4, 1fr); max-width: 820px; }
.picks-3 { grid-template-columns: repeat(3, 1fr); max-width: 640px; }
.pick { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; aspect-ratio: 1 / 1.02; padding: 18px 10px;
  text-decoration: none; border-radius: 20px; border: 1px solid var(--line-2); background: var(--glass); box-shadow: var(--shadow); overflow: hidden; -webkit-tap-highlight-color: transparent;
  transition: transform .28s var(--ease-out), border-color .2s, background .2s, box-shadow .25s, opacity .2s, filter .2s; }
.pick::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(120% 80% at 50% 0%, var(--sheen), transparent 60%); }
.pick b { font-weight: 800; font-size: clamp(40px, 5.6vw, 64px); line-height: 1; letter-spacing: -.05em; }
.pick span { font-weight: 700; font-size: 14px; color: var(--ink-2); letter-spacing: -.1px; }
.pick small { margin-top: 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.pick.ghost { border-style: dashed; background: transparent; box-shadow: none; }
.pick.ghost b { font-size: clamp(30px, 3.8vw, 42px); padding: 6px 0 4px; }
@media (hover: hover) {
  .pick:hover { transform: translateY(-4px); border-color: var(--line-3); background: var(--glass-2); box-shadow: var(--shadow-up); }
  .pick:hover::before { opacity: 1; }
}
.pick:active { transform: scale(.95); transition-duration: .1s; }
.pick.dim, .subj.dim { opacity: 0; transform: scale(.96); transition: opacity .24s ease, transform .3s var(--ease-out); }
.picking .ask, .picking .hint, .picking .crumbs, .picking .dots, .picking .sem-head, .picking .sem-jump, .picking .note { opacity: 0; transition: opacity .22s ease; }
.hint { margin-top: 28px; border: 0; background: none; padding: 6px 10px; border-radius: 8px; color: var(--ink-3); font-weight: 600; font-size: 13px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; transition: color .15s; }
.hint:hover { color: var(--ink); }

/* breadcrumb pill: "2n curs ✎ · 1r sem ✎" */
.crumbs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); box-shadow: var(--shadow); }
.crumb { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 14px; border-radius: 999px; text-decoration: none; font-size: 13px; color: var(--ink); transition: background .18s, color .18s, transform .2s var(--ease-out); }
.crumb b { font-weight: 700; }
.crumb svg { width: 13px; height: 13px; color: var(--ink-3); transition: color .18s, transform .25s var(--ease-out); }
.crumb + .crumb { position: relative; }
.crumb + .crumb::before { content: ''; position: absolute; left: -3px; top: 9px; bottom: 9px; width: 1px; background: var(--line-2); }
.crumb:hover { background: var(--solid); color: var(--on-solid); }
.crumb:hover svg { color: inherit; transform: rotate(-12deg) scale(1.1); }
.crumb:active { transform: scale(.95); }

/* ============ Subjects of a semester ============ */
.list-view { padding: 34px 0 8px; }
.list-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 30px; }
.list-head .dots { margin-bottom: 18px; }
.list-head .ask { margin-top: 16px; }
/* semesters: big headings, 2n semestre is its own section further down (with a divider) */
.sem-block { scroll-margin-top: 84px; }
.sem-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 0 22px; text-align: center;
  font-weight: 800; font-size: clamp(26px, 3.4vw, 38px); line-height: 1.05; letter-spacing: -.035em; text-wrap: balance; }
.sem-head small { font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--ink-3); }
.sem-block.split + .sem-block.split { position: relative; margin-top: clamp(64px, 9vw, 112px); padding-top: clamp(52px, 7vw, 88px); }
.sem-block.split + .sem-block.split::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2) 18%, var(--line-3) 50%, var(--line-2) 82%, transparent); }
.list-head + .sem-block .sem-head { margin-top: 22px; }
/* floating jump pill: 1r sem · 2n sem */
.sem-jump { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 15; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--bar); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow-pop); animation: up .4s var(--ease-out) .5s backwards; }
.sem-jump a { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; transition: background .2s, color .2s; }
.sem-jump a:hover { color: var(--ink); }
.sem-jump a.on { background: var(--solid); color: var(--on-solid); }
main[data-view="list"] { padding-bottom: 96px; }
.subj-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.subj-grid .subj { flex: 0 1 calc((100% - 28px) / 3); min-width: 0; }
.subj { position: relative; display: flex; flex-direction: column; min-height: 124px; padding: 20px 20px 16px; border-radius: 16px; text-decoration: none; overflow: hidden;
  transition: transform .28s var(--ease-out), border-color .2s, background .2s, box-shadow .25s, opacity .2s; }
.subj::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; background: radial-gradient(90% 70% at 0% 0%, var(--sheen), transparent 65%); }
.subj-name { font-weight: 700; font-size: 20px; line-height: 1.18; letter-spacing: -.45px; text-wrap: balance; }
.subj .old { margin-top: 5px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.subj-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subj-n { font-size: 13px; font-weight: 600; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; transition: color .2s; }
.subj-foot > svg { width: 18px; height: 18px; flex: none; color: var(--ink-4); transition: transform .25s var(--ease-out), color .2s; }
@media (hover: hover) {
  .subj:hover { transform: translateY(-3px); border-color: var(--line-3); background: var(--glass-2); box-shadow: var(--shadow-up); }
  .subj:hover::before { opacity: 1; }
  .subj:hover .subj-n { color: var(--ink-2); }
  .subj:hover .subj-foot > svg { color: var(--ink); transform: translateX(4px); }
}
.subj:active { transform: scale(.98); transition-duration: .1s; }
.subj.empty { background: transparent; border-style: dashed; border-color: var(--line-2); box-shadow: none; }
.subj.empty .subj-name { color: var(--ink-3); font-weight: 600; }
.subj.empty .subj-n { color: var(--ink-4); }
.subj.empty .subj-foot > svg { opacity: .4; }
.note { text-align: center; color: var(--ink-3); font-weight: 500; font-size: 13.5px; margin: 26px 0 0; }

/* ============ Subject ============ */
.subject-head { padding: 30px 4px 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; font-size: 12.5px; color: var(--ink-3); transition: color .15s; }
.back svg { width: 15px; height: 15px; transition: transform .2s; }
.back:hover { color: var(--ink); }
.back:hover svg { transform: translateX(-3px); }
.subject-head h1 { font-weight: 800; font-size: clamp(26px, 3.6vw, 42px); line-height: 1.12; letter-spacing: -.8px; margin: 8px 0 0; text-wrap: balance; }
.subject-head .old { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }

.filters { position: sticky; top: 64px; z-index: 10; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; padding: 6px; margin: 14px 0 12px;
  background: var(--bar); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.kind-nav { position: relative; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.kind-nav::-webkit-scrollbar { display: none; }
.kind-nav a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; transition: background .15s, color .15s; }
.kind-nav a span { font-size: 11px; font-weight: 600; color: var(--ink-4); font-variant-numeric: tabular-nums; transition: color .15s; }
.kind-nav a:hover { color: var(--ink); background: var(--hover); }
.kind-nav a.on { background: var(--solid); color: var(--on-solid); }
.kind-nav a.on span { color: color-mix(in srgb, var(--on-solid) 55%, transparent); }
.tools { display: flex; align-items: center; gap: 6px; flex: none; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 8px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); user-select: none; transition: border-color .15s, color .15s; }
.switch:hover { border-color: var(--line-3); color: var(--ink); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; width: 26px; height: 15px; border-radius: 999px; border: 1px solid var(--line-3); transition: background .2s, border-color .2s; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); transition: transform .2s ease, background .2s; }
.switch input:checked + i { background: var(--solid); border-color: var(--solid); }
.switch input:checked + i::after { transform: translateX(11px); background: var(--on-solid); }
.switch input:focus-visible + i { outline: 1.5px solid var(--ink); outline-offset: 2px; }
.select { appearance: none; height: 30px; padding: 0 28px 0 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); transition: border-color .15s, color .15s;
  background: transparent url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'><path d='M7 10l5 5 5-5z'/></svg>") no-repeat right 6px center/16px; }
.select:hover { border-color: var(--line-3); color: var(--ink); }
.select option { background: #fff; color: #111; }
[data-theme="dark"] .select option { background: #111; color: #eee; }

.sections.multi { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.sections.multi > .col { display: contents; }
@media (min-width: 1500px) { .sections.multi { grid-template-columns: 1fr 1fr; } .sections.multi > .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; } }
.sections:not(.multi) .section { margin-bottom: 14px; }
.section { padding: 14px 8px 8px; scroll-margin-top: 130px; min-width: 0; }
.section h2 { margin: 0 12px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-3); }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; align-items: start; padding: 11px 12px; transition: background .15s; }
.row + .row { border-top: 1px solid var(--line); }
.rows { border-radius: 8px; overflow: hidden; }
.row:hover { background: rgba(0,0,0,.022); }
[data-theme="dark"] .row:hover { background: rgba(255,255,255,.025); }
.year { display: flex; flex-direction: column; gap: 1px; padding-top: 8px; min-width: 0; }
.year b { font-weight: 700; font-size: 16px; line-height: 1.4; letter-spacing: -.1px; font-variant-numeric: tabular-nums; }
.year b sup { font-weight: 600; font-size: 12px; color: var(--ink-3); margin-left: 2px; cursor: var(--cur-hand); }
.year small { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.files { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; min-width: 0; }

/* file chips: outlined = statement, filled white = solution, dim = not downloaded */
.file { display: inline-flex; align-items: center; height: 40px; max-width: 100%; border-radius: 10px; font-size: 14.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.file:not(.missing) { border: 1px solid var(--line-3); background: var(--glass); color: var(--ink); transition: border-color .15s, background .15s, color .15s; }
.file:not(.missing):hover { border-color: var(--ink); background: var(--glass-2); }
.file .open { display: inline-flex; align-items: center; gap: 8px; height: 100%; min-width: 0; border: 0; background: none; padding: 0 12px 0 13px; font-weight: 600; color: inherit; border-radius: 9px 0 0 9px; }
.file .open span { overflow: hidden; text-overflow: ellipsis; }
.file .open svg { width: 17px; height: 17px; opacity: .6; }
.file .div { width: 1px; height: 18px; background: currentColor; opacity: .18; }
.file .dl { display: grid; place-items: center; width: 38px; height: 100%; color: inherit; opacity: .55; border-radius: 0 9px 9px 0; transition: opacity .15s; }
.file .dl svg { width: 17px; height: 17px; }
.file .dl:hover { opacity: 1; }
.file.sol:not(.missing) { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.file.sol:not(.missing):hover { background: color-mix(in srgb, var(--solid) 86%, transparent); border-color: transparent; }
.file.sol .open svg { opacity: .85; }
.file.missing { gap: 7px; padding: 0 13px; color: var(--ink-3); font-weight: 500; border: 1px dashed var(--line-2); opacity: .85; transition: color .15s, border-color .15s, opacity .15s; }
.file.missing svg { width: 13px; height: 13px; opacity: .8; }
.file.missing:hover { color: var(--ink); border-color: var(--line-2); opacity: 1; }
.no-match { color: var(--ink-3); padding: 24px 4px; font-weight: 500; font-size: 13.5px; }

.empty-state { margin: 16px 0; padding: 22px 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.empty-state h2 { font-weight: 700; font-size: 15px; margin: 0; }
.empty-state p { color: var(--ink-3); margin: 0 0 12px; font-size: 13.5px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 8px; background: var(--solid); color: var(--on-solid); text-decoration: none; font-weight: 700; font-size: 12.5px; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.back:active, .btn:active, .file:active, .kind-nav a:active, .switch:active { transform: scale(.96); }
.file, .kind-nav a, .switch, .back, .btn { transition-property: border-color, background, color, opacity, transform; transition-duration: .15s; }

.foot { padding: 18px clamp(16px, 4vw, 40px) 26px; color: var(--ink-3); font-size: 11.5px; text-align: center; }
.foot p { max-width: 560px; margin: 0 auto; }
.foot a { color: var(--ink-2); font-weight: 600; text-decoration-color: var(--line-2); text-underline-offset: 2px; transition: color .15s; }
.foot a:hover { color: var(--ink); }

/* ============ Viewer ============ */
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--v-bg); color: var(--v-ink); animation: vin .2s ease; }
@keyframes vin { from { opacity: 0; transform: scale(.99); } }
.v-top { display: flex; align-items: center; gap: 12px; padding: 7px 10px; background: var(--v-bar); border-bottom: 1px solid var(--v-line); box-shadow: 0 1px 0 var(--v-line); flex-wrap: wrap; backdrop-filter: blur(14px); }
.v-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; margin-right: 6px; }
.v-title strong { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.v-title span { font-size: 11.5px; font-weight: 500; color: var(--v-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.v-files { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--v-line); border-radius: 10px; overflow-x: auto; max-width: 34vw; scrollbar-width: none; }
.v-files button { border: 1px solid transparent; background: none; color: var(--v-ink-3); height: 28px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; transition: color .15s, background .15s; }
.v-files button:hover { color: var(--v-ink); background: var(--v-hover); }
.v-files button.sol { border-color: var(--v-line-2); }
.v-files button.on { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.v-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.v-btn { display: inline-grid; place-items: center; grid-auto-flow: column; gap: 6px; height: 32px; min-width: 32px; padding: 0 7px; border: 0; border-radius: 8px; background: none; color: var(--v-ink-2); text-decoration: none; font-size: 12.5px; font-weight: 600; transition: background .15s, color .15s; }
.v-btn:hover { background: var(--v-hover); color: var(--v-ink); } .v-btn.on { background: var(--v-on); color: var(--v-ink); }
.v-btn.primary { background: var(--solid); color: var(--on-solid); padding: 0 12px; margin-left: 4px; } .v-btn.primary:hover { background: var(--solid); opacity: .86; color: var(--on-solid); }
.v-btn svg { width: 18px; height: 18px; }
.v-zoom { border: 1px solid var(--v-line); background: none; color: var(--v-ink); font-weight: 600; font-size: 11.5px; font-variant-numeric: tabular-nums; height: 28px; padding: 0 8px; border-radius: 7px; min-width: 54px; }
.v-zoom:hover { border-color: var(--v-line-2); }
.v-sep { width: 1px; height: 20px; background: var(--v-line); margin: 0 5px; }
.v-page { font-weight: 500; font-size: 12px; color: var(--v-ink-3); display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.v-page input { width: 42px; height: 28px; background: none; border: 1px solid var(--v-line-2); color: var(--v-ink); border-radius: 7px; padding: 0 4px; text-align: center; font: inherit; -moz-appearance: textfield; }
.v-page input:focus { outline: none; border-color: var(--v-ink-3); }
.v-page input::-webkit-inner-spin-button { -webkit-appearance: none; }
.v-body { flex: 1; display: flex; min-height: 0; }
.v-thumbs { width: 150px; flex: none; overflow-y: auto; background: var(--v-side); border-right: 1px solid var(--v-line); padding: 12px 18px; display: flex; flex-direction: column; gap: 14px; transition: margin .2s; scrollbar-width: thin; scrollbar-color: var(--v-scroll) transparent; }
.v-thumbs.hide { margin-left: -150px; }
.v-thumb { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--v-ink-3); font-weight: 600; font-size: 11px; }
.v-thumb canvas, .v-thumb .ph { width: 100%; border-radius: 3px; box-shadow: var(--v-shadow); background: #fff; outline: 1.5px solid transparent; outline-offset: 3px; transition: outline-color .15s; }
.v-thumb .ph { aspect-ratio: 1 / 1.414; background: var(--v-ph); }
.v-thumb:hover canvas { outline-color: var(--v-line-2); }
.v-thumb.on canvas, .v-thumb.on .ph { outline-color: var(--v-ink); } .v-thumb.on { color: var(--v-ink); }
.v-panes { flex: 1; display: flex; min-width: 0; }
.v-pane { position: relative; flex: 1; overflow: auto; min-width: 0; scroll-behavior: auto; scrollbar-width: thin; scrollbar-color: var(--v-scroll) transparent; }
.v-pane + .v-pane { border-left: 1px solid var(--v-line-2); }
.v-pane .pane-label { position: sticky; top: 10px; left: 10px; z-index: 3; display: inline-block; margin: 10px 0 0 10px; padding: 4px 10px; border-radius: 7px; background: var(--v-bar); border: 1px solid var(--v-line-2); color: var(--v-ink); font-size: 11.5px; font-weight: 600; backdrop-filter: blur(8px); }
.v-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 24px 60px; min-width: min-content; }
.v-pagebox { position: relative; background: #fff; box-shadow: var(--v-shadow); flex: none; border-radius: 2px; }
.v-pagebox canvas { display: block; width: 100%; height: 100%; border-radius: 2px; }
.v-pagebox .textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; }
.v-pagebox .textLayer span { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; }
.v-pagebox .textLayer ::selection { background: rgba(0, 0, 0, .22); }
.v-pagebox .pnum { position: absolute; bottom: -19px; right: 0; font-weight: 600; font-size: 10.5px; color: var(--v-ink-3); }
.v-img { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.v-img img { max-width: none; box-shadow: var(--v-shadow); background: #fff; user-select: none; -webkit-user-drag: none; transition: transform .15s ease; }
.v-msg { display: grid; place-items: center; height: 100%; text-align: center; padding: 30px; color: var(--v-ink-3); font-weight: 500; }
.v-msg .box { max-width: 420px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.v-msg a { color: var(--on-solid); background: var(--solid); padding: 8px 16px; border-radius: 8px; text-decoration: none; font-weight: 700; font-size: 13px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--v-line-2); border-top-color: var(--v-ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-toast { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--v-bar); border: 1px solid var(--v-line-2); box-shadow: var(--shadow-pop); backdrop-filter: blur(10px); padding: 7px 14px; border-radius: 9px; font-size: 12px; font-weight: 500; color: var(--v-ink-2); pointer-events: none; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }

/* ============ Sparkle layer ============ */
.sparkles { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 2147483000; pointer-events: none; }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .subj-grid .subj { flex-basis: calc((100% - 14px) / 2); }
}
@media (max-width: 900px) {
  .v-title strong, .v-title span { max-width: 60vw; }
  .v-files { max-width: 100%; order: 3; width: 100%; } .v-tools { order: 4; width: 100%; overflow-x: auto; }
  .v-thumbs { display: none; } .v-sep { display: none; }
}
@media (max-width: 700px) {
  .topbar-in { flex-wrap: wrap; gap: 8px; } .search { order: 3; max-width: none; flex-basis: 100%; } .search kbd { display: none; }
  .top-actions { margin-left: auto; } .brand-text small { display: none; }
  .filters { top: 108px; }
  .section { scroll-margin-top: 220px; }
  .step { min-height: calc(100svh - 190px); padding: 24px 0 40px; }
  .step .ask { margin: 12px 0 26px; }
  .picks-4 { grid-template-columns: repeat(2, 1fr); max-width: 340px; }
  .picks-3 { grid-template-columns: repeat(2, 1fr); max-width: 340px; }
  .picks-3 .pick.ghost { grid-column: 1 / -1; aspect-ratio: auto; flex-direction: row; gap: 10px; padding: 16px; }
  .picks-3 .pick.ghost b { font-size: 24px; padding: 0; } .picks-3 .pick.ghost small { margin: 0 0 0 auto; }
  .pick { border-radius: 18px; aspect-ratio: 1 / .9; }
  .list-view { padding-top: 22px; } .list-head { margin-bottom: 20px; }
  .subj-grid { gap: 10px; } .subj-grid .subj { flex-basis: 100%; }
  .subj { min-height: 0; padding: 16px 16px 13px; } .subj-foot { padding-top: 12px; } .subj-name { font-size: 17.5px; }
  .sem-head { margin-bottom: 16px; }
  .kind-nav { flex-basis: 100%; }
  .tools { width: 100%; } .tools .select { margin-left: auto; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 10px; }
  .year { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding-top: 0; }
  .section { padding: 12px 4px 6px; }
  .file { height: 40px; font-size: 14px; }
  .v-btn span { display: none; }
}
/* ============ Dot-matrix crown (js/crown.js) ============ */
/* one persistent overlay at the top-right of the content column (same spot on picker and course page);
   zero-height and pointer-transparent so it never moves or blocks the page — only the canvas is interactive */
.crown-dock { position: relative; z-index: 5; height: 0; width: 100%; max-width: calc(var(--wrap) + 2 * clamp(12px, 3vw, 32px)); margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 32px); box-sizing: border-box; pointer-events: none; view-transition-name: crown-dock; }
::view-transition-group(crown-dock), ::view-transition-old(crown-dock), ::view-transition-new(crown-dock) { animation: none; }
.crown-slot { position: absolute; top: 16px; right: clamp(12px, 3vw, 32px); width: 210px; height: 210px; pointer-events: none; }
.crown-canvas { display: block; pointer-events: auto; touch-action: pan-y; cursor: grab; -webkit-tap-highlight-color: transparent; outline: none; }
.crown-canvas.grabbing { cursor: grabbing; }
.crown-canvas:focus-visible { outline: 1.5px solid var(--line-3); outline-offset: 4px; border-radius: 12px; }
@media (max-width: 1199px) { .crown-slot { top: 12px; width: 120px; height: 120px; } }
@media (max-width: 700px) { .crown-slot { top: 8px; width: 84px; height: 84px; } }
.crown-dock.clash .crown-slot { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }
.foot-contact{margin-top:6px}
.foot-contact a{color:inherit;text-decoration:underline;text-underline-offset:3px}
.note.optatives{margin-top:48px;text-align:center;opacity:.75;font-style:italic}
