:root {
  color-scheme: light;
  --bg: #eef1f9;
  --panel: #fff;
  --line: #e1e6f2;
  --ink: #17213b;
  --muted: #566184;
  --primary: #5b4bdb;
  font-family: "Avenir Next", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; background: radial-gradient(ellipse at 100% -10%, #5b4bdb20, transparent 55%), radial-gradient(ellipse at 0% 0%, #e8459b18, transparent 55%); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
header { min-height: 56px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; padding: .4rem clamp(.75rem, 3vw, 2.75rem); border-bottom: 1px solid var(--line); }
nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.brand { display: inline-flex; gap: .65rem; align-items: center; font-weight: 800; font-size: 1.23rem; }
.brand-logo { display: block; border-radius: .55rem; }
.brand-quiz { font-size: 1rem; color: var(--muted); font-weight: 550; }
.tile { display: inline-grid; place-items: center; color: #fff; background: var(--primary); border-radius: .55rem; width: 2rem; height: 2rem; }
.tile { width: 3.1rem; height: 3.1rem; border-radius: .9rem; font-size: 1.7rem; margin-bottom: .9rem; }
main { width: min(1180px, 100% - clamp(2rem, 8vw, 8rem)); margin: 0 auto; padding: clamp(.85rem, 2.7vh, 1.65rem) 0 1.5rem; outline: none; }
h1, h2, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.3rem, 5.2vw, 5.3rem); line-height: 1.05; letter-spacing: -.055em; }
h2 { font-size: 1.4rem; line-height: 1.25; letter-spacing: -.02em; }
p { line-height: 1.55; }
em { color: var(--primary); font-style: normal; }
.muted, .connection { color: var(--muted); }
.eyebrow { color: var(--primary); font-weight: 750; text-transform: uppercase; font-size: .875rem; letter-spacing: .13em; margin-bottom: .8rem; }
.panel { border: 1px solid var(--line); border-radius: 1.35rem; background: var(--panel); padding: clamp(.85rem, 2vw, 1.45rem); box-shadow: 0 18px 60px #17213b13; }
.welcome { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: clamp(1rem, 4vw, 4rem); padding: clamp(0rem, 2.25vh, 1.5rem) 0; }
.intro > p:not(.eyebrow) { max-width: 37ch; font-size: clamp(1rem, 2vw, 1.25rem); color: var(--muted); margin: .65rem 0 .85rem; }
.join h2, .auth h1 { margin-bottom: .65rem; }
.auth { max-width: 31rem; margin: 0 auto; }
.auth h1 { font-size: clamp(1.65rem, 4vw, 2.35rem); }
.auth > button, .auth > a { margin-top: .4rem; }
.auth > p { margin: .4rem 0 .65rem; }
form { display: grid; gap: .65rem; }
label { display: grid; gap: .28rem; font-weight: 650; }
input:not([type=radio]), textarea { width: 100%; min-height: 2.65rem; padding: .45rem .65rem; background: #fff; color: var(--ink); border: 1px solid #838caf; border-radius: .65rem; }
textarea { resize: vertical; }
input[type=radio] { width: 1.25rem; height: 1.25rem; margin: .25rem; accent-color: var(--primary); }
[name=pin] { letter-spacing: .25em; font-weight: 800; font-variant-numeric: tabular-nums; }
button, .button { border: 1px solid transparent; border-radius: .65rem; min-height: 2.75rem; padding: .4rem .75rem; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 750; color: var(--ink); background: transparent; text-align: center; }
button:disabled { cursor: default; }
button:hover:not(:disabled), .button:hover { filter: brightness(1.13); text-decoration: none; }
.primary { background: var(--primary); color: #fff; }
.secondary { background: #edeafb; color: var(--ink); border-color: #c8bff6; }
.quiet { color: var(--muted); }
.quiet:hover:not(:disabled) { background: #5b4bdb12; }
.section-head, .game-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem; margin-bottom: .7rem; }
.section-head p.muted { margin-top: .35rem; }
.quiz-list { display: grid; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 1rem; }
.quiz-card p, .empty p { margin-top: .35rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.quiz-card .actions { margin-top: 1rem; }
.editor { max-width: 900px; margin: auto; }
.editor h1, .library h1 { font-size: clamp(1.7rem, 3.8vw, 2.65rem); }
.editor .panel { padding: clamp(.75rem, 1.4vw, 1rem); }
.question-editor { display: grid; gap: .65rem; }
.question-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .35rem .6rem; }
.question-heading h2 { color: var(--primary); font-size: 1.15rem; }
.edit-actions:empty { display: none; }
.edit-actions { gap: .15rem; }
.answer-editor { display: grid; gap: .35rem; }
.answer-label { font-size: .9rem; }
.answer-field { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .4rem; }
.question-settings { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .3rem .6rem; }
.seconds-field { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.seconds-field input { width: 4.25rem; }
.question-note summary { cursor: pointer; color: var(--muted); min-height: 2.25rem; padding: .35rem 0; }
.question-note textarea { display: block; }
.editor-footer { justify-content: space-between; }
.room { max-width: 1050px; margin: auto; }
.room.screen { max-width: none; }
body:has(.screen) main { width: min(1800px, 94%); padding-top: 1vh; }
.screen .game h1 { font-size: clamp(1.7rem, min(4.8vw, 8vh), 4.4rem); }
.screen .pin { font-size: clamp(2.5rem, min(9vw, 15vh), 7rem); }
.screen .qr img { width: clamp(115px, min(19vw, 32vh), 240px); }
.screen .option { min-height: 3.75rem; }
.screen .game { padding: clamp(1rem, 3vw, 2.5rem); }
.game h1 { font-size: clamp(1.65rem, 3.3vw, 3.25rem); }
.lobby { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1.5rem; }
.lobby p:not(.eyebrow) { margin-top: .8rem; }
.pin { font-size: clamp(2.5rem, 7vw, 5rem); line-height: 1.1; font-weight: 850; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--primary); margin-top: .8rem; }
.qr { display: grid; gap: .35rem; justify-items: center; }
.qr img { width: clamp(110px, 15vw, 190px); max-width: 100%; aspect-ratio: 1; border-radius: .75rem; image-rendering: pixelated; }
.waiting, .final { text-align: center; }
.waiting p { margin-top: .75rem; }
.controls { margin-top: 1rem; }
.controls h2 { margin-bottom: .7rem; }
.roster { margin-top: .75rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.roster button { background: #edeafb; overflow-wrap: anywhere; gap: .5rem; }
.game-head .eyebrow { margin: 0; }
.timer, .pill { padding: .45rem .8rem; border-radius: 3rem; background: #edeafb; color: var(--primary); font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-track { height: .4rem; border-radius: 2rem; background: #edeafb; margin-top: .65rem; overflow: hidden; }
.timer-track div { height: 100%; background: var(--primary); transition: width .2s linear; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin: .65rem 0; }
.option { display: grid; position: relative; grid-template-columns: auto minmax(0, 1fr) auto; gap: .7rem; align-items: center; min-height: 3.25rem; padding: .55rem; border: 1px solid #d0d6e8; border-radius: .8rem; background: #f8f8fd; text-align: left; font-size: clamp(1rem, 2vw, 1.55rem); overflow-wrap: anywhere; overflow: hidden; }
.option:hover:not(:disabled) { border-color: var(--primary); }
.option.selected, .option.correct { border-color: #087952; background: #e4f6ee; }
.letter { display: grid; place-items: center; border-radius: .45rem; min-width: 2.1rem; min-height: 2.1rem; color: #171727; font-weight: 850; }
.tone-0 { background: #d4b4ff; }
.tone-1 { background: #aeead8; }
.tone-2 { background: #ffd19a; }
.tone-3 { background: #ffb7d7; }
.revealed .option { padding-bottom: 1.35rem; }
.bar { position: absolute; bottom: 0; height: .4rem; width: var(--fill); transform-origin: left; animation: grow .85s cubic-bezier(.15,.7,.25,1) both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.feedback, .explanation { margin-top: .8rem; font-weight: 700; }
.explanation { padding: .95rem; border-left: .22rem solid var(--primary); background: #edeafb; border-radius: .4rem; white-space: pre-line; }
.podium { display: flex; justify-content: center; align-items: end; gap: .6rem; margin: .75rem auto; max-width: 48rem; }
.podium-place { width: 33.33%; display: grid; align-content: end; justify-items: center; gap: .35rem; min-width: 0; padding: .65rem; border-radius: .8rem .8rem .25rem .25rem; overflow-wrap: anywhere; background: #edeafb; animation: rise .65s both; }
.podium-place strong { max-width: 100%; font-size: clamp(1rem, 3vw, 2rem); }
.place-0 { min-height: 7.5rem; order: 2; background: var(--primary); color: #fff; animation-delay: .25s; }
.place-1 { min-height: 6rem; order: 1; background: #edeafb; color: #4132ae; animation-delay: .12s; }
.place-2 { min-height: 4.75rem; order: 3; }
@keyframes rise { from { opacity: 0; transform: translateY(1.4rem); } to { opacity: 1; transform: translateY(0); } }
.ranking { max-width: 34rem; margin: 1rem auto 0; padding: 0; text-align: left; }
.ranking li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#network:not(:empty) { margin-top: .5rem; }
#notice:empty { display: none; }
#notice { position: fixed; bottom: 1rem; z-index: 3; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); padding: .75rem 1rem; background: #fff; border: 1px solid var(--primary); border-radius: .7rem; box-shadow: 0 6px 25px #17213b26; }
@media (max-width: 660px) {
  .welcome, .options, .lobby { grid-template-columns: 1fr; }
  .qr { justify-items: start; }
  .lobby .pin { font-size: clamp(2.3rem, 11vw, 4rem); }
  .player .option { min-height: 3rem; }
  nav { gap: .35rem; font-size: .9rem; }
  header { gap: .15rem .55rem; }
  header nav button { padding-inline: .45rem; }
  input:not([type=radio]), textarea { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.active-rooms { margin-bottom: 1rem; }
.active-rooms h2 { margin-bottom: .75rem; }

.brand-group { display: flex; align-items: center; gap: .75rem; }
.game-history { margin-top: .65rem; border-top: 1px solid var(--line); }
.game-history summary { cursor: pointer; padding: .65rem 0 .2rem; font-weight: 750; color: var(--primary); }
.history-list ul { list-style: none; margin: .35rem 0 0; padding: 0; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: .35rem; border-bottom: 1px solid var(--line); }
.history-list small { display: block; color: var(--muted); font-size: .875rem; }
.history-result:not(:empty) { margin-top: .65rem; }
.history-result h3 { margin: 0 0 .45rem; font-size: 1rem; }
.history-result table { width: 100%; border-collapse: collapse; margin-bottom: .45rem; font-variant-numeric: tabular-nums; }
.history-result th, .history-result td { padding: .35rem .25rem; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.history-result th:first-child, .history-result td:first-child, .history-result th:last-child, .history-result td:last-child { width: 1%; white-space: nowrap; }
.history-result th:last-child, .history-result td:last-child { text-align: right; }
