:root {
  --ink: #17152a;
  --blue: #2620c8;
  --blue-deep: #171272;
  --lime: #d9ff00;
  --pink: #ef5a9a;
  --paper: #f8f8f3;
  --white: #fff;
  --muted: #6e6b7b;
  --line: rgba(23, 21, 42, 0.13);
  --danger: #cf2f56;
  --success: #177f5a;
  --shadow: 0 28px 80px rgba(23, 18, 114, 0.13);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 92%, rgba(217,255,0,.18), transparent 23rem),
    radial-gradient(circle at 92% 8%, rgba(239,90,154,.12), transparent 22rem),
    var(--paper);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.ambient i { position: absolute; border: 1px solid rgba(38,32,200,.13); border-radius: 50%; }
.ambient i:nth-child(1) { width: 46vw; height: 46vw; min-width: 460px; min-height: 460px; right: -23vw; top: -19vw; }
.ambient i:nth-child(2) { width: 28vw; height: 28vw; min-width: 300px; min-height: 300px; right: -8vw; top: -10vw; border-color: rgba(239,90,154,.25); }
.ambient i:nth-child(3) { width: 18px; height: 18px; left: 7vw; top: 29vh; background: var(--pink); border: 0; box-shadow: 40vw 52vh 0 6px var(--lime), 77vw 24vh 0 -3px var(--blue); }

.site-header {
  position: relative;
  z-index: 5;
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 15px; text-decoration: none; }
.brand-mark {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  line-height: .76;
  color: var(--blue);
  background: var(--lime);
  box-shadow: 0 12px 26px rgba(38,32,200,.14);
}
.brand-mark b { display: block; font-size: 25px; letter-spacing: -1px; }
.brand-mark span { display: block; font-size: 22px; font-weight: 500; }
.brand-mark i { position: absolute; right: 4px; bottom: 11px; width: 15px; height: 15px; border-radius: 50%; background: var(--pink); border: 2px solid var(--lime); }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.admin-link { font-size: 14px; font-weight: 800; text-decoration: none; border-bottom: 2px solid var(--ink); padding: 8px 0 5px; }

