:root {
  --night: #0d0726;
  --night2: #1d0b3f;
  --plum: #3a0f5c;
  --maroon: #5c0f2e;
  --gold: #ffc23d;
  --gold2: #ff9f1c;
  --saffron: #ff7a00;
  --pink: #ff3d8b;
  --teal: #1fd1b2;
  --green: #22c55e;
  --red: #ef4444;
  --text: #fff7e6;
  --muted: #d7c6f0;
  --card: rgba(30, 12, 66, 0.82);
  --line: rgba(255, 194, 61, 0.55);
  --radius: 18px;
  font-size: clamp(14px, 1.15vw, 26px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--night);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden, [hidden] { display: none !important; }

/* ---------- background ---------- */
.sky {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 600px at 50% 110%, rgba(255, 122, 0, 0.35), transparent 70%),
    radial-gradient(900px 500px at 10% -10%, rgba(255, 61, 139, 0.25), transparent 70%),
    radial-gradient(900px 500px at 95% 0%, rgba(31, 209, 178, 0.16), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night2) 55%, var(--maroon) 120%);
}
.sky::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 32% 8%, #fff7 50%, transparent 51%),
    radial-gradient(2px 2px at 58% 22%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 76% 12%, #fff8 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 30%, #fff5 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 22% 40%, #fff4 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 66% 44%, #fff4 50%, transparent 51%);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.5; } to { opacity: 1; } }
/* String of hanging lights along the top */
.lights {
  position: fixed; left: 0; right: 0; top: 0; height: 26px; z-index: -1;
  background:
    radial-gradient(circle at 50% 70%, var(--gold) 0 5px, transparent 6px) 0 0 / 60px 26px repeat-x,
    radial-gradient(circle at 50% 70%, var(--pink) 0 5px, transparent 6px) 20px 0 / 60px 26px repeat-x,
    radial-gradient(circle at 50% 70%, var(--teal) 0 5px, transparent 6px) 40px 0 / 60px 26px repeat-x;
  filter: drop-shadow(0 0 6px rgba(255, 194, 61, 0.9));
  animation: lights 1.6s steps(2) infinite;
}
@keyframes lights { 50% { filter: drop-shadow(0 0 2px rgba(255, 194, 61, 0.4)); opacity: 0.75; } }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 30px; left: 16px; right: 16px; display: flex; gap: 8px; z-index: 40; }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(13, 7, 38, 0.6); cursor: pointer; font-size: 1.15rem;
  display: grid; place-items: center; transition: transform 0.15s, background 0.15s;
}
.icon-btn:hover { transform: scale(1.08); background: rgba(58, 15, 92, 0.9); }
.icon-btn.off { opacity: 0.45; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 0.55em 1.4em; cursor: pointer; font-weight: 700;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s; white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-gold {
  background: linear-gradient(180deg, #ffd66b, var(--gold2));
  color: #3a1500; box-shadow: 0 6px 20px rgba(255, 159, 28, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
.btn-ghost { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); color: var(--text); }
.btn-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.6); color: #ffd4d4; }
.btn-big { font-size: 1.35rem; padding: 0.6em 1.8em; }
.btn-small { font-size: 0.85rem; padding: 0.4em 1em; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; padding: 5.5rem 2rem 1.5rem; overflow: auto; }
.screen.active { display: flex; animation: screenIn 0.5s ease both; }
@keyframes screenIn { from { opacity: 0; transform: scale(0.98); } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 2rem; backdrop-filter: blur(6px); }
h1, h2, h3 { margin: 0; line-height: 1.1; }

/* ---------- home ---------- */
.home { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.emblem { position: relative; width: 15rem; height: 15rem; display: grid; place-items: center; }
.rangoli {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 34%, var(--gold) 34.5% 36%, transparent 36.5%),
    radial-gradient(circle, transparent 0 46%, var(--pink) 46.5% 48%, transparent 48.5%),
    radial-gradient(circle, transparent 0 60%, var(--teal) 60.5% 61.5%, transparent 62%),
    repeating-conic-gradient(from 0deg, rgba(255, 122, 0, 0.85) 0 10deg, rgba(255, 61, 139, 0.8) 10deg 20deg, rgba(255, 194, 61, 0.85) 20deg 30deg, transparent 30deg 45deg);
  -webkit-mask: radial-gradient(circle, #000 0 70%, transparent 70.5%);
  mask: radial-gradient(circle, #000 0 70%, transparent 70.5%);
  animation: spin 40s linear infinite;
  filter: drop-shadow(0 0 30px rgba(255, 159, 28, 0.6));
}
.rangoli::after {
  content: ""; position: absolute; inset: 22%; border-radius: 50%;
  background: radial-gradient(circle, #2a0b4d 0 60%, var(--night) 100%);
  box-shadow: 0 0 0 4px var(--gold), 0 0 40px rgba(255, 194, 61, 0.7) inset;
}
.emblem-diya { position: relative; font-size: 5rem; animation: flicker 2.2s ease-in-out infinite; filter: drop-shadow(0 0 20px #ffb000); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.06) rotate(2deg); } }
.game-title {
  font-size: clamp(2.5rem, 5vw, 5.5rem); font-weight: 800; letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold) 45%, var(--saffron) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(92, 15, 46, 0.9)) drop-shadow(0 0 25px rgba(255, 159, 28, 0.5));
}
.game-sub { margin: 0; color: var(--muted); font-size: 1.3rem; }
.home-set { display: flex; gap: 0.7rem; align-items: center; color: var(--muted); }
select, input, textarea {
  background: rgba(13, 7, 38, 0.75); border: 1px solid var(--line); border-radius: 12px; padding: 0.45em 0.8em; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 194, 61, 0.25); }
.home-actions { display: flex; gap: 1rem; align-items: center; margin-top: 0.5rem; flex-wrap: wrap; justify-content: center; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; overflow: auto; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 2.2rem; text-align: center; width: min(420px, 100%); }
.login-card h1 { color: var(--gold); font-size: 2.2rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.login-card input { font-size: 1.2rem; text-align: center; padding: 0.6em; }
.login-diya { font-size: 3.5rem; animation: flicker 2.2s ease-in-out infinite; }
.login-msg { color: #ffb4b4; }

/* ---------- players ---------- */
.players-panel { margin: auto; width: min(1000px, 100%); display: flex; flex-direction: column; gap: 1rem; }
.players-panel h2 { font-size: 2.2rem; color: var(--gold); text-align: center; }
.player-form { display: flex; gap: 0.8rem; }
.player-form input { flex: 1; font-size: 1.4rem; }
.hint { margin: 0; color: var(--muted); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr)); gap: 0.5rem; }
.emoji-btn {
  font-size: 2rem; aspect-ratio: 1; border-radius: 14px; border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06); cursor: pointer; transition: transform 0.12s;
}
.emoji-btn:hover { transform: scale(1.12); }
.emoji-btn.sel { border-color: var(--gold); background: rgba(255, 194, 61, 0.2); transform: scale(1.12); box-shadow: 0 0 18px rgba(255, 194, 61, 0.5); }
.emoji-btn.taken { opacity: 0.25; }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; min-height: 3rem; }
.player-chip {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.5rem 0.3rem 0.4rem; border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 61, 139, 0.25), rgba(255, 159, 28, 0.25)); border: 1px solid var(--line);
  font-size: 1.25rem; animation: pop 0.35s cubic-bezier(.3, 1.6, .5, 1) both;
}
.player-chip .num { color: var(--muted); font-size: 0.9rem; min-width: 1.2rem; text-align: right; }
.player-chip .av { font-size: 1.7rem; }
.player-chip button { background: none; border: 0; cursor: pointer; opacity: 0.6; font-size: 1rem; }
.player-chip button:hover { opacity: 1; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.row-end { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.row-center { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* ---------- intro ---------- */
.intro, .result { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.intro-kicker { margin: 0; color: var(--gold); font-size: 1.8rem; font-weight: 700; letter-spacing: 0.05em; }
.intro-avatar, .result-avatar {
  font-size: 9rem; line-height: 1; width: 14rem; height: 14rem; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 194, 61, 0.35), transparent 70%);
  animation: bounceIn 0.9s cubic-bezier(.3, 1.6, .5, 1) both, float 3s ease-in-out 0.9s infinite;
}
.intro-name { font-size: 4rem; font-weight: 800; }
.intro-goal { color: var(--muted); font-size: 1.4rem; margin: 0 0 0.6rem; }
@keyframes bounceIn { from { transform: scale(0) rotate(-30deg); } }
@keyframes float { 50% { transform: translateY(-12px); } }

/* ---------- play ---------- */
.play { width: 100%; display: grid; grid-template-columns: 1fr 17rem; gap: 1.5rem; min-height: 100%; }
.play-main { display: flex; flex-direction: column; min-width: 0; }
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.who { display: flex; align-items: center; gap: 0.6rem; font-size: 1.8rem; font-weight: 700; }
.who-avatar { font-size: 3rem; animation: float 3s ease-in-out infinite; }
.lifelines { display: flex; gap: 0.8rem; }
.lifeline {
  width: 5.2rem; height: 3.4rem; border-radius: 50%; cursor: pointer; font-weight: 800; font-size: 1.1rem;
  background: radial-gradient(circle at 50% 30%, #4b1c86, #1b0a3c); border: 2px solid var(--gold);
  box-shadow: 0 0 14px rgba(255, 194, 61, 0.45); transition: transform 0.15s; position: relative;
}
.lifeline span { font-size: 1.35rem; }
.lifeline[data-ll="fifty"] span { font-size: 1.1rem; }
.lifeline:hover:not(:disabled) { transform: scale(1.08); }
.lifeline.used { opacity: 0.35; cursor: default; box-shadow: none; }
.lifeline.used::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 4px; background: var(--red); transform: rotate(-20deg); border-radius: 4px;
}
.lifeline:disabled:not(.used) { opacity: 0.6; cursor: default; }

.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1rem; padding: 0.6rem 0; }
.q-level { text-align: center; font-size: 1.3rem; color: var(--gold); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.q-level.finale { font-size: 2rem; color: #fff; text-shadow: 0 0 20px var(--pink), 0 0 40px var(--gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.q-box, .answer {
  position: relative; border: 2px solid var(--gold); background: linear-gradient(180deg, #2a0f57, #160733);
  box-shadow: 0 0 18px rgba(255, 194, 61, 0.35), inset 0 0 22px rgba(255, 61, 139, 0.15);
}
.q-box {
  border-radius: 28px; padding: 1.1rem 2.5rem; min-height: 5.5rem; display: grid; place-items: center; text-align: center;
  font-size: clamp(1.5rem, 2.4vw, 2.8rem); font-weight: 700; line-height: 1.2;
}
.q-box::before, .q-box::after, .answer::before {
  content: "🪔"; position: absolute; top: 50%; transform: translateY(-50%); font-size: 1.6rem; filter: drop-shadow(0 0 8px #ffb000);
}
.q-box::before { left: -1.1rem; }
.q-box::after { right: -1.1rem; }
.q-box.in { animation: qIn 0.6s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes qIn { from { transform: scaleX(0.2); opacity: 0; } }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 2rem; }
.answer {
  border-radius: 999px; padding: 0.5rem 1.4rem 0.5rem 1.2rem; min-height: 3.8rem; line-height: 1.15; display: flex; align-items: center; gap: 0.8rem;
  font-size: clamp(1.2rem, 1.9vw, 2.2rem); font-weight: 600; cursor: pointer; text-align: left; color: var(--text);
  transition: background 0.2s, transform 0.15s, opacity 0.4s; opacity: 0; transform: translateY(14px);
}
.answer::before { display: none; }
.answer.show { opacity: 1; transform: none; }
.answer:hover:not(:disabled) { transform: scale(1.02); }
.answer .letter { color: var(--gold); font-weight: 800; font-size: 1.1em; min-width: 1.3em; }
.answer.selected { background: linear-gradient(180deg, #ffb347, var(--saffron)); color: #2b0d00; animation: selPulse 0.9s ease-in-out infinite; }
.answer.selected .letter { color: #fff; }
.answer.locked { animation: lockFlash 0.5s steps(2) infinite; }
.answer.correct { background: linear-gradient(180deg, #4ade80, #15803d); color: #fff; border-color: #bbf7d0; animation: correctFlash 0.45s ease-in-out 4; box-shadow: 0 0 40px rgba(74, 222, 128, 0.9); }
.answer.correct .letter { color: #fff; }
.answer.wrong { background: linear-gradient(180deg, #f87171, #b91c1c); color: #fff; animation: shake 0.6s ease both; }
.answer.wrong .letter { color: #fff; }
.answer.gone { opacity: 0 !important; pointer-events: none; transform: scale(0.85); }
.answer:disabled { cursor: default; }
@keyframes selPulse { 50% { box-shadow: 0 0 40px rgba(255, 122, 0, 0.9); } }
@keyframes lockFlash { 50% { filter: brightness(1.35); } }
@keyframes correctFlash { 50% { filter: brightness(1.6); transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }

.explain {
  border-radius: var(--radius); background: rgba(255, 194, 61, 0.12); border: 1px dashed var(--gold); padding: 1rem 1.4rem;
  font-size: clamp(1rem, 1.4vw, 1.6rem); animation: screenIn 0.5s ease both;
}
.explain-title { color: var(--gold); font-weight: 800; }
.hostbar { display: flex; align-items: center; gap: 0.7rem; padding-top: 0.6rem; border-top: 1px solid rgba(255, 194, 61, 0.2); flex-wrap: wrap; }
.hostbar-spacer { flex: 1; }
.host-prompt { color: var(--gold); font-weight: 700; font-size: 1.2rem; }

/* ladder */
.ladder {
  background: rgba(13, 7, 38, 0.7); border: 1px solid var(--line); border-radius: 20px; padding: 0.8rem; align-self: center;
  display: flex; flex-direction: column-reverse; gap: 0.15rem;
}
.rung { display: flex; gap: 0.6rem; padding: 0.15rem 0.8rem; border-radius: 999px; font-size: 1.15rem; font-weight: 600; color: var(--gold2); transition: background 0.3s; }
.rung .n { min-width: 1.6rem; text-align: right; color: var(--muted); }
.rung .amt { flex: 1; text-align: right; }
.rung.safe { color: #fff; }
.rung.safe .amt::after { content: " 🪔"; }
.rung.done { color: rgba(255, 255, 255, 0.4); }
.rung.done .amt::before { content: "✓ "; color: var(--green); }
.rung.current { background: linear-gradient(90deg, var(--saffron), var(--gold)); color: #2b0d00; box-shadow: 0 0 18px rgba(255, 159, 28, 0.8); transform: scale(1.04); }
.rung.current .n { color: #2b0d00; }
.rung.final .amt { font-weight: 800; }

/* result */
.result h2 { font-size: 3rem; }
.result-amount {
  font-size: clamp(3rem, 7vw, 7rem); font-weight: 800; color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 159, 28, 0.8), 0 5px 0 var(--maroon); animation: bounceIn 0.8s cubic-bezier(.3, 1.6, .5, 1) both;
}
.result p { font-size: 1.4rem; color: var(--muted); max-width: 40rem; margin: 0 0 0.6rem; }

/* scoreboard */
.board { margin: auto; text-align: center; width: min(1100px, 100%); display: flex; flex-direction: column; gap: 1.2rem; }
.board h2 { font-size: 3rem; color: var(--gold); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; width: 12rem; animation: rise 0.9s cubic-bezier(.3, 1.4, .5, 1) both; }
.pod .av { font-size: 4.5rem; animation: float 3s ease-in-out infinite; }
.pod .nm { font-size: 1.5rem; font-weight: 800; }
.pod .am { color: var(--gold); font-weight: 700; }
.pod .block { width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: center; font-size: 2.5rem; font-weight: 800; color: #2b0d00; }
.pod.p1 .block { height: 11rem; background: linear-gradient(180deg, #ffe58a, var(--gold2)); }
.pod.p2 .block { height: 8rem; background: linear-gradient(180deg, #f1f1f1, #9ca3af); }
.pod.p3 .block { height: 6rem; background: linear-gradient(180deg, #f6b47b, #b45309); }
.pod.p1 { animation-delay: 0.6s; } .pod.p2 { animation-delay: 0.3s; }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } }
.board-list { list-style: none; padding: 0; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.board-list li { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 1rem; font-size: 1.2rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 2, 20, 0.7); display: grid; place-items: center; z-index: 60; padding: 16px; backdrop-filter: blur(3px); }
.modal-card {
  background: linear-gradient(180deg, #2a0f57, #160733); border: 2px solid var(--gold); border-radius: 26px; padding: 2rem;
  width: min(900px, 100%); max-height: 92vh; overflow: auto; text-align: center; animation: bounceIn 0.5s cubic-bezier(.3, 1.4, .5, 1) both;
  box-shadow: 0 0 60px rgba(255, 159, 28, 0.45);
}
.modal-card h2 { color: var(--gold); font-size: 2.4rem; margin-bottom: 0.6rem; }
.modal-card p { font-size: 1.3rem; color: var(--muted); }
.modal-actions { display: flex; justify-content: center; gap: 1rem; margin-top: 1.2rem; flex-wrap: wrap; }
.aud-inputs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
.aud-col { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.aud-col .l { font-size: 2rem; font-weight: 800; color: var(--gold); }
.aud-col .cnt { font-size: 2.6rem; font-weight: 800; min-width: 3rem; }
.aud-col .pm { display: flex; gap: 0.4rem; }
.aud-col .pm button { width: 3rem; height: 3rem; border-radius: 50%; font-size: 1.5rem; }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; height: 18rem; align-items: end; margin-top: 1rem; padding: 0 1rem; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 0.3rem; }
.bar-col .pct { font-size: 1.6rem; font-weight: 800; }
.bar-col .bar { width: 70%; height: 0; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, var(--gold), var(--saffron)); transition: height 1.6s cubic-bezier(.2, .9, .3, 1); box-shadow: 0 0 20px rgba(255, 159, 28, 0.6); }
.bar-col .l { font-size: 1.8rem; font-weight: 800; color: var(--gold); }
.timer { position: relative; width: 14rem; height: 14rem; margin: 1rem auto; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 10; }
.timer .track { stroke: rgba(255, 255, 255, 0.12); }
.timer .prog { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.timer .prog.low { stroke: var(--red); }
.timer .secs { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4.5rem; font-weight: 800; }
.phone-emoji { font-size: 4rem; animation: ring 0.5s ease-in-out infinite; display: inline-block; }
@keyframes ring { 25% { transform: rotate(-15deg); } 75% { transform: rotate(15deg); } }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 70;
  background: #1b0a3c; border: 1px solid var(--gold); border-radius: 999px; padding: 0.6rem 1.4rem; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- config ---------- */
#screen-config { padding-top: 5rem; padding-bottom: 6.5rem; }
/* No transform on this screen: a transformed ancestor would pin the fixed save bar to the page instead of the window. */
#screen-config.active { animation-name: fadeIn; }
@keyframes fadeIn { from { opacity: 0; } }
.config { width: min(1200px, 100%); margin: 0 auto; display: grid; grid-template-columns: 16rem 1fr; gap: 1.5rem; align-items: start; font-size: 0.95rem; }
.cfg-side { display: flex; flex-direction: column; gap: 0.5rem; }
.cfg-side h2 { color: var(--gold); font-size: 1.6rem; margin-bottom: 0.4rem; }
.cfg-set {
  text-align: left; padding: 0.6rem 0.9rem; border-radius: 12px; border: 1px solid rgba(255, 194, 61, 0.25);
  background: rgba(255, 255, 255, 0.05); cursor: pointer;
}
.cfg-set.active { border-color: var(--gold); background: rgba(255, 194, 61, 0.15); }
.cfg-set small { display: block; color: var(--muted); }
.cfg-main { display: flex; flex-direction: column; gap: 1rem; }
.cfg-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem 1.4rem; }
.cfg-card h3 { color: var(--gold); margin-bottom: 0.8rem; font-size: 1.3rem; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.8rem 1rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field > span { color: var(--muted); font-size: 0.85rem; }
.check { display: flex; gap: 0.5rem; align-items: center; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--gold2); }
.lvl { border: 1px solid rgba(255, 194, 61, 0.35); border-radius: 16px; padding: 1rem; background: rgba(13, 7, 38, 0.55); }
.lvl + .lvl { margin-top: 0.9rem; }
.lvl-head { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.lvl-num { font-size: 1.3rem; font-weight: 800; color: var(--gold); min-width: 5.5rem; }
.lvl-head input.amt { width: 9rem; }
.lvl-head input.lbl { width: 11rem; }
.lvl-tools { margin-left: auto; display: flex; gap: 0.3rem; }
.tool { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 194, 61, 0.3); border-radius: 10px; padding: 0.25rem 0.6rem; cursor: pointer; }
.tool:hover { background: rgba(255, 194, 61, 0.2); }
.tool:disabled { opacity: 0.3; cursor: default; }
.qcard { margin-top: 0.8rem; padding: 0.9rem; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 0.5rem; }
.qcard.invalid { border-color: rgba(239, 68, 68, 0.7); }
.qcard-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.85rem; }
.qcard textarea { resize: vertical; min-height: 2.6rem; }
.qcard textarea.qtext { font-size: 1.1rem; font-weight: 600; }
.ans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.ans-row { display: flex; gap: 0.5rem; align-items: center; }
.ans-row input[type="text"] { flex: 1; }
.ans-row label { display: flex; align-items: center; gap: 0.3rem; font-weight: 800; color: var(--gold); cursor: pointer; }
.ans-row input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--green); }
.ans-row.is-correct input[type="text"] { border-color: var(--green); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25); }
.cfg-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 0.8rem 2rem; display: flex; gap: 0.8rem; align-items: center; justify-content: flex-end;
  background: #0d0726; border-top: 1px solid var(--line); z-index: 30; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}
.cfg-bar .status { margin-right: auto; color: var(--muted); }
.cfg-bar .status.dirty { color: var(--gold); }
.cfg-bar .status.err { color: #ffb4b4; }
.voice-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.voice-row select { max-width: 100%; flex: 1; min-width: 14rem; }

@media (max-width: 900px) {
  :root { font-size: 15px; }
  .screen { padding: 4.5rem 16px 1rem; }
  .play { grid-template-columns: 1fr; }
  .ladder { display: none; }
  .answers { grid-template-columns: 1fr; gap: 0.7rem; }
  .config { grid-template-columns: 1fr; }
  .cfg-side { position: static; }
  .ans-grid { grid-template-columns: 1fr; }
  .cfg-bar { padding: 0.6rem 16px; }
  .aud-inputs { grid-template-columns: repeat(2, 1fr); }
  .pod { width: 30%; }
  .pod .av { font-size: 3rem; }
}

#screen-play { padding-top: 4.2rem; padding-bottom: 1rem; }
#screen-play .play-head { padding-left: 3rem; }
