:root {
  --navy: #19234F;
  --navy-2: #0f1737;
  --navy-3: #232f63;
  --blue: #007DB6;
  --teal: #77CBD5;
  --slate: #495966;
  --light: #EBE9E7;
  --orange: #E74B22;
  --yellow: #F7C100;
  --white: #ffffff;
  --good: #2fb67c;

  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --font-head: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--white);
  background: var(--navy);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(0, 125, 182, .35), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(247, 193, 0, .12), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(119, 203, 213, .12), transparent 35%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .head { font-family: var(--font-head); margin: 0; }
button { font-family: var(--font-head); cursor: pointer; border: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .8em 1.5em; border-radius: 10px; text-decoration: none;
  font-weight: 700; font-size: 1rem; letter-spacing: .01em;
  color: var(--navy); background: var(--yellow);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  transition: filter .15s, transform .1s;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.ghost { background: rgba(255, 255, 255, .1); color: var(--white); box-shadow: none; border: 1px solid rgba(255, 255, 255, .18); }
.btn.danger { background: var(--orange); color: var(--white); }
.btn.lg { font-size: 1.15rem; padding: .95em 2em; }

/* ---------- Common bits ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .35em .9em; border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  font-weight: 700; font-size: .85rem;
}
.pill.yellow { background: var(--yellow); color: var(--navy); }
.eyebrow { color: var(--teal); text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; }
.card {
  background: var(--light); color: var(--navy);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.muted { color: rgba(255, 255, 255, .65); }

.progress { height: 6px; background: rgba(255, 255, 255, .12); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--yellow); border-radius: 99px; transition: width .4s ease; }

@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.anim-rise { animation: rise .45s ease both; }

.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, .15); border-top-color: var(--yellow);
  animation: spin 1s linear infinite;
}

/* Timer ring */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: rgba(255, 255, 255, .12); }
.ring .bar { stroke: var(--yellow); stroke-linecap: round; transition: stroke .3s; }
.ring.urgent .bar { stroke: var(--orange); }
.ring.urgent .num { color: var(--orange); animation: pulse .5s ease infinite; }
.ring .num { position: absolute; font-family: var(--font-head); font-weight: 900; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--orange); color: white; padding: .8em 1.2em; border-radius: 12px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 100; max-width: 90vw; text-align: center;
  animation: rise .3s ease both;
}
.toast.ok { background: var(--good); }

.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99;
  background: var(--orange); color: white; text-align: center; padding: .4em; font-size: .85rem; font-weight: 600;
}

/* =====================================================================
   HOST (projector)
   ===================================================================== */
