/* Studied: look carried over from the Estudi study site (cream paper, navy + gold, Inter + STIX),
   dressed as a beautiful notebook: paper grain, ruled index cards, gold bookmark ribbons, warm shadows. */
:root {
  --ink: #1a1e26; --soft: #545b68; --faint: #6a717d; --line: #e4ded2; --line-2: #d8d0bf; --bg: #f3f0e9; --bg-2: #ebe6da; --card: #ffffff; --paper: #fffdf8;
  --navy: #0f3d5e; --navy-ink: #0f3d5e; --navy-2: #e7eff7; --navy-line: #bcd2e6; --navy-deep: #0a2c45;
  --gold: #c9952e; --gold-ink: #7d5a10; --gold-2: #fff4dc; --gold-line: #f0d9a5; --gold-hi: #e6b85a;
  --red: #b3372a; --red-2: #fcefec; --red-line: #efc5bf; --green: #1f6d45; --green-2: #e6f4ec; --green-line: #b9dfc8; --violet: #6b4a9e; --violet-2: #f1ebf9;
  --margin: rgba(196, 72, 60, .28); --rule: rgba(15, 61, 94, .075);
  --r: 18px;
  --sh: 0 1px 1px rgba(70, 52, 20, .04), 0 2px 6px rgba(70, 52, 20, .05), 0 10px 26px -8px rgba(70, 52, 20, .10);
  --sh-lg: 0 2px 4px rgba(70, 52, 20, .06), 0 22px 50px -12px rgba(40, 32, 18, .28);
  --sh-press: 0 1px 2px rgba(70, 52, 20, .08);
  --ring: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold);
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "STIX Two Text", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --math: "STIX Two Text", "STIX Two Math", "Cambria Math", Georgia, serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .16 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #ece8df; --soft: #b0b6c0; --faint: #8d94a0; --line: #2e3440; --line-2: #3a414e; --bg: #14171c; --bg-2: #191d24; --card: #1f242c; --paper: #222831;
  --navy: #2f6f9e; --navy-ink: #9cc6ea; --navy-2: #1b2a38; --navy-line: #2d4a63; --navy-deep: #0b2233;
  --gold: #d9a640; --gold-ink: #f0c766; --gold-2: #2e2614; --gold-line: #5a4720; --gold-hi: #f0c766;
  --red: #e57a69; --red-2: #34201d; --red-line: #5e2f28; --green: #5cbd89; --green-2: #18291f; --green-line: #2b5038; --violet-2: #261f33;
  --margin: rgba(229, 122, 105, .22); --rule: rgba(156, 198, 234, .07);
  --sh: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -6px rgba(0,0,0,.35); --sh-lg: 0 24px 54px -10px rgba(0,0,0,.6); --sh-press: 0 1px 2px rgba(0,0,0,.4);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-theme="dark"]) {
  --ink: #ece8df; --soft: #b0b6c0; --faint: #8d94a0; --line: #2e3440; --line-2: #3a414e; --bg: #14171c; --bg-2: #191d24; --card: #1f242c; --paper: #222831;
  --navy: #2f6f9e; --navy-ink: #9cc6ea; --navy-2: #1b2a38; --navy-line: #2d4a63; --navy-deep: #0b2233;
  --gold: #d9a640; --gold-ink: #f0c766; --gold-2: #2e2614; --gold-line: #5a4720; --gold-hi: #f0c766;
  --red: #e57a69; --red-2: #34201d; --red-line: #5e2f28; --green: #5cbd89; --green-2: #18291f; --green-line: #2b5038; --violet-2: #261f33;
  --margin: rgba(229, 122, 105, .22); --rule: rgba(156, 198, 234, .07);
  --sh: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -6px rgba(0,0,0,.35); --sh-lg: 0 24px 54px -10px rgba(0,0,0,.6); --sh-press: 0 1px 2px rgba(0,0,0,.4);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg) var(--grain); color: var(--ink); font: 16px/1.55 var(--ui); min-height: 100vh; overscroll-behavior-y: none; font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--gold-line); color: var(--ink); }
a { color: var(--navy-ink); text-underline-offset: 2px; }
h1 { font-family: var(--serif); font-size: 38px; line-height: 1.08; margin: 2px 0 8px; font-weight: 700; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-size: 13px; margin: 30px 0 12px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--soft); display: flex; align-items: center; gap: 10px; }
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); order: 1; }
h2 .more { order: 2; margin-left: 0; font-size: 13.5px; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--navy-ink); text-decoration: none; cursor: pointer; padding: 4px 10px; border-radius: 999px; transition: background .15s; }
@media (hover: hover) { h2 .more:hover { background: var(--navy-2); } }
.modal h2, .empty h2 { font-family: var(--serif); font-size: 26px; letter-spacing: -.01em; text-transform: none; color: var(--ink); font-weight: 700; }
.modal h2::after { display: none; }
h3 { font-size: 16px; margin: 18px 0 6px; color: var(--navy-ink); font-weight: 700; letter-spacing: -.005em; }
b, strong { font-weight: 650; }
.sub { color: var(--soft); margin: 0 0 12px; }
.hi { color: var(--soft); font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; } .hi::first-letter { text-transform: uppercase; }
.f, code.f { font-family: var(--math); font-size: 1.1em; }
.muted { color: var(--soft); } .faint { color: var(--faint); } .small { font-size: 13.5px; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; }
input:not([type=checkbox]):not([type=radio]):focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* ---------- inline svg icons ---------- */
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.ico svg { width: 100%; height: 100%; display: block; }

