/* ============================================================
   JAMB CBT Battle Arena — mobile-first dark arena theme
   ============================================================ */

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

:root {
  --bg: #0b1120;
  --panel: #121a2b;
  --panel2: #0e1626;
  --border: rgba(148, 163, 184, .16);
  --text: #e7edf5;
  --muted: #93a3b8;
  --green: #19b45c;
  --green-dark: #0e8a45;
  --gold: #f2b530;
  --red: #ef4444;
  --radius: 14px;
}

html { color-scheme: dark; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(25, 180, 92, .15), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(242, 181, 48, .06), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
button { font-family: inherit; }

/* ------------------------------------------------ floating topbar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: 10px 12px 0;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 10px 18px;
  background: rgba(13, 20, 36, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, .5);
}
.brand { font-weight: 800; font-size: 16px; text-decoration: none; }
.brand em { font-style: normal; color: var(--green); }
.nav { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.nav a { text-decoration: none; color: var(--muted); min-width: 28px; text-align: center; transition: color .12s; }
.nav a:hover { color: var(--text); }
.user-chip {
  background: rgba(25, 180, 92, .12);
  border: 1px solid rgba(25, 180, 92, .35);
  color: #bdf3d2;
  padding: 4px 10px; border-radius: 999px; font-weight: 600; font-size: 12px;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ------------------------------------------------ global page loader
   Perfectly centered; fades in only when loading takes >250ms. */

#pageLoader {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 17, 32, .92);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 1;
  transition: opacity .25s ease;
}
#pageLoader.hidden-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.loader-card { display: grid; gap: 14px; justify-items: center; }
.loader-card .spinner { width: 48px; height: 48px; border-width: 4px; }
.loader-text { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

/* ------------------------------------------------ layout */

.container { width: min(540px, 94vw); margin: 18px auto; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: 11px; padding: 18px 14px; margin-top: 30px; }

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, .35);
}
.center-card { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 28px 18px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.page-title { font-size: 22px; margin-bottom: 14px; }

/* ------------------------------------------------ buttons & inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px;
  padding: 13px 18px; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none;
  transition: transform .12s, filter .12s, background .12s;
  min-height: 46px;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; box-shadow: 0 6px 18px rgba(25, 180, 92, .25); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-gold { background: linear-gradient(135deg, #f7c948, #e8a020); color: #241a02; box-shadow: 0 6px 18px rgba(242, 181, 48, .2); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost { background: rgba(148, 163, 184, .1); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: rgba(148, 163, 184, .18); }
.btn-lg { padding: 15px 22px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 38px; }
.btn-block { width: 100%; }
.grow { flex: 1; }
.btn-link { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 8px; }

.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.field input, .field select {
  width: 100%; padding: 13px 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text);
  font-size: 16px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(25, 180, 92, .18); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ------------------------------------------------ chips, badges, pills */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(148, 163, 184, .1); border: 1px solid var(--border);
  padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .5px; }
