* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── OlyAdmit-style tokens, Hinsdale Central red ── */
/* OlyAdmit palette — warm gold neutrals, distinctive accents swapped to Hinsdale red */
:root {
  --background: oklch(0.965 0.008 85);
  --foreground: oklch(0.24 0.018 265);
  --card: oklch(0.99 0.005 85);
  --card-foreground: oklch(0.24 0.018 265);
  --primary: #d80c0c;
  --primary-foreground: #ffffff;
  --secondary: oklch(0.93 0.01 80);
  --secondary-foreground: oklch(0.24 0.018 265);
  --muted: oklch(0.93 0.01 80);
  --muted-foreground: oklch(0.5 0.014 265);
  --accent: #f7d9d9;
  --accent-foreground: #a30b0b;
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: #ffffff;
  --border: oklch(0.88 0.012 80);
  --border-light: oklch(0.92 0.010 80);
  --input: oklch(0.88 0.012 80);
  --ring: #d80c0c;
  --success: #15803d;
  --success-bg: #dbf2e2;
  --warning: #b98a45;
  --gold: #b98a45;
  --gold-bg: #efe3d0;
  --gold-fg: #8a6526;
  --choice-bg: oklch(0.975 0.007 85);
  --choice-hover: oklch(0.93 0.01 80);
  --sidebar: oklch(0.95 0.008 85);
  --sidebar-foreground: oklch(0.24 0.018 265);
  --sidebar-accent: oklch(0.91 0.010 80);
  --backdrop: rgb(0 0 0 / .45);
  --shadow: 0 6px 24px rgb(60 48 30 / .08);
  --radius: 0.625rem;
}
[data-theme="dark"] {
  --background: #1A1714;
  --foreground: #E4DED4;
  --card: #252019;
  --card-foreground: #E4DED4;
  --primary: #e8382a;
  --primary-foreground: #ffffff;
  --secondary: #2E2820;
  --secondary-foreground: #E4DED4;
  --muted: #2E2820;
  --muted-foreground: #A39C90;
  --accent: #3c1e21;
  --accent-foreground: #f0b9bf;
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: #1A1714;
  --border: #38322A;
  --border-light: #2E2820;
  --input: #2A251F;
  --ring: #e8382a;
  --success: #4ade80;
  --success-bg: #17251c;
  --warning: #C49A5A;
  --gold: #C49A5A;
  --gold-bg: #332915;
  --gold-fg: #d8b878;
  --choice-bg: #211D19;
  --choice-hover: #2E2820;
  --sidebar: #211D19;
  --sidebar-foreground: #E4DED4;
  --sidebar-accent: #2E2820;
  --shadow: 0 6px 24px rgb(0 0 0 / .4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--background); color: var(--foreground); min-height: 100vh;
  transition: background .25s, color .25s;
}
#app { min-height: 100vh; }
.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); color: var(--card-foreground);
  transition: background .25s, border-color .25s;
}
.center { text-align: center; }
.narrow { max-width: 460px !important; }
.brand-mark { height: 26px; width: auto; display: block; }

h1 { font-size: 24px; margin-bottom: 4px; color: var(--primary); letter-spacing: -.01em; }
h2 { font-size: 20px; margin-bottom: 10px; }
h3 { font-size: 13px; color: var(--muted-foreground); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.sub { color: var(--muted-foreground); margin-bottom: 18px; }
.dim { color: var(--muted-foreground); font-size: 13px; opacity: .8; }
.hint { color: var(--muted-foreground); font-size: 12px; margin-top: 10px; opacity: .85; }
.hint.warn { color: var(--warning); }
.big { font-size: 20px; margin: 12px 0 20px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
label { display: block; font-size: 12px; color: var(--muted-foreground); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }

input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--input);
  background: var(--muted); color: var(--foreground); font-size: 16px; margin-bottom: 10px;
  transition: border-color .15s, background .25s;
}
input:focus { outline: none; border-color: var(--ring); }

.btn {
  padding: 12px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--secondary); color: var(--secondary-foreground); font-size: 15px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--choice-hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); font-weight: 600; }
