:root {
  --green: #078344; --green-press: #06703a; --ink: #17191c; --muted: #686d76; --line: #e4e6eb;
  --page: #f5f6f8; --surface: #fff; --panel: #f3f3f8; --pale: #edf6ef; --class-bg: #eef6f0; --class-line: #deeee3;
  --focus: #88bf9d; --error: #b42318;
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --gutter: 20px; --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px;
  --r-card: 14px; --r-btn: 10px; --r-input: 10px; --tab-h: 64px;
}
@media (min-width: 400px) { :root { --gutter: 24px; } }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.ic { width: 20px; height: 20px; flex: none; }

.shell { max-width: 480px; min-height: 100vh; margin: 0 auto; background: var(--surface); padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + var(--s3)); }
@media (min-width: 520px) { .shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* header */
.top { min-height: 64px; padding: 12px var(--gutter); display: flex; align-items: center; gap: var(--s1); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.wordmark { font-size: 25px; font-weight: 700; letter-spacing: -1px; color: var(--ink); line-height: 1.1; text-decoration: none; }
.wordmark span { color: var(--green); }
.brand { display: flex; flex-direction: column; }
.tagline { font-size: 12px; color: var(--muted); margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; }
.top .spacer { flex: 1; }
.top .small-mark { font-size: 15px; font-weight: 700; letter-spacing: -.4px; color: var(--ink); }
.top .small-mark span { color: var(--green); }

main { padding: var(--s3) var(--gutter) 0; outline: none; }
.eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--green); margin: 0 0 var(--s1); }
h1 { font-size: 28px; font-weight: 700; line-height: 1.17; letter-spacing: -.7px; margin: 0 0 12px; }
@media (min-width: 400px) { h1 { font-size: 30px; } }
h2 { font-size: 19px; font-weight: 600; letter-spacing: -.3px; margin: var(--s4) 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0; }
.lead { color: var(--muted); font-size: 15px; margin: 0 0 var(--s3); }
.muted { color: var(--muted); font-size: 13px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); width: 100%; min-height: 48px; padding: 12px 16px;
  border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-press); }
.btn:not(.primary):hover { border-color: #c9ccd2; }
.btn[aria-pressed="true"] { border-color: var(--class-line); background: var(--pale); color: var(--green); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.inline { width: auto; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: var(--s3) 0; }
.link-btn { background: none; border: 0; color: var(--green); font-weight: 600; font-size: 14px; padding: 10px 0; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* welcome */
.welcome { padding-top: var(--s2); }
.welcome h1 { font-size: 34px; }
.illus { margin: var(--s3) 0; padding: var(--s3); background: var(--panel); border-radius: var(--r-card); }
.illus.photo { padding: 0; overflow: hidden; background: var(--panel); }
.illus img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.illus svg { display: block; width: 100%; height: auto; max-height: 180px; }

/* exam tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 140px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card);
  background: var(--surface); color: var(--ink); text-decoration: none; }
.tile:hover, .row:hover { border-color: #b9d6c3; }
.tile .badge { margin-bottom: 8px; }
.tile strong { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }
.tile small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.tile.wide { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
.tile.wide .badge { margin: 0; }
.tile.wide > .ic:last-child { margin-left: auto; color: var(--muted); }
.badge { width: 40px; height: 40px; border-radius: 10px; background: var(--pale); color: var(--green); display: grid; place-items: center; flex: none; }

/* rows */
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink); text-decoration: none; }
.row .txt { flex: 1; min-width: 0; }
.row strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.35; }
.row small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.row > .ic:last-child { color: #9aa0a8; }
.row.done strong::after { content: " · Completed"; color: var(--green); font-weight: 500; font-size: 12px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .4px; padding: 2px 8px; border-radius: 6px; background: var(--panel); color: var(--muted); vertical-align: 2px; }
.tag.demo { background: #fff4e5; color: #8a4b00; }
.tag.green { background: var(--pale); color: var(--green); }

/* class card */
.class-card { display: block; margin: var(--s4) 0 var(--s2); padding: 20px; border-radius: var(--r-card); background: var(--class-bg); border: 1px solid var(--class-line); color: var(--ink); text-decoration: none; }
.class-card h3 { font-size: 20px; letter-spacing: -.4px; margin: 0 0 6px; }
.class-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.class-card b { color: var(--green); font-size: 15px; }

/* states */
.field { margin: 0 0 var(--s2); }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 14px; color: var(--muted); }
.search .input { padding-left: 40px; }
.state-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.state-list button { display: flex; justify-content: space-between; width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.state-list button:last-child { border-bottom: 0; }
.state-list button small { color: var(--muted); }
.context { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); padding: 12px 16px; background: var(--panel); border-radius: 12px; margin-bottom: var(--s3); }
.context strong { font-size: 15px; }

/* notes, panels, states of load */
.note { font-size: 13px; color: var(--muted); background: var(--panel); padding: 14px 16px; border-radius: 12px; margin: var(--s2) 0; }
.empty { text-align: center; padding: var(--s4) var(--s2); color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: var(--r-card); }
.empty .ic { width: 28px; height: 28px; color: #9aa0a8; margin-bottom: 8px; }
.error { color: var(--error); }
.loading { padding: var(--s4) 0; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 10px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* classes */
.teacher { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s2); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--pale); color: var(--green); display: grid; place-items: center; font-weight: 700; letter-spacing: .5px; }
.teacher small { display: block; color: var(--muted); font-size: 13px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: var(--s3); }
.filters label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.today { display: block; padding: 18px; border-radius: var(--r-card); border: 1px solid var(--class-line); background: var(--class-bg); color: var(--ink); text-decoration: none; }
.today strong { display: block; font-size: 18px; letter-spacing: -.3px; margin: 6px 0 4px; }
.today small { color: var(--muted); font-size: 13px; }

/* lesson */
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 13px; margin-bottom: var(--s3); }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin-bottom: var(--s3); }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { font-size: 16px; line-height: 1.65; }
.prose h3 { font-size: 18px; margin: var(--s3) 0 var(--s1); }
.prose p { margin: 0 0 14px; }
.prose ul { padding-left: 20px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.practice { background: var(--panel); border-radius: 12px; padding: 16px; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; max-width: 160px; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--green); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100% - 32px));
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; z-index: 20; }
.toast a { color: #9fe0b8; font-weight: 600; }
.noscript { padding: 24px; }

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