/* KhermistryQuest design system — original Canva-inspired visual language */

/* ---------------------------------------------------------------- tokens */
:root {
  --primary: #7B2FF7;
  --primary-2: #00C4CC;
  --accent-pink: #FF5C8A;
  --accent-yellow: #FFC93C;
  --accent-orange: #FF8A3D;
  --accent-green: #22C55E;
  --danger: #EF4444;
  --bg: #F7F5FF;
  --surface: #FFFFFF;
  --surface-2: #F1EDFF;
  --text: #1E1B3A;
  --muted: #6B6889;
  --border: #E6E1F7;

  /* AA-safe text tints of the accents on light surfaces */
  --primary-ink: #6420D8;
  --teal-ink: #007D82;
  --pink-ink: #C81E55;
  --yellow-ink: #8A5A00;
  --orange-ink: #B3500F;
  --green-ink: #15803D;

  --g-hero: linear-gradient(135deg, #7B2FF7 0%, #00C4CC 100%);
  --g-reward: linear-gradient(135deg, #FF5C8A 0%, #FFC93C 100%);
  --g-market: linear-gradient(135deg, #FF8A3D 0%, #FF5C8A 100%);
  --g-alchemy: linear-gradient(135deg, #4F46E5 0%, #7B2FF7 50%, #C026D3 100%);

  --shadow: 0 8px 24px rgba(123, 47, 247, .08);
  --shadow-lg: 0 18px 44px rgba(123, 47, 247, .16);
  --r-card: 22px;
  --r-input: 14px;
  --r-modal: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font-head: 'Poppins', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14112B; --surface: #1F1B3D; --surface-2: #2A2550; --text: #F1EFFF; --muted: #A9A5C9; --border: #352F63;
    --primary: #8B4DF8; --primary-ink: #C4A6FF; --teal-ink: #5EE3E8; --pink-ink: #FF8FB0; --yellow-ink: #FFD56B;
    --orange-ink: #FFAA70; --green-ink: #5BE08A;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 18px 44px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14112B; --surface: #1F1B3D; --surface-2: #2A2550; --text: #F1EFFF; --muted: #A9A5C9; --border: #352F63;
  --primary: #8B4DF8; --primary-ink: #C4A6FF; --teal-ink: #5EE3E8; --pink-ink: #FF8FB0; --yellow-ink: #FFD56B;
  --orange-ink: #FFAA70; --green-ink: #5BE08A;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 18px 44px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* Module accents (Alchemy violet, Pop Quiz teal, Tournament coral, Mission tangerine, Exit green, Live pink, Market sunshine) */
.m-alchemy    { --m: #7B2FF7; --m-ink: var(--primary-ink); --m-soft: rgba(123, 47, 247, .12); --m-grad: var(--g-alchemy); }
.m-popquiz    { --m: #00C4CC; --m-ink: var(--teal-ink);    --m-soft: rgba(0, 196, 204, .14);  --m-grad: linear-gradient(135deg, #00A8B0, #00C4CC 60%, #4FE3D2); }
.m-tournament { --m: #FF5C8A; --m-ink: var(--pink-ink);    --m-soft: rgba(255, 92, 138, .14); --m-grad: linear-gradient(135deg, #FF5C8A, #FF7A6B); }
.m-mission    { --m: #FF8A3D; --m-ink: var(--orange-ink);  --m-soft: rgba(255, 138, 61, .15); --m-grad: linear-gradient(135deg, #FF8A3D, #FFB347); }
.m-exit       { --m: #22C55E; --m-ink: var(--green-ink);   --m-soft: rgba(34, 197, 94, .14);  --m-grad: linear-gradient(135deg, #16A34A, #22C55E 60%, #7EE0A1); }
.m-live       { --m: #E8457A; --m-ink: var(--pink-ink);    --m-soft: rgba(255, 92, 138, .14); --m-grad: linear-gradient(135deg, #C026D3, #FF5C8A); }
.m-market     { --m: #FFC93C; --m-ink: var(--yellow-ink);  --m-soft: rgba(255, 201, 60, .2);  --m-grad: var(--g-reward); }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font-body);
  background-image: radial-gradient(rgba(123, 47, 247, .06) 1px, transparent 1px);
  background-size: 22px 22px;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75em; }
a { color: var(--primary-ink); }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; border-radius: 8px; }
.ico { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.wrap { white-space: normal; word-break: break-word; }
.tabular, .num, .stat-tile b { font-variant-numeric: tabular-nums; }
.pos { color: var(--green-ink); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }
.mt-2 { margin-top: 1rem; }
.inline { display: inline; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 99; border-radius: 0 0 12px 0; }
.skip:focus { left: 0; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- buttons, chips, pills */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 2px solid transparent; border-radius: 999px; padding: .62rem 1.25rem;
  font: 600 .95rem/1.2 var(--font-body); cursor: pointer; text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, opacity .18s;
  background: var(--surface-2); color: var(--text); min-height: 44px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--g-hero); color: #fff; box-shadow: 0 8px 20px rgba(123, 47, 247, .3); }
.btn-primary:hover { box-shadow: 0 12px 28px rgba(123, 47, 247, .38); }
.btn-secondary { background: transparent; border-color: var(--primary); color: var(--primary-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-reward { background: var(--g-reward); color: #2A1500; box-shadow: 0 8px 20px rgba(255, 92, 138, .3); }
.btn-light { background: #fff; color: #4C1DB0; }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; min-height: 36px; }
.btn-lg { padding: .85rem 1.6rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: var(--surface-2); color: var(--text); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--border); }
.ico-sun { display: none; }
:root[data-theme="dark"] .ico-sun { display: block; } :root[data-theme="dark"] .ico-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ico-sun { display: block; } :root:not([data-theme="light"]) .ico-moon { display: none; } }

.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .7rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); text-decoration: none; border: 0; white-space: nowrap;
}
a.chip:hover, .chip.active { background: var(--primary); color: #fff; }
.chip-done { background: rgba(34, 197, 94, .15); color: var(--green-ink); }
.chip-pending { background: rgba(255, 201, 60, .25); color: var(--yellow-ink); }
.chip-locked { background: rgba(239, 68, 68, .12); color: var(--danger); }
.chip-new { background: rgba(0, 196, 204, .15); color: var(--teal-ink); }
.chip-xp { background: rgba(255, 201, 60, .25); color: var(--yellow-ink); }
.chip-level { background: rgba(123, 47, 247, .12); color: var(--primary-ink); }
.chip-light { background: rgba(255, 255, 255, .22); color: #fff; }
.chip-btn { cursor: pointer; }
[class*="chip-m-"] { background: var(--m-soft); color: var(--m-ink); }
.chip-m-alchemy { --m-soft: rgba(123, 47, 247, .12); --m-ink: var(--primary-ink); }
.chip-m-popquiz { --m-soft: rgba(0, 196, 204, .14); --m-ink: var(--teal-ink); }
.chip-m-tournament { --m-soft: rgba(255, 92, 138, .14); --m-ink: var(--pink-ink); }
.chip-m-mission { --m-soft: rgba(255, 138, 61, .15); --m-ink: var(--orange-ink); }
.chip-m-exit { --m-soft: rgba(34, 197, 94, .14); --m-ink: var(--green-ink); }
.chip-m-live { --m-soft: rgba(255, 92, 138, .14); --m-ink: var(--pink-ink); }
.chip-m-market { --m-soft: rgba(255, 201, 60, .22); --m-ink: var(--yellow-ink); }

.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; font-weight: 700; font-family: var(--font-head); font-size: .9rem; }
.pill-level { background: rgba(123, 47, 247, .12); color: var(--primary-ink); }
.pill-level .elem { background: var(--g-alchemy); color: #fff; border-radius: 6px; padding: 0 .35rem; font-size: .78rem; }
.pill-token { background: rgba(255, 201, 60, .25); color: var(--yellow-ink); }
.price-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .75rem; border-radius: 999px; background: rgba(255, 201, 60, .25); color: var(--yellow-ink); font: 700 .95rem var(--font-head); }

/* Sticker-style icon tiles */
.sticker {
  width: 48px; height: 48px; border-radius: 14px; display: inline-grid; place-items: center; flex: none;
  background: var(--m-grad, var(--g-hero)); color: #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
  transform: rotate(-4deg);
}
.sticker .ico { width: 24px; height: 24px; }
.sticker-sm { width: 36px; height: 36px; border-radius: 11px; } .sticker-sm .ico { width: 18px; height: 18px; }
.sticker-lg { width: 60px; height: 60px; border-radius: 18px; } .sticker-lg .ico { width: 30px; height: 30px; }
.sticker-xl { width: 84px; height: 84px; border-radius: 24px; } .sticker-xl .ico { width: 42px; height: 42px; }
[class*="g-"] > .sticker { background: rgba(255, 255, 255, .25); box-shadow: none; }

/* ---------------------------------------------------------------- layout shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .5rem; overflow-x: hidden;
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); font: 700 1.1rem var(--font-head); padding: .25rem .25rem .75rem; white-space: nowrap; }
.brand img { flex: none; }
@media (max-width: 1080px) { .sidebar .brand { font-size: .98rem; } }
.brand b { background: var(--g-hero); -webkit-background-clip: text; background-clip: text; color: transparent; }
.role-chip { align-self: flex-start; margin: 0 .5rem .5rem; padding: .2rem .7rem; border-radius: 999px; background: var(--g-alchemy); color: #fff; font-size: .75rem; font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-nav a { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; transition: background .15s, color .15s; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.active { background: var(--g-hero); color: #fff; box-shadow: 0 8px 18px rgba(123, 47, 247, .28); }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: .8rem .9rem .2rem; font-weight: 700; }
.side-logout { margin-top: auto; }
.side-logout .btn { width: 100%; justify-content: flex-start; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.75rem; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.brand-mobile { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--g-reward); color: #2A1500; display: inline-grid; place-items: center; font: 800 1rem var(--font-head); flex: none; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 2rem; }
.content { padding: .5rem 1.75rem 3rem; max-width: 1240px; width: 100%; }
.admin-mobile-nav { display: none; }
.mobile-only { display: none; }
.bottom-nav { display: none; }

/* ---------------------------------------------------------------- cards and grids */
.card { background: var(--surface); border-radius: var(--r-card); padding: 1.35rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; border: 1px solid var(--border); position: relative; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.card-title { display: flex; align-items: center; gap: .5rem; }
.card-title .ico { color: var(--primary-ink); }
.card-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.card-head h2 { margin-bottom: .2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-2 > .card, .stack > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.narrow { max-width: 620px; }
.page-head { margin: 1rem 0 1.25rem; }
.page-head h1 { display: flex; align-items: center; gap: .7rem; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 700; color: var(--primary-ink); margin: 0 0 .2rem; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: .4rem; }
.back:hover { color: var(--text); }
.link { color: var(--primary-ink); font-weight: 600; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* Gradient surfaces */
.g-hero { background: var(--g-hero); color: #fff; }
.g-reward { background: var(--g-reward); color: #2A1500; }
.g-market { background: var(--g-market); color: #fff; }
.g-alchemy { background: var(--g-alchemy); color: #fff; }
.g-hero .muted, .g-alchemy .muted, .g-market .muted { color: rgba(255, 255, 255, .85); }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-tile { border-radius: var(--r-card); padding: 1.1rem 1.2rem; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .1rem; box-shadow: var(--shadow); }
.stat-tile::after { content: ''; position: absolute; width: 120px; height: 120px; right: -40px; bottom: -50px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.stat-tile .sticker { position: absolute; right: 1rem; top: 1rem; width: 40px; height: 40px; border-radius: 12px; }
.stat-tile b { font: 800 1.9rem/1.1 var(--font-head); margin-top: .8rem; }
.stat-tile span:last-child { font-size: .85rem; font-weight: 600; opacity: .92; }

/* Progress */
.progress { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: var(--m-grad, var(--g-hero)); position: relative; overflow: hidden; transition: width .8s var(--ease); }
.progress > span::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: shimmer 2.4s infinite; }
.progress-lg { height: 14px; margin: .2rem 0 1rem; }
.progress-light { background: rgba(255, 255, 255, .25); }
.progress-light > span { background: #fff; }
@keyframes shimmer { to { transform: translateX(100%); } }
.ring { --p: 0; width: 96px; height: 96px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--primary-2) calc(var(--p) * 1%), rgba(123, 47, 247, .15) 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; font: 800 1.15rem var(--font-head); color: var(--text); }
.ring-sm { width: 56px; height: 56px; } .ring-sm::before { inset: 7px; } .ring-sm > span { font-size: .8rem; }
.g-alchemy .ring { background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, .25) 0); }
.g-alchemy .ring::before { background: #5B2BD9; }
.g-alchemy .ring > span { color: #fff; }
.ring-row { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }

.bar-row { display: grid; grid-template-columns: 120px 1fr 48px auto; align-items: center; gap: .75rem; margin: .55rem 0; font-size: .9rem; }
.bar-inline { display: flex; align-items: center; gap: .5rem; min-width: 140px; }
.bar-inline .progress { flex: 1; height: 8px; }

/* Key/value lists and lists */
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.kv li:last-child { border-bottom: 0; }
.kv li span { color: var(--muted); }
.kv li b { text-align: right; }
.kv-total b { font-size: 1.1rem; color: var(--primary-ink); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list li .grow b, .list li .grow small { display: block; }
.score { font: 700 1rem var(--font-head); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .7rem; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: .65rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table-compact td, .table-compact th { padding: .35rem .4rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .88rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field legend { font-weight: 600; font-size: .88rem; margin-bottom: .4rem; padding: 0; }
input, select, textarea {
  font: 400 .95rem var(--font-body); color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: var(--r-input); padding: .65rem .85rem; width: 100%; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(123, 47, 247, .15); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); flex: none; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; margin-right: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
.field-inline span { flex: 1; }
.field-inline input, .field-inline select { max-width: 200px; }
.inline-form { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; }
.row-form { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.field-mini { display: flex; flex-direction: column; font-size: .72rem; color: var(--muted); font-weight: 600; }
.field-mini input { width: 80px; min-height: 36px; padding: .35rem .5rem; }
.field-search { flex-direction: row; align-items: center; position: relative; flex: 1; min-width: 220px; }
.field-search .ico { position: absolute; left: .8rem; color: var(--muted); }
.field-search input { padding-left: 2.4rem; }
.filters { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: 1rem; }
.filters select { width: auto; }
.filter-chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.check-grid { display: flex; flex-wrap: wrap; gap: .5rem 0; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 3rem; }
.pw-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: .4rem; border-radius: 10px; }
.pw-meter { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: -.4rem; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s, background .25s; }
.rules { margin: 0; padding-left: 1.2rem; font-size: .85rem; color: var(--muted); }
.form-row-between { display: flex; justify-content: flex-end; }
.option-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.opt-letter { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font: 700 .9rem var(--font-head); background: var(--surface-2); }
.collapsible summary { cursor: pointer; font: 700 1rem var(--font-head); display: flex; align-items: center; gap: .5rem; list-style: none; }
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible[open] summary { margin-bottom: 1rem; }
.pick-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; }
.pick { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .7rem; border-radius: 14px; border: 2px solid var(--border); cursor: pointer; font-size: .9rem; }
.pick:has(input:checked) { border-color: var(--primary); background: rgba(123, 47, 247, .06); }

/* Notices, toasts, empty states */
.notice { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.2rem; border-radius: var(--r-card); margin-bottom: 1.25rem; border: 2px solid; }
.notice ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.notice-warn { background: rgba(255, 201, 60, .14); border-color: rgba(255, 201, 60, .55); }
.notice-ok { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .45); }
.big-code { font-size: 1.15rem; letter-spacing: .08em; padding: .2rem .55rem; }
.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .6rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: center; padding: .85rem 1.1rem; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); border-left: 6px solid var(--primary); font-weight: 500; animation: toast-in .35s var(--ease); }
.toast-success { border-color: var(--accent-green); } .toast-success .ico { color: var(--green-ink); }
.toast-error { border-color: var(--danger); } .toast-error .ico { color: var(--danger); }
.toast-info { border-color: var(--primary-2); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
.empty { text-align: center; padding: 1.5rem 1rem; color: var(--muted); }
.empty-ico { width: 56px; height: 56px; color: var(--primary); opacity: .5; display: block; margin: 0 auto .5rem; }
.lock-note { font-size: .85rem; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: .55rem .8rem; border-radius: 12px; margin: .5rem 0 0; }
.success-note { display: flex; gap: .5rem; align-items: center; font-weight: 600; color: var(--green-ink); }

/* Tabs */
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding: .35rem; background: var(--surface); border-radius: 999px; margin-bottom: 1.25rem; box-shadow: var(--shadow); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.05rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { background: var(--g-hero); color: #fff; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: .25rem; margin-bottom: 1rem; }
.seg a { padding: .4rem 1rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .88rem; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }

/* ---------------------------------------------------------------- decorations */
.decor { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; filter: blur(2px); opacity: .55; }
.blob-1 { width: 320px; height: 320px; right: -80px; top: -120px; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%); }
.blob-2 { width: 260px; height: 260px; left: 35%; bottom: -150px; background: radial-gradient(circle at 50% 50%, rgba(255, 201, 60, .45), rgba(255, 201, 60, 0) 70%); }
.blob-3 { width: 380px; height: 380px; left: -140px; top: 30%; background: radial-gradient(circle, rgba(0, 196, 204, .55), rgba(0, 196, 204, 0) 70%); }
.shape { position: absolute; color: rgba(255, 255, 255, .28); }
.shape-hex { width: 120px; right: 6%; bottom: 10%; animation: float 9s ease-in-out infinite; }
.shape-molecule { width: 130px; right: 26%; top: -20px; animation: float 11s ease-in-out infinite reverse; }
.shape-flask { width: 74px; right: 40%; bottom: -12px; transform: rotate(-12deg); }
.shape-atom { width: 110px; right: -20px; top: 25%; animation: spin 40s linear infinite; }
.shape-hex2 { width: 90px; left: 12%; top: 8%; animation: float 12s ease-in-out infinite; }
.bubble { position: absolute; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); animation: rise 12s linear infinite; }
.b1 { width: 18px; height: 18px; left: 20%; bottom: -20px; } .b2 { width: 10px; height: 10px; left: 55%; bottom: -20px; animation-delay: 3s; }
.b3 { width: 26px; height: 26px; left: 75%; bottom: -30px; animation-delay: 6s; } .b4 { width: 14px; height: 14px; left: 40%; bottom: -20px; animation-delay: 9s; }
@keyframes float { 50% { transform: translateY(-14px) rotate(6deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { to { transform: translateY(-110vh); opacity: 0; } }

/* ---------------------------------------------------------------- auth */
.auth-body { background-image: none; }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; background: var(--g-hero); color: #fff; display: flex; align-items: center; padding: 3rem; }
.auth-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(79, 70, 229, .4), transparent 60%); }
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-logo { display: flex; align-items: center; gap: .7rem; font: 800 1.6rem var(--font-head); margin-bottom: 2.5rem; }
.auth-logo img { background: #fff; border-radius: 16px; padding: 6px; }
.hero-tag { font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 800; margin-bottom: 1.5rem; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.hero-points li { display: flex; align-items: center; gap: .7rem; font-weight: 600; background: rgba(255, 255, 255, .14); padding: .7rem 1rem; border-radius: 16px; backdrop-filter: blur(4px); }
.auth-panel { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-center { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(circle at 15% 10%, rgba(123, 47, 247, .18), transparent 40%), radial-gradient(circle at 85% 90%, rgba(0, 196, 204, .18), transparent 40%); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--r-modal); padding: 2.2rem 2rem; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.auth-card .sticker { margin-bottom: 1rem; }
.auth-title { font-size: 1.55rem; font-weight: 800; letter-spacing: .01em; background: var(--g-hero); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-title.sm { font-size: 1.4rem; }
.auth-sub { color: var(--muted); font-weight: 500; margin-bottom: 1.5rem; }
.auth-note { display: flex; gap: .5rem; align-items: flex-start; font-size: .82rem; color: var(--muted); margin: 1.25rem 0 0; background: var(--surface-2); padding: .75rem .9rem; border-radius: 14px; }
.steps { padding-left: 1.2rem; display: grid; gap: .5rem; margin: 0 0 1.25rem; }

/* ---------------------------------------------------------------- student dashboard */
.hero-banner { position: relative; overflow: hidden; border-radius: var(--r-modal); background: var(--g-hero); color: #fff; padding: 1.8rem 2rem; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0 1.25rem; box-shadow: var(--shadow-lg); }
.hero-banner > *:not(.decor) { position: relative; z-index: 1; }
.hero-banner h1 { font-size: clamp(1.4rem, 3vw, 2.1rem); margin-bottom: .5rem; }
.hero-banner .eyebrow { color: rgba(255, 255, 255, .85); }
.hero-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; }
.hero-level { display: flex; align-items: center; gap: 1rem; background: rgba(255, 255, 255, .14); border-radius: 22px; padding: .8rem 1rem; backdrop-filter: blur(6px); min-width: 280px; }
.hero-level-bar { flex: 1; display: flex; flex-direction: column; gap: .35rem; font-weight: 600; }
.hero-level-bar small { opacity: .9; font-weight: 500; }
.element-tile { width: 76px; height: 84px; flex: none; border-radius: 16px; background: #fff; color: #4C1DB0; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; box-shadow: 0 8px 18px rgba(0, 0, 0, .15); }
.element-tile small { position: absolute; top: 5px; left: 8px; font-size: .7rem; font-weight: 700; }
.element-tile b { font: 800 1.9rem/1 var(--font-head); }
.element-tile span { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.element-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.element-tile.sm { width: 64px; height: 70px; background: var(--surface-2); color: var(--muted); box-shadow: none; }
.element-tile.sm b { font-size: 1.4rem; }
.element-tile.sm.is-reached { background: var(--g-alchemy); color: #fff; }
.element-tile.sm.is-current { outline: 3px solid var(--accent-yellow); outline-offset: 2px; }
.card-alchemy h2 { color: var(--primary-ink); letter-spacing: .02em; }
.resume { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; margin: 0 0 1.2rem; }
.resume div { background: var(--surface-2); padding: .6rem .8rem; border-radius: 14px; }
.resume div:nth-child(3) { grid-column: 1 / -1; }
.resume dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.resume dd { margin: 0; font-weight: 600; }
.card-alchemy form { display: flex; gap: .6rem; flex-wrap: wrap; }
.quick-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ql { display: flex; align-items: center; gap: .7rem; padding: .8rem; border-radius: 18px; background: var(--m-soft); color: var(--m-ink); font-weight: 700; text-decoration: none; transition: transform .18s var(--ease); }
.ql:hover { transform: translateY(-2px); }
.ql .sticker { width: 38px; height: 38px; border-radius: 12px; } .ql .sticker .ico { width: 20px; height: 20px; }
.announce { padding: .8rem 0; border-bottom: 1px dashed var(--border); }
.announce:last-child { border-bottom: 0; }
.announce.is-hidden { opacity: .5; }
.new-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }

/* Task hub */
.feature-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 1.25rem; padding: 1.6rem 1.8rem; border-radius: var(--r-modal); text-decoration: none; margin-bottom: 1.25rem; box-shadow: var(--shadow-lg); transition: transform .2s var(--ease); }
.feature-card > *:not(.decor) { position: relative; z-index: 1; }
.feature-card > div { flex: 1; }
.feature-card h2 { font-size: 1.5rem; margin-bottom: .25rem; }
.feature-card:hover { transform: translateY(-3px); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.module-tile { background: var(--surface); border-radius: var(--r-card); padding: 1.4rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--border); border-top: 6px solid var(--m); display: flex; flex-direction: column; gap: .5rem; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.module-tile:not(.is-static):hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-lg); }
.module-tile h2 { margin: .4rem 0 0; color: var(--m-ink); }
.module-tile .chip { align-self: flex-start; background: var(--m-soft); color: var(--m-ink); }

.activity-grid, .product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.activity-card { background: var(--surface); border-radius: var(--r-card); padding: 1.25rem; box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; flex-direction: column; gap: .4rem; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.activity-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.activity-card form { margin-top: auto; padding-top: .5rem; }
.activity-card.is-locked { opacity: .78; }
.activity-card.is-locked .sticker { background: var(--muted); }
.activity-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.activity-top .sticker { margin-right: auto; }
.page-head .sticker { width: 44px; height: 44px; }

/* Alchemy map */
.alchemy-summary { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; border: 0; }
.alchemy-summary h2 { margin-bottom: .2rem; }
.alchemy-summary p { margin: 0; opacity: .9; }
.chapter-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.chapter-progress { display: flex; align-items: center; gap: .6rem; min-width: 200px; }
.chapter-progress .progress { flex: 1; }
.subtopic { margin: 1.1rem 0 .5rem; color: var(--primary-ink); font-size: .95rem; }
.lo-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.lo { display: flex; align-items: center; gap: .8rem; padding: .75rem .9rem; border-radius: 16px; background: var(--surface-2); flex-wrap: wrap; }
.lo-dot { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--muted); border: 2px dashed var(--border); }
.lo-dot .ico { width: 18px; height: 18px; }
.lo-completed .lo-dot { background: rgba(0, 196, 204, .18); color: var(--teal-ink); border: 0; }
.lo-mastered .lo-dot { background: var(--g-reward); color: #fff; border: 0; }
.lo-current { background: rgba(123, 47, 247, .1); outline: 2px solid var(--primary); }
.lo-current .lo-dot { background: var(--g-hero); color: #fff; border: 0; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(123, 47, 247, .15); } }
.mastery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.mastery-cell { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .9rem .5rem; border-radius: 18px; background: var(--surface-2); text-align: center; }
.mastery-cell small { color: var(--muted); font-size: .75rem; }
.mastery-cell.m-mastered { background: rgba(255, 201, 60, .22); }
.mastery-cell.m-completed { background: rgba(0, 196, 204, .12); }

/* Leaderboard */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; margin: 1rem 0 1.5rem; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: min(30%, 180px); text-align: center; position: relative; }
.podium-name { font-size: .9rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.podium-step { width: 100%; border-radius: 20px 20px 8px 8px; display: grid; place-items: center; color: #fff; font: 800 2rem var(--font-head); margin-top: .4rem; box-shadow: var(--shadow); }
.rank-1 .podium-step { height: 150px; background: linear-gradient(160deg, #FFC93C, #FF8A3D); color: #3A2000; }
.rank-2 .podium-step { height: 112px; background: linear-gradient(160deg, #C7CEE0, #8E9AB8); }
.rank-3 .podium-step { height: 88px; background: linear-gradient(160deg, #E8A57A, #B66A3C); }
.rank-1 .avatar { box-shadow: 0 0 0 4px #FFC93C; }
.crown { color: #F4B400; position: absolute; top: -26px; } .crown .ico { width: 30px; height: 30px; fill: #FFC93C; }
.podium-col.is-me .podium-name { color: var(--primary-ink); }
.rank-list { list-style: none; padding: .5rem 1rem; margin: 0 0 1.25rem; }
.rank-list li { display: flex; align-items: center; gap: .8rem; padding: .7rem .3rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li.is-me { background: rgba(123, 47, 247, .08); border-radius: 14px; }
.rank { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font: 700 .9rem var(--font-head); flex: none; }
.rank-list.compact { padding: 0; }

/* Badges & products */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.badge-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 1.1rem .8rem; border-radius: 20px; background: var(--surface-2); filter: grayscale(1); opacity: .65; }
.badge-tile.is-earned { filter: none; opacity: 1; }
.badge-tile small { font-size: .78rem; color: var(--muted); }
.c-violet { --m-grad: var(--g-alchemy); } .c-sunshine { --m-grad: var(--g-reward); } .c-teal { --m-grad: linear-gradient(135deg, #00A8B0, #4FE3D2); }
.c-green { --m-grad: linear-gradient(135deg, #16A34A, #7EE0A1); } .c-coral { --m-grad: linear-gradient(135deg, #FF5C8A, #FF7A6B); } .c-tangerine { --m-grad: var(--g-market); }
.market-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.wallet-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.2rem; border-radius: 999px; box-shadow: var(--shadow-lg); }
.wallet-pill b { font: 800 1.5rem var(--font-head); }
.tabs-icons .ico { width: 18px; height: 18px; }
.product-card { background: var(--surface); border-radius: var(--r-card); padding: 1rem; box-shadow: var(--shadow); border: 3px solid var(--border); display: flex; flex-direction: column; gap: .5rem; transition: transform .2s var(--ease); }
.product-card:hover { transform: translateY(-3px); }
.product-card.rarity-rare { border-color: rgba(0, 196, 204, .5); }
.product-card.rarity-epic { border-color: rgba(123, 47, 247, .45); }
.product-art { height: 120px; border-radius: 16px; display: grid; place-items: center; position: relative; overflow: hidden; }
.product-art::after { content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .15); right: -40px; top: -60px; }
.art-ico { width: 56px; height: 56px; color: #fff; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .2)); }
.product-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: auto; }
.reveal { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .6rem; animation: pop .5s var(--ease); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.timeline { list-style: none; padding: 0 0 0 1rem; margin: 0; border-left: 3px solid var(--border); }
.timeline li { position: relative; padding: .5rem 0 .5rem .9rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.timeline .dot { position: absolute; left: -1.55rem; width: 16px; height: 16px; border-radius: 50%; background: var(--g-hero); border: 3px solid var(--surface); }
.profile-card { text-align: center; }
.profile-card .avatar { margin-bottom: .6rem; }
.profile-card .kv { text-align: left; }
.prose h3 { margin-top: 1.2rem; color: var(--primary-ink); }

/* ---------------------------------------------------------------- quiz player */
.play { max-width: 860px; margin: 0 auto; }
.play-head { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.play-title { flex: 1; min-width: 0; }
.play-title h1 { font-size: 1.25rem; margin: .3rem 0 0; }
.timer { position: relative; width: 64px; height: 64px; flex: none; }
.timer svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 5; }
.t-bg { stroke: var(--surface-2); }
.t-fg { stroke: var(--m); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 0; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer.is-low .t-fg { stroke: var(--danger); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font: 800 1.1rem var(--font-head); }
.play-progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.play-progress span { display: block; height: 100%; width: 0; background: var(--m-grad); transition: width .4s var(--ease); }
.question-card { margin-top: 1rem; padding: 2rem; text-align: center; border-top: 6px solid var(--m); }
.question-body { font: 600 clamp(1.1rem, 2.4vw, 1.45rem)/1.45 var(--font-head); margin: 0; }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.answer {
  --c: #7B2FF7; display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.2rem; min-height: 76px; border-radius: 20px; border: 0;
  background: var(--c); color: #fff; font: 600 1.02rem/1.35 var(--font-body); text-align: left; cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .18); transition: transform .12s var(--ease), box-shadow .12s, opacity .2s;
}
.answer:hover:not([disabled]) { transform: translateY(-2px); }
.answer:active:not([disabled]) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.answer .opt { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, .25); font: 800 1.05rem var(--font-head); }
.answer:nth-child(1) { --c: #6D28D9; } .answer:nth-child(2) { --c: #00838A; } .answer:nth-child(3) { --c: #C8325C; } .answer:nth-child(4) { --c: #B45309; } .answer:nth-child(5) { --c: #15803D; }
.answer[disabled] { cursor: default; }
.answer.is-dim { opacity: .35; }
.answer.is-hidden-opt { visibility: hidden; }
.answer.is-correct { --c: #16A34A; opacity: 1; animation: bounce .45s var(--ease); }
.answer.is-wrong { --c: #DC2626; opacity: 1; animation: shake .4s; }
@keyframes bounce { 40% { transform: scale(1.04); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.feedback { border-left: 8px solid var(--m); }
.feedback-head { display: flex; align-items: center; gap: .6rem; font: 800 1.2rem var(--font-head); margin-bottom: .4rem; }
.feedback.is-correct { border-color: var(--accent-green); } .feedback.is-correct .feedback-head { color: var(--green-ink); }
.feedback.is-wrong { border-color: var(--danger); } .feedback.is-wrong .feedback-head { color: var(--danger); }
.powerups { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem; }
.powerup-btn { display: inline-flex; align-items: center; gap: .4rem; border: 2px dashed var(--primary); background: rgba(123, 47, 247, .08); color: var(--primary-ink); border-radius: 999px; padding: .45rem .9rem; font-weight: 700; cursor: pointer; }
.powerup-btn[disabled] { opacity: .4; cursor: default; }

.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1rem; background: rgba(20, 17, 43, .6); backdrop-filter: blur(6px); }
.modal-card { position: relative; z-index: 1; width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--r-modal); padding: 2rem; text-align: center; box-shadow: var(--shadow-lg); animation: pop .45s var(--ease); max-height: 92vh; overflow-y: auto; }
.modal-card .sticker { margin: -4rem auto .8rem; display: grid; }
.complete-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin: 1.2rem 0 .6rem; }
.complete-stats div { background: var(--surface-2); border-radius: 16px; padding: .8rem .4rem; display: flex; flex-direction: column; }
.complete-stats b { font: 800 1.5rem var(--font-head); }
.complete-stats span { font-size: .72rem; font-weight: 600; opacity: .85; }
.complete-stats div.g-reward { background: var(--g-reward); color: #2A1500; }
.complete-stats div.g-market { background: var(--g-market); color: #fff; }
.complete-extras { display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0 1rem; }
.extra { display: flex; align-items: center; gap: .5rem; justify-content: center; padding: .5rem .8rem; border-radius: 14px; background: rgba(123, 47, 247, .08); font-weight: 600; }
.extra-level { background: var(--g-alchemy); color: #fff; }
.modal-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 220px; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .brand-mobile { display: flex; padding: 0; font-size: 1rem; }
  .topbar { padding: .7rem 1rem; }
  .content { padding: .25rem 1rem 6.5rem; }
  .grid-2, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { padding: 1.5rem 1.25rem 4rem; min-height: 0; }
  .hero-tag, .hero-points { display: none; }
  .auth-logo { margin: 0; justify-content: center; width: 100%; }
  .auth-panel { margin-top: -3rem; position: relative; z-index: 2; align-items: start; }
  .auth-card { padding: 1.6rem 1.25rem; }
  .bottom-nav {
    display: flex; position: fixed; left: .75rem; right: .75rem; bottom: .75rem; z-index: 50; justify-content: space-around; align-items: flex-end;
    background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); padding: .45rem .3rem calc(.45rem + env(safe-area-inset-bottom)); border: 1px solid var(--border);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 700; padding: .25rem 0; }
  .bottom-nav .bn-ico { width: 40px; height: 32px; display: grid; place-items: center; border-radius: 999px; }
  .bottom-nav a.active { color: var(--primary-ink); }
  .bottom-nav a.active .bn-ico { background: rgba(123, 47, 247, .14); }
  .bottom-nav a.is-center .bn-ico { width: 56px; height: 56px; margin-top: -1.6rem; border-radius: 50%; background: var(--g-hero); color: #fff; box-shadow: 0 10px 22px rgba(123, 47, 247, .4); border: 4px solid var(--bg); }
  .admin-mobile-nav { display: flex; gap: .4rem; overflow-x: auto; padding: .2rem 1rem .6rem; scrollbar-width: none; }
  .admin-mobile-nav::-webkit-scrollbar { display: none; }
  .admin-mobile-nav a { flex: none; padding: .45rem .9rem; border-radius: 999px; background: var(--surface); color: var(--muted); text-decoration: none; font-weight: 600; font-size: .82rem; box-shadow: var(--shadow); }
  .admin-mobile-nav a.active { background: var(--g-hero); color: #fff; }
  .is-admin .content { padding-bottom: 2rem; }
  .mobile-only { display: block; }
  .hero-banner { padding: 1.4rem; }
  .hero-level { min-width: 0; width: 100%; }
  .bar-row { grid-template-columns: 90px 1fr 40px; }
  .bar-row small { grid-column: 2 / -1; margin-top: -.5rem; }
  .field-inline { flex-direction: column; align-items: stretch; }
  .field-inline input, .field-inline select { max-width: none; }
  .toasts { left: 1rem; right: 1rem; max-width: none; }
}
@media (max-width: 560px) {
  .stat-grid, .stat-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .stat-tile { padding: .9rem; }
  .stat-tile b { font-size: 1.4rem; }
  .stat-tile .sticker { width: 32px; height: 32px; right: .7rem; top: .7rem; }
  .answer-grid { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .answer { min-height: 60px; padding: .8rem 1rem; }
  .question-card { padding: 1.3rem 1rem; }
  .complete-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resume { grid-template-columns: minmax(0, 1fr); }
  .podium { gap: .5rem; }
  .rank-1 .podium-step { height: 120px; } .rank-2 .podium-step { height: 90px; } .rank-3 .podium-step { height: 70px; }
  .avatar-lg { width: 52px; height: 52px; }
  .pill-level { display: none; }
  .feature-card { flex-direction: column; align-items: flex-start; padding: 1.3rem; }
  .card { padding: 1.1rem; }
}

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

/* ---------------------------------------------------------------- Phase 2: KHERmistry Live */
.seg label { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem 1rem; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .88rem; cursor: pointer; }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input { accent-color: var(--primary); }
.pin-input { font: 800 2rem var(--font-head); letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.live-scorebar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: .25rem 0 1rem; }
.live-scorebar .pill b { font-variant-numeric: tabular-nums; }
.live-wait { text-align: center; padding: 3rem 1.5rem; }
.live-wait .sticker { margin: 0 auto 1rem; }
.live-pulse { animation: livePulse 1.6s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 92, 138, .45); } 50% { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(255, 92, 138, 0); } }
.answer.is-picked { --c: var(--primary); outline: 4px solid rgba(255, 255, 255, .7); outline-offset: -6px; }
.answer .answer-count { margin-left: auto; font: 800 1rem var(--font-head); background: rgba(0, 0, 0, .18); border-radius: 999px; padding: .15rem .6rem; }
.live-mini { margin-top: 1rem; }
.live-confetti { z-index: 90; }
.rank-compact li { padding: .35rem .6rem; }
.live-mine { margin: .5rem 0; }
.live-podium { min-height: 0; }
.live-join-panel { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; background: var(--grad-hero, linear-gradient(135deg, #7B2FF7 0%, #00C4CC 100%)); color: #fff; }
.live-join-panel .muted, .live-join-panel .eyebrow { color: rgba(255, 255, 255, .88); }
.live-pin .big-code { font: 800 clamp(3rem, 9vw, 5.5rem) var(--font-head); letter-spacing: .12em; padding: 0; background: none; color: #fff; line-height: 1.05; font-variant-numeric: tabular-nums; }
.live-qr { background: #fff; border-radius: 20px; padding: .6rem; line-height: 0; }
.live-qr svg { width: 220px; height: 220px; }
.live-stage .question-body { font-size: clamp(1.25rem, 2.6vw, 2rem); text-align: center; margin: .5rem 0 1rem; }
.live-players { display: flex; flex-wrap: wrap; gap: .4rem; }
.live-host .row-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.live-hw[hidden] { display: none; }

/* ---------------------------------------------------------------- Phase 2: Demo / Support banners */
.mode-banner { position: sticky; top: 0; z-index: 60; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .6rem 1.25rem; font-weight: 700; color: #fff; }
.mode-banner form { margin: 0; }
.mode-banner .btn { padding: .35rem .9rem; font-size: .85rem; }
.mode-banner .grow { flex: 1 1 auto; }
.mode-banner small { font-weight: 500; opacity: .92; }
.mode-banner a { color: #fff; }
.mode-demo { background: repeating-linear-gradient(135deg, #B45309 0 18px, #C2410C 18px 36px); }
.mode-support { background: #9F1239; }
.mode-banner .seg { margin: 0; background: rgba(255, 255, 255, .18); }
.mode-banner .seg a { color: #fff; }
.mode-banner .seg a.active { background: #fff; color: #1E1B3A; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.demo-card { display: flex; flex-direction: column; gap: .5rem; }
.demo-card form { margin-top: auto; }

@media (max-width: 860px) {
  .live-join-panel { grid-template-columns: 1fr; text-align: center; }
  .live-qr { justify-self: center; }
  .live-qr svg { width: 180px; height: 180px; }
}