.host { min-height: 100vh; display: flex; flex-direction: column; }
.host-top {
  display: flex; align-items: center; gap: 24px;
  padding: 18px 36px;
  background: rgba(15, 23, 55, .55); backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.host-top .logo { height: 40px; display: block; }
.host-top .host-title { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-top .grow { min-width: 0; }
.host-top .grow { flex: 1; }
.host-top .qprog { display: flex; flex-direction: column; gap: 6px; min-width: 260px; }
.host-top .qprog .label { font-family: var(--font-head); font-weight: 700; font-size: .95rem; }
.host-top .icon-btn { background: rgba(255, 255, 255, .1); color: white; border-radius: 12px; padding: .55em .8em; font-size: 1.1rem; }

.host-main { flex: 1; display: flex; flex-direction: column; padding: 28px 36px 110px; min-height: 0; }
.host-controls {
  position: fixed; right: 28px; bottom: 24px; display: flex; gap: 12px; z-index: 20;
}
.host-controls .hint { align-self: center; font-size: .8rem; color: rgba(255, 255, 255, .45); margin-right: 8px; }

/* Lobby */
.lobby { display: grid; grid-template-columns: minmax(340px, 480px) 1fr; gap: 40px; flex: 1; align-items: start; }
.join-card { padding: 28px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.join-card .qr { width: 100%; max-width: 360px; aspect-ratio: 1; background: white; border-radius: 12px; padding: 8px; }
.join-card .qr svg { width: 100%; height: 100%; display: block; }
.join-or { color: var(--slate); font-size: 1rem; }
.join-or b { color: var(--navy); }
.join-code {
  font-family: var(--font-head); font-weight: 900; font-size: clamp(2.4rem, 4vw, 3.4rem); letter-spacing: .08em;
  background: var(--navy); color: var(--yellow); padding: .15em .6em; border-radius: 12px; width: 100%;
}
.lobby-hero .lobby-meta { font-size: 1rem; color: rgba(255, 255, 255, .6); }
.lobby-right { display: flex; flex-direction: column; gap: 22px; min-height: 0; }
.lobby-hero h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); font-weight: 900; line-height: 1.05; }
.lobby-hero h1 span { color: var(--yellow); }
.lobby-hero p { font-size: 1.15rem; color: rgba(255, 255, 255, .75); margin: 10px 0 0; }
.count-badge { display: flex; align-items: center; gap: 14px; }
.count-badge .n {
  font-family: var(--font-head); font-weight: 900; font-size: 2.6rem; color: var(--navy);
  background: var(--yellow); border-radius: 12px; min-width: 76px; padding: 0 16px; text-align: center; line-height: 1.5;
}
.count-badge .t { font-weight: 700; font-size: 1.2rem; }
.player-chips { display: flex; flex-wrap: wrap; gap: 16px 14px; align-content: flex-start; }
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  background: white; color: var(--navy); font-weight: 800; font-family: var(--font-head);
  padding: .55em 1.05em; border-radius: 999px; font-size: 1.05rem;
  animation: rise .35s ease both;
}
.chip.off { opacity: .45; }
.chip .x { background: none; color: var(--slate); font-size: .9rem; padding: 0; width: 0; overflow: hidden; opacity: 0; transition: opacity .2s, width .2s; }
.chip:hover .x { width: 1.2em; }
.chip:hover .x { opacity: 1; }
.empty-note { color: rgba(255, 255, 255, .5); font-size: 1.1rem; display: flex; align-items: center; gap: 14px; }

/* Prep */
.prep { flex: 1; display: grid; place-items: center; text-align: center; }
.prep .num { font-family: var(--font-head); font-size: clamp(3.5rem, 9vw, 7rem); font-weight: 900; color: var(--yellow); line-height: 1; }
.prep h2 { font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 900; margin-top: 12px; }
.prep .progress { width: min(520px, 70vw); margin: 32px auto 0; height: 10px; }
.prep .progress > span { transition: none; }

/* Question */
.q-wrap { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: stretch; }
.q-card { padding: 28px 34px; }
.q-card .eyebrow { color: var(--blue); }
.q-card h2 { font-size: clamp(1.4rem, 2.2vw, 2rem); font-weight: 800; margin: 6px 0 12px; }
.q-card p { font-size: clamp(1.15rem, 1.8vw, 1.6rem); line-height: 1.45; margin: 0; color: var(--navy); }
.q-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-width: 190px; }
.q-side .ring .num { font-size: 3.2rem; }
.answers-count { text-align: center; }
.answers-count .n { font-family: var(--font-head); font-weight: 900; font-size: 2.6rem; }
.answers-count .l { font-size: .9rem; color: rgba(255, 255, 255, .65); text-transform: uppercase; letter-spacing: .12em; }

