/* ============ FizzyQuiz ============ */
:root {
  --brand: #2457f5;
  --brand-2: #6b8cff;
  --brand-soft: #e8eeff;
  --navy: #0d1a3d;
  --ink: #111a3f;
  --ink-2: #3c4566;
  --muted: #6b7393;
  --line: #e4e8f3;
  --bg: #f4f6fc;
  --surface: #ffffff;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #e11d48;
  --bad-soft: #ffe4e6;
  --sun: #f59e0b;
  --gem: #06b6d4;
  --radius: 20px;
  --sh-1: 0 1px 2px rgba(17, 26, 63, .06), 0 2px 8px rgba(17, 26, 63, .05);
  --sh-2: 0 6px 24px rgba(17, 26, 63, .08), 0 2px 6px rgba(17, 26, 63, .05);
  --sh-3: 0 24px 60px rgba(17, 26, 63, .18);
  --ui: "Outfit", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --side: 248px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; line-height: 1.5; overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--ui); letter-spacing: -.01em; line-height: 1.15; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: breathe 1.4s var(--ease) infinite; border-radius: 16px; }
@keyframes breathe { 50% { transform: scale(.9); opacity: .7; } }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 10px; }

/* ============ layout ============ */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.logo svg, .logo > img { width: 38px; height: 38px; flex: none; transition: transform .4s var(--spring); }
.logo:hover svg, .logo:hover > img { transform: rotate(-8deg) scale(1.06); }
.logo span { font-family: var(--ui); font-weight: 700; font-size: 1.5rem; letter-spacing: -.03em; color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px;
  font-family: var(--ui); font-weight: 600; font-size: 1.02rem; color: var(--ink-2);
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.nav a:hover { background: var(--bg); transform: translateX(3px); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav .i { width: 22px; height: 22px; }
.side-foot { margin-top: auto; }
.math-cluster { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 2px 6px 14px; }
.math-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-family: var(--ui); font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.math-back:hover { border-color: var(--brand); color: var(--brand); }
.math-back .i { width: 16px; height: 16px; }
.mstat { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-family: var(--ui); font-weight: 700; font-size: .85rem; }
.mstreak { color: var(--sun); }
.mrank { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--rc, #b0703c) 45%, var(--line)); background: color-mix(in srgb, var(--rc, #b0703c) 7%, var(--surface)); color: color-mix(in srgb, var(--rc, #b0703c) 85%, var(--ink)); font-family: var(--ui); font-weight: 800; font-size: .82rem; white-space: nowrap; }
.mrank svg { width: 15px; height: 15px; fill: var(--rc, #b0703c); }
.nav .subj-emoji { width: 22px; text-align: center; flex: none; font-size: 1.05rem; line-height: 1; }
.nav .subj-ico { display: inline-grid; place-items: center; color: var(--brand); }
.nav .subj-ico .i { width: 20px; height: 20px; stroke-width: 1.9; }
/* Subject dropdowns: each subject's sections sit under its name in the sidebar. */
.nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-head { display: flex; align-items: center; gap: 2px; }
.nav-head a { flex: 1; min-width: 0; gap: 10px; padding: 11px 6px 11px 12px; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-head a[aria-current] { background: var(--brand-soft); color: var(--brand); }
.nav-caret { flex: none; width: 28px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.nav-caret:hover { background: var(--bg); color: var(--ink); }
.nav-caret .i { width: 18px; height: 18px; transform: rotate(90deg); transition: transform .25s var(--ease); }
.nav-group.open .nav-caret .i { transform: rotate(-90deg); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 25px; padding-left: 12px; border-left: 2px solid var(--line); animation: sub-in .25s var(--ease); }
.nav-sub[hidden] { display: none; }
.nav .nav-sub a { padding: 7px 12px; border-radius: 10px; font-size: .93rem; font-weight: 600; gap: 8px; }
.nav .nav-sub a:hover { transform: none; }
.nav .nav-sub a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
@keyframes sub-in { from { opacity: 0; transform: translateY(-4px); } }
.nav-sub-phone { display: none; }
.shell.subject-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.shell.subject-mode .main { min-height: 0; height: 100%; }
.subject-stage, .shell.subject-mode .content.subject-stage { flex: 1; min-height: 0; padding: 0; max-width: none; margin: 0; width: 100%; display: flex; flex-direction: column; }
.stage-view { flex: 1; min-height: 0; display: flex; animation: none; }
.subject-frame { flex: 1; width: 100%; height: 100%; min-height: 0; border: 0; display: block; background: #fff; }
body:has(.subject-mode) { overflow: hidden; }
.me-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; border: 1px solid var(--line);
  transition: box-shadow .2s, transform .2s var(--ease);
}
.me-chip:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.me-chip b { display: block; font-family: var(--ui); font-size: .98rem; line-height: 1.2; }
.me-chip small { color: var(--muted); font-size: .78rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
}
.topbar .mlogo { display: none; margin-right: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: var(--surface);
  box-shadow: var(--sh-1); font-family: var(--ui); font-weight: 700; font-size: .95rem; white-space: nowrap;
}
.pill .i { width: 18px; height: 18px; }
.pill.streak .i { color: #f97316; }
.pill.gems .i { color: var(--gem); }
.pill.lvl { padding-right: 15px; }
.lvl-ring { width: 26px; height: 26px; position: relative; display: grid; place-items: center; font-size: .72rem; }
.lvl-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.bump { animation: bump .5s var(--spring); }
@keyframes bump { 40% { transform: scale(1.18); } }

.content { padding: 8px 32px 64px; max-width: 1240px; width: 100%; margin: 0 auto; }
.view { animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } }
.stagger > * { animation: rise .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(6) { animation-delay: .2s; } .stagger > *:nth-child(7) { animation-delay: .24s; }
.stagger > *:nth-child(8) { animation-delay: .28s; } .stagger > *:nth-child(n+9) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.bottom-nav { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 24px; flex-wrap: wrap; }
.eyebrow { font-family: var(--ui); font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.section-title { font-family: var(--ui); font-size: 1.3rem; font-weight: 700; margin: 34px 0 14px; display: flex; align-items: center; justify-content: space-between; }
.section-title a { font-size: .95rem; color: var(--brand); }
.back { display: inline-flex; align-items: center; gap: 6px; font-family: var(--ui); font-weight: 600; color: var(--muted); margin-bottom: 10px; transition: color .2s, transform .2s; }
.back:hover { color: var(--brand); transform: translateX(-3px); }
.back .i { width: 18px; height: 18px; }

/* ============ components ============ */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: 14px;
  background: var(--brand); color: #fff; font-family: var(--ui); font-weight: 700; font-size: 1.02rem;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--brand) 70%, #000), 0 8px 20px color-mix(in srgb, var(--brand) 30%, transparent);
  transition: transform .15s var(--ease), box-shadow .15s, filter .2s; user-select: none;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 70%, #000); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: 0 3px 0 var(--line), var(--sh-1); border: 1px solid var(--line); }
.btn.good { background: var(--good); box-shadow: 0 4px 0 #11803a; }
.btn.lg { padding: 16px 30px; font-size: 1.15rem; border-radius: 16px; }
.btn.sm { padding: 8px 14px; font-size: .9rem; border-radius: 11px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--sh-1); border: 1px solid var(--line);
}
:where(.card) { padding: 22px; }
.panel { padding: 24px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; font-family: var(--ui); background: var(--brand-soft); color: var(--brand); }
.bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transform-origin: left; animation: grow 1s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }

/* ============ home ============ */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 34px 36px; color: #fff;
  background: linear-gradient(125deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 55%, #7c3aed) 100%);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; box-shadow: var(--sh-2);
}
.hero h1 { color: #fff; }
.hero p { opacity: .9; margin-top: 8px; font-size: 1.06rem; max-width: 520px; }
.hero .blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .25; background: #fff; animation: float 9s ease-in-out infinite; }
.hero .b1 { width: 260px; height: 260px; right: -60px; top: -90px; }
.hero .b2 { width: 140px; height: 140px; right: 220px; bottom: -70px; animation-delay: -3s; opacity: .14; }
@keyframes float { 50% { transform: translate(-16px, 18px) scale(1.06); } }
.hero-stats { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.ring { position: relative; width: 116px; height: 116px; display: grid; place-items: center; text-align: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .track { stroke: rgba(255, 255, 255, .22); }
.ring .val { stroke: #fff; transition: stroke-dashoffset 1.2s var(--ease); }
.ring b { font-family: var(--ui); font-size: 1.6rem; line-height: 1; display: block; }
.ring small { font-size: .74rem; opacity: .85; font-weight: 600; }
/* Streak fire */
.ring.lit::before { content: ""; position: absolute; inset: 9%; border-radius: 50%; background: rgba(8, 12, 56, .3); }
.flame { --fh: var(--h); position: absolute; left: 50%; top: 50%; width: calc(var(--fh) * .833); height: var(--fh); margin: calc(var(--fh) * -.53) 0 0 calc(var(--fh) * -.4165); pointer-events: none; transform-origin: 50% 90%; animation: flame-in .7s var(--ease) both; }
.ring .flame svg { position: static; display: block; width: 100%; height: 100%; transform: none; overflow: visible; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--glow) 55%, transparent)); }
.flame.out { animation: none; }
.ring .flame.out svg { filter: none; }
@keyframes flame-in { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.streak-stat { display: flex; align-items: center; gap: 12px; }
.streak-stat > div:last-child b { display: block; font-family: var(--ui); font-size: 2.1rem; line-height: 1; }
.streak-stat > div:last-child small { display: block; margin-top: 3px; font-size: .78rem; font-weight: 600; opacity: .85; white-space: nowrap; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; position: relative; }
.hero .btn { background: #fff; color: var(--brand); box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.hero .btn.ghost { background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .35); box-shadow: none; }

.game-card {
  position: relative; overflow: hidden; border-radius: 22px; aspect-ratio: 16 / 10; display: flex; align-items: flex-end;
  padding: 18px; color: #fff; box-shadow: var(--sh-1); transition: transform .3s var(--ease), box-shadow .3s; isolation: isolate;
  text-align: left; width: 100%;
}
.game-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; transition: transform .6s var(--ease); }
.game-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 35%, rgba(5, 10, 30, .85)); }
.game-card:hover { transform: translateY(-5px); box-shadow: var(--sh-3); }
.game-card:hover canvas { transform: scale(1.06); }
.game-card h3 { font-size: 1.35rem; }
.game-card p { font-size: .86rem; opacity: .85; }
.game-card .play-dot { position: absolute; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; transform: scale(.8); opacity: 0; transition: all .3s var(--spring); }
.game-card:hover .play-dot { transform: scale(1); opacity: 1; }

.list-row {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--sh-1); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; width: 100%; text-align: left;
}
.list-row:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.list-row .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; flex: none; background: var(--brand-soft); }
.list-row b { font-family: var(--ui); font-size: 1.05rem; display: block; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .chev { color: var(--muted); transition: transform .25s var(--ease); }
.list-row:hover .chev { transform: translateX(4px); color: var(--brand); }
.stars { color: var(--sun); font-size: .9rem; letter-spacing: 1px; }

.tabs { display: inline-flex; gap: 4px; padding: 5px; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { padding: 8px 14px; border-radius: 10px; font-family: var(--ui); font-weight: 600; color: var(--muted); transition: all .2s var(--ease); }
.tabs button[aria-pressed="true"] { background: var(--brand); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 35%, transparent); }

/* ============ quiz / practice ============ */
.quiz { max-width: 760px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.quiz-top .bar { flex: 1; height: 14px; }
.quiz-top .bar > i { animation: none; transition: width .5s var(--ease); }
.x-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); transition: background .2s, transform .2s; }
.x-btn:hover { background: var(--surface); transform: rotate(90deg); }
.mult { font-family: var(--ui); font-weight: 800; color: #f97316; min-width: 44px; text-align: right; }
.q-card { padding: 30px; animation: qIn .45s var(--ease) both; }
@keyframes qIn { from { opacity: 0; transform: translateX(40px); } }
.q-card.out { animation: qOut .3s var(--ease) both; }
@keyframes qOut { to { opacity: 0; transform: translateX(-40px); } }
.q-kind { font-family: var(--ui); font-weight: 700; color: var(--brand); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
.q-text { font-family: var(--ui); font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 700; margin: 10px 0 24px; line-height: 1.3; }
.q-text .big { font-size: 2.6rem; display: block; margin-top: 8px; letter-spacing: .02em; }
.passage { background: var(--bg); border-radius: 16px; padding: 18px 20px; margin-bottom: 20px; line-height: 1.7; font-size: 1.02rem; max-height: 260px; overflow: auto; }
.choices { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice {
  position: relative; padding: 18px 18px 18px 56px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line);
  font-weight: 600; font-size: 1.05rem; text-align: left; box-shadow: 0 3px 0 var(--line); transition: transform .15s var(--ease), border-color .2s, background .2s, box-shadow .15s;
}
.choice:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); transform: translateY(-2px); }
.choice:active { transform: translateY(2px); box-shadow: none; }
.choice .k { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-family: var(--ui); color: var(--muted); }
.choice.right { border-color: var(--good); background: var(--good-soft); box-shadow: 0 3px 0 #86efac; animation: pop .4s var(--spring); }
.choice.right .k { border-color: var(--good); background: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 3px 0 #fda4af; animation: shake .4s; }
.choice.wrong .k { border-color: var(--bad); background: var(--bad); color: #fff; }
.choice.dim { opacity: .55; }
.choices.locked .choice { pointer-events: none; }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.type-row { display: flex; gap: 10px; }
.type-row input { flex: 1; min-width: 0; padding: 16px 18px; border-radius: 16px; border: 2px solid var(--line); font-size: 1.15rem; font-weight: 600; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.type-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.type-row input.right { border-color: var(--good); background: var(--good-soft); }
.type-row input.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s; }
.feedback {
  margin-top: 20px; padding: 16px 20px; border-radius: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  animation: slideUp .35s var(--ease) both;
}
.feedback.right { background: var(--good-soft); color: #14532d; }
.feedback.wrong { background: var(--bad-soft); color: #881337; }
.feedback .grow { flex: 1; min-width: 200px; }
.feedback b { font-family: var(--ui); font-size: 1.15rem; display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } }
.xp-float { position: fixed; z-index: 90; pointer-events: none; font-family: var(--ui); font-weight: 800; font-size: 1.3rem; color: var(--good); text-shadow: 0 2px 0 #fff; animation: xpFloat 1.1s var(--ease) forwards; }
@keyframes xpFloat { 0% { opacity: 0; transform: translateY(0) scale(.6); } 20% { opacity: 1; transform: translateY(-14px) scale(1.15); } 100% { opacity: 0; transform: translateY(-70px) scale(1); } }

.results { text-align: center; padding: 40px 28px; max-width: 560px; margin: 0 auto; }
.results .big-emoji { font-size: 4.5rem; animation: pop 1s var(--spring) infinite alternate; display: inline-block; }
.results h1 { margin: 10px 0 6px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0; }
.result-stats div { padding: 16px 8px; border-radius: 16px; background: var(--bg); }
.result-stats b { display: block; font-family: var(--ui); font-size: 1.7rem; }
.result-stats small { color: var(--muted); font-weight: 600; }

/* flashcards */
.flash { perspective: 1200px; height: 260px; margin-bottom: 18px; cursor: pointer; }
.flash-in { position: relative; width: 100%; height: 100%; transition: transform .6s var(--ease); transform-style: preserve-3d; }
.flash.flipped .flash-in { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 24px; display: grid; place-items: center; text-align: center; padding: 24px; box-shadow: var(--sh-2); }
.flash-face.front { background: var(--surface); border: 1px solid var(--line); font-family: var(--ui); font-size: 2.4rem; font-weight: 800; }
.flash-face.back { background: linear-gradient(135deg, var(--brand), #5b7cff); color: #fff; transform: rotateY(180deg); font-size: 1.15rem; }
/* Flashcards (js/flashcards.js) */
.fc-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.fc-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.fc-s { display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-family: var(--ui); font-size: .82rem; font-weight: 600; color: var(--muted); }
.fc-s b { font-size: .95rem; color: var(--ink); }
.fc-s.learning b { color: var(--brand); }
.fc-s.mastered b { color: #059669; }
.fc-tools { display: flex; gap: 6px; }
.fc-tools .chip { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fc-tools .chip .i { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fc-stage { position: relative; }
.fc .flash { position: relative; height: 300px; touch-action: pan-y; user-select: none; -webkit-user-select: none; --yes: 0; --no: 0; }
.fc .flash-in { transition: transform .55s cubic-bezier(.3, 1.3, .5, 1); }
.fc .flash-face.front { flex-direction: column; gap: 12px; font-size: 1rem; box-shadow: var(--sh-2), inset 0 0 0 calc(var(--yes) * 3px) #059669, inset 0 0 0 calc(var(--no) * 3px) #f59e0b; }
.fc-word { font-family: var(--ui); font-size: clamp(2rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.fc-word--back { color: #fff; display: block; }
.fc-mean { display: block; font-family: var(--ui); font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.flash-face.front .fc-mean { color: var(--ink); }
.fc-say { position: absolute; right: 14px; bottom: 14px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; cursor: pointer; }
.fc-say--back { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .35); color: #fff; }
.fc-say .i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fc-say .i path:first-child { fill: currentColor; }
.fc-stamp { position: absolute; top: 18px; padding: 4px 12px; border-radius: 10px; border: 2.5px solid; font-family: var(--ui); font-weight: 800; font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; pointer-events: none; background: var(--surface); }
.fc-stamp--yes { left: 18px; color: #059669; transform: rotate(-12deg); opacity: var(--yes); }
.fc-stamp--no { right: 18px; color: #d97706; transform: rotate(12deg); opacity: var(--no); }
.fc-hint { text-align: center; color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
.fc-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fc-actions .btn { min-width: 160px; justify-content: center; }
.fc-done .fc-stats { justify-content: center; margin: 16px 0 12px; }
.fc-missed { margin: 8px auto 6px; max-width: 460px; }
.fc-end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
@media (max-width: 560px) { .fc .flash { height: 260px; } .fc-actions .btn { min-width: 0; flex: 1; } }
@media (prefers-reduced-motion: reduce) { .fc .flash-in { transition: none; } }
.flash-face.back i { display: block; margin-top: 10px; opacity: .85; font-size: .95rem; }

/* ============ geography ============ */
.geo-wrap { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.geo-side { padding: 22px; position: sticky; top: 80px; }
.map-box { position: relative; overflow: hidden; border-radius: 24px; background: linear-gradient(180deg, #dbeafe, #eff6ff); border: 1px solid var(--line); box-shadow: var(--sh-1); aspect-ratio: 16 / 10; touch-action: none; }
.map-box svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-box svg:active { cursor: grabbing; }
.map-box path.land { fill: #f8fafc; stroke: #94a3b8; stroke-width: .5; vector-effect: non-scaling-stroke; transition: fill .25s; }
.map-box path.land.quiz:hover { fill: #c7d2fe; cursor: pointer; }
.map-box path.land.mastered { fill: #86efac; }
.map-box path.land.target { fill: #fbbf24; animation: glow 1.2s ease-in-out infinite; }
.map-box path.land.right { fill: var(--good); }
.map-box path.land.wrong { fill: var(--bad); }
.map-box path.land.reveal { fill: var(--good); animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .55; } }
.map-tools { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.map-tools button { width: 38px; height: 38px; border-radius: 12px; background: var(--surface); box-shadow: var(--sh-1); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; transition: transform .2s; }
.map-tools button:hover { transform: scale(1.08); }
.map-tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 700; font-size: .85rem; transform: translate(-50%, -130%); white-space: nowrap; opacity: 0; transition: opacity .15s; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 600; }
.flag-img { width: 100%; max-width: 280px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 14px; box-shadow: var(--sh-2); margin: 4px auto 20px; border: 1px solid var(--line); background: var(--bg); }
.mode-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; text-align: left; transition: transform .25s var(--ease), box-shadow .25s; }
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--sh-2); }
.mode-card .ico { font-size: 2rem; }
.mode-card b { font-family: var(--ui); font-size: 1.15rem; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .9rem; transition: all .2s var(--ease); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ games ============ */
.game-overlay { position: fixed; inset: 0; z-index: 80; background: #050a1e; color: #fff; animation: fadeIn .35s var(--ease); display: flex; flex-direction: column; }
@keyframes fadeIn { from { opacity: 0; } }
.game-overlay canvas.stage { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-veil { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(5, 10, 30, .35), rgba(5, 10, 30, .85)); }
.preview { position: relative; margin: auto; text-align: center; padding: 24px; animation: rise .7s var(--ease) both; }
.preview .tag { background: rgba(255, 255, 255, .14); color: #fff; }
.preview h1 { font-family: var(--ui); font-weight: 900; font-size: clamp(3rem, 9vw, 6.5rem); letter-spacing: -.04em; margin: 14px 0 8px; text-shadow: 0 8px 40px rgba(0, 0, 0, .5); }
.preview p { opacity: .85; max-width: 480px; margin: 0 auto; font-size: 1.08rem; }
.play-big {
  margin-top: 28px; width: 96px; height: 96px; border-radius: 50%; background: #fff; color: var(--brand); display: inline-grid; place-items: center;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); animation: pulse 2s infinite; transition: transform .2s var(--spring);
}
.play-big:hover { transform: scale(1.1); }
.play-big svg { width: 40px; height: 40px; margin-left: 6px; fill: currentColor; }
@keyframes pulse { 70% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
.preview .best { margin-top: 16px; font-family: var(--ui); font-weight: 700; opacity: .8; }
/* online play (Snake Arena): the button under Play, and the lobby where you pick a room */
.online-btn { margin-top: 20px; display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); color: #fff; font-family: var(--ui); font-weight: 800; transition: background .2s, transform .2s var(--spring); }
.online-btn:hover { background: rgba(255, 255, 255, .24); transform: translateY(-1px); }
.so-lobby { width: min(380px, calc(100vw - 48px)); margin: 0 auto; padding: 26px 24px; border-radius: 24px; background: rgba(8, 14, 36, .82); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 10px; }
.so-lobby .tag { align-self: center; }
.so-lobby h2 { font-family: var(--ui); font-weight: 900; font-size: 1.9rem; letter-spacing: -.02em; margin-top: 4px; }
.preview .so-sub { font-size: .95rem; margin-bottom: 8px; }
.so-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border-radius: 14px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); color: #fff; font-family: var(--ui); font-weight: 800; transition: filter .15s, transform .1s; }
.so-btn:hover { filter: brightness(1.2); }
.so-btn:active { transform: translateY(2px); }
.so-btn.primary { background: #16a34a; border-color: #16a34a; box-shadow: 0 4px 0 #0f6f33; font-size: 1.1rem; padding: 15px 16px; }
.so-btn:disabled, .so-join input:disabled { opacity: .5; pointer-events: none; }
.so-join { display: flex; gap: 8px; }
.so-join input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .08); color: #fff; font-family: var(--ui); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; text-align: center; }
.so-join input::placeholder { color: rgba(255, 255, 255, .5); letter-spacing: 0; text-transform: none; font-weight: 600; }
.so-join input:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); }
.preview .so-status { min-height: 1.4em; font-size: .95rem; font-weight: 700; opacity: 1; }
.preview .so-note { font-size: .82rem; opacity: .7; line-height: 1.45; }
/* online races: everyone's score in a row under the bar, and the cards between rounds */
.race-strip { position: relative; z-index: 2; display: flex; gap: 8px; padding: 0 18px 10px; overflow-x: auto; scrollbar-width: none; min-height: 40px; }
.race-chip { flex: none; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); font-family: var(--ui); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.race-chip b { margin-left: 4px; font-weight: 900; }
.race-chip.me { background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .5); }
.race-chip.lead { border-color: #fde047; color: #fde047; }
.race-chip.gone { opacity: .45; }
.race-msg h2.race-count { font-size: clamp(5rem, 20vw, 9rem); line-height: 1; }
.race-msg .race-code { display: inline-block; margin: 6px 0; font-family: var(--ui); font-size: 2.2rem; font-weight: 900; letter-spacing: .18em; color: #fde047; }
.race-results { list-style: none; margin: 14px auto 6px; padding: 0; width: min(320px, 80vw); counter-reset: place; }
.race-results li { counter-increment: place; display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; border-radius: 12px; font-family: var(--ui); font-weight: 700; }
.race-results li::before { content: counter(place) "."; opacity: .6; margin-right: 8px; }
.race-results li span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-results li.me { background: rgba(255, 255, 255, .16); }
.race-results li:first-child b { color: #fde047; }
.race-msg { background: rgba(5, 10, 30, .8); }
.race-msg p { margin: 6px 0; }
.race-msg .race-next { opacity: .7; font-size: .92rem; margin-bottom: 14px; }
/* short screens (a phone on its side): keep Play, Play online and the lobby on screen, and let the rest scroll */
@media (max-height: 560px) {
  .preview { padding: 6px 24px 12px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
  .preview h1 { font-size: clamp(2rem, 11vh, 3rem); margin: 6px 0 4px; }
  .preview p { font-size: .95rem; }
  .play-big { margin-top: 12px; width: 64px; height: 64px; }
  .play-big svg { width: 28px; height: 28px; margin-left: 4px; }
  .online-btn { margin-top: 10px; padding: 8px 16px; }
  .preview .best { margin-top: 8px; }
  .so-lobby { padding: 14px 18px; gap: 8px; }
  .so-lobby .tag, .preview .so-sub { display: none; }
  .so-lobby h2 { font-size: 1.4rem; margin: 0; }
  .so-btn, .so-btn.primary { padding: 10px 14px; font-size: 1rem; }
  .so-join input { padding: 9px 12px; }
}
.game-bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.game-bar .x-btn { color: #fff; background: rgba(255, 255, 255, .1); }
.game-bar .x-btn:hover { background: rgba(255, 255, 255, .2); }
.game-bar .title { font-family: var(--ui); font-weight: 800; font-size: 1.15rem; }
.game-bar .hud { margin-left: auto; font-family: var(--ui); font-weight: 700; display: flex; gap: 14px; }
.game-bar .music-btn { font-size: 1.15rem; }
.game-bar .music-btn:hover { transform: scale(1.08); }
.game-bar .music-btn[aria-pressed="false"] { opacity: .65; }
.game-stage { position: relative; flex: 1; min-height: 0; }
.game-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 3; background: rgba(5, 10, 30, .55); animation: fadeIn .3s; }
.game-msg h2 { font-family: var(--ui); font-weight: 900; font-size: clamp(2.2rem, 6vw, 3.6rem); }
.game-msg p { opacity: .85; margin: 8px 0 20px; }
.chess-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; }
.chess-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(92vw, calc(100vh - 150px)); aspect-ratio: 1; border-radius: 14px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); user-select: none; }
.sq { position: relative; display: grid; place-items: center; font-size: min(8.6vw, calc((100vh - 150px) / 10)); line-height: 1; cursor: pointer; }
.sq.l { background: #e9edf8; } .sq.d { background: #7f95d1; }
.sq.sel { background: #fde68a !important; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(250, 204, 21, .35); }
.sq.check { background: radial-gradient(circle, #f87171 0%, #dc2626 60%, transparent 90%) !important; }
.sq .dot { position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(13, 26, 61, .28); }
.sq .ring2 { position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(13, 26, 61, .28); }
.pc { transition: transform .18s var(--ease); z-index: 1; }
.pc.w { color: #fff; text-shadow: 0 0 2px #0d1a3d, 0 0 2px #0d1a3d, 0 2px 4px rgba(0, 0, 0, .5); }
.pc.b { color: #0d1a3d; text-shadow: 0 1px 1px rgba(255, 255, 255, .4); }
.sq:hover .pc { transform: scale(1.08); }
.sq .coord { position: absolute; font-size: 11px; font-weight: 700; opacity: .6; font-family: var(--ui); }
.sq .coord.f { right: 4px; bottom: 2px; } .sq .coord.r { left: 4px; top: 2px; }
.sq.l .coord { color: #7f95d1; } .sq.d .coord { color: #e9edf8; }

/* ============ profile ============ */
.banner { position: relative; height: 170px; border-radius: 28px 28px 0 0; overflow: hidden; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .15)); }
.profile-head { position: relative; padding: 0 28px 24px; display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.avatar { display: grid; place-items: center; border-radius: 50%; flex: none; font-size: 1.3rem; line-height: 1; }
.avatar.xl { width: 128px; height: 128px; font-size: 4rem; margin-top: -64px; border: 6px solid var(--surface); box-shadow: var(--sh-2); transition: transform .4s var(--spring); }
.avatar.xl:hover { transform: rotate(-6deg) scale(1.05); }
.avatar.sm { width: 40px; height: 40px; }
.nameplate { font-family: var(--ui); font-weight: 700; font-size: .85rem; color: var(--brand); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.pick {
  position: relative; aspect-ratio: 1; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center;
  font-size: 1.9rem; transition: transform .2s var(--spring), border-color .2s;
}
.pick:hover { transform: scale(1.07); }
.pick[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.pick.locked { filter: grayscale(1); opacity: .55; }
.pick .cost { position: absolute; bottom: -8px; left: 50%; translate: -50% 0; font-size: .7rem; font-weight: 800; font-family: var(--ui); background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 7px; white-space: nowrap; filter: none; }
.pick.swatch { font-size: 0; }
.pick.wide { aspect-ratio: 2 / 1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-family: var(--ui); font-weight: 600; font-size: .92rem; }
.field input, .field select { padding: 13px 15px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; transition: border-color .2s, box-shadow .2s; }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { padding: 16px; border-radius: 18px; background: var(--bg); text-align: center; transition: transform .25s var(--spring); }
.badge:hover { transform: translateY(-3px) rotate(-1deg); }
.badge .e { font-size: 2.2rem; display: block; }
.badge b { font-family: var(--ui); display: block; margin-top: 4px; }
.badge small { color: var(--muted); font-size: .78rem; }
.badge.off { opacity: .45; filter: grayscale(1); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px; }
.stat b { display: block; font-family: var(--ui); font-size: 1.7rem; }
.stat small { color: var(--muted); font-weight: 600; }

/* ============ onboarding ============ */
.welcome { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #dbe4ff, transparent 50%), radial-gradient(circle at 90% 90%, #ede9fe, transparent 45%), var(--bg); }
.welcome .card { width: min(480px, 100%); padding: 34px; animation: rise .6s var(--ease) both; }
.welcome .logo { justify-content: center; padding: 0 0 18px; }
.welcome h1 { text-align: center; font-size: 2.2rem; }
.welcome .lead { text-align: center; color: var(--muted); margin: 8px 0 24px; }

/* ============ toasts & confetti ============ */
#toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; translate: -50% 0; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 16px; background: var(--navy); color: #fff; font-weight: 700; box-shadow: var(--sh-3); animation: toastIn .45s var(--spring) both; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .e { font-size: 1.5rem; }
.toast small { display: block; font-weight: 500; opacity: .75; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.95); } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 95; }
#overlay { position: fixed; inset: 0; z-index: 80; }

/* ============ responsive ============ */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geo-wrap { grid-template-columns: minmax(0, 1fr); }
  .geo-side { position: static; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell.subject-mode { grid-template-rows: auto minmax(0, 1fr); }
  .side {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand foot" "cluster cluster" "nav nav" "sub sub";
    position: sticky; top: 0; height: auto; z-index: 40; gap: 8px;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px 8px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px);
  }
  .side .logo { grid-area: brand; padding: 2px 4px 0; }
  .side-foot { grid-area: foot; margin-top: 0; align-self: center; }
  .math-cluster { grid-area: cluster; flex-direction: row; flex-wrap: wrap; padding: 0; }
  .nav { grid-area: nav; flex-direction: row; overflow-x: auto; gap: 4px; -webkit-overflow-scrolling: touch; }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  .nav a:hover { transform: none; }
  .nav { overflow-y: visible; }
  .nav-group { display: contents; }
  .nav-caret, .nav .nav-sub { display: none; }
  .nav-sub-phone { grid-area: sub; display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-top: 2px; border-top: 1px solid var(--line); }
  .nav-sub-phone::-webkit-scrollbar { display: none; }
  .nav-sub-phone a { flex: none; white-space: nowrap; padding: 6px 12px; border-radius: 999px; font-family: var(--ui); font-weight: 600; font-size: .88rem; color: var(--ink-2); }
  .nav-sub-phone a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
  .topbar { padding: 12px 16px; }
  .content { padding: 4px 16px 28px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 26px 22px; }
  .hero-stats { justify-content: flex-start; }
  .pill.lvl span.t { display: none; }
}
@media (max-width: 560px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .choices { grid-template-columns: minmax(0, 1fr); }
  .q-card { padding: 22px 18px; }
  .ring { width: 96px; height: 96px; }
  .flame { --fh: calc(var(--h) * .83); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-head { padding: 0 18px 20px; }
  .avatar.xl { width: 104px; height: 104px; margin-top: -52px; font-size: 3.2rem; }
  .pill { padding: 6px 10px; font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============ chess screen ============ */
.game-overlay.chess { background: #302e2b; }
.cx { position: absolute; inset: 0; display: flex; gap: 22px; align-items: center; justify-content: center; padding: 6px 16px 16px; color: #fff; font-family: var(--ui); }
.cx-main { --bw: min(calc(100vh - 190px), calc(100vw - 420px), 760px); width: var(--bw); display: flex; flex-direction: column; gap: 8px; }
.cx-bar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.cx-av { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.cx-av.bot { background: #4b4847; }
.cx-who { flex: 1; min-width: 0; }
.cx-who b { font-weight: 700; font-size: .98rem; }
.cx-who small { color: #bab9b8; font-weight: 500; }
.cx-caps { position: relative; display: flex; align-items: center; height: 18px; }
.cx-caps piece { position: static; display: inline-block; width: 18px; height: 18px; margin-right: -7px; background-size: cover; transform: none !important; }
.cx-caps span { margin-left: 12px; font-size: .8rem; color: #bab9b8; font-weight: 700; }
.cx-clock { min-width: 110px; padding: 8px 12px; border-radius: 6px; background: #262421; color: #8b8987; font-size: 1.5rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; transition: background .2s, color .2s; }
.cx-clock.on { background: #fff; color: #262421; }
.cx-clock.on.low { background: #e02828; color: #fff; }
.cx-turn { font-size: .78rem; font-weight: 700; color: #81b64c; text-transform: uppercase; letter-spacing: .08em; }
.cx-board { position: relative; width: var(--bw); aspect-ratio: 1; border-radius: 4px; overflow: hidden; user-select: none; touch-action: none; box-shadow: 0 6px 30px rgba(0, 0, 0, .35); }
.cx-squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); }
.cx-sq { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.cx-sq.l { background: #ebecd0; } .cx-sq.d { background: #739552; }
.cx-sq.l.last, .cx-sq.l.sel { background: #f5f682; } .cx-sq.d.last, .cx-sq.d.sel { background: #b9ca43; }
.cx-sq.check { background: radial-gradient(circle, #ff3b3b 0%, #e01c1c 35%, rgba(224, 28, 28, .25) 70%) !important; }
.cx-sq.hover { box-shadow: inset 0 0 0 calc(var(--bw) / 160) rgba(255, 255, 255, .75); }
.cx-sq.dot::after { content: ""; position: absolute; inset: 35%; border-radius: 50%; background: rgba(0, 0, 0, .14); }
.cx-sq.ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: calc(var(--bw) / 110) solid rgba(0, 0, 0, .14); }
.cx-sq .rk, .cx-sq .fl { position: absolute; font-size: calc(var(--bw) / 46); font-weight: 700; line-height: 1; }
.cx-sq .rk { left: 4%; top: 4%; } .cx-sq .fl { right: 5%; bottom: 4%; }
.cx-sq.l .rk, .cx-sq.l .fl { color: #739552; } .cx-sq.d .rk, .cx-sq.d .fl { color: #ebecd0; }
.cx-pieces { position: absolute; inset: 0; pointer-events: none; }
.cx-pieces piece { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; background-size: cover; will-change: transform; }
.cx-pieces piece.anim { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.cx-pieces piece.dragging { z-index: 5; transition: none; transform-origin: center; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
.cx-promo { position: absolute; z-index: 10; width: 12.5%; display: flex; flex-direction: column; background: #fff; border-radius: 3px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); overflow: hidden; animation: promoIn .18s var(--ease); }
.cx-promo.top { top: 0; } .cx-promo.bottom { bottom: 0; flex-direction: column-reverse; }
.cx-promo button { position: relative; aspect-ratio: 1; display: block; transition: background .15s; }
.cx-promo button:hover { background: #e8e8e8; }
.cx-promo button piece { position: absolute; inset: 6%; background-size: cover; transition: transform .15s; }
.cx-promo button:hover piece { transform: scale(1.08); }
.cx-promo button.x { aspect-ratio: auto; height: calc(var(--bw) / 20); background: #f1f1f1; color: #8b8987; font-size: calc(var(--bw) / 40); }
@keyframes promoIn { from { opacity: 0; transform: scaleY(.8); } }
.cx-over { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(0, 0, 0, .35); animation: fadeIn .3s; }
.cx-over-card { width: min(320px, 80%); background: #fff; color: #312e2b; border-radius: 12px; padding: 26px 22px 20px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); animation: rise .45s var(--spring) both; }
.cx-trophy { font-size: 3rem; line-height: 1; }
.cx-over-card h3 { font-size: 1.7rem; font-weight: 800; margin-top: 8px; }
.cx-over-card p { color: #777; margin: 4px 0 18px; }
.cx-over-btns { display: grid; gap: 8px; }
.cx-side { width: 340px; height: calc(var(--bw, 640px) + 104px); max-height: calc(100vh - 80px); display: flex; flex-direction: column; background: #262522; border-radius: 10px; overflow: hidden; }
.cx-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #21201d; font-size: 1.05rem; }
.cx-head span { color: #bab9b8; font-weight: 600; font-size: .9rem; }
.cx-open { padding: 10px 16px; font-size: .9rem; font-weight: 600; color: #e8e6e3; border-bottom: 1px solid #3a3835; min-height: 40px; }
.cx-open .eco { color: #81b64c; margin-right: 8px; font-weight: 800; }
.cx-open .muted { color: #8b8987; }
.cx-moves { flex: 1; overflow-y: auto; padding: 6px 0; font-size: .95rem; }
.cx-row { display: grid; grid-template-columns: 44px 1fr 1fr; align-items: center; padding: 1px 10px; }
.cx-row:nth-child(even) { background: #2a2926; }
.cx-row .n { color: #8b8987; font-weight: 600; padding-left: 6px; }
.cx-row button { text-align: left; padding: 4px 8px; border-radius: 4px; font-weight: 700; color: #e8e6e3; font-family: var(--body); }
.cx-row button:hover { background: #3c3a37; }
.cx-row button.cur { background: #4b4847; color: #fff; box-shadow: inset 0 -2px 0 #81b64c; }
.cx-empty { color: #8b8987; padding: 16px; font-size: .9rem; }
.cx-offer { margin: 8px 12px; padding: 12px; border-radius: 8px; background: #3c3a37; font-size: .9rem; font-weight: 600; text-align: center; }
.cx-offer button { margin: 8px 4px 0; padding: 6px 12px; border-radius: 6px; background: #81b64c; color: #fff; font-weight: 800; }
.cx-offer button + button { background: #5d5a56; }
.cx-code { font-size: 2rem; font-weight: 900; letter-spacing: .2em; margin: 6px 0 2px; color: #fff; }
.cx-offer small { color: #bab9b8; }
.cx-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px 10px; border-top: 1px solid #3a3835; }
.cx-nav button { padding: 9px 0; border-radius: 6px; background: #3c3a37; color: #e8e6e3; font-size: 1rem; transition: background .15s; }
.cx-nav button:hover { background: #4b4847; }
.cx-actions { display: flex; gap: 8px; padding: 6px 10px 12px; }
.cx-actions .cx-btn { flex: 1; }
.cx-btn { padding: 11px 14px; border-radius: 8px; background: #3c3a37; color: #e8e6e3; font-weight: 800; font-family: var(--ui); box-shadow: 0 3px 0 #1d1c1a; transition: filter .15s, transform .1s; }
.cx-btn:hover { filter: brightness(1.15); }
.cx-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1d1c1a; }
.cx-btn.primary { background: #81b64c; color: #fff; box-shadow: 0 4px 0 #45753c; }
.cx-btn.big { font-size: 1.25rem; padding: 16px; }
.cx-over-card .cx-btn:not(.primary) { background: #ebecd0; color: #312e2b; box-shadow: 0 3px 0 #c9cab0; }
.cx-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #21201d; }
.cx-tabs button { padding: 12px 4px; color: #bab9b8; font-weight: 700; font-size: .9rem; border-bottom: 3px solid transparent; transition: color .15s, border-color .15s; }
.cx-tabs button[aria-pressed="true"] { color: #fff; border-color: #81b64c; }
.cx-setup { display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; overflow-y: auto; }
.cx-setup label { font-size: .85rem; font-weight: 700; color: #bab9b8; margin-top: 4px; }
.cx-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.cx-chips button { padding: 10px 6px; border-radius: 8px; background: #3c3a37; color: #e8e6e3; font-weight: 700; border: 2px solid transparent; transition: all .15s; }
.cx-chips button[aria-pressed="true"] { border-color: #81b64c; background: #45753c33; color: #fff; }
.cx-note { font-size: .82rem; color: #a7a6a2; line-height: 1.45; }
.cx-note.strong { color: #fff; font-weight: 700; }
.cx-join { display: flex; gap: 6px; }
.cx-join input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 2px solid #3c3a37; background: #1d1c1a; color: #fff; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.cx-join input:focus { outline: none; border-color: #81b64c; }
@media (max-width: 900px) {
  .cx { flex-direction: column; justify-content: flex-start; overflow-y: auto; padding: 4px 10px 20px; gap: 12px; }
  .cx-main { --bw: min(calc(100vw - 20px), calc(100vh - 260px)); }
  .cx-side { width: var(--bw); height: auto; max-height: none; flex: none; }
  .cx-moves { max-height: 160px; }
  .cx-clock { min-width: 84px; font-size: 1.2rem; }
}

/* ---------- geography levels, ranks and leaderboard (js/geo-rank.js) ---------- */
.geo-rank-row { margin-bottom: 22px; }
.geo-stat { display: grid; gap: 8px; align-content: start; }
.geo-stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.geo-stat-top > b { font-family: var(--ui); font-size: 1.15rem; }
.geo-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; text-align: center; }
.geo-kpis b { display: block; font-family: var(--ui); font-size: 1.25rem; }
.geo-kpis small { color: var(--muted); font-size: .78rem; }
.rank { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--rc) 45%, var(--line)); background: color-mix(in srgb, var(--rc) 7%, var(--surface)); color: color-mix(in srgb, var(--rc) 85%, var(--ink)); font-family: var(--ui); font-weight: 800; font-size: .82rem; white-space: nowrap; }
.rank svg { width: 15px; height: 15px; fill: var(--rc); }
.rank.big { font-size: 1.1rem; padding: 8px 15px 8px 11px; }
.rank.big svg { width: 22px; height: 22px; }
.tierrow { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; flex-wrap: wrap; }
.tierrow.on { background: var(--brand-soft); }
.rk-timer { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 4px 0 14px; }
.rk-timer i { display: block; height: 100%; width: 100%; background: var(--brand); transition: width .1s linear, background .3s; }
.rk-timer i.low { background: #ef4444; }
.lbtabs { margin-bottom: 14px; }
.lbrow { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 14px; }
.lbrow + .lbrow { border-top: 1px solid var(--line); }
.lbrow.me { background: var(--brand-soft); border-top-color: transparent; }
.lbrow .pos { width: 26px; text-align: center; font-family: var(--ui); color: var(--muted); }
.lbrow .grow { flex: 1; min-width: 0; }
.lbrow .grow b { display: block; font-family: var(--ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow small { color: var(--muted); font-size: .8rem; }
.lbrow .score { font-family: var(--ui); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
@media (max-width: 560px) { .lbrow .rank { display: none; } .lbrow .score { min-width: 0; } }

/* ---------- homepage: continue, daily challenge, overall leaderboard, classes (js/home-extras.js) ---------- */
.continue-row .btn { flex: none; }
.home-duo { margin-top: 28px; align-items: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.card-head h3 .i { width: 20px; height: 20px; color: var(--brand); }
.daily-card > p, .home-duo .card > p { margin-bottom: 14px; }
.daily-done { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); }
.daily-done b { font-family: var(--ui); font-size: 1.6rem; color: var(--brand); }
.board-title { font-family: var(--ui); font-size: .95rem; margin: 16px 0 6px; }
.board-note { margin-top: 12px; }
.board-note a, .classes-card a { color: var(--brand); font-weight: 700; }
.classes-card { display: flex; gap: 16px; align-items: flex-start; }
.classes-card .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.7rem; flex: none; background: var(--brand-soft); }
.classes-card .grow { flex: 1; min-width: 0; display: grid; gap: 6px; }
.classes-card b { font-family: var(--ui); font-size: 1.05rem; }
.tag-ok { display: inline-block; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--good); font-weight: 700; margin-right: 6px; }

/* ---------- admin mode (js/admin.js) ---------- */
.logo .code-input { width: 138px; min-width: 0; padding: 8px 12px; border: 2px solid var(--brand); border-radius: 12px; background: var(--surface); color: var(--ink); font: 700 1rem var(--ui); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); animation: codeIn .25s var(--ease) both; }
.logo .code-input::placeholder { color: var(--muted); font-weight: 600; }
.logo .code-input.shake { animation: codeShake .35s; border-color: var(--bad, #ef4444); }
@keyframes codeIn { from { opacity: 0; transform: translateX(-6px); } }
@keyframes codeShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
html[data-admin] .logo span::after { content: "admin"; margin-left: 8px; padding: 2px 8px; border-radius: 99px; background: var(--ink); color: var(--surface); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }
.adm-fab { position: fixed; z-index: 96; right: 16px; bottom: 16px; width: 46px; height: 46px; border-radius: 14px; border: 0; cursor: pointer; background: #0f172a; color: #7dd3fc; font: 800 1rem ui-monospace, Menlo, monospace; box-shadow: var(--sh-2); transition: transform .2s var(--ease); }
.adm-fab:hover { transform: translateY(-2px); }
.adm { position: fixed; z-index: 97; right: 16px; bottom: 72px; width: min(440px, calc(100vw - 32px)); height: min(420px, 60vh); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: #0b1220; color: #e2e8f0; box-shadow: 0 20px 60px rgba(2, 6, 23, .5); font: 500 .85rem/1.5 ui-monospace, Menlo, monospace; animation: rise .3s var(--ease) both; }
.adm-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #111a2e; border-bottom: 1px solid #1e293b; }
.adm-head b { font-family: var(--ui); font-size: .95rem; }
.adm-head small { color: #64748b; margin-right: auto; }
.adm-x { border: 0; background: none; color: #94a3b8; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.adm-log { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.adm-row b { color: #7dd3fc; } .adm-row span { color: #94a3b8; }
.adm-row.cmd { color: #f8fafc; } .adm-row .p, .adm-form .p { color: #38bdf8; }
.adm-row.err { color: #fca5a5; }
.adm-form { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid #1e293b; }
.adm-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #f8fafc; font: inherit; }
@media (max-width: 640px) { .adm-fab { bottom: 84px; } .adm { right: 8px; bottom: 140px; width: calc(100vw - 16px); height: min(360px, 50vh); } }

/* ---------- accounts, levels everywhere, games board ---------- */
.mscope { font-family: var(--ui); font-weight: 800; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-left: 4px; }
.acct { padding: 0 4px 10px; }
.acct .btn { width: 100%; justify-content: center; }
.acct-link { border: 0; background: none; color: var(--muted); font: 600 .85rem var(--ui); padding: 4px 8px; cursor: pointer; border-radius: 8px; }
.acct-link:hover { color: var(--brand); background: var(--brand-soft); }
.acct-top { margin-left: auto; display: inline-flex; }
.acct-top:empty { display: none; }
.nav-divider { height: 1px; background: var(--line); margin: 10px 8px; }
.linklike { border: 0; background: none; padding: 0; color: var(--brand); font: 700 inherit var(--ui); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linklike:hover { filter: brightness(.85); }

/* start screen and the Log in pop-up */
.welcome .auth-card { width: min(500px, 100%); }
.auth-tabs { display: flex; width: 100%; margin-bottom: 18px; }
.auth-tabs button { flex: 1; }
.auth-msg { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: .9rem; font-weight: 600; background: var(--brand-soft); }
.auth-msg.err { background: var(--bad-soft); color: var(--bad); }
.auth-msg.ok { background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--good); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--muted); font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { display: grid; gap: 10px; margin-top: 12px; }
.auth-guest { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.auth-scrim { position: fixed; inset: 0; z-index: 98; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 40, .5); backdrop-filter: blur(4px); animation: fadeIn .2s both; overflow-y: auto; }
.auth-modal { position: relative; width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 28px; animation: rise .35s var(--ease) both; }
.auth-modal h2 { font-size: 1.5rem; margin-bottom: 4px; padding-right: 36px; }
.auth-modal .muted { margin-bottom: 16px; }
.auth-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--bg); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.auth-x:hover { color: var(--ink); }
.auth-x .i { width: 18px; height: 18px; }

/* Your levels (home) */
.levels-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 12px; }
.lvl-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1); text-decoration: none; color: var(--ink); transition: transform .2s var(--ease), box-shadow .2s; flex-wrap: wrap; }
.lvl-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.lvl-tile .lvl-em { font-size: 1.6rem; line-height: 1; }
.lvl-tile div { flex: 1; min-width: 90px; }
.lvl-tile b { display: block; font-family: var(--ui); }
.lvl-tile small { color: var(--muted); font-weight: 600; }
.result-stats:has(div:nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .result-stats:has(div:nth-child(4)) { grid-template-columns: repeat(4, 1fr); } }

/* Games leaderboard */
.gb-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.gb-tabs button { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 600 .88rem var(--ui); color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.gb-tabs button[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.gb-tabs button:hover:not([aria-selected="true"]) { color: var(--ink); border-color: var(--brand); }
.subj-board .lbrow .rank, .gb-list .lbrow .rank { flex: none; }

/* My decks and deck study */
.deck-row { display: flex; align-items: center; gap: 10px; }
.deck-row .grow { flex: 1; min-width: 0; } .deck-row b { display: block; font-family: var(--ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-top { max-width: 640px; margin: 0 auto 14px; display: grid; gap: 6px; }
.ds-card { display: grid; place-items: center; gap: 10px; width: min(640px, 100%); min-height: 280px; margin: 0 auto; padding: 32px 28px; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-2); cursor: pointer; text-align: center; font: 700 clamp(1.3rem, 3.4vw, 1.9rem) var(--ui); color: var(--ink); transition: transform .25s var(--ease), background .25s; }
.ds-card:hover { transform: translateY(-2px); }
.ds-card.back { background: var(--brand-soft); border-color: var(--brand); }
.ds-side { overflow-wrap: anywhere; } .ds-hint { font-weight: 500; font-family: var(--body); }
.ds-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
.ds-actions[hidden] { display: none; }
@media (max-width: 860px) {
  .side-foot { display: flex; align-items: center; gap: 8px; }
  .acct { padding: 0; } .acct .btn { width: auto; white-space: nowrap; }
  .acct-top { display: none; }
  .nav-divider { display: none; }
}

.acct-in .short { display: none; }
@media (max-width: 860px) {
  .acct-in .long { display: none; } .acct-in .short { display: inline; }
  .side-foot { min-width: 0; flex-wrap: nowrap; }
  .side-foot .me-chip { padding: 6px 10px 6px 6px; gap: 8px; min-width: 0; }
  .side-foot .me-chip small { display: none; }
  .side-foot .me-chip b { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- classes (js/classes.js) ---------- */
.cls-home, .cls-block { display: grid; gap: 10px; }
.cls-home { gap: 18px; }
.cls-block h3 { font-family: var(--ui); font-size: 1.05rem; font-weight: 700; }
.cls-block + .cls-block { margin-top: 14px; }
.cls-home .cls-block + .cls-block { margin-top: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.cls-err { color: var(--bad); font-weight: 600; font-size: .9rem; }
.cls-asg, .cls-member { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cls-asg .grow, .cls-member .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cls-asg small, .cls-member small, .cls-row small, .cls-scores small { color: var(--muted); font-size: .82rem; }
.cls-asg b, .cls-member b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cls-asg .tag-ok { margin-right: 0; }
.cls-asg .due, .cls-scores .due { font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cls-asg .due.soon, .cls-scores .due.soon { color: var(--sun); }
.cls-subj { flex: none; font-family: var(--ui); font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 4px 8px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.cls-subj.s-geography { background: #dbeafe; color: #1d4ed8; }
.cls-subj.s-reading, .cls-subj.s-vocab { background: #ffedd5; color: #c2410c; }
.cls-subj.s-science { background: var(--good-soft); color: #15803d; }
.cls-subj.s-history { background: var(--bad-soft); color: #9f1239; }
.cls-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); transition: border-color .2s, transform .2s; }
.cls-row:hover { border-color: var(--brand); transform: translateX(2px); }
.cls-row b { font-family: var(--ui); }
.cls-row small { flex: 1; }
.cls-row code, .cls-code b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; font-weight: 700; color: var(--brand); }
.cls-join { display: flex; gap: 8px; flex-wrap: wrap; }
.cls-join input, .cls-new input, .cls-new select { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); }
.cls-join input[name="code"] { flex: 0 1 170px; text-transform: uppercase; letter-spacing: .14em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cls-join input:focus, .cls-new input:focus, .cls-new select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.cls-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cls-code { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 12px; padding: 10px 14px; border-radius: 14px; background: var(--brand-soft); }
.cls-code small { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; font-weight: 600; }
.cls-code b { font-size: 1.5rem; }
.cls-grid { margin: 16px 0; align-items: start; }
.cls-grid .cls-block + .cls-block { margin-top: 0; }
.cls-new { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cls-new label { display: grid; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.cls-new .wide, .cls-new button { grid-column: 1 / -1; }
.cls-scores { border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px; }
.cls-scores summary { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; list-style: none; }
.cls-scores summary::-webkit-details-marker { display: none; }
.cls-scores summary .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cls-score-list { display: grid; gap: 4px; padding: 6px 0 10px; border-top: 1px solid var(--line); }
.cls-score-list div { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; padding: 4px 2px; }
.cls-scores .btn { margin: 0 0 10px; }
.cls-danger { margin-top: 18px; color: var(--bad); }
.cls-subject:not(:empty) { margin-bottom: 18px; }
.asg-note { color: var(--good); font-weight: 600; }
.asg-note.bad { color: var(--bad); }
@media (max-width: 640px) {
  .cls-asg { flex-wrap: wrap; }
  .cls-asg .grow { flex-basis: calc(100% - 90px); }
  .cls-new { grid-template-columns: 1fr; }
  .cls-grid { grid-template-columns: 1fr; }
}
.cls-subject p a, #cls-page p a, .cls-home p a { color: var(--brand); font-weight: 700; }

/* ---------- admin: All accounts (js/admin-accounts.js) ---------- */
.acc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.acc-stats .card { display: grid; gap: 2px; }
.acc-stats b { font-family: var(--ui); font-size: 1.8rem; color: var(--brand); }
.acc-stats small { color: var(--muted); font-weight: 600; }
.acc-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.acc-tools input { flex: 1; min-width: 180px; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); }
.acc-tools input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.acc-scroll { overflow-x: auto; }
.acc-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.acc-table th { text-align: left; border-bottom: 1px solid var(--line); padding: 0; white-space: nowrap; }
.acc-table th button { border: 0; background: none; font: 700 .82rem var(--ui); color: var(--muted); padding: 8px 10px; cursor: pointer; }
.acc-table th[aria-sort] button, .acc-table th button:hover { color: var(--brand); }
.acc-table td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.acc-table td.num { font-variant-numeric: tabular-nums; }
.acc-table tbody tr:hover { background: var(--bg); }
.acc-admin { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--brand); color: #fff; font: 700 .7rem var(--ui); letter-spacing: .04em; vertical-align: 2px; }
.acc-note { display: grid; gap: 6px; }
.acc-note .i { width: 18px; height: 18px; vertical-align: -3px; color: var(--bad); }
.acc-note a { color: var(--brand); font-weight: 700; }

/* admin console: resize handles (drag the left/top edge or the top-left corner; double-click resets) */
.adm-grip { position: absolute; z-index: 2; touch-action: none; }
.adm-grip--l { left: 0; top: 14px; bottom: 0; width: 7px; cursor: ew-resize; }
.adm-grip--t { top: 0; left: 14px; right: 0; height: 7px; cursor: ns-resize; }
.adm-grip--tl { left: 0; top: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.adm-grip--tl::after { content: ""; position: absolute; left: 4px; top: 4px; width: 7px; height: 7px; border-left: 2px solid #475569; border-top: 2px solid #475569; border-radius: 2px 0 0 0; }
.adm-grip:hover, .adm.resizing .adm-grip { background: rgba(56, 189, 248, .18); }
.adm.resizing { user-select: none; }
.adm { max-width: calc(100vw - 24px); max-height: calc(100vh - 100px); }
.adm-link { color: #7dd3fc; font: 600 .8rem var(--ui); text-decoration: none; padding: 3px 8px; border-radius: 8px; border: 1px solid #1e3a5f; }
.adm-link:hover { background: #12263f; }

/* All accounts: roomier */
.acc-stats b { font-size: 2rem; }
.acc-card { padding: 22px; }
.acc-tools { margin-bottom: 18px; }
.acc-tools input { padding: 12px 16px; font-size: 1rem; }
.acc-table { font-size: 1rem; border-collapse: separate; border-spacing: 0; }
.acc-table th button { font-size: .85rem; padding: 12px 14px; text-transform: uppercase; letter-spacing: .04em; }
.acc-table td { padding: 16px 14px; vertical-align: middle; }
.acc-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
.acc-table tbody tr.on td { background: var(--brand-soft); }
.acc-table tbody tr.is-banned .acc-name { text-decoration: line-through; text-decoration-color: var(--bad); }
.acc-who { min-width: 180px; }
.acc-name { font-family: var(--ui); font-size: 1.02rem; margin-right: 6px; }
.acc-act { text-align: right; }
.acc-banned { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); font-weight: 700; font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.kbadges { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; flex-wrap: wrap; }
.kbadge { display: inline-block; padding: 1px 8px; margin: 0 4px 0 0; border-radius: 99px; font: 700 .7rem var(--ui); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; background: #e2e8f0; color: #334155; vertical-align: 2px; }
.kbadges .kbadge { margin: 0; }
.kbadge.b-admin { background: #fee2e2; color: #b91c1c; }
.kbadge.b-staff { background: var(--brand-soft); color: var(--brand); }
.kbadge.b-site { background: var(--brand); color: #fff; }

/* Manage section */
.acc-manage { margin-top: 22px; padding: 26px; scroll-margin-top: 20px; outline: none; border: 2px solid var(--brand-soft); }
.acc-m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.acc-m-head h2 { font-family: var(--ui); font-size: 1.5rem; }
.acc-msg { min-height: 1.4em; font-weight: 600; margin-bottom: 10px; }
.acc-msg.ok { color: var(--good); } .acc-msg.bad { color: var(--bad); }
.acc-m-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.acc-m-grid section { display: grid; gap: 10px; align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.acc-m-grid h3 { font-family: var(--ui); font-size: 1.05rem; }
.acc-m-grid section.acc-danger { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.acc-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acc-inline input { flex: 1; min-width: 120px; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); }
.acc-inline input[type="number"] { flex: 0 1 120px; }
.acc-inline input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.acc-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.acc-chip { display: inline-flex; align-items: center; gap: 2px; }
.acc-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 4px; }
.acc-chip button:hover { color: var(--bad); }
.btn.bad { background: var(--bad); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--bad) 70%, black); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { opacity: .7; }

/* phones: each account becomes a card */
@media (max-width: 760px) {
  .acc-table thead { display: none; }
  .acc-table, .acc-table tbody, .acc-table tr, .acc-table td { display: block; width: 100%; }
  .acc-table tr { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; overflow: hidden; }
  .acc-table td { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: none !important; }
  .acc-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: .85rem; }
  .acc-table td.acc-who { display: block; font-size: 1.05rem; background: var(--bg) !important; }
  .acc-table td.acc-who::before, .acc-table td.acc-act::before { content: none; }
  .acc-table td.acc-act { border-bottom: 0; }
  .acc-table td.acc-act .btn { width: 100%; justify-content: center; }
  .acc-manage { padding: 18px; }
}

/* banned screen */
.ban-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 40, .78); backdrop-filter: blur(6px); }
.ban-card { width: min(460px, 100%); text-align: center; display: grid; gap: 12px; justify-items: center; padding: 32px 26px; }
.ban-card h1 { font-family: var(--ui); font-size: 1.6rem; }
.ban-reason { font-weight: 700; color: var(--bad); }

/* No default page scrollbar on the right; the page still scrolls with the wheel, keys and touch. */
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Admin console buttons (help, and commands with choices such as immersive) */
.adm-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.adm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: 7px 14px; border-radius: 10px; border: 0; background: #2563eb; color: #fff; font: 700 .85rem/1.2 var(--ui), system-ui, sans-serif; letter-spacing: .01em; cursor: pointer; user-select: none; box-shadow: 0 3px 0 #1e40af, 0 4px 12px rgba(37, 99, 235, .35); transition: transform .12s var(--ease), box-shadow .12s, background .15s, filter .15s; }
.adm-btn:hover { background: #3b82f6; transform: translateY(-1px); box-shadow: 0 4px 0 #1e40af, 0 6px 16px rgba(59, 130, 246, .5); }
.adm-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1e40af, 0 2px 6px rgba(37, 99, 235, .3); }
.adm-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.adm-btn.on { background: #fff; color: #1d4ed8; box-shadow: 0 3px 0 #93c5fd, 0 0 0 2px #60a5fa; }
.adm-btn.on::before { content: ""; display: inline-block; width: .38em; height: .72em; margin: 0 5px 3px 1px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.adm-btn.more::after { content: "›"; font-size: 1.1em; margin-left: 2px; opacity: .85; }
.adm-btn.pri { background: #16a34a; box-shadow: 0 3px 0 #166534, 0 4px 12px rgba(22, 163, 74, .35); }
.adm-btn.pri:hover { background: #22c55e; box-shadow: 0 4px 0 #166534, 0 6px 16px rgba(34, 197, 94, .45); }
.adm-btn.pri:active { box-shadow: 0 1px 0 #166534; }
.adm-btn.bad { background: #dc2626; box-shadow: 0 3px 0 #991b1b, 0 4px 12px rgba(220, 38, 38, .35); }
.adm-btn.bad:hover { background: #ef4444; box-shadow: 0 4px 0 #991b1b, 0 6px 16px rgba(239, 68, 68, .45); }
.adm-btn.bad:active { box-shadow: 0 1px 0 #991b1b; }
.adm-btn[data-cancel] { background: #334155; box-shadow: 0 3px 0 #1e293b; }
.adm-btn[data-cancel]:hover { background: #475569; box-shadow: 0 4px 0 #1e293b; }
.adm-btn:disabled { opacity: .4; pointer-events: none; transform: none; box-shadow: none; }
.adm-row > .adm-btn { min-height: 28px; padding: 4px 11px; margin: 0 3px; vertical-align: middle; }
.adm-help { display: flex; gap: 12px; align-items: center; padding: 3px 0; }
.adm-help .adm-btn { flex: none; min-width: 104px; justify-content: space-between; }
.adm-help span i { font-style: normal; color: #64748b; }

/* Line icons in place of emoji (icon() in js/core.js) */
.mode-card .ico .i { width: 30px; height: 30px; color: var(--brand); stroke-width: 1.8; }
.classes-card .ico .i { width: 28px; height: 28px; color: var(--brand); }
.toast .e .i { width: 24px; height: 24px; color: #93c5fd; display: block; }
.res-ico { display: inline-grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent); animation: pop .6s var(--spring) both; }
.res-ico .i { width: 46px; height: 46px; stroke-width: 1.8; }
.ban-card .res-ico { background: var(--bad-soft); color: var(--bad); }
.fb-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; background: rgba(255,255,255,.7); }
.fb-ico .i { width: 24px; height: 24px; }
.acc-panel h3 .i, .acc-danger h3 .i, section > h3 > .i { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; color: var(--brand); }
.acc-danger h3 .i { color: var(--bad); }

/* ---------- Classes: tidy headings, one-piece fields, empty states, Join screen ---------- */
.cls-home, .cls-block { gap: 14px; }
.cls-title { display: flex; align-items: center; gap: 12px; }
.cls-title h3 { font-family: var(--ui); font-size: 1.15rem; font-weight: 800; line-height: 1.2; }
.cls-title p { margin-top: 2px; }
.cls-ico { display: inline-grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); }
.cls-ico .i { width: 28px; height: 28px; }
.cls-ico.sm { width: 40px; height: 40px; border-radius: 12px; }
.cls-ico.sm .i { width: 21px; height: 21px; }
.cls-ico.lg { width: 76px; height: 76px; border-radius: 22px; }
.cls-ico.lg .i { width: 38px; height: 38px; }
.cls-list { display: grid; gap: 10px; }
.cls-field { display: flex; align-items: stretch; gap: 6px; padding: 6px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.cls-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.cls-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; padding: 10px 12px; border-radius: 12px; }
.cls-field input:focus { outline: none; }
.cls-field .btn { flex: none; white-space: nowrap; padding: 11px 20px; border-radius: 13px; box-shadow: none; }
.cls-field .btn:active { transform: translateY(1px); }
.cls-field .btn .i { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.cls-row { padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.cls-row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cls-row code { padding: 5px 10px; border-radius: 9px; background: var(--brand-soft); font-size: .95rem; }
.cls-row .chev { width: 18px; height: 18px; color: var(--muted); flex: none; }
.cls-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 22px 16px; border: 2px dashed var(--line); border-radius: 18px; }
.cls-empty b { font-family: var(--ui); font-size: 1.2rem; font-weight: 800; }
.cls-empty p { max-width: 36ch; margin: 0 0 6px; }
.cls-empty .btn { margin-top: 6px; }
.cls-more { display: inline-flex; align-items: center; gap: 8px; font-family: var(--ui); font-weight: 700; color: var(--brand); padding: 6px 2px; }
.cls-more .i { width: 18px; height: 18px; }
.cls-joincard { max-width: 460px; margin: 18px auto; display: grid; justify-items: center; text-align: center; gap: 8px; padding: 32px 26px; }
.cls-joincard h1 { font-size: 1.8rem; }
.cls-joinform { display: grid; gap: 4px; width: 100%; margin-top: 14px; text-align: left; }
.cls-joinform .field span { font-family: var(--ui); font-weight: 600; font-size: .92rem; }
.cls-joinform .field input { padding: 13px 15px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; }
.cls-joinform .field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.cls-joinform .code-in { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.6rem; letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 800; }
.cls-joinform .btn { width: 100%; margin-top: 6px; }
@media (max-width: 480px) { .cls-field { flex-direction: column; } .cls-field .btn { padding: 13px; } .cls-row code { display: none; } }
/* Sign up: Student / Teacher */
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-pick button { display: grid; justify-items: center; gap: 3px; padding: 14px 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); text-align: center; transition: border-color .2s, box-shadow .2s, background .2s; }
.role-pick button .i { width: 26px; height: 26px; color: var(--muted); }
.role-pick button b { font-family: var(--ui); font-size: 1rem; }
.role-pick button small { font-size: .76rem; color: var(--muted); line-height: 1.25; }
.role-pick button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.role-pick button[aria-pressed="true"] .i { color: var(--brand); }
/* Verified checkmark beside a name: blue for a verified admin, green for a verified teacher (checkHTML in js/core.js). */
.kcheck { display: inline-flex; vertical-align: -0.15em; width: 1.05em; height: 1.05em; margin-left: 4px; flex: none; }
.kcheck svg { width: 100%; height: 100%; display: block; }
.kcheck .kc-seal { fill: #2563eb; stroke: none; }
.kcheck.k-teacher .kc-seal { fill: #16a34a; }
.kcheck .kc-tick { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.acc-m-head h2 .kcheck { width: .9em; height: .9em; }

/* ---------- Assessment (js/assess.js) ---------- */
.as-intro { max-width: 680px; }
.as-last { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); margin-bottom: 16px; }
.as-last small { display: block; color: var(--ink-2); }
.as-last-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--brand); flex: none; }
.as-last-ico .i { width: 22px; height: 22px; }
.as-points { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.as-points li { display: flex; gap: 10px; align-items: flex-start; }
.as-points .i { width: 20px; height: 20px; color: var(--brand); flex: none; margin-top: 2px; }
.as-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.as-intro .as-actions { justify-content: flex-start; }
.as-bar { margin: 6px 0 16px; }
.as-result .as-rows { text-align: left; margin: 18px auto 0; max-width: 360px; display: grid; gap: 6px; }
.as-row { display: flex; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.as-row b.good { color: var(--good); }
.as-row b.bad { color: var(--bad); }
.as-next-h { margin: 20px 0 10px; }
.as-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.as-link { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 99px; border: 2px solid var(--brand); color: var(--brand); font-weight: 700; text-decoration: none; background: var(--surface); transition: background .2s, color .2s; }
.as-link:hover { background: var(--brand); color: #fff; }
.as-link .i { width: 18px; height: 18px; }

/* ---------- Shop (js/shop.js) ---------- */
.kbadge.b-pack { background: linear-gradient(90deg, #fde68a, #f59e0b); color: #78350f; }
.shop-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; border-color: var(--brand); }
.shop-banner > .i { width: 26px; height: 26px; color: var(--brand); flex: none; }
.shop-banner .grow { display: flex; flex-direction: column; gap: 2px; }
.shop-bal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; padding: 14px 18px; }
.shop-bal > div { display: flex; flex-direction: column; gap: 2px; }
.shop-bal b { display: inline-flex; align-items: center; gap: 6px; font: 800 1.35rem var(--ui); color: var(--ink); }
.shop-bal b .i { width: 20px; height: 20px; color: var(--brand); }
.shop-bal small { color: var(--muted); font-weight: 600; }
.kshop-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }
.shop-gacha, .shop-packs { display: flex; gap: 20px; align-items: center; }
.shop-packs { margin-bottom: 18px; }
.shop-gacha .grow, .shop-packs .grow { flex: 1; min-width: 0; }
.shop-gacha h2, .shop-packs h2 { margin-bottom: 4px; }
.shop-machine { flex: none; width: 140px; }
.wheel-svg { width: 100%; height: auto; display: block; overflow: visible; }
.wh-name { font: 900 11px var(--ui), system-ui, sans-serif; fill: #fff; stroke: rgba(15, 23, 42, .45); stroke-width: 3px; paint-order: stroke; }
.wh-pct { font: 800 10px var(--ui), system-ui, sans-serif; fill: #fff; stroke: rgba(15, 23, 42, .45); stroke-width: 3px; paint-order: stroke; }
.shop-gacha .wh-rot { animation: wh-idle 30s linear infinite; }
@keyframes wh-idle { to { transform: rotate(360deg); } }
.btn.short, .buy-card.short { opacity: .55; cursor: pointer; }
/* the big wheel screen */
.wheel-ov .wh-main { display: grid; justify-items: center; gap: 12px; padding: 56px 16px 20px; max-height: 100vh; overflow-y: auto; width: 100%; }
.wh-title { margin: 0; font: 800 1.1rem var(--ui); color: #fff; text-align: center; }
.wh-stage { position: relative; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); }
.wh-stage::before { content: ""; position: absolute; inset: -14%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 60%, transparent), transparent 68%); transition: background .4s; pointer-events: none; }
.wh-pin { transform-origin: 0 -126px; }
.wh-pin.flap { animation: wh-flap .14s ease-out; }
@keyframes wh-flap { 40% { transform: rotate(-16deg); } }
.wh-res { margin: 0; min-height: 2.2em; display: flex; gap: 8px; align-items: center; justify-content: center; font: 800 1.25rem var(--ui); color: #fff; }
.wh-res.on { animation: shop-pop .35s var(--ease); }
.wh-res .tier-tag { font-size: .95rem; }
.wh-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 520px; min-height: 8px; }
.wh-chip { width: 44px; height: 44px; border-radius: 12px; background: #fff; border: 3px solid var(--tc); display: grid; place-items: center; animation: shop-pop .3s var(--ease); }
.wh-chip .ani-svg { width: 34px; height: 34px; }
.wh-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; max-width: 560px; font: 700 .85rem var(--ui); color: rgba(255, 255, 255, .85); }
.wh-legend li { display: flex; align-items: center; gap: 6px; }
.wh-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--tc); border: 1.5px solid #fff; }
.wh-legend b { color: #fff; }
@media (prefers-reduced-motion: reduce) { .shop-gacha .wh-rot { animation: none; } }
@keyframes shop-shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg) translateY(-2px); } 75% { transform: rotate(6deg) translateY(2px); } }
.pack-art { flex: none; width: 110px; }
.pack-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(36, 87, 245, .25)); transition: transform .3s var(--ease); }
.shop-packs:hover .pack-svg { transform: rotate(-4deg) scale(1.03); }
.spin-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 6px; }
.spin-btn { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 92px; }
.spin-btn small { font-weight: 600; font-size: .75rem; opacity: .85; }
.buy-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.buy-card, .boost-card { border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 12px; cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; transition: border-color .2s, transform .2s, box-shadow .2s; }
.buy-card:hover:not([disabled]) { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(36, 87, 245, .15); }
.buy-card[disabled] { opacity: .5; cursor: not-allowed; }
.buy-card b { font: 800 1.05rem var(--ui); }
.buy-card small { color: var(--muted); font-size: .75rem; }
.buy-price { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--brand); }
.buy-price .i { width: 16px; height: 16px; }
.buy-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.buy-ico .i { width: 22px; height: 22px; }
.boost-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.boost-card { flex-direction: row; text-align: left; gap: 12px; cursor: default; }
.boost-card .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.boost-card .btn { flex: none; display: inline-flex; align-items: center; gap: 5px; }
.boost-card .btn .i { width: 16px; height: 16px; }
.boost-on { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: #fef3c7; color: #92400e; font: 700 .8rem var(--ui); }
.boost-on .i { width: 14px; height: 14px; }
.shop-luck:empty { display: none; }
.shop-luck { margin-top: 8px; }
.pack-goal { display: flex; flex-direction: column; gap: 4px; max-width: 380px; margin-top: 10px; }
.odds { margin-top: 10px; }
.odds summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.odds-t { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .92rem; }
.odds-t th { text-align: left; color: var(--muted); font: 700 .75rem var(--ui); text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.odds-t td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.odds-t tr:last-child td { border-bottom: 0; }
.tier-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font: 800 .78rem var(--ui); color: #fff; background: var(--tc, var(--brand)); white-space: nowrap; }
.tier-tag.new { background: #db2777; }
.tier-tag.plain { background: var(--brand-soft); color: var(--brand); }
.tier-tag .i { width: 14px; height: 14px; }
.coll-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 12px; }
.coll-card { border: 2px solid var(--tc); border-radius: 14px; padding: 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; background: color-mix(in srgb, var(--tc) 7%, var(--surface)); }
.coll-card b { font: 800 .9rem var(--ui); color: var(--ink); }
.coll-card small { color: var(--tc); font-weight: 700; font-size: .75rem; }
.coll-card.locked { border-style: dashed; border-color: var(--line); background: var(--surface); }
.coll-card.locked b { color: var(--muted); font-weight: 600; }
.coll-card.locked small { color: var(--muted); }
.ani-svg { width: 64px; height: 64px; display: block; }
.shop-reveal { position: fixed; inset: 0; z-index: 110; background: rgba(9, 17, 40, .62); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.shop-reveal[hidden] { display: none; }
.rv-panel { width: min(900px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; animation: shop-pop .3s var(--ease); }
@keyframes shop-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.rv-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rv-top h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.rv-best { display: flex; align-items: center; gap: 16px; padding: 12px; margin: 10px 0; border-radius: 16px; background: linear-gradient(120deg, #fff7ed, #fdf2f8); }
.rv-best .rv-card { opacity: 1; transform: none; width: 120px; }
.rv-best p { font-size: 1.1rem; }
.rv-badge { display: flex; align-items: center; gap: 8px; padding: 12px; margin: 10px 0; border-radius: 14px; background: #fef3c7; color: #78350f; font-weight: 700; }
.rv-badge .i { width: 22px; height: 22px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.rv-grid.many { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.rv-card { position: relative; border: 2px solid var(--tc); border-radius: 14px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; background: color-mix(in srgb, var(--tc) 9%, var(--surface)); opacity: 0; transform: translateY(10px) scale(.9); transition: opacity .3s, transform .35s var(--ease); }
.rv-card.in, .pk-card.in { opacity: 1; transform: none; }
.rv-card b { font: 800 .85rem var(--ui); color: var(--ink); }
.rv-card small { color: var(--tc); font-weight: 800; font-size: .72rem; }
.rv-card.sm { padding: 6px 4px; }
.rv-card.sm .ani-svg { width: 44px; height: 44px; }
.rv-card.sm b { font-size: .72rem; }
.rv-card.t-epic, .pk-item.t-epic { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 25%, transparent); }
.rv-card.t-legendary, .rv-card.t-mythic, .pk-item.t-legendary, .pk-item.t-mythic { box-shadow: 0 0 18px color-mix(in srgb, var(--tc) 55%, transparent); }
.rv-card.in.t-legendary, .rv-card.in.t-mythic { animation: shop-glow 1.6s ease-in-out infinite alternate; }
@keyframes shop-glow { to { box-shadow: 0 0 28px color-mix(in srgb, var(--tc) 80%, transparent); } }
.rv-new { position: absolute; top: -8px; right: -6px; padding: 1px 7px; border-radius: 99px; background: #db2777; color: #fff; font: 800 .65rem var(--ui); text-transform: uppercase; letter-spacing: .05em; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pk-grid.many { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pk-card { border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .35s var(--ease); }
.pk-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--brand-soft); color: var(--ink); font-weight: 700; font-size: .85rem; }
.pk-item > .i { width: 18px; height: 18px; color: var(--brand); flex: none; }
.pk-item.k-jackpot { background: #fef3c7; color: #78350f; }
.pk-item.k-jackpot > .i { color: #d97706; }
.pk-item.ani { border: 2px solid var(--tc); background: color-mix(in srgb, var(--tc) 9%, var(--surface)); flex-wrap: wrap; }
.pk-item.ani .ani-svg { width: 34px; height: 34px; }
.pk-item.ani small { color: var(--tc); font-weight: 800; margin-left: auto; }
.rv-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; position: sticky; bottom: -1px; background: var(--surface); padding-top: 10px; }
@media (max-width: 900px) { .kshop-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .shop-bal { grid-template-columns: 1fr 1fr; }
  .shop-gacha, .shop-packs { flex-direction: column; text-align: center; }
  .spin-row { justify-content: center; }
  .buy-row, .boost-row { grid-template-columns: 1fr; }
  .boost-card { flex-wrap: wrap; }
}

/* ---------- Pack ripping (js/pack-rip.js) ---------- */
.rip { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; overflow: hidden; color: #fff; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--tc, #2563eb) 38%, #0b1226) 0%, #0b1226 62%); animation: rip-in .35s ease-out; }
@keyframes rip-in { from { opacity: 0; } to { opacity: 1; } }
.rip-skip { position: absolute; top: 16px; right: 16px; z-index: 2; }
.rip-count { position: absolute; top: 22px; left: 0; right: 0; text-align: center; font: 700 .95rem var(--ui); color: rgba(255, 255, 255, .75); margin: 0; pointer-events: none; }
.rip-main { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: grab; }
.rip-main:has(.grab) { cursor: grabbing; }
.rip-glow { position: absolute; left: 50%; top: 46%; width: 520px; height: 520px; translate: -50% -50%; border-radius: 50%; pointer-events: none; opacity: .35;
  background: radial-gradient(circle, var(--tc) 0%, transparent 65%); animation: rip-breathe 3s ease-in-out infinite; }
.rip-glow.burst { animation: rip-burst .9s ease-out forwards; }
@keyframes rip-breathe { 50% { opacity: .55; scale: 1.08; } }
@keyframes rip-burst { 0% { opacity: .9; scale: .6; } 100% { opacity: 0; scale: 2.6; } }
.rip-stage { position: relative; flex: none; animation: rip-float 3.2s ease-in-out infinite; }
.rip-stage.grab { animation: none; }
@keyframes rip-float { 50% { transform: translateY(-7px) rotate(.4deg); } }
.rip-pack { position: absolute; left: 0; top: 0; transform-origin: 0 0; outline: none; }
.rip-pack::before { content: ""; position: absolute; left: 16px; right: 16px; top: 52px; bottom: 16px; border-radius: 34px; z-index: -1; box-shadow: 0 26px 34px rgba(0, 0, 0, .5); }
.rl { position: absolute; left: -10px; top: 0; width: 320px; height: 440px; pointer-events: none; will-change: transform, clip-path; }
.rl svg { display: block; }
.rl-tl { transition: none; }
.rp-t { font-family: var(--ui), system-ui, sans-serif; font-weight: 900; }
.rp-big { font-size: 31px; letter-spacing: 1.5px; fill: #fff; stroke: rgba(15, 23, 42, .6); stroke-width: 7px; paint-order: stroke; stroke-linejoin: round; }
.rp-sub { font-size: 16px; letter-spacing: 6px; fill: #fff; stroke: rgba(15, 23, 42, .55); stroke-width: 6px; paint-order: stroke; stroke-linejoin: round; }
.rp-sheen { animation: rp-sheen 3.4s ease-in-out infinite; }
@keyframes rp-sheen { 0% { transform: translateX(0); } 55%, 100% { transform: translateX(480px); } }
.rip-edge { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.rip-edge path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.rip-spark { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .12s;
  background: radial-gradient(circle, #fff 0%, #fff 25%, color-mix(in srgb, var(--tc) 70%, #fff) 55%, transparent 72%); }
.rip-fleck { position: absolute; width: 5px; height: 3px; border-radius: 1px; pointer-events: none; animation: rip-fleck .6s ease-out forwards; }
@keyframes rip-fleck { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
.rip-hint { position: absolute; left: 14px; right: 14px; top: 62px; height: 0; pointer-events: none; }
.rip-hint::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; border-top: 3px dashed rgba(255, 255, 255, .9); }
.rip-hint span { position: absolute; top: -13px; left: 0; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #1e2a55; display: grid; place-items: center; font-weight: 900; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); animation: rip-hint 1.7s ease-in-out infinite; }
.rip-hint span::before { content: "›"; font-size: 20px; line-height: 1; margin-top: -2px; }
@keyframes rip-hint { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 26px); opacity: 0; } }
.rip-pack.went .rip-hint { display: none; }
.rip-rar, .rip-tip { margin: 0; text-align: center; }
.rip-rar b { font: 900 1.15rem var(--ui); letter-spacing: .06em; text-transform: uppercase; padding: 6px 16px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 2px solid var(--tc); box-shadow: 0 0 18px color-mix(in srgb, var(--tc) 55%, transparent); }
.rip-tip { font-weight: 600; color: rgba(255, 255, 255, .78); font-size: .95rem; min-height: 1.4em; }
.rip-out { display: grid; justify-items: center; gap: 16px; width: min(420px, 92vw); animation: shop-pop .35s var(--ease); }
.rip-rar.big b { font-size: 1.4rem; }
.rip-card { width: 100%; color: var(--ink); gap: 8px; padding: 12px; opacity: 1; transform: none; }
.rip-card > div { animation: rip-item .5s var(--ease, ease-out) both; animation-delay: calc(var(--i) * .22s + .1s); }
@keyframes rip-item { from { opacity: 0; transform: translateY(18px) scale(.9); } to { opacity: 1; transform: none; } }
.rip-card .pk-item { font-size: 1rem; padding: 10px 12px; }
.rip-card .pk-item.ani .ani-svg { width: 48px; height: 48px; }
.rip-next { min-width: 200px; }
@media (prefers-reduced-motion: reduce) { .rip-stage, .rip-glow, .rp-sheen { animation: none; } }

/* ---------- Pack results (inside the rip screen) and the older summary panel ---------- */
.rv-panel { background: var(--surface); }
.rv-actions { background: var(--surface); padding: 12px 0 2px; border-top: 1px solid var(--line); }
.rip-out { width: min(640px, 94vw); max-height: calc(100vh - 40px); overflow-y: auto; padding: 4px 6px 8px; gap: 14px; scrollbar-width: none; }
.rip-out::-webkit-scrollbar { display: none; }
.rip-title { margin: 0; font: 900 1.7rem var(--ui); letter-spacing: .01em; text-align: center; text-shadow: 0 2px 14px rgba(0, 0, 0, .45); }
.rip-badge { display: inline-block; font: 900 1.05rem var(--ui); letter-spacing: .09em; text-transform: uppercase; padding: 8px 20px; border-radius: 999px; color: #fff;
  background: color-mix(in srgb, var(--tc) 55%, #0b1226); border: 2px solid var(--tc); box-shadow: 0 0 24px color-mix(in srgb, var(--tc) 60%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.rip-sum { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rip-sum .tier-tag { font-size: .9rem; padding: 5px 13px; }
.rip-out .rv-badge { width: 100%; }
.rip-cards { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.rip-cards.one { grid-template-columns: minmax(0, 340px); justify-content: center; }
.rip-card { position: relative; display: grid; gap: 8px; align-content: start; padding: 14px; border-radius: 20px; color: var(--ink); background: var(--surface); width: auto; border: 0; opacity: 1; transform: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .5) inset; overflow: hidden; }
.rip-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--tc); }
.rip-lab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; color: var(--muted); font: 700 .78rem var(--ui); }
.rip-lab b { color: var(--ink); }
.rip-lab span { padding: 2px 9px; border-radius: 99px; color: #fff; background: var(--tc); font-weight: 800; }
.rip-card > div { animation: rip-item .55s var(--ease, ease-out) both; animation-delay: calc(var(--i) * .2s + .1s); }
.rip-card .pk-item { font-size: 1.02rem; padding: 12px 14px; border-radius: 14px; gap: 10px; }
.rip-card .pk-item > .i { width: 24px; height: 24px; }
.rip-card .pk-item.ani .ani-svg { width: 52px; height: 52px; }
.rip-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.rip-actions .btn { min-width: 170px; }
.rip-actions .btn.ghost { background: rgba(255, 255, 255, .95); }
@media (max-width: 480px) { .rip-title { font-size: 1.35rem; } .rip-actions .btn { flex: 1 1 100%; } }
/* many packs at once: a tilted row with one cut, then each bursts in its rarity's light */
.ripf-row { position: relative; flex: none; perspective: 900px; outline: none; animation: rip-float 3.2s ease-in-out infinite; }
.ripf-row.grab { animation: none; }
.ripf-slot { position: absolute; top: 0; transform: rotateY(var(--tilt)); transform-origin: 0 50%; animation: ripf-deal .5s var(--ease, ease-out) both; animation-delay: var(--d); }
@keyframes ripf-deal { from { opacity: 0; transform: translateY(40px) rotateY(var(--tilt)) rotate(-8deg); } to { opacity: 1; transform: rotateY(var(--tilt)); } }
.ripf-pack::before { box-shadow: -10px 18px 20px rgba(0, 0, 0, .55); }
.ripf-slot.lit::after { content: ""; position: absolute; inset: -12% -8%; border-radius: 30%; pointer-events: none; background: radial-gradient(closest-side, #fff, var(--tc) 45%, transparent 75%); mix-blend-mode: screen; animation: ripf-lit .7s ease-out forwards; }
@keyframes ripf-lit { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: .35; } }
.ripf-hint { left: 0; right: 0; }
.ripf-row.went .ripf-hint { display: none; }
.ripf-row > .rip-spark { left: -9px; top: -9px; z-index: 40; }
.ripf-more { margin: 4px 0 0; font-weight: 700; color: rgba(255, 255, 255, .7); }
@media (prefers-reduced-motion: reduce) { .ripf-row, .ripf-slot, .rip-cards.fanned > .rip-card, .rip-cards.fanned > .rip-card::after { animation: none; } }
.rip-cards.fanned > .rip-card { animation: ripf-card .55s var(--ease, ease-out) both; animation-delay: var(--d); box-shadow: 0 14px 34px rgba(0, 0, 0, .35), 0 0 26px color-mix(in srgb, var(--tc) 65%, transparent); }
.rip-cards.fanned > .rip-card.big { box-shadow: 0 14px 34px rgba(0, 0, 0, .35), 0 0 40px var(--tc); }
.rip-cards.fanned > .rip-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 85%, #fff), transparent 75%); animation: ripf-beam .9s ease-out both; animation-delay: var(--d); }
.rip-cards.fanned > .rip-card > div { animation-delay: calc(var(--d) + .3s); }
@keyframes ripf-card { 0% { opacity: 0; transform: scale(.5) rotateY(90deg); } 60% { opacity: 1; transform: scale(1.05) rotateY(0); } 100% { transform: none; } }
@keyframes ripf-beam { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Animal avatars (js/avatar.js): the face fills its circle */
.avatar > .ani-svg, .cx-av > .ani-svg { width: 86%; height: 86%; display: block; }
.avatar.xl > .ani-svg { width: 84%; height: 84%; }

.rip-sub { margin: -6px 0 0; text-align: center; color: rgba(255, 255, 255, .78); font-weight: 600; font-size: .95rem; max-width: 46ch; }

/* Continue with Google */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 13px 18px; margin-bottom: 4px; border-radius: 14px; border: 1px solid #dadce0; background: #fff; color: #3c4043;
  font: 600 1rem var(--ui); box-shadow: 0 1px 2px rgba(60, 64, 67, .15); transition: box-shadow .2s, background .2s, transform .15s; }
.btn-google:hover { background: #f8f9fa; box-shadow: 0 2px 8px rgba(60, 64, 67, .25); }
.btn-google:active { transform: translateY(1px); }
.btn-google:disabled { opacity: .6; pointer-events: none; }
.btn-google .g-logo { width: 22px; height: 22px; flex: none; }
.auth-form > .auth-or { margin-top: 12px; }

/* ---------- Pack pictures, waiting, click to rip, pinned buttons ---------- */
.rl-img, .rl-txt { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.rl .rp-t { font-family: var(--ui), system-ui, sans-serif; }
.rip-wait { display: grid; justify-items: center; gap: 16px; font: 800 1.15rem var(--ui); color: rgba(255, 255, 255, .9); }
.rip-wait p { margin: 0; }
.rip-spin { width: 54px; height: 54px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .22); border-top-color: #fff; animation: rip-spin .8s linear infinite; }
@keyframes rip-spin { to { rotate: 360deg; } }
.rip-main { cursor: pointer; }
.rip-main:has(.rip-out) { cursor: default; }
.rip-out.res { padding-bottom: 104px; }
/* Open more sits in the same spot (bottom centre) every time, so one click spot can open pack after pack */
.rip-out.res .rip-actions.pinned { position: fixed; left: 50%; bottom: 26px; translate: -50% 0; z-index: 5; width: min(360px, 92vw); }
.rip-out.res .rip-actions.pinned .btn { width: 100%; padding-block: 18px; font-size: 1.15rem; }

/* Interstellar: the rarest pack. The whole screen turns into deep space. */
.rip.rip-cosmic { background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, #22d3ee 26%, #0a0f3a) 0%, #060a26 55%, #02030f 100%); }
.rip.rip-cosmic::before { content: ""; position: absolute; inset: 0; pointer-events: none; animation: rip-twinkle 3.4s ease-in-out infinite alternate;
  background-image: radial-gradient(1.6px 1.6px at 8% 14%, #fff 50%, transparent), radial-gradient(1px 1px at 17% 71%, #fff 50%, transparent), radial-gradient(1.8px 1.8px at 26% 33%, #cdeeff 50%, transparent), radial-gradient(1.2px 1.2px at 34% 88%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 43% 9%, #fff 50%, transparent), radial-gradient(1px 1px at 52% 57%, #fff 50%, transparent), radial-gradient(1.8px 1.8px at 61% 22%, #ffd9fb 50%, transparent), radial-gradient(1.2px 1.2px at 69% 79%, #fff 50%, transparent), radial-gradient(1.6px 1.6px at 77% 41%, #fff 50%, transparent), radial-gradient(1px 1px at 85% 12%, #cdeeff 50%, transparent), radial-gradient(1.8px 1.8px at 92% 66%, #fff 50%, transparent), radial-gradient(1.2px 1.2px at 5% 52%, #fff 50%, transparent), radial-gradient(1.4px 1.4px at 48% 94%, #fff 50%, transparent), radial-gradient(1px 1px at 96% 90%, #fff 50%, transparent); }
@keyframes rip-twinkle { from { opacity: .45; } to { opacity: 1; } }
.rip-cards .rip-card[data-rank="6"] { box-shadow: 0 14px 34px rgba(0, 0, 0, .35), 0 0 34px #22d3ee, 0 0 0 2px #22d3ee; background: linear-gradient(160deg, #f0fdff, #e6e3ff); }
@media (prefers-reduced-motion: reduce) { .rip.rip-cosmic::before { animation: none; } }