#app { position: relative; z-index: 1; width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 70px; }
.loading-card { min-height: 55vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.loader { display: block; width: 42px; height: 42px; margin: 0 auto 14px; border: 4px solid rgba(38,32,200,.15); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow { margin: 0 0 10px; color: var(--pink); font-size: 13px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 20px; max-width: 980px; font-size: clamp(48px, 7.2vw, 112px); line-height: .89; letter-spacing: -.065em; }
h2 { margin-bottom: 12px; font-size: clamp(30px, 3.2vw, 52px); line-height: .98; letter-spacing: -.045em; }
h3 { margin-bottom: 9px; font-size: 22px; letter-spacing: -.03em; }
.lead { max-width: 660px; color: #444151; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.hero-grid { min-height: calc(100vh - 220px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .72fr); gap: clamp(40px, 8vw, 120px); align-items: center; }
.hero-copy strong { color: var(--blue); }
.hero-copy .accent { display: inline-block; color: var(--blue); position: relative; }
.hero-copy .accent::after { content: ""; position: absolute; left: 2%; right: -2%; bottom: -5px; height: 9px; background: var(--lime); z-index: -1; transform: rotate(-1.2deg); }

.card { background: rgba(255,255,255,.9); border: 1px solid rgba(23,21,42,.1); border-radius: var(--radius); box-shadow: var(--shadow); }
.join-card { padding: clamp(28px, 4vw, 50px); }
.join-card h2 { max-width: 430px; }
.field { display: grid; gap: 8px; margin: 20px 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 14px; font-weight: 800; }
input, select {
  width: 100%;
  min-height: 54px;
  border: 1.5px solid rgba(23,21,42,.18);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 0 16px;
  outline: 0;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(38,32,200,.1); }
input.code-input { font-size: 28px; font-weight: 900; letter-spacing: .12em; text-align: center; }
.button {
  border: 0;
  border-radius: 15px;
  min-height: 54px;
  padding: 0 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 25px rgba(38,32,200,.22);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 18px 30px rgba(38,32,200,.27); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.button.lime { background: var(--lime); color: var(--ink); box-shadow: 0 12px 25px rgba(176,205,0,.2); }
.button.pink { background: var(--pink); }
.button.ghost { color: var(--ink); background: transparent; border: 1.5px solid rgba(23,21,42,.18); box-shadow: none; }
.button.danger { background: var(--danger); }
.button.wide { width: 100%; }
.button.compact { min-height: 44px; padding: 0 16px; font-size: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.status { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 14px; font-weight: 750; }

.admin-shell { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: calc(100vh - 190px); gap: 36px; }
.admin-nav { align-self: start; position: sticky; top: 26px; padding: 25px; background: var(--blue-deep); color: #fff; border-radius: 24px; }
.admin-nav .nav-kicker { color: var(--lime); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.admin-nav h3 { margin: 9px 0 24px; }
.admin-nav a, .admin-nav button { width: 100%; color: inherit; background: transparent; border: 0; border-top: 1px solid rgba(255,255,255,.16); padding: 15px 0; text-align: left; font-weight: 750; cursor: pointer; text-decoration: none; }
.admin-main { min-width: 0; }
.admin-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 34px; }
.admin-head h1 { margin: 0; font-size: clamp(42px, 5vw, 76px); }
.empty-state { padding: 60px; text-align: center; }
.quiz-list { display: grid; gap: 16px; }
.quiz-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 25px 28px; }
.quiz-card h3 { margin-bottom: 5px; }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: 999px; background: rgba(38,32,200,.08); color: var(--blue); font-size: 12px; font-weight: 900; }

.editor { display: grid; gap: 18px; }
.editor-top { padding: 26px; }
.question-card { position: relative; padding: 28px; overflow: hidden; }
.question-card::before { content: attr(data-number); position: absolute; right: 18px; top: -15px; color: rgba(38,32,200,.08); font-size: 92px; font-weight: 950; letter-spacing: -.08em; }
.question-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.question-type { display: inline-flex; gap: 8px; }
.type-button { min-height: 38px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; font-weight: 850; }
.type-button.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.options { display: grid; gap: 10px; margin-top: 15px; }
.option-row { display: grid; grid-template-columns: 36px 1fr 42px; align-items: center; gap: 9px; }
.option-row input[type="radio"] { width: 22px; min-height: 22px; accent-color: var(--blue); }
.icon-button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 20px; }
.editor-actions { position: sticky; bottom: 20px; z-index: 3; padding: 16px; display: flex; justify-content: space-between; gap: 12px; background: rgba(248,248,243,.91); border: 1px solid var(--line); border-radius: 20px; backdrop-filter: blur(18px); }

.host-shell { display: grid; gap: 26px; }
.host-top { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 28px; }
.host-top h1 { margin: 0; font-size: clamp(46px, 7vw, 104px); }
.live-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--blue); font-weight: 900; }
.live-badge i { width: 9px; height: 9px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 7px rgba(239,90,154,.13); }
.host-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.65fr); gap: 20px; }
.stage { min-height: 540px; padding: clamp(26px, 4vw, 52px); display: flex; flex-direction: column; justify-content: space-between; background: var(--blue-deep); color: #fff; }
.stage .eyebrow { color: var(--lime); }
.stage h2 { max-width: 860px; font-size: clamp(38px, 5vw, 74px); }
.stage-foot { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.timer { font-size: clamp(64px, 9vw, 126px); line-height: .75; font-weight: 950; letter-spacing: -.08em; font-variant-numeric: tabular-nums; }
.timer.danger { color: var(--pink); }
.qr-panel { padding: 24px; display: grid; gap: 17px; align-content: start; }
.qr { padding: 14px; border-radius: 18px; background: #fff; }
.qr img { display: block; width: 100%; aspect-ratio: 1; }
.game-code { color: var(--blue); font-size: clamp(44px, 6vw, 82px); font-weight: 950; line-height: .9; letter-spacing: .07em; font-variant-numeric: tabular-nums; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { padding: 8px 12px; background: rgba(38,32,200,.08); border-radius: 999px; font-size: 14px; font-weight: 800; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 18px; background: rgba(255,255,255,.08); border-radius: 17px; }
.stat b { display: block; color: var(--lime); font-size: 28px; }
.answer-key { display: grid; gap: 8px; margin-top: 16px; }
.answer-key span { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.76); }
.answer-key span.correct { color: var(--lime); font-weight: 900; }
.answer-key i { width: 22px; height: 22px; border-radius: 7px; border: 1px solid rgba(255,255,255,.28); }
.answer-key .correct i { background: var(--lime); border-color: var(--lime); }

.player-shell { width: min(650px, 100%); margin: 0 auto; padding-top: 2vh; }
.player-top { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 22px; }
.score-chip { padding: 10px 14px; border-radius: 999px; color: #fff; background: var(--blue); font-weight: 900; }
.player-card { padding: clamp(24px, 6vw, 44px); }
.progress-track { height: 10px; background: rgba(23,21,42,.09); border-radius: 999px; overflow: hidden; margin: 15px 0 27px; }
.progress-track span { display: block; height: 100%; background: var(--lime); transform-origin: left; transition: width .25s linear; }
.question-title { margin-bottom: 24px; font-size: clamp(30px, 7vw, 48px); line-height: 1.04; letter-spacing: -.045em; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  min-height: 112px;
  padding: 18px;
  border: 2px solid rgba(38,32,200,.14);
  border-radius: 20px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  font-size: 17px;
  cursor: pointer;
  text-align: left;
  transition: border .15s ease, transform .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--blue); transform: translateY(-2px); }
.choice:nth-child(1) { border-left: 8px solid var(--blue); }
.choice:nth-child(2) { border-left: 8px solid var(--pink); }
.choice:nth-child(3) { border-left: 8px solid var(--lime); }
.choice:nth-child(4) { border-left: 8px solid #22b9b2; }
.result { text-align: center; padding: 40px 16px 15px; }
.result-icon { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 22px; color: #fff; font-size: 40px; font-weight: 950; background: var(--success); }
.result.wrong .result-icon { background: var(--pink); }
.waiting-pulse { display: inline-flex; gap: 7px; margin-top: 20px; }
.waiting-pulse i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: blink 1.1s infinite; }
.waiting-pulse i:nth-child(2) { animation-delay: .18s; }
.waiting-pulse i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,80%,100% { opacity: .2; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.lobby { text-align: center; padding: 55px 20px; }
.lobby-orbit { width: 118px; height: 118px; margin: 0 auto 30px; border: 2px solid var(--blue); border-radius: 50%; position: relative; animation: spin 8s linear infinite; }
.lobby-orbit::before { content: ""; position: absolute; width: 23px; height: 23px; border-radius: 50%; background: var(--pink); top: 3px; left: 9px; }
.lobby-orbit::after { content: ""; position: absolute; width: 42px; height: 42px; border-radius: 50%; background: var(--lime); top: 36px; left: 36px; }
.leaderboard { width: 100%; border-collapse: collapse; }
.leaderboard th, .leaderboard td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.leaderboard th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.leaderboard td:first-child { width: 56px; color: var(--blue); font-weight: 950; }
.leaderboard td:last-child { text-align: right; font-weight: 950; }
.podium-title { text-align: center; color: var(--blue); }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translate(-50%, 140%); width: min(520px, calc(100% - 32px)); padding: 15px 18px; border-radius: 14px; color: #fff; background: var(--ink); font-weight: 800; text-align: center; box-shadow: var(--shadow); transition: transform .24s ease; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

@media (max-width: 900px) {
  .hero-grid, .admin-shell, .host-grid { grid-template-columns: 1fr; }
  .hero-grid { padding: 25px 0; }
  .hero-copy { text-align: center; }
  .hero-copy .lead { margin-left: auto; margin-right: auto; }
  .admin-nav { position: static; display: flex; justify-content: space-between; gap: 14px; align-items: center; }
  .admin-nav h3, .admin-nav .nav-kicker { display: none; }
  .admin-nav a, .admin-nav button { width: auto; border: 0; padding: 8px; }
  .host-grid { gap: 15px; }
  .stage { min-height: 450px; }
  .qr-panel { grid-template-columns: 180px 1fr; align-items: center; }
}

@media (max-width: 620px) {
  .site-header, #app { width: min(100% - 28px, 1440px); }
  .site-header { min-height: 88px; }
  .brand-mark { width: 58px; height: 58px; }
  .brand-mark b { font-size: 20px; }
  .brand-mark span { font-size: 17px; }
  .brand-mark i { width: 12px; height: 12px; bottom: 8px; }
  .brand-name { display: none; }
  #app { padding-top: 18px; }
  .hero-grid { min-height: auto; gap: 28px; }
  h1 { font-size: clamp(48px, 16vw, 72px); }
  .join-card, .player-card { border-radius: 22px; }
  .field-row, .choice-grid, .stats-row { grid-template-columns: 1fr; }
  .admin-head, .quiz-card, .host-top { align-items: stretch; grid-template-columns: 1fr; display: grid; }
  .quiz-card .button { width: 100%; }
  .admin-shell { gap: 20px; }
  .empty-state { padding: 40px 22px; }
  .question-head { align-items: start; flex-direction: column; }
  .editor-actions { display: grid; grid-template-columns: 1fr; }
  .editor-actions .button-row { display: grid; grid-template-columns: 1fr 1fr; }
  .stage { min-height: 420px; padding: 25px; }
  .stage-foot { align-items: stretch; flex-direction: column; }
  .timer { font-size: 82px; }
  .qr-panel { grid-template-columns: 1fr; }
  .qr { width: min(260px, 100%); margin: 0 auto; }
  .choice { min-height: 82px; }
}

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