/* Answer cards (host + player) */
.answers { display: grid; gap: 12px; }
.ans {
  position: relative; overflow: hidden; width: 100%;
  display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 16px 20px; border-radius: 14px;
  background: var(--white); color: var(--navy); border: 2px solid transparent;
  font-family: var(--font-body); font-weight: 600; line-height: 1.3;
  transition: opacity .35s, border-color .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.ans-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(0, 125, 182, .12); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.ans-letter {
  position: relative; flex: 0 0 auto; width: 2em; height: 2em; border-radius: 8px;
  display: grid; place-items: center; background: var(--navy); color: var(--white);
  font-family: var(--font-head); font-weight: 800;
}
.ans-txt { position: relative; flex: 1; }
.ans-cnt { position: relative; font-family: var(--font-head); font-weight: 800; white-space: nowrap; color: var(--slate); }
.ans.correct { border-color: var(--good); }
.ans.correct .ans-letter { background: var(--good); }
.ans.correct .ans-fill { background: rgba(47, 182, 124, .18); }
.ans.dim { opacity: .45; }
.host-answers { grid-template-columns: 1fr 1fr; margin-top: 22px; }
.host-answers .ans { font-size: clamp(1.05rem, 1.6vw, 1.45rem); min-height: 84px; }
button.ans { cursor: pointer; }
button.ans:hover { border-color: var(--teal); }
button.ans:active { transform: scale(.99); }

.explain {
  margin-top: 20px; padding: 18px 24px; border-radius: var(--radius);
  background: rgba(119, 203, 213, .14); border: 2px solid var(--teal);
  font-size: clamp(1rem, 1.5vw, 1.3rem); line-height: 1.45;
  display: flex; gap: 16px; align-items: flex-start;
}
.explain b { color: var(--teal); font-family: var(--font-head); }

/* Leaderboard */
.lb { max-width: 980px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.lb-title { text-align: center; margin-bottom: 10px; }
.lb-title h2 { font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 900; }
.lb-row {
  display: grid; grid-template-columns: 64px 1fr auto auto; gap: 18px; align-items: center;
  background: white; color: var(--navy); border-radius: 12px; padding: 12px 20px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.3rem;
}
.lb-row .rk {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--light); font-weight: 900;
}
.lb-row:nth-child(1) .rk { background: var(--yellow); }
.lb-row:nth-child(2) .rk { background: #d7dde3; }
.lb-row:nth-child(3) .rk { background: #f0b48f; }
.lb-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.lb-row .streak { font-size: .8em; color: var(--orange); }
.lb-row .mv { font-size: .8em; min-width: 3ch; text-align: center; }
.lb-row .mv.up { color: var(--good); }
.lb-row .mv.down { color: var(--orange); }
.lb-row .mv.same { color: #b6bcc4; }
.lb-row .sc { font-weight: 900; min-width: 5ch; text-align: right; }

/* Final results */
.final { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.results { width: 100%; max-width: 980px; display: flex; flex-direction: column; gap: 8px; }
.res-row {
  display: grid; grid-template-columns: 56px 1fr auto auto; gap: 18px; align-items: center;
  background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 10px 20px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.15rem;
}
.res-row.top { background: white; color: var(--navy); font-size: 1.35rem; padding: 14px 20px; }
.res-row .rk { text-align: center; font-weight: 900; font-size: 1.1em; }
.res-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .cc { font-family: var(--font-body); font-weight: 500; font-size: .85em; opacity: .7; }
.res-row .sc { font-weight: 900; text-align: right; min-width: 7ch; }

.host-menu {
  position: fixed; right: 28px; bottom: 92px; z-index: 30; min-width: 260px;
  background: white; color: var(--navy); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
  display: flex; flex-direction: column;
}
.host-menu button, .host-menu a {
  background: none; text-align: left; padding: .7em 1em; border-radius: 8px; color: var(--navy);
  font-family: var(--font-body); font-weight: 600; font-size: .95rem; text-decoration: none;
}
.host-menu button:hover, .host-menu a:hover { background: var(--light); }

/* =====================================================================
   PLAYER (mobile)
   ===================================================================== */
.player { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.p-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: rgba(15, 23, 55, .6);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.p-top .logo { height: 28px; }
.p-top .me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.p-top .me .nm { font-weight: 700; font-size: .9rem; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-main { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 16px; }
.center-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 12px; }

.join-box { width: 100%; max-width: 420px; margin: auto; display: flex; flex-direction: column; gap: 18px; align-items: center; text-align: center; }
.join-box img { width: 220px; max-width: 70%; }
.join-box h1 { font-size: 1.7rem; font-weight: 900; }
.join-box h1 span { color: var(--yellow); }
.join-box input {
  width: 100%; font-size: 1.25rem; text-align: center; font-weight: 800;
  padding: .85em; border-radius: 14px; border: 3px solid transparent; background: white; color: var(--navy);
  font-family: var(--font-head); outline: none;
}
.join-box input:focus { border-color: var(--yellow); }
.join-box .code-input { letter-spacing: .3em; font-size: 1.6rem; }
.join-box .btn { width: 100%; }

.big-emoji { font-size: 4rem; line-height: 1; }
.center-screen h2 { font-size: 1.8rem; font-weight: 900; }
.center-screen h2 span { color: var(--yellow); }
.center-screen p { margin: 0; color: rgba(255, 255, 255, .75); font-size: 1.05rem; max-width: 340px; }

.p-qhead { display: flex; align-items: center; gap: 14px; }
.p-qhead .info { flex: 1; min-width: 0; }
.p-qhead .info .t { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-qhead .ring .num { font-size: 1.35rem; }
.p-case { padding: 14px 16px; font-size: .98rem; line-height: 1.45; max-height: 34vh; overflow: auto; }

.p-answers { flex: 1; align-content: start; }
.p-answers .ans { font-size: 1rem; padding: 14px 16px; min-height: 64px; }
.locked-letter {
  width: 96px; height: 96px; border-radius: 20px; display: grid; place-items: center;
  background: white; color: var(--navy); font-family: var(--font-head); font-weight: 900; font-size: 3rem;
}

.result {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px;
  border-radius: 22px; padding: 24px 18px;
}
.result.ok { background: linear-gradient(160deg, #2fb67c, #1b8f5d); }
.result.bad { background: linear-gradient(160deg, var(--orange), #b5381a); }
.result.none { background: linear-gradient(160deg, var(--slate), #36424c); }
.result .icon {
  width: 80px; height: 80px; border-radius: 50%; background: rgba(255, 255, 255, .95);
  display: grid; place-items: center; font-size: 3rem; font-weight: 900;
}
.result.ok .icon { color: #1b8f5d; }
.result.bad .icon { color: var(--orange); animation: shake .5s ease; }
.result.none .icon { color: var(--slate); }
.result h2 { font-size: 2rem; font-weight: 900; }
.result .pts { font-family: var(--font-head); font-weight: 900; font-size: 1.5rem; background: rgba(0, 0, 0, .2); padding: .3em .9em; border-radius: 12px; }
.result .streak { font-weight: 800; }
.result .rank { font-size: 1.05rem; opacity: .95; }
.p-explain { padding: 14px 16px; font-size: .95rem; line-height: 1.45; }
.p-explain .p-ans { font-family: var(--font-head); font-weight: 700; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.p-explain .ans-letter { background: var(--good); font-size: .9rem; }

.rank-big { font-family: var(--font-head); font-weight: 900; font-size: 5rem; color: var(--yellow); line-height: 1; }
.stat-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stat { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 12px 18px; min-width: 110px; }
.stat .v { font-family: var(--font-head); font-weight: 900; font-size: 1.5rem; }
.stat .l { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .6); }

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  .q-wrap { grid-template-columns: 1fr; }
  .host-answers { grid-template-columns: 1fr; }
  .host-main { padding: 20px 16px 110px; }
  .host-top { padding: 12px 16px; gap: 12px; }
  .host-top .qprog { min-width: 0; }
}
@media (max-width: 360px) {
  .p-answers .ans { font-size: .92rem; padding: 12px; }
}

/* =====================================================================
   DASHBOARD + LOGIN (light theme)
   ===================================================================== */
body.dash {
  background: #f4f6f9; background-image: none; color: var(--navy);
  --line: #e1e5eb; --muted: #66727d; --panel: #ffffff;
}
.dash .muted { color: var(--muted); }
.dash .eyebrow { color: var(--blue); }
.dash .btn { box-shadow: none; font-size: .92rem; padding: .65em 1.15em; }
.dash .btn.primary { background: var(--navy); color: white; }
.dash .btn.ghost { background: white; color: var(--navy); border: 1px solid var(--line); }
.dash .btn.ghost:hover { background: #f7f8fa; }
.dash .btn.danger-ghost { background: white; color: var(--orange); border: 1px solid #f3c6b9; }
.dash .btn.sm { padding: .45em .8em; font-size: .82rem; }
.dash input, .dash textarea, .dash select {
  font: inherit; color: var(--navy); background: white; width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: .6em .75em; outline: none;
}
.dash textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
.dash input:focus, .dash textarea:focus, .dash select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 125, 182, .15); }
.dash label.field { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: white; border-radius: 16px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(25, 35, 79, .1); display: flex; flex-direction: column; gap: 16px; }
.login-card img { width: 180px; }
.login-card h1 { font-size: 1.45rem; font-weight: 800; }
.login-card .btn { width: 100%; }
.otp-input { font-family: var(--font-head) !important; font-size: 1.8rem !important; letter-spacing: .5em; text-align: center; font-weight: 800; }
.link-btn { background: none; color: var(--blue); font-family: var(--font-body); font-weight: 600; padding: 0; font-size: .9rem; }
.link-btn:disabled { color: var(--muted); }

/* Shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.side { background: var(--navy); color: white; padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side img { width: 150px; margin: 0 8px 22px; }
.side a { color: rgba(255, 255, 255, .78); text-decoration: none; padding: .7em .9em; border-radius: 8px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.side a:hover { background: rgba(255, 255, 255, .07); color: white; }
.side a.on { background: rgba(255, 255, 255, .12); color: white; }
.side .grow { flex: 1; }
.side .me { font-size: .8rem; color: rgba(255, 255, 255, .6); padding: 0 .9em; word-break: break-all; }
.side .me button { margin-top: 8px; background: none; color: var(--teal); font-family: var(--font-body); font-weight: 600; padding: 0; font-size: .85rem; }
.content { padding: 28px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; font-weight: 800; flex: 1; min-width: 200px; }
.page-head .back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f9fafc; }
.tbl .t { font-weight: 700; }
.tbl .sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: .2em .65em; border-radius: 99px; font-size: .74rem; font-weight: 700; background: #eef1f5; color: var(--slate); }
.badge.live { background: #e3f6ee; color: #1b8f5d; }
.badge.off { background: #fdece7; color: var(--orange); }

/* Quiz editor */
.editor { display: flex; flex-direction: column; gap: 18px; }
.meta-grid { display: grid; grid-template-columns: 1fr 160px; gap: 14px; padding: 20px; }
.meta-grid .wide { grid-column: 1 / -1; }
.q-item { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.q-item .q-top { display: flex; align-items: center; gap: 10px; }
.q-item .q-num { font-family: var(--font-head); font-weight: 800; background: var(--navy); color: white; border-radius: 8px; padding: .2em .6em; font-size: .9rem; }
.q-item .q-top .grow { flex: 1; }
.q-item .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt-edit { display: flex; align-items: center; gap: 10px; }
.opt-edit .ans-letter { font-size: .85rem; width: 1.9em; height: 1.9em; cursor: pointer; background: #e7ebf1; color: var(--navy); }
.opt-edit.is-correct .ans-letter { background: var(--good); color: white; }
.opt-edit.is-correct input { border-color: var(--good); }
.opt-hint { font-size: .78rem; color: var(--muted); }
.icon-act { background: white; border: 1px solid var(--line); color: var(--slate); border-radius: 8px; width: 34px; height: 34px; display: grid; place-items: center; font-size: .9rem; }
.icon-act:hover:not(:disabled) { background: #f4f6f9; }
.sticky-bar { position: sticky; bottom: 0; background: rgba(244, 246, 249, .92); backdrop-filter: blur(6px); padding: 14px 0; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); z-index: 5; }
.sticky-bar .grow { flex: 1; align-self: center; color: var(--muted); font-size: .88rem; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 55, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: white; color: var(--navy); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { font-size: 1.25rem; font-weight: 800; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--blue); background: #f0f7fb; }
.err-list { background: #fdf1ed; border: 1px solid #f3c6b9; color: #9c3216; border-radius: 10px; padding: 12px 16px; font-size: .88rem; max-height: 220px; overflow: auto; }
.err-list ul { margin: 6px 0 0; padding-left: 18px; }

/* Session detail */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stats .panel { padding: 16px 18px; }
.stats .v { font-family: var(--font-head); font-weight: 800; font-size: 1.6rem; }
.stats .l { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.bar { height: 8px; background: #eef1f5; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--good); }
.section-title { font-size: 1.05rem; font-weight: 800; margin: 24px 0 10px; }
.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 4px; }
  .side img { width: 110px; margin: 0 8px 0 4px; }
  .side .grow { display: none; }
  .side .me { width: 100%; padding: 6px 4px 0; }
  .content { padding: 20px 16px 40px; }
  .meta-grid, .q-item .row2, .add-row { grid-template-columns: 1fr; }
}

/* login: admins-only note */
.admin-note { font-size: 13px; line-height: 1.5; color: var(--muted, #5b6478); background: rgba(13, 37, 84, .05); border-radius: 10px; padding: 10px 12px; }
.admin-note a { color: inherit; font-weight: 600; }