.btn.primary:hover { background: var(--primary); filter: brightness(.88); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.warn { border-color: var(--warning); color: var(--warning); background: transparent; }
.btn.good { border-color: var(--success); color: var(--success); background: transparent; }
.btn.bad { border-color: var(--destructive); color: var(--destructive); background: transparent; }

.choice {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  margin-bottom: 8px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--choice-bg); color: var(--foreground); font-size: 15px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.choice:hover { background: var(--choice-hover); }
.choice.selected { border-color: var(--primary); background: var(--accent); }
.choice.correct { border-color: var(--success); background: var(--success-bg); }
.choice.wrong { border-color: var(--destructive); background: var(--accent); }
.choice:disabled { cursor: default; opacity: .85; }
.choice .k {
  display: inline-block; min-width: 20px; margin-right: 8px; padding: 1px 5px;
  border: 1px solid var(--border); border-radius: 5px; text-align: center;
  font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--muted-foreground);
}
.choice.selected .k { border-color: var(--primary); color: var(--primary); }
.choice.correct .k { border-color: var(--success); color: var(--success); }
.choice.wrong .k { border-color: var(--destructive); color: var(--destructive); }

.qtext { font-size: 17px; line-height: 1.55; margin: 14px 0 16px; }
.tag {
  background: var(--gold-bg); color: var(--gold-fg); font-size: 12px; padding: 4px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.bar { height: 6px; background: var(--muted); border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
#q-bar { height: 100%; background: var(--gold); width: 0%; transition: width .2s; }
#q-explain {
  background: var(--muted); border-left: 3px solid var(--primary); padding: 12px 14px;
  border-radius: 8px; font-size: 14px; line-height: 1.55; margin-top: 12px;
}
#q-explain .verdict { font-weight: 700; display: block; margin-bottom: 6px; }
#q-explain .verdict.ok { color: var(--success); }
#q-explain .verdict.no { color: var(--destructive); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--choice-bg); color: var(--secondary-foreground); font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--choice-hover); }
.chip.on { border-color: var(--primary); color: var(--accent-foreground); background: var(--accent); }

.tstat {
  display: flex; justify-content: space-between; padding: 6px 2px;
  font-size: 13px; color: var(--muted-foreground); border-bottom: 1px solid var(--border-light);
}
.tstat .ok { color: var(--success); }
.tstat .mid { color: var(--warning); }
.tstat .low { color: var(--destructive); }

.stats { display: flex; gap: 14px; margin: 10px 0 4px; }
.stat { background: var(--muted); border-radius: var(--radius); padding: 10px 14px; flex: 1; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--gold); }
.stat span { font-size: 11px; color: var(--muted-foreground); }

.review-item {
  background: var(--choice-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; font-size: 14px;
}
.review-item .tag { font-size: 11px; }
.review-item p { margin: 8px 0; line-height: 1.45; }
.review-item .ans { color: var(--success); font-size: 13px; }
.review-item button { margin-top: 6px; }

.profile-chip {
  display: inline-block; margin: 10px 8px 0 0; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 14px;
  transition: background .15s;
}
.profile-chip:hover { background: var(--choice-hover); }

code, .cmd { font-family: "Roboto Mono", monospace; background: var(--muted); padding: 1px 5px; border-radius: 4px; font-size: 90%; }
.event-card {
  display: block; width: 100%; text-align: left; padding: 16px 18px;
  margin-bottom: 10px; border-radius: 12px; font-size: 15px; line-height: 1.5;
}
.event-card:hover { background: var(--choice-hover); }
.ebar { height: 5px; background: var(--muted); border-radius: 3px; overflow: hidden; margin: 8px 0 4px; }
.ebar div { height: 100%; background: var(--gold); }

.focus-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--gold-bg); border: 1px solid var(--gold); border-radius: 12px;
  padding: 12px 16px; margin: 14px 0 4px; font-size: 14px;
}
.focus-card .tag { background: var(--gold); color: #fff; margin-right: 8px; }
.focus-card .btn { border-color: var(--gold); color: var(--gold-fg); flex: none; }

/* ── App shell: OlyAdmit-style topbar + sidebar ── */
.shell { display: none; }
body.authed .shell { display: block; }

/* topbar: fixed, h-20, like OlyAdmit AdminTopBar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 80px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--border);
}
.tb-left { display: flex; align-items: center; gap: 16px; }
.tb-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-left: 8px; }
.tb-brand .tb-mark { height: 34px; width: auto; display: block; }
.tb-brand .tb-dot { color: var(--primary); }
.tb-user {
  font-size: 13px; font-weight: 600; color: var(--secondary-foreground);
  background: var(--secondary); border: none; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; transition: filter .15s;
}
.tb-right { display: flex; align-items: center; gap: 10px; }
.topbar .theme-toggle { position: static; box-shadow: none; width: 36px; height: 36px; font-size: 15px; }
.tb-user:hover { filter: brightness(.96); }

/* hamburger — mobile only, like OlyAdmit */
.hamburger {
  display: none; width: 48px; height: 48px; border: none; border-radius: 50%;
  background: var(--secondary); cursor: pointer; flex-direction: column;
  justify-content: center; align-items: center; gap: 4px;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--foreground); transition: transform .3s, opacity .3s; }