/* ---------- buttons ---------- */
button, .btn { font: inherit; color: var(--ink); cursor: pointer; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 9px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-weight: 620; font-size: 15px; letter-spacing: -.005em; box-shadow: 0 1px 1px rgba(70,52,20,.05); transition: transform .12s var(--ease), box-shadow .18s, background .18s, border-color .18s, color .18s; }
@media (hover: hover) { button:hover:not(:disabled), .btn:hover { border-color: var(--line-2); box-shadow: var(--sh); } }
button:active:not(:disabled), .btn:active { transform: translateY(1px) scale(.985); box-shadow: var(--sh-press); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: linear-gradient(180deg, #17507a, var(--navy)); color: #fff; border-color: var(--navy-deep); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 2px 8px -2px rgba(15,61,94,.45); }
@media (hover: hover) { .primary:hover:not(:disabled) { border-color: var(--navy-deep); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 8px 20px -6px rgba(15,61,94,.55); } }
.gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #1a1e26; border-color: #b8862a; font-weight: 750; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 3px 10px -3px rgba(170,120,30,.55); }
@media (hover: hover) { .gold:hover:not(:disabled) { border-color: #a97a22; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 10px 22px -8px rgba(170,120,30,.7); } }
.good { background: var(--green); color: #fff; border-color: var(--green); }
.bad { background: var(--red); color: #fff; border-color: var(--red); }
:root[data-theme="dark"] .bad, :root[data-theme="dark"] .good { color: #14171c; }
.ghost { background: transparent; border-color: transparent; color: var(--navy-ink); box-shadow: none; }
@media (hover: hover) { .ghost:hover:not(:disabled) { background: var(--navy-2); border-color: transparent; box-shadow: none; } }
.pill { border-radius: 999px; }
.icon-btn { width: 44px; padding: 0; border-radius: 50%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---------- inputs ---------- */
input, textarea, select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 13px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { border-color: var(--navy); box-shadow: 0 0 0 4px var(--navy-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--navy); width: 18px; height: 18px; padding: 0; box-shadow: none; flex: none; }
:root[data-theme="dark"] input[type=checkbox], :root[data-theme="dark"] input[type=radio] { accent-color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input[type=checkbox], :root:not([data-theme="light"]) input[type=radio] { accent-color: var(--gold); } }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8f99' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; cursor: pointer; }
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
label.field { display: block; margin: 14px 0; } label.field > span { display: block; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--soft); margin-bottom: 6px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid rgba(120, 100, 60, .07); border-radius: var(--r); padding: 18px 20px; margin: 12px 0; box-shadow: var(--sh); }
.key { border: 1px solid var(--navy-line); background: var(--navy-2); box-shadow: none; }
.warn { border: 1px solid var(--gold-line); background: var(--gold-2); box-shadow: none; }
.err { border: 1px solid var(--red-line); background: var(--red-2); box-shadow: none; }
.ok { border: 1px solid var(--green-line); background: var(--green-2); box-shadow: none; }
.card.ok > b:first-child, .card.ok .row > b { color: var(--green); }
.card.err > b:first-child, .card.err .row > b { color: var(--red); }
.card.warn .row > b { color: var(--gold-ink); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2) var(--grain); border-right: 1px solid var(--line); padding: calc(22px + var(--safe-t)) 14px 18px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-weight: 700; font-size: 25px; letter-spacing: -.01em; margin: 0 8px 22px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 4px 10px -2px rgba(15,61,94,.35); }
.nav { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; font-weight: 600; font-size: 15px; color: var(--soft); text-decoration: none; cursor: pointer; transition: background .15s, color .15s; min-height: 40px; }
@media (hover: hover) { .nav:hover { background: color-mix(in srgb, var(--card) 55%, transparent); color: var(--ink); } }
.nav.on { background: var(--card); color: var(--ink); box-shadow: var(--sh); }
.nav.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav .em { width: 22px; height: 22px; display: grid; place-items: center; font-size: 16px; flex: none; }
.nav .em svg { width: 19px; height: 19px; }
.nav.on .em svg { color: var(--navy-ink); }
.nav .sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-left: -4px; flex: none; opacity: .9; }
.nav .due { margin-left: auto; font-size: 11.5px; font-weight: 750; color: var(--gold-ink); background: var(--gold-2); border: 1px solid var(--gold-line); border-radius: 999px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.nav.add { color: var(--navy-ink); }
.side h4 { font-size: 11px; letter-spacing: .12em; color: var(--faint); margin: 20px 11px 6px; text-transform: uppercase; font-weight: 750; }
.side .spacer { flex: 1; min-height: 16px; }
.main { min-width: 0; }
.wrap { max-width: 1060px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 36px 110px; }
.tabbar, .fab { display: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .wrap { padding: calc(16px + var(--safe-t)) 18px calc(130px + var(--safe-b)); }
  h1 { font-size: 34px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); justify-content: space-around; box-shadow: 0 -8px 24px -12px rgba(70,52,20,.18); }
  .tabbar a { flex: 1; text-align: center; font-size: 11px; font-weight: 650; color: var(--soft); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; min-height: 52px; justify-content: center; transition: color .15s; }
  .tabbar a svg { width: 24px; height: 24px; padding: 0; box-sizing: content-box; padding: 3px 16px; border-radius: 999px; transition: background .2s var(--ease); }
  .tabbar a.on { color: var(--navy-ink); }
  .tabbar a.on svg { background: var(--navy-2); }
  .tabbar a:active svg { transform: scale(.92); }
  .fab { display: inline-flex; position: fixed; right: 18px; bottom: calc(88px + var(--safe-b)); z-index: 31; border-radius: 999px; padding: 13px 20px; min-height: 50px; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 10px 26px -6px rgba(170,120,30,.6); }
}

/* ---------- today ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.session { color: #fff; border-radius: 26px; padding: 26px 26px 24px; box-shadow: var(--sh-lg); position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; isolation: isolate;
  background:
    radial-gradient(55% 65% at 100% 100%, rgba(230,184,90,.13), transparent 70%),
    radial-gradient(80% 70% at 0% 0%, rgba(120,170,215,.22), transparent 60%),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(255,255,255,.045) 31px 32px),
    linear-gradient(155deg, #18557f, #0f3d5e 45%, #0a2a42); }
.session::before { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .9; mix-blend-mode: overlay; z-index: -1; pointer-events: none; }
.session::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 0 0 1px rgba(255,255,255,.06); pointer-events: none; }
.session .ribbon { position: absolute; top: -2px; left: 30px; width: 22px; height: 46px; background: linear-gradient(180deg, #b8862a, var(--gold-hi) 70%); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); box-shadow: 0 2px 6px rgba(0,0,0,.25); filter: drop-shadow(0 3px 4px rgba(0,0,0,.25)); }
.session > div:first-of-type { padding-top: 22px; min-width: 0; }
.session .k { font-size: 11.5px; letter-spacing: .12em; font-weight: 750; color: rgba(255,255,255,.72); text-transform: uppercase; }
.session .t { font-family: var(--serif); font-size: 31px; font-weight: 700; line-height: 1.12; margin: 6px 0 14px; letter-spacing: -.01em; text-wrap: balance; }
.session ul { margin: 0; padding: 0; list-style: none; font-size: 15px; color: rgba(255,255,255,.92); }
.session li { margin: 0; padding: 7px 0; display: flex; gap: 11px; align-items: baseline; border-top: 1px solid rgba(255,255,255,.09); line-height: 1.4; }
.session li:first-child { border-top: 0; padding-top: 2px; }
.session li .bx { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.45); display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; transform: translateY(3px); color: #1a1e26; }
.session li.done { color: rgba(255,255,255,.55); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.35); }
.session li.done .bx { background: var(--gold); border-color: var(--gold); }
.session li.ex .bx { border-color: var(--gold-hi); color: var(--gold-hi); }
.session .go { margin-top: 18px; position: relative; z-index: 1; padding: 11px 22px; min-height: 48px; font-size: 16px; }
.session .go .arr { transition: transform .2s var(--ease); display: inline-block; }
@media (hover: hover) { .session .go:hover .arr { transform: translateX(3px); } }
.ring { width: 118px; height: 118px; position: relative; z-index: 1; filter: drop-shadow(0 4px 14px rgba(0,0,0,.25)); }
.ring .pct { font: 700 27px var(--serif); fill: #fff; }
.ring .lbl { font: 700 8.5px var(--ui); fill: rgba(255,255,255,.65); letter-spacing: .14em; }
.ring .arc { transition: stroke-dashoffset .9s var(--ease); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.stat { position: relative; background: var(--card); border-radius: 18px; padding: 15px 16px 14px; box-shadow: var(--sh); border: 1px solid rgba(120,100,60,.06); display: grid; grid-template-columns: 1fr auto; column-gap: 10px; overflow: hidden; }
.stat .k { font-size: 11px; font-weight: 750; letter-spacing: .1em; color: var(--soft); text-transform: uppercase; grid-column: 1; }
.stat .v { font-family: var(--serif); font-size: 36px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.01em; margin-top: 4px; grid-column: 1; }
.stat .v small { font-size: .5em; font-weight: 600; color: var(--soft); margin-left: 5px; }
.stat .s { font-size: 13px; color: var(--soft); grid-column: 1; }
.stat .si { grid-column: 2; grid-row: 1 / span 3; align-self: start; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--gold-2); color: var(--gold-ink); }
.stat .si svg { width: 20px; height: 20px; }
.stat.mem .si { background: var(--green-2); color: var(--green); }
.stat.later .si { background: var(--navy-2); color: var(--navy-ink); }
.stat .mini { grid-column: 1 / -1; height: 4px; border-radius: 9px; background: var(--bg-2); margin-top: 10px; overflow: hidden; }
.stat .mini i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; } .stats .stat:nth-child(3) { display: none; }
  .session { grid-template-columns: 1fr; padding: 22px 20px 20px; border-radius: 24px; }
  .session .ribbon { left: 22px; }
  .ring { position: absolute; right: 14px; top: 14px; width: 78px; height: 78px; }
  .ring .lbl { display: none; } .ring .pct { font-size: 30px; }
  .session .t { font-size: 27px; padding-right: 76px; } .session .k { padding-right: 84px; }
  .session .go { width: 100%; }
  .stat .v { font-size: 32px; }
}
/* exams: tear-off calendar pages */
.exams { display: flex; gap: 12px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.exams::-webkit-scrollbar { display: none; }
.exam { position: relative; flex: none; width: 150px; background: var(--paper); border-radius: 14px; box-shadow: var(--sh); cursor: pointer; overflow: hidden; scroll-snap-align: start; transition: transform .18s var(--ease), box-shadow .18s; border: 1px solid rgba(120,100,60,.08); }
@media (hover: hover) { .exam:hover { transform: translateY(-2px) rotate(-.4deg); box-shadow: var(--sh-lg); } }
.exam:active { transform: scale(.98); }
.exam .top { background: var(--navy); color: #fff; font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; padding: 7px 12px 9px; display: flex; justify-content: space-between; position: relative; }
.exam .top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 6px; background: radial-gradient(circle at 5px 6px, var(--paper) 2.6px, transparent 3px) 0 0 / 10px 6px repeat-x; }
.exam .body { padding: 8px 12px 12px; }
.exam b { font-family: var(--serif); font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.02em; }
.exam i { font-style: normal; font-size: 13px; color: var(--soft); margin-left: 5px; font-weight: 600; }
.exam.soon .top { background: var(--red); }
.exam.soon b { color: var(--red); }
.exam .s { font-weight: 650; font-size: 14.5px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam .t { font-size: 12.5px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam.add { display: grid; place-items: center; align-content: center; gap: 4px; color: var(--navy-ink); font-weight: 650; border: 1.5px dashed var(--line-2); background: transparent; box-shadow: none; min-height: 132px; font-size: 14.5px; }
.exam.add .plus { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-2); display: grid; place-items: center; font-size: 20px; line-height: 1; }
@media (hover: hover) { .exam.add:hover { transform: none; border-color: var(--navy-line); background: color-mix(in srgb, var(--card) 50%, transparent); box-shadow: none; } }
/* subject tiles: notebooks with a coloured spine */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.tile { position: relative; display: flex; flex-direction: column; background: var(--paper); border-radius: 8px 18px 18px 8px; padding: 15px 15px 14px 25px; box-shadow: var(--sh); color: var(--ink); text-decoration: none; transition: transform .18s var(--ease), box-shadow .18s; cursor: pointer; border: 1px solid rgba(120,100,60,.07); min-height: 148px; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 11px; background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--navy)) 80%, #000), var(--c, var(--navy)) 55%, color-mix(in srgb, var(--c, var(--navy)) 75%, #fff)); }
.tile::after { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.08); }
@media (hover: hover) { .tile:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); } }
.tile:active { transform: scale(.985); }
.tile .em { font-size: 22px; line-height: 1; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--navy)) 13%, var(--paper)); }
.tile b { display: block; font-family: var(--serif); font-size: 20px; font-weight: 700; margin-top: 10px; line-height: 1.15; letter-spacing: -.005em; }
.tile small { display: block; color: var(--soft); font-size: 13px; line-height: 1.35; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .bar { height: 5px; border-radius: 9px; background: var(--bg-2); margin-top: auto; overflow: hidden; }
.tile .pl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--soft); font-weight: 650; margin: 12px 0 5px; font-variant-numeric: tabular-nums; }
.tile .bar i { display: block; height: 100%; background: var(--c, var(--green)); border-radius: 9px; transition: width .6s var(--ease); }
.badge { position: absolute; right: 12px; top: 13px; font-size: 11.5px; font-weight: 750; background: var(--gold-2); color: var(--gold-ink); border: 1px solid var(--gold-line); border-radius: 999px; padding: 1px 9px; font-variant-numeric: tabular-nums; }
.badge.soon { background: var(--red-2); color: var(--red); border-color: var(--red-line); }
.tile.new { border: 1.5px dashed var(--line-2); background: transparent; box-shadow: none; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--navy-ink); font-weight: 650; min-height: 148px; border-radius: 18px; padding: 14px; }
.tile.new::before, .tile.new::after { display: none; }
.tile.new .plus { width: 40px; height: 40px; border-radius: 50%; background: var(--navy-2); display: grid; place-items: center; font-size: 22px; }
@media (hover: hover) { .tile.new:hover { transform: none; box-shadow: none; border-color: var(--navy-line); background: color-mix(in srgb, var(--card) 50%, transparent); } }