.badge-ready { background: rgba(25, 180, 92, .16); color: #7ef0ab; border: 1px solid rgba(25, 180, 92, .4); }
.badge-win   { background: rgba(242, 181, 48, .16); color: var(--gold); border: 1px solid rgba(242, 181, 48, .45); }
.badge-loss  { background: rgba(239, 68, 68, .12); color: #ff9b9b; border: 1px solid rgba(239, 68, 68, .4); }
.badge-draw  { background: rgba(148, 163, 184, .14); color: var(--muted); border: 1px solid var(--border); }

.flash-error {
  background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4);
  color: #ffb4b4; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px;
}

/* ------------------------------------------------ home */

.auth-card { text-align: center; display: grid; gap: 12px; padding: 34px 20px; margin-top: 6vh; }
.logo-big { font-size: 46px; line-height: 1; }
.auth-card h1 { font-size: 24px; }
.auth-card form { text-align: left; display: grid; gap: 10px; margin-top: 6px; }

.home-grid { display: grid; gap: 14px; margin-top: 4px; }
.btn-huge {
  display: grid; grid-template-areas: "ico lbl" "ico sub";
  grid-template-columns: 52px 1fr;
  align-items: center; column-gap: 14px;
  text-align: left; text-decoration: none;
  border-radius: 18px; padding: 18px;
  border: 1px solid var(--border);
  cursor: pointer; color: var(--text);
  transition: transform .12s, filter .12s;
}
.btn-huge:active { transform: scale(.985); }
.btn-huge .ico { grid-area: ico; font-size: 34px; text-align: center; }
.btn-huge .lbl { grid-area: lbl; font-size: 18px; font-weight: 800; }
.btn-huge .sub { grid-area: sub; font-size: 12.5px; color: rgba(255, 255, 255, .65); margin-top: 2px; }
.btn-huge.primary { background: linear-gradient(135deg, var(--green), var(--green-dark)); border: none; box-shadow: 0 8px 24px rgba(25, 180, 92, .3); }
.btn-huge.gold { background: linear-gradient(135deg, #f7c948, #e8a020); border: none; box-shadow: 0 8px 24px rgba(242, 181, 48, .22); }
.btn-huge.gold .sub { color: rgba(36, 26, 2, .7); }
.btn-huge.ghost { background: linear-gradient(180deg, var(--panel), var(--panel2)); }

.secondary-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pill-btn {
  flex: 1; text-align: center; text-decoration: none;
  background: rgba(148, 163, 184, .08); border: 1px solid var(--border);
  border-radius: 999px; padding: 12px 14px; font-size: 13.5px; font-weight: 700;
  white-space: nowrap;
}
.pill-btn .count {
  background: var(--gold); color: #241a02; border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 800;
}

.how-steps { margin-left: 18px; display: grid; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.how-steps b { color: var(--text); }

/* ------------------------------------------------ banners */

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(25, 180, 92, .1); border: 1px solid rgba(25, 180, 92, .35);
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px;
}
.banner-gold {
  background: linear-gradient(135deg, rgba(242, 181, 48, .16), rgba(242, 181, 48, .05));
  border-color: rgba(242, 181, 48, .5);
  flex-direction: column; align-items: center; text-align: center; gap: 4px;
  font-size: 18px; font-weight: 800; padding: 16px;
}
.reason-line { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .8); }

/* ------------------------------------------------ waiting room */

.wait-wrap { display: flex; justify-content: center; margin-top: 2vh; }
.wait-card { width: 100%; display: grid; gap: 16px; justify-items: center; text-align: center; }
.code-row { display: flex; align-items: center; gap: 10px; }
.room-code {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: clamp(32px, 10vw, 46px); font-weight: 800; letter-spacing: 10px;
  background: linear-gradient(90deg, #7ee2a8, var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.settings-row { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }

.slots { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; width: 100%; }
.slot {
  border: 1px dashed var(--border); border-radius: 12px;
  padding: 14px 8px; text-align: center; display: grid; gap: 6px; justify-items: center;
  background: rgba(148, 163, 184, .04);
}
.slot.me { border: 1px solid rgba(25, 180, 92, .45); background: rgba(25, 180, 92, .06); }
.slot-avatar { font-size: 30px; }
.slot-name { font-weight: 700; font-size: 13.5px; word-break: break-word; }
.vs { font-weight: 900; font-size: 18px; color: var(--gold); }

/* ------------------------------------------------ battle */

.battle-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.bh-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.hide-sm { display: none; }

.timer {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  background: rgba(25, 180, 92, .12); border: 1px solid rgba(25, 180, 92, .4);
  color: #8ceab2; padding: 7px 14px; border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.timer.danger { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .55); color: #ff9b9b; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.battle-grid { display: grid; gap: 12px; }
.q-card { padding: 16px; }
.q-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.q-num {
  background: rgba(25, 180, 92, .14); border: 1px solid rgba(25, 180, 92, .4);
  color: #8ceab2; font-weight: 800; font-size: 13px;
  padding: 4px 11px; border-radius: 999px;
}
.q-text { font-size: 17px; line-height: 1.5; margin-bottom: 14px; min-height: 50px; }
.q-image {
  display: block; max-width: 100%; max-height: 230px; object-fit: contain;
  border-radius: 10px; border: 1px solid var(--border);
  margin: -4px 0 14px; background: #fff;
}
.review-item .q-image { max-height: 180px; margin: 0 0 8px; }

.options { display: grid; gap: 9px; margin-bottom: 14px; }
.option {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px;
  color: var(--text); font-size: 15.5px; cursor: pointer;
  min-height: 52px;
  transition: border-color .12s, background .12s;
}
.option:active { border-color: rgba(25, 180, 92, .6); }
.option.selected { border-color: var(--green); background: rgba(25, 180, 92, .12); box-shadow: 0 0 0 1px var(--green) inset; }
.opt-letter {
  flex: 0 0 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; font-weight: 800;
  background: rgba(148, 163, 184, .14); border: 1px solid var(--border);
}
.option.selected .opt-letter { background: var(--green); border-color: var(--green); color: #fff; }
.opt-text { line-height: 1.35; }

.q-nav { display: flex; gap: 9px; }
.q-nav .btn { min-width: 52px; }

.opp-card { padding: 12px 14px; }
.opp-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13.5px; }
.opp-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: rgba(148, 163, 184, .14); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), #7ee2a8); border-radius: 999px; transition: width .5s; }
.bar-fill.done { background: linear-gradient(90deg, var(--gold), #f7d070); }

.palette-box { padding: 0; overflow: hidden; }
.palette-box summary { padding: 13px 16px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none; }
.palette-box summary::after { content: ' ▾'; color: var(--muted); }
.palette-box[open] summary::after { content: ' ▴'; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; padding: 0 16px 14px; }
.palette-btn {
  aspect-ratio: 1; border-radius: 8px; font-weight: 700; font-size: 12.5px;
  background: var(--panel2); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
}
.palette-btn.answered { background: rgba(25, 180, 92, .2); border-color: rgba(25, 180, 92, .5); color: #8ceab2; }
.palette-btn.current { outline: 2px solid var(--gold); outline-offset: 1px; color: var(--text); }

/* ------------------------------------------------ modal & overlay */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(2, 6, 23, .72); backdrop-filter: blur(3px); padding: 16px; }
.modal-card { width: min(400px, 100%); display: grid; gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(2, 6, 23, .85); backdrop-filter: blur(4px); }
.overlay-card { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 30px; }
.overlay-card p { font-size: 16px; font-weight: 700; }

.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid rgba(25, 180, 92, .2); border-top-color: var(--green); animation: spin .9s linear infinite; }
.spinner.big { width: 52px; height: 52px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------ result */

.vs-result { display: grid; gap: 12px; margin: 14px 0; }
.result-card.winner { border-color: rgba(242, 181, 48, .65); box-shadow: 0 0 0 1px rgba(242, 181, 48, .5), 0 14px 40px rgba(242, 181, 48, .1); }
.result-card.loser { opacity: .85; }

.rc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rc-avatar { font-size: 30px; }
.rc-name { font-weight: 800; font-size: 15.5px; margin-bottom: 4px; }

.rc-score { font-size: 44px; font-weight: 900; line-height: 1; margin-bottom: 12px; }
.rc-total { font-size: 20px; color: var(--muted); font-weight: 700; }
.winner .rc-score { color: var(--gold); }

.rc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rc-stats > div { background: rgba(148, 163, 184, .07); border: 1px solid var(--border); border-radius: 10px; padding: 9px 6px; text-align: center; display: grid; gap: 2px; }
.rc-val { font-weight: 800; font-size: 15px; }
.rc-lab { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.solo-result { text-align: center; padding: 26px 18px; }
.solo-result .rc-score { font-size: 56px; color: var(--gold); }

.reward-card { text-align: center; display: grid; gap: 8px; justify-items: center; margin: 14px 0; }
.reward-card.mine { border-color: rgba(242, 181, 48, .6); background: linear-gradient(180deg, rgba(242, 181, 48, .1), var(--panel2)); }
.rw-title { font-weight: 800; }
.rw-code {
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: clamp(26px, 8vw, 36px); font-weight: 800; letter-spacing: 8px; color: var(--gold);
}

.actions-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }

.review-box { padding: 0; overflow: hidden; }
.review-box summary { padding: 14px 16px; font-weight: 700; font-size: 14.5px; cursor: pointer; list-style: none; }
.review-box summary::after { content: ' ▾'; color: var(--muted); }
.review-box[open] summary::after { content: ' ▴'; }
.review { display: grid; gap: 1px; background: var(--border); }
.review-item { background: var(--panel2); padding: 12px 16px; }
.ri-top { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.q-pill { flex: 0 0 auto; background: rgba(148, 163, 184, .14); padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }
.ri-text { line-height: 1.45; font-size: 14px; }
.ri-grid { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }

.chip-ans { display: inline-block; padding: 3px 9px; border-radius: 7px; font-weight: 800; font-size: 12.5px; border: 1px solid transparent; }
.chip-ans.ok      { background: rgba(25, 180, 92, .16); color: #7ef0ab; border-color: rgba(25, 180, 92, .5); }
.chip-ans.bad     { background: rgba(239, 68, 68, .14); color: #ff9b9b; border-color: rgba(239, 68, 68, .45); }
.chip-ans.correct { background: rgba(242, 181, 48, .14); color: var(--gold); border-color: rgba(242, 181, 48, .5); }
.chip-ans.none    { background: rgba(148, 163, 184, .1); color: var(--muted); border-color: var(--border); }

/* ------------------------------------------------ codes */

.code-list { display: grid; gap: 12px; margin-top: 14px; }
.code-card { padding: 14px 16px; }
.code-card.active { border-color: rgba(25, 180, 92, .5); }
.code-card.used { opacity: .7; }
.code-card.expired { opacity: .55; }
.cc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cc-code { font-family: 'Consolas', 'Menlo', monospace; font-size: 21px; font-weight: 800; letter-spacing: 4px; }
.cc-meta { line-height: 1.6; }
.cc-action { margin-top: 10px; }
.state-pill { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.st-active  { background: rgba(25, 180, 92, .16); color: #7ef0ab; border: 1px solid rgba(25, 180, 92, .45); }
.st-used    { background: rgba(148, 163, 184, .14); color: var(--muted); border: 1px solid var(--border); }
.st-expired { background: rgba(239, 68, 68, .12); color: #ff9b9b; border: 1px solid rgba(239, 68, 68, .4); }

/* ------------------------------------------------ leaderboard */

.board-grid { display: grid; gap: 14px; margin-top: 6px; }
.card-h { font-size: 14px; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.me-row td { background: rgba(25, 180, 92, .07); }

.battle-list { display: grid; gap: 9px; }
.battle-row {
  display: block; text-decoration: none;
  background: rgba(148, 163, 184, .06); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px;
}
.battle-row:hover { border-color: rgba(25, 180, 92, .5); }
.br-names { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.br-vs { color: var(--muted); font-size: 11px; }
.br-meta { margin-top: 5px; }
.win-name { color: var(--gold); font-weight: 700; }

/* ------------------------------------------------ utilities */

.narrow { max-width: 560px; margin-inline: auto; }

/* ------------------------------------------------ tablets & up */

@media (min-width: 700px) {
  .container { width: min(660px, 92vw); margin-top: 26px; }
  .hide-sm { display: inline-flex; }
  .home-grid { gap: 16px; }
  .vs-result { grid-template-columns: 1fr 1fr; }
  .board-grid { grid-template-columns: 1.1fr .9fr; }
  .battle-grid { grid-template-columns: 1fr 250px; align-items: start; }
  .battle-grid.solo { grid-template-columns: 1fr; max-width: 660px; margin: 0 auto; }
  .side { order: -1; }
  .palette { grid-template-columns: repeat(10, 1fr); }
}

/* ------------------------------------------------ desktop */

@media (min-width: 1024px) {
  body { font-size: 16px; }
  .container { width: min(1040px, 92vw); margin-top: 34px; }
  .page-title { font-size: 26px; }

  /* home: three big cards side by side */
  .home-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 14px;
  }
  .btn-huge {
    grid-template-areas: "ico" "lbl" "sub";
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    row-gap: 8px;
    padding: 34px 20px;
    border-radius: 20px;
    transition: transform .15s, box-shadow .15s, filter .15s;
  }
  .btn-huge:hover { transform: translateY(-3px); filter: brightness(1.05); }
  .btn-huge .ico { font-size: 44px; }
  .btn-huge .lbl { font-size: 20px; }
  .btn-huge .sub { font-size: 13.5px; }
  .secondary-row { justify-content: center; margin-top: 22px; }
  .pill-btn { flex: 0 0 auto; padding: 12px 28px; font-size: 14px; transition: background .15s, transform .15s; }
  .pill-btn:hover { background: rgba(148, 163, 184, .16); transform: translateY(-1px); }
  .auth-card { max-width: 480px; margin: 9vh auto 0; }

  /* battle: question area + right sidebar (opponent + palette) */
  .battle-grid:not(.solo) { grid-template-columns: 1fr 320px; gap: 18px; }
  .battle-grid:not(.solo) .q-card { grid-column: 1; grid-row: 1 / span 2; }
  .battle-grid:not(.solo) .side { grid-column: 2; grid-row: 1; order: 0; }
  .battle-grid:not(.solo) .palette-box { grid-column: 2; grid-row: 2; }
  .battle-grid:not(.solo) .palette { grid-template-columns: repeat(6, 1fr); }
  .battle-grid.solo { grid-template-columns: 1fr; max-width: 780px; }
  .q-card { padding: 24px; }
  .q-text { font-size: 19px; min-height: 56px; }
  .option { padding: 15px 18px; font-size: 16px; }
  .option:hover { border-color: rgba(25, 180, 92, .6); background: rgba(25, 180, 92, .05); }
  .timer { font-size: 25px; padding: 8px 18px; }

  /* result */
  .vs-result { gap: 18px; margin: 18px 0; }
  .result-card { padding: 22px; }
  .rc-score { font-size: 52px; }
  .solo-result .rc-score { font-size: 64px; }
  .ri-grid { flex-wrap: nowrap; }
  .review-item { padding: 14px 22px; }

  /* waiting room */
  .wait-card { width: min(600px, 100%); margin-top: 5vh; padding: 26px; }
  .room-code { letter-spacing: 14px; }

  /* leaderboard */
  .board-grid { gap: 18px; }
  table { font-size: 14.5px; }
  th, td { padding: 11px 10px; }

  /* code cards in two columns */
  .code-list { grid-template-columns: 1fr 1fr; max-width: 900px; }

  .card { padding: 20px; }
}

/* ---------------- Round 7: multi-candidate rooms ---------------- */
.slots-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  width: 100%;
}
.badge-ready { background: rgba(25,180,92,.15); color: var(--green, #19b45c); font-size: 10.5px; font-weight: 800; }

/* share row */
.share-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.share-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--card-2, #232a3d); border: 1px solid var(--border, #2c3550);
  color: var(--text, #e8ecf4); text-decoration: none; cursor: pointer;
}
.share-chip:hover { border-color: var(--gold); }
.share-chip.wa   { background: rgba(37,211,102,.12); color: #3ddc79; border-color: rgba(37,211,102,.35); }
.share-chip.mail { background: rgba(66,133,244,.10); color: #7fb0ff; border-color: rgba(66,133,244,.30); }
.share-chip.online { background: rgba(25,180,92,.12); color: #4fe391; border-color: rgba(25,180,92,.40); font-weight: 800; }
.badge-live { background: rgba(239,68,68,.14); color: #ff9b9b; border: 1px solid rgba(239,68,68,.40); animation: livePulse 1.4s infinite; }
@keyframes livePulse { 50% { opacity: .55; } }
@keyframes fabIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------ clickable answer review */
.review-item.clickable { cursor: pointer; transition: background .12s ease; }
.review-item.clickable:hover { background: rgba(148, 163, 184, .07); }
.review-item.clickable:active { transform: scale(.99); }
.rv-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 2000;
  background: rgba(4, 8, 18, .86);
  display: flex; align-items: center; justify-content: center; padding: 18px; overflow: hidden; }
.rv-overlay.hidden { display: none !important; }
.rv-modal { position: relative; max-width: 540px; width: 100%; max-height: 86vh; overflow-y: auto;
  margin: auto; border-radius: 20px; padding: 24px 20px 18px; border: 1px solid #2c3550;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 0 1px rgba(242, 194, 48, .08);
  animation: rvPop .22s ease; }
@keyframes rvPop { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.rv-modal::before { content: ""; display: block; position: absolute; top: 0; left: 20px; right: 20px; height: 3px;
  border-radius: 0 0 6px 6px; background: linear-gradient(90deg, #19b45c, #f2c230); }
.rv-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid #2c3550; background: #10182b; color: #e8ecf4; font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2; }
.rv-close:hover, .rv-close:active { border-color: var(--gold); color: var(--gold); }
.rv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.rv-question { font-size: 16px; font-weight: 700; line-height: 1.5; margin: 12px 0; }
.rv-opt { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 8px; background: #10182b; line-height: 1.4; }
.rv-dash { color: #8b93a7; font-weight: 700; flex: 0 0 auto; }
.rv-opt em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 800; white-space: nowrap; padding-left: 8px; }
.rv-opt.correct { background: rgba(25, 180, 92, .16); border-color: rgba(25, 180, 92, .55); }
.rv-opt.correct em { color: #4fe391; }
.rv-opt.wrongpick { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .5); }
.rv-opt.wrongpick em { color: #ff9b9b; }
.rv-letter { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: #232c44;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.rv-opt.correct .rv-letter { background: #19b45c; color: #04220f; }
.rv-opt.wrongpick .rv-letter { background: #ef4444; color: #fff; }
.rv-picks { margin-top: 10px; }
.share-chip.sms  { background: rgba(255,179,71,.10); color: #ffc46b; border-color: rgba(255,179,71,.30); }

/* rivals in battle */
.rivals-box { display: grid; gap: 10px; }
.rival { display: grid; gap: 5px; }
.rival .bar { margin-top: 2px; }

/* ranked result cards */
.rank-list { display: grid; gap: 12px; margin: 14px 0; }
@media (min-width: 768px) { .rank-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.rank-pos {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px;
  background: var(--card-2, #232a3d); border: 1px solid var(--border, #2c3550);
  font-weight: 900; font-size: 14px;
}
.rank-pos.gold { background: rgba(255,193,7,.15); border-color: var(--gold); color: var(--gold); }

/* solo funnel on create page */
.solo-funnel { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 6px 0; }
.solo-funnel .logo-big { font-size: 44px; }
.rw-share { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ---------------- Round 8: branding ---------------- */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-icon { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 5px; }
.exam-brand em { color: var(--gold); font-size: .82em; font-weight: 700; }
.exam-brand:active { transform: scale(.98); }

/* ---------------- Round 9: subject chips ---------------- */
.subj-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; min-height: 4px; }
.subj-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(25,180,92,.12); border: 1px solid rgba(25,180,92,.4);
  color: var(--green, #19b45c); border-radius: 999px; padding: 6px 10px;
  font-size: 12.5px; font-weight: 700;
}
.subj-chip button {
  all: unset; cursor: pointer; font-weight: 900; line-height: 1;
  color: inherit; opacity: .75; font-size: 14px; padding: 0 2px;
}
.subj-chip button:hover { opacity: 1; }

/* ---------------- Round 12: exams grid + floating menu ---------------- */
.exam-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, 1fr);           /* 2 cards on mobile */
}
@media (min-width: 900px) {
  .exam-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}
.exam-card {
  position: relative; display: grid; gap: 6px; align-content: start;
  text-decoration: none; color: inherit; padding: 16px 14px; min-height: 118px;
  border: 1px solid var(--border, #2c3550); transition: border-color .15s ease, transform .15s ease;
}
.exam-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.exam-card.current { border-color: var(--green, #19b45c); background: rgba(25,180,92,.06); }
.exam-card .badge { position: absolute; top: 10px; right: 10px; }
.ex-title { font-weight: 900; font-size: 15.5px; letter-spacing: .3px; }

/* Floating + menu (hidden on the test screen itself) */
.fab-wrap { position: fixed; right: 14px; bottom: 16px; z-index: 60; display: grid; justify-items: end; gap: 8px; }
.fab-menu { display: grid; gap: 7px; }
.fab-wrap.closed .fab-menu { display: none; }
.fab-item {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  background: #141b2e; border: 1px solid #2c3550; color: #e8ecf4;
  border-radius: 999px; padding: 11px 20px; font-size: 15px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.fab-item:active { transform: scale(.97); }
.fab-btn {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #f7c948, #e8a020); color: #241a02;
  font-size: 32px; font-weight: 900; line-height: 1;
  box-shadow: 0 10px 26px rgba(242,181,48,.35);
  transition: transform .18s ease;
}
.fab-wrap:not(.closed) .fab-btn { transform: rotate(45deg); }