body.nav-open .hamburger span:nth-child(1) { transform: rotate(45deg) translate(4px, 4.5px); }
body.nav-open .hamburger span:nth-child(2) { opacity: 0; }
body.nav-open .hamburger span:nth-child(3) { transform: rotate(-45deg) translate(4.5px, -4.5px); }

.nav-backdrop {
  display: none; position: fixed; inset: 0; z-index: 40; background: var(--backdrop);
}

/* sidebar: fixed under topbar, w-80, desktop */
.sidebar {
  position: fixed; left: 0; top: 80px; height: calc(100vh - 80px); width: 320px;
  background: var(--sidebar); border-right: 1px solid var(--border); z-index: 30;
  display: flex; flex-direction: column; padding: 16px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  border: none; border-radius: 8px; background: transparent;
  color: var(--sidebar-foreground); font-size: 15px; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-accent); }
.nav-item.on { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }
.nav-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.nav-foot .nav-item { color: var(--muted-foreground); text-align: center; }
.nav-foot .nav-item:hover { color: var(--destructive); }

.main { margin-left: 320px; padding: 104px 24px 24px; }
.main .card { max-width: 760px; margin: 0 auto 16px; }

/* mobile: sidebar becomes drawer, hamburger shows — like OlyAdmit lg breakpoint */
@media (max-width: 1023px) {
  .hamburger { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform .3s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: translateX(0); z-index: 60; }
  body.nav-open .nav-backdrop { display: block; }
  .main { margin-left: 0; }
}
@media (max-width: 640px) {
  .tb-brand span { font-size: 15px; }
  .tb-brand .tb-mark { height: 28px; }
  .main { padding: 96px 12px 16px; }
  .stats { flex-wrap: wrap; }
  .stat { flex: 1 1 40%; }
}
@media (hover: none) {
  #screen-quiz .hint { display: none; }
}

.theme-toggle {
  position: fixed; top: 14px; right: 14px; z-index: 30;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card); color: var(--foreground);
  font-size: 17px; cursor: pointer; box-shadow: var(--shadow);
  transition: background .2s, border-color .2s;
}
.theme-toggle:hover { background: var(--choice-hover); }
body.authed #btn-theme-login { display: none; }

/* ── Login: full-height split ── */
#screen-login { padding: 0; }
#screen-login.active {
  display: flex; position: fixed; inset: 0; z-index: 20; background: var(--background);
}
.login-side {
  flex: 0 0 44%; display: flex; align-items: center; justify-content: center;
  background: #17130f; border-right: 1px solid var(--border-light);
  padding: 0; overflow: hidden;
}
.login-side img { height: 100vh; width: auto; max-width: none; display: block; }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--background); }
.login-box { width: 100%; max-width: 420px; }
.login-box h1 { font-size: 34px; letter-spacing: .02em; }
@media (max-width: 760px) {
  #screen-login.active { flex-direction: column; overflow: auto; }
  .login-side { flex: none; height: 200px; border-right: none; border-bottom: 1px solid var(--border-light); }
  .login-side img { height: 200px; }
}