/* ---------- subject page ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; min-height: 44px; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 14px; font-weight: 650; color: var(--navy-ink); background: var(--card); box-shadow: var(--sh); border-radius: 999px; padding: 8px 15px 8px 12px; min-height: 40px; transition: transform .12s var(--ease), box-shadow .18s; border: 1px solid rgba(120,100,60,.07); }
.back:active { transform: scale(.97); }
@media (hover: hover) { .back:hover { box-shadow: var(--sh-lg); } }
.shead { display: flex; align-items: center; gap: 16px; margin: 4px 0 2px; }
.shead .badge-ic { width: 60px; height: 60px; border-radius: 18px; flex: none; display: grid; place-items: center; font-size: 30px; background: color-mix(in srgb, var(--c, var(--navy)) 14%, var(--paper)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--navy)) 25%, transparent); position: relative; }
.shead .badge-ic::after { content: ""; position: absolute; right: 9px; top: -3px; width: 10px; height: 18px; background: var(--c, var(--gold)); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%); }
.shead h1 { margin: 2px 0 0; }
.shead .hi { margin: 0; }
.tabs { position: relative; display: flex; gap: 2px; margin: 18px 0 20px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: color-mix(in srgb, var(--bg-2) 85%, var(--line)); border-radius: 14px; width: max-content; max-width: 100%; box-shadow: inset 0 1px 2px rgba(70,52,20,.08); scroll-padding: 0 24px; }
@media (max-width: 680px) { .tabs { width: auto; margin-right: -18px; border-radius: 14px 0 0 14px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); } .tabs a { padding: 8px 12px; } }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 650; text-decoration: none; color: var(--soft); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; transition: background .18s, color .18s, box-shadow .18s; }
@media (hover: hover) { .tabs a:hover { color: var(--ink); } }
.tabs a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(70,52,20,.08), 0 3px 10px -3px rgba(70,52,20,.14); }
.tabs a .ico { width: 17px; height: 17px; color: var(--faint); vertical-align: 0; }
.tabs a.on .ico { color: var(--navy-ink); }
.tabs a .n { font-size: 11.5px; font-weight: 750; color: var(--gold-ink); background: var(--gold-2); border-radius: 999px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.cols > aside { position: sticky; top: 20px; }
@media (max-width: 980px) { .cols > aside { position: static; } }
.list .item { display: flex; gap: 13px; align-items: center; background: var(--card); border-radius: 14px; padding: 13px 15px; margin: 8px 0; box-shadow: var(--sh); cursor: pointer; text-decoration: none; color: var(--ink); border: 1px solid rgba(120,100,60,.06); transition: transform .15s var(--ease), box-shadow .18s, border-color .18s; }
@media (hover: hover) { .list .item:hover { transform: translateX(2px); box-shadow: var(--sh-lg); border-color: var(--line); } }
.list .item:active { transform: scale(.99); }
.list .item .ic { font-size: 19px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--navy-2); color: var(--navy-ink); flex: none; }
.list .item .ic svg { width: 19px; height: 19px; }
.list .item > div { min-width: 0; }
.list .item b { display: block; font-size: 15px; line-height: 1.35; }
.list .item small { display: block; color: var(--soft); font-size: 13px; line-height: 1.4; margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list .item .r { margin-left: auto; color: var(--soft); font-size: 12.5px; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 6px; }
.list .item .r.go { color: var(--navy-ink); }
.list .item .r.st { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--bg-2); }
.list .item .r.st.due { background: var(--gold-2); color: var(--gold-ink); }
.list .item .r.st.new { background: var(--navy-2); color: var(--navy-ink); }
.empty { position: relative; text-align: center; padding: 40px 22px 34px; color: var(--soft); background: var(--paper); border-radius: 22px; box-shadow: var(--sh); border: 1px solid rgba(120,100,60,.07); overflow: hidden; line-height: 1.5; }
.empty::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px); pointer-events: none; -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
.empty > * { position: relative; }
.empty .big { font-size: 34px; width: 76px; height: 76px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--sh), inset 0 0 0 6px var(--gold-2); }
.empty b { display: block; color: var(--ink); font-family: var(--serif); font-size: 22px; font-weight: 700; margin: 10px 0 4px; letter-spacing: -.005em; }

/* ---------- note body (rendered markdown) ---------- */
.note { font-size: 16.5px; line-height: 1.7; }
article.note { position: relative; background: var(--paper); padding: 26px 30px 26px 46px; }
article.note::before { content: ""; position: absolute; left: 26px; top: 0; bottom: 0; width: 1.5px; background: var(--margin); }
@media (max-width: 560px) { article.note { padding: 20px 16px 20px 32px; } article.note::before { left: 18px; } .note { font-size: 16px; } }
.note > :first-child { margin-top: 0; }
.note h1 { font-size: 28px; } .note h2 { font-family: var(--serif); font-size: 23px; margin: 26px 0 8px; color: var(--navy-ink); text-transform: none; letter-spacing: -.005em; font-weight: 700; display: block; }
.note h2::after { display: none; }
/* md.js shifts headings down one level: "#" -> h2, "##" -> h3, "###" -> h4 */
.note h3 { font-family: var(--serif); font-size: 22px; line-height: 1.25; margin: 28px 0 8px; color: var(--navy-ink); font-weight: 700; letter-spacing: -.005em; }
.note h4 { font-size: 16.5px; margin: 20px 0 4px; color: var(--ink); font-weight: 700; }
.note h5 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); margin: 18px 0 4px; }
.note p { margin: 9px 0; } .note ul, .note ol { padding-left: 22px; margin: 8px 0; } .note li { margin: 5px 0; padding-left: 2px; }
.note ul li::marker { color: var(--gold); } .note ol li::marker { color: var(--navy-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.note b, .note strong { color: var(--ink); background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--gold) 22%, transparent) 62%); padding: 0 1px; }
.note hr { border: 0; height: 1px; background: var(--line); margin: 22px 0; }
.note .tablewrap { overflow-x: auto; margin: 14px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.note table { border-collapse: collapse; width: 100%; margin: 0; font-size: 14.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.note td, .note th { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.note td + td, .note th + th { border-left: 1px solid var(--line); }
.note tr:last-child td { border-bottom: 0; }
.note tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.note th { background: var(--navy-2); color: var(--navy-ink); font-weight: 700; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
.note blockquote { position: relative; margin: 16px 0; border-radius: 4px 14px 14px 4px; padding: 12px 16px 12px 18px; border: 0; border-left: 4px solid var(--navy); background: var(--navy-2); }
.note blockquote.warn { border-left-color: var(--gold); background: var(--gold-2); }
.note blockquote.tip { border-left-color: var(--green); background: var(--green-2); }
.note blockquote p { margin: 3px 0; }
.note code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .86em; background: var(--bg-2); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
.note pre { background: var(--bg-2); padding: 14px 16px; border-radius: 12px; overflow-x: auto; border: 1px solid var(--line); line-height: 1.5; } .note pre code { background: none; padding: 0; border: 0; }
.note .formula { position: relative; display: block; font-family: var(--math); font-size: 1.35em; text-align: center; margin: 16px 0; padding: 16px 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--navy-line); box-shadow: 0 1px 0 var(--navy-line), 0 6px 18px -10px rgba(15,61,94,.35); overflow-x: auto; color: var(--navy-ink); letter-spacing: .01em; }
.note .formula::before { content: "ƒ"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; font-style: italic; color: var(--gold); width: 22px; height: 22px; border-radius: 50%; background: var(--gold-2); display: grid; place-items: center; line-height: 1; }
.src { font-size: 12.5px; color: var(--faint); margin-top: 18px; padding-top: 10px; border-top: 1px dashed var(--line); }
.cardside { background: var(--paper); border-radius: 12px; padding: 12px 14px 12px 16px; margin: 8px 0; box-shadow: var(--sh); border-left: 3px solid var(--gold); }
.cardside b { font-size: 14.5px; display: block; line-height: 1.35; }
.cardside div { font-size: 13.5px; color: var(--soft); margin-top: 3px; line-height: 1.45; }
.fromnote { background: linear-gradient(160deg, var(--card), var(--paper)); }
.fromnote .lead { font-family: var(--serif); font-size: 20px; font-weight: 700; display: block; }

/* ---------- flashcard review ---------- */
.review { max-width: 660px; margin: 0 auto; }
.review > .row:first-child { min-height: 44px; }
.counter { font-size: 13px; font-weight: 700; color: var(--soft); font-variant-numeric: tabular-nums; background: var(--card); border-radius: 999px; padding: 5px 12px; box-shadow: var(--sh); }
.counter .again { color: var(--red); }
.progress { height: 6px; border-radius: 9px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; margin: 12px 0 22px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); border-radius: inherit; transition: width .45s var(--ease); min-width: 6px; }
.flash { position: relative; background-color: var(--paper); border-radius: 8px 8px 20px 20px; padding: 18px 26px 24px; min-height: 300px; display: flex; flex-direction: column; cursor: pointer; margin-bottom: 26px;
  /* index card: red header rule, faint blue lines below it, and two cards stacked underneath */
  background-image: linear-gradient(180deg, transparent 0 56px, var(--margin) 56px 58px, transparent 58px), repeating-linear-gradient(180deg, transparent 0 33px, var(--rule) 33px 34px);
  background-position: 0 0, 0 58px; background-size: 100% 100%, 100% 100%; background-repeat: no-repeat, no-repeat;
  box-shadow: 0 1px 0 rgba(120,100,60,.06), 0 8px 0 -4px color-mix(in srgb, var(--paper) 94%, #000), 0 8px 1px -3px rgba(120,100,60,.12), 0 16px 0 -9px color-mix(in srgb, var(--paper) 88%, #000), 0 16px 1px -8px rgba(120,100,60,.12), var(--sh-lg);
  animation: cardin .38s var(--ease); }
.flash .meta { font-size: 11px; font-weight: 750; letter-spacing: .1em; color: var(--soft); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 30px; line-height: 30px; padding-right: 4px; }
.flash .q { font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1.25; margin: 28px 0 16px; white-space: pre-wrap; letter-spacing: -.005em; text-wrap: balance; }
.flash .a { position: relative; border-top: 1.5px dashed var(--line-2); padding-top: 16px; margin-top: 4px; font-size: 18px; line-height: 1.6; white-space: pre-wrap; animation: reveal .4s var(--ease); }
.flash .a::before { content: "Answer"; position: absolute; top: -10px; left: 0; background: var(--paper); padding-right: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); line-height: 18px; }
.flash .tap { margin-top: auto; text-align: center; color: var(--soft); font-size: 14px; padding-top: 18px; }
@media (hover: hover) { .flash:not(:has(.a)):hover { transform: translateY(-2px); } }
.flash { transition: transform .2s var(--ease); }
.flash:has(.a) { animation: none; cursor: default; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cardin { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; animation: fadein .3s var(--ease); }
.rate button { position: relative; flex-direction: column; gap: 1px; border: 1px solid transparent; font-weight: 750; min-height: 64px; border-radius: 16px; font-size: 16px; box-shadow: 0 1px 0 color-mix(in srgb, var(--card) 65%, transparent) inset, var(--sh); }
.rate button small { font-weight: 600; font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }
.rate button .kbd { position: absolute; top: 6px; right: 7px; font-size: 10px; opacity: .55; border-color: currentColor; color: inherit; }
@media (hover: none) { .rate button .kbd { display: none; } }
.r1 { background: var(--red-2); color: var(--red); border-color: var(--red-line); } .r2 { background: var(--gold-2); color: var(--gold-ink); border-color: var(--gold-line); } .r3 { background: var(--green-2); color: var(--green); border-color: var(--green-line); } .r4 { background: var(--navy-2); color: var(--navy-ink); border-color: var(--navy-line); }
@media (hover: hover) { .r1:hover:not(:disabled) { border-color: var(--red); } .r2:hover:not(:disabled) { border-color: var(--gold); } .r3:hover:not(:disabled) { border-color: var(--green); } .r4:hover:not(:disabled) { border-color: var(--navy-ink); } .rate button:hover { transform: translateY(-2px); } }
.kbd { font: 650 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--soft); background: var(--card); }
.showbtn { min-width: 220px; min-height: 52px; font-size: 16px; border-radius: 999px; }

/* ---------- practice ---------- */
.qcard { padding: 22px 24px; }
.qcard .qmeta { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.qcard .qmeta .marks { margin-left: auto; background: var(--gold-2); color: var(--gold-ink); border-radius: 999px; padding: 1px 9px; letter-spacing: .02em; }
.qcard .qtext { font-family: var(--serif); font-size: 24px; font-weight: 700; line-height: 1.3; margin: 10px 0 16px; white-space: pre-wrap; letter-spacing: -.005em; }
.opt { display: flex; width: 100%; text-align: left; justify-content: flex-start; align-items: center; gap: 12px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 14px 10px 10px; margin: 8px 0; font-weight: 550; min-height: 52px; box-shadow: none; line-height: 1.4; }
.opt .L { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--bg-2); color: var(--soft); transition: background .15s, color .15s; }
@media (hover: hover) { .opt:hover:not(:disabled) { border-color: var(--navy-line); background: var(--card); box-shadow: var(--sh); } .opt:hover:not(:disabled) .L { background: var(--navy); color: #fff; } }
.opt.right { background: var(--green-2); border-color: var(--green); font-weight: 650; animation: pop .35s var(--ease); }
.opt.right .L { background: var(--green); color: #fff; }
.opt.wrong { background: var(--red-2); border-color: var(--red); animation: shake .35s; }
.opt.wrong .L { background: var(--red); color: #fff; }
:root[data-theme="dark"] .opt.right .L, :root[data-theme="dark"] .opt.wrong .L { color: #14171c; }
@keyframes pop { 50% { transform: scale(1.015); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.score { font-family: var(--serif); font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.02em; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.fb { animation: fadein .3s var(--ease); }

/* ---------- add material ---------- */
.drop { position: relative; border: 2px dashed var(--line-2); border-radius: 24px; padding: 34px 20px 28px; text-align: center; background: color-mix(in srgb, var(--paper) 75%, transparent); transition: background .2s, border-color .2s, transform .2s var(--ease); overflow: hidden; }
.drop::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px); pointer-events: none; }
.drop > * { position: relative; }
.drop.over { border-color: var(--gold); background: var(--gold-2); transform: scale(1.01); }
.drop .big { width: 68px; height: 68px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: var(--navy); color: #fff; box-shadow: 0 10px 24px -8px rgba(15,61,94,.55); }
.drop .big svg { width: 32px; height: 32px; }
.drop > b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 700; }
.drop .dsub { display: block; font-size: 14px; color: var(--soft); margin-top: 2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.chips button .ico { width: 17px; height: 17px; color: var(--navy-ink); }
.thumbs { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.thumb { width: 96px; height: 120px; border-radius: 10px; background: var(--paper); box-shadow: var(--sh); overflow: hidden; position: relative; display: grid; place-items: center; font-size: 12px; color: var(--soft); text-align: center; padding: 8px; border: 1px solid rgba(120,100,60,.08); transition: transform .18s var(--ease), box-shadow .18s; animation: fadein .25s var(--ease); }
.thumb[data-f]:hover { transform: translateY(-3px) rotate(-.6deg); box-shadow: var(--sh-lg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb .x { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 50%; background: rgba(20,24,33,.65); color: #fff; border: none; font-size: 12px; z-index: 2; box-shadow: none; }
.thumb .tag { position: absolute; left: 6px; bottom: 6px; background: var(--red); color: #fff; font: 750 10px var(--ui); letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; z-index: 2; }
#prog { margin-top: 14px; }
.step { position: relative; display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 14px; padding: 13px 16px; margin: 0 0 10px; box-shadow: var(--sh); animation: fadein .3s var(--ease); }
.step:not(:last-child)::after { content: ""; position: absolute; left: 31px; top: 100%; height: 10px; width: 2px; background: var(--line-2); }
.step.done:not(:last-child)::after { background: var(--green-line); }
.step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; background: var(--bg-2); color: var(--soft); }
.step.done .n { background: var(--green); color: #fff; } .step.now .n { background: var(--gold); color: #1a1e26; animation: pulse 1.4s infinite; }
.step.now { box-shadow: var(--sh-lg); }
.step:not(.done):not(.now) { opacity: .7; }
.step small { color: var(--soft); display: block; font-size: 13px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 50%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.out div { background: var(--card); border-radius: 16px; padding: 14px 12px; text-align: center; box-shadow: var(--sh); border-top: 3px solid var(--gold); }
.out b { display: block; font-family: var(--serif); font-size: 32px; line-height: 1.1; color: var(--navy-ink); font-variant-numeric: lining-nums tabular-nums; } .out span { font-size: 12.5px; color: var(--soft); font-weight: 650; }
.editrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: start; margin: 8px 0; }
.editrow textarea { min-height: 58px; font-size: 14.5px; background: var(--paper); }
@media (max-width: 560px) { .editrow { grid-template-columns: 1fr auto; } .editrow textarea:nth-child(2) { grid-column: 1; } }

/* ---------- plan: planner pages ---------- */
.day { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 0 16px; background: var(--paper); border-radius: 16px; box-shadow: var(--sh); padding: 14px 18px 12px 14px; margin: 10px 0; border: 1px solid rgba(120,100,60,.07); }
.day .d { grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 2px; border-right: 1.5px solid var(--margin); padding-right: 14px; margin-right: -2px; line-height: 1.1; font-weight: 700; text-align: center; }
.day .d .dw { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); font-weight: 750; }
.day .d .dn { font-family: var(--serif); font-size: 30px; font-variant-numeric: lining-nums; color: var(--ink); margin-top: 2px; }
.day .d .dm { font-size: 11px; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; }
.day.today { border: 1.5px solid var(--gold); box-shadow: var(--sh), 0 0 0 4px var(--gold-2); }
.day.today .d .dw { color: var(--gold-ink); }
.day.today .d .dn { color: var(--gold-ink); }
.day ul { margin: 0; padding-left: 0; list-style: none; } .day li { padding: 8px 0; border-top: 1px dashed var(--line); font-size: 15px; display: flex; gap: 10px; align-items: center; line-height: 1.4; }
.day li:first-child { border-top: 0; }
.day li input[type=checkbox] { margin: 0 !important; width: 20px !important; height: 20px; cursor: pointer; }
.day li .exam-ic { width: 20px; text-align: center; flex: none; }
.day li a.open { font-size: 13px; font-weight: 650; text-decoration: none; color: var(--navy-ink); background: var(--navy-2); border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
@media (hover: hover) { .day li a.open:hover { background: var(--navy); color: #fff; } }
.day li.examday { font-weight: 650; color: var(--red); }

/* ---------- settings ---------- */
.choice { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0; cursor: pointer; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); transition: border-color .15s, background .15s, box-shadow .15s; }
.choice input { margin-top: 3px !important; }
.choice:has(input:checked) { border-color: var(--navy); background: var(--navy-2); }
.choice:has(input:disabled) { opacity: .65; cursor: default; }
@media (hover: hover) { .choice:not(:has(input:disabled)):hover { border-color: var(--navy-line); } }
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--bg-2) 85%, var(--line)); box-shadow: inset 0 1px 2px rgba(70,52,20,.08); flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 650; font-size: 14.5px; color: var(--soft); min-height: 40px; transition: background .15s, color .15s; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(70,52,20,.08), 0 3px 10px -3px rgba(70,52,20,.14); }
.seg label:has(input:focus-visible) { outline: 2.5px solid var(--gold); outline-offset: 1px; }
.setcard { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.setcard > .si { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--navy-2); color: var(--navy-ink); }
.setcard > .si svg { width: 22px; height: 22px; }
.setcard > div { min-width: 0; }
@media (max-width: 560px) { .setcard { grid-template-columns: 1fr; } .setcard > .si { display: none; } }

/* ---------- modal + toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15,20,28,.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; padding: 18px; animation: fadein .18s; }
.modal { background: var(--bg) var(--grain); border-radius: 24px; box-shadow: var(--sh-lg), 0 0 0 1px rgba(120,100,60,.08); width: min(560px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; padding: 26px; animation: modalin .28s var(--ease); }
@keyframes modalin { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal h2 { margin-top: 0; }
.emojis { display: flex; flex-wrap: wrap; gap: 6px; } .emojis button { width: 44px; padding: 0; font-size: 20px; border-radius: 12px; }
.emojis button.on, .swatches button.on { outline: 3px solid var(--gold); outline-offset: 2px; }
.emojis button.on { background: var(--gold-2); border-color: var(--gold-line); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; } .swatches button { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; border: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15), 0 2px 6px -2px rgba(0,0,0,.3); }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14.5px; z-index: 60; box-shadow: var(--sh-lg); animation: toastin .3s var(--ease); max-width: calc(100vw - 36px); border-left: 4px solid var(--gold); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- timer ---------- */
.timer { position: fixed; right: 24px; bottom: calc(24px + var(--safe-b)); z-index: 40; background: var(--navy-deep); color: #fff; border-radius: 999px; padding: 6px 7px 6px 16px; display: flex; gap: 8px; align-items: center; font: 700 16px var(--ui); font-variant-numeric: tabular-nums; box-shadow: var(--sh-lg), inset 0 0 0 1px rgba(255,255,255,.08), inset 0 -2px 0 var(--gold); animation: fadein .25s var(--ease); }
.timer button { min-height: 32px; padding: 2px 11px; background: rgba(255,255,255,.08); color: inherit; border-color: rgba(255,255,255,.18); font-size: 13px; border-radius: 999px; box-shadow: none; }
@media (max-width: 820px) { .timer { right: auto; left: 18px; bottom: calc(92px + var(--safe-b)); } }
@media (hover: hover) { .timer button:hover:not(:disabled) { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); box-shadow: none; } }

/* ---------- welcome ---------- */
.welcome { max-width: 680px; margin: 5vh auto 0; text-align: center; }
.welcome img.logo { width: 116px; height: 116px; border-radius: 28px; box-shadow: var(--sh-lg); transform: rotate(-3deg); }
.welcome h1 { font-size: 54px; margin-top: 22px; letter-spacing: -.02em; }
.welcome .lead { font-size: 18.5px; color: var(--soft); line-height: 1.6; max-width: 540px; margin: 10px auto 0; text-wrap: balance; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 30px 0 28px; text-align: left; counter-reset: how; }
.how div { position: relative; background: var(--paper); border-radius: 18px; padding: 18px 16px 16px; box-shadow: var(--sh); font-size: 14px; color: var(--soft); line-height: 1.5; border: 1px solid rgba(120,100,60,.07); overflow: hidden; }
.how .hic { font-size: 24px; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--navy-2); }
.how b { display: block; font-family: var(--serif); font-size: 19px; margin: 10px 0 3px; color: var(--ink); }
.welcome .row button { min-height: 50px; padding: 12px 22px; font-size: 16px; border-radius: 999px; }
@media (max-width: 560px) {
  .how { grid-template-columns: 1fr; gap: 10px; margin: 24px 0; } .welcome { margin-top: 2vh; } .welcome h1 { font-size: 44px; margin-top: 16px; } .welcome img.logo { width: 92px; height: 92px; border-radius: 22px; }
  .how div { display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; padding: 14px; font-size: 13.5px; } .how .hic { grid-row: 1 / span 2; } .how b { margin: 0 0 1px; font-size: 17.5px; }
  .welcome .lead { font-size: 17px; }
}

@media print { .side, .tabbar, .fab, .tabs, .crumbs, .noprint { display: none !important; } .app { display: block; } body { background: #fff; } .card { box-shadow: none; border: 1px solid #ddd; } article.note::before { display: none; } article.note { padding-left: 20px; } }
/* cover the phone status bar so content doesn't scroll under it */
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-t); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 45; pointer-events: none; }
.opt:disabled { opacity: 1; color: var(--soft); cursor: default; }
.opt.right:disabled { color: var(--green); }
.opt.wrong:disabled { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
