/* Player phone screens (live play, practice and challenges) */
body { min-height: 100vh; min-height: 100dvh; }
.play-top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; z-index: 5; pointer-events: none; }
.play-top > * { pointer-events: auto; }
.play-top .logo { font-size: 1.5rem; }
.play-top .brand-mark img { height: 32px; }
#topInfo:empty, .answering #topInfo { visibility: hidden; }

.join-hero { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-bottom: 1.4rem; }
.join-or { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-weight: 700; font-size: .85rem; }
.join-or::before, .join-or::after { content: ''; flex: 1; height: 2px; background: var(--line); }
#hostForm { margin-top: .8rem; }
.scanner { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 30, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 16px; text-align: center; }
.scanner video { width: min(420px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: 18px; border: 4px solid #fff; background: #000; }
.join-hero .tagline { font-size: clamp(1.1rem, 3.6vw, 1.5rem); opacity: .95; }
.welcome { max-width: 520px; font-size: 1.05rem; line-height: 1.5; opacity: .9; margin: .4rem auto 0; }
.welcome:empty { display: none; }

.lobby-shapes { display: flex; gap: 12px; margin: 1.5rem 0; }
.lobby-shapes span { width: 40px; height: 40px; border-radius: 38% 62% 45% 55% / 55% 42% 58% 45%; font-size: 1rem; display: grid; place-items: center; animation: pulse 1.6s infinite; }
.lobby-shapes span:nth-child(2) { animation-delay: .2s; } .lobby-shapes span:nth-child(3) { animation-delay: .4s; } .lobby-shapes span:nth-child(4) { animation-delay: .6s; }
.lobby-shapes .shape { width: 24px; height: 24px; }

.name-spin { display: flex; align-items: center; gap: 8px; }
.name-spin .input { flex: 1; }
.name-spin .input[readonly] { background: var(--mint-50); }

.countdown-ball { width: 140px; height: 140px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 4rem; font-weight: 800; box-shadow: inset 0 -8px 0 rgba(0,0,0,.2); }

.answer-screen { flex-direction: column; min-height: 100vh; min-height: 100dvh; padding: 62px 10px 76px; }
.answer-head { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 6; }
.ans-q { text-align: center; font-weight: 800; font-size: clamp(1.05rem, 3.6vw, 1.5rem); margin: 0 auto 12px; max-width: 900px; font-family: var(--font-display); }
.ans-q:empty { display: none; }
.ans-img { max-height: 26vh; border-radius: var(--radius); margin: 0 auto 12px; display: block; }
.ans-body { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1000px; margin: 0 auto; }
/* Phone controller: tall answer tiles that share the screen height, so they're easy to hit with a
   thumb. Each keeps the Wimzi ticket look (letter badge, colour rail) on a light tint of its colour. */
.ans-body .answers { grid-template-columns: 1fr; grid-auto-rows: minmax(72px, 1fr); gap: 10px; width: min(560px, 100%); max-height: 74vh; margin: 0 auto; align-content: stretch; flex: 1; }
.ans-body .answers.two { grid-template-columns: 1fr 1fr; max-height: 46vh; }
.ans-body .answer { min-height: 72px; font-size: clamp(1.1rem, 4.2vw, 1.45rem); background: color-mix(in srgb, var(--ac) 13%, var(--surface)); box-shadow: inset 10px 0 0 var(--ac), 0 6px 18px rgba(12, 30, 41, .18); padding-left: 1.6rem; }
.ans-body .answers.two .answer { flex-direction: column; justify-content: center; text-align: center; padding: 1rem; box-shadow: inset 0 -8px 0 var(--ac), 0 6px 18px rgba(12, 30, 41, .18); }
.ans-body .answer .shape { font-size: 1.8em; }
.ans-body .answers.six { grid-auto-rows: minmax(58px, 1fr); }
.ans-body .answers.six .answer { min-height: 58px; }
.ans-body .answer span:empty { display: none; }
/* No text on the phone (question shown only on the big screen): label the card "Tap to answer". */
.ans-body .answer:has(span:empty)::after { content: attr(data-tap); font-weight: 600; opacity: .55; font-size: .9em; }

.ans-panel { background: var(--white); color: var(--navy); border-radius: var(--radius-lg); padding: 1.4rem; display: grid; gap: 14px; width: min(560px, 100%); margin: auto; box-shadow: var(--shadow-lg); }
.ans-panel textarea { resize: vertical; font-size: 1.1rem; }
.pin-panel { width: min(820px, 100%); justify-items: center; }
.slider-val { text-align: center; font-size: 2.6rem; font-weight: 800; color: var(--accent); }
input[type=range].wimzi-range { width: 100%; accent-color: var(--accent); height: 36px; }
.range-ends { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; color: var(--muted); font-size: .9rem; }

.rating-panel { width: min(760px, 100%); }
.rating-row { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.rating-row button { border: 0; cursor: pointer; font-weight: 800; transition: transform .1s; font-family: inherit; }
.rating-row button:active { transform: scale(.9); }
.rating-row.stars button { background: none; font-size: clamp(2.6rem, 11vw, 3.6rem); color: #d6d0c4; line-height: 1; padding: 0 2px; }
.rating-row.stars button.lit { color: var(--sun); }
.rating-row.scale button { width: clamp(38px, 8vw, 52px); height: clamp(44px, 9vw, 56px); border-radius: 10px; background: var(--mint-50); color: var(--navy); font-size: 1.15rem; }
.rating-row.scale button:nth-child(-n+7) { background: #fde9e3; }
.rating-row.scale button:nth-child(n+8):nth-child(-n+9) { background: #fbf1dc; }
.rating-row.scale button.lit { background: var(--accent); color: var(--accent-ink); }

.puzzle-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.puzzle-item { display: flex; align-items: center; gap: 10px; border-radius: var(--radius); padding: .8rem 1rem; font-weight: 800; box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.puzzle-item .ord { background: rgba(0,0,0,.2); border-radius: 6px; padding: .1em .5em; }
.puzzle-item .txt { flex: 1; text-align: left; }
.puzzle-item button { background: rgba(255,255,255,.22); color: inherit; border: 0; width: 40px; height: 40px; border-radius: 10px; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.puzzle-item button:disabled { opacity: .3; cursor: default; }

/* Answer feedback: the stage stays navy with a soft glow; the result sits in a blob badge. */
.result-screen { position: fixed; inset: 0; z-index: 2; overflow-y: auto; background: var(--stage); color: var(--stage-ink); --glow: var(--accent); }
.result-screen.correct { --glow: var(--mint-600); }
.result-screen.incorrect { --glow: var(--coral); }
.result-screen::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(55vmax 45vmax at 50% 30%, color-mix(in srgb, var(--glow) 32%, transparent), transparent 70%); }
.result-screen > * { position: relative; z-index: 1; }
.result-screen #resTitle { color: var(--glow); }
.res-icon { width: 120px; height: 120px; border-radius: 38% 62% 45% 55% / 55% 42% 58% 45%; background: var(--glow); color: var(--navy); display: grid; place-items: center; font-size: 4rem; margin: .6rem 0 1rem; font-weight: 800; box-shadow: 0 0 0 8px color-mix(in srgb, var(--glow) 25%, transparent); }
.incorrect .res-icon { color: #fff; }
#resStreak:empty { display: none; }
.points-box { background: transparent; border: 3px dashed var(--glow); color: var(--glow); padding: .4em 1.3em; border-radius: 18px 18px 18px 4px; font-size: 1.8rem; font-weight: 800; margin: 1rem 0; font-family: var(--font-display); }
.points-box:empty { display: none; }
.team-chip { display: inline-flex; align-items: center; gap: .5em; padding: .4em 1em; border-radius: var(--pill); font-weight: 800; color: #fff; margin: .4rem 0; }
.team-chip:empty { display: none; }

.medal { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; font-size: 4.2rem; font-weight: 800; color: var(--white); background: var(--sun); box-shadow: inset 0 -10px 0 rgba(0,0,0,.2); margin-bottom: 1rem; }
.medal.silver { background: #c9d3d8; color: var(--navy); } .medal.bronze { background: #b06a2e; } .medal.other { background: var(--accent); color: var(--accent-ink); font-size: 2.6rem; }

.slide-card { background: var(--white); color: var(--navy); border-radius: var(--radius-lg); padding: 1.4rem; width: min(640px, 100%); box-shadow: var(--shadow-lg); text-align: left; }
.slide-card h2 { font-size: clamp(1.4rem, 5vw, 2rem); }
.slide-card p { line-height: 1.55; font-size: 1.05rem; white-space: pre-wrap; margin: 0; }
.slide-card img { border-radius: var(--radius); margin-bottom: 1rem; max-height: 30vh; }

.play-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); color: var(--navy); display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); font-weight: 800; font-size: 1.05rem; z-index: 10; }
.play-bar .bar-team { font-size: .8rem; padding: .25em .7em; border-radius: var(--pill); color: #fff; }
.play-bar .bar-team:empty { display: none; }
.bar-score { background: var(--primary); color: var(--primary-ink); padding: .25em .9em; border-radius: var(--pill); }

.review { width: min(640px, 100%); text-align: left; max-height: 42vh; overflow: auto; list-style: none; padding: 1rem 1.2rem; margin: 1rem 0 0; }
.review li { padding: .55em 0; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; gap: .6em; align-items: baseline; }
.review li:last-child { border-bottom: 0; }
.review .ok { color: var(--leaf); font-weight: 800; } .review .no { color: var(--red); font-weight: 800; } .review .na { color: var(--muted); }
.review .pts { margin-left: auto; color: var(--muted); font-weight: 700; white-space: nowrap; }
.review .fix { display: block; color: var(--muted); font-size: .85rem; font-weight: 600; }

/* Anonymous joining, nickname hint, explanations, slide text */
.anon-note { background: var(--mint-50); color: var(--teal-700); border-radius: var(--radius); padding: .7em .9em; margin: 0; font-weight: 600; text-align: left; line-height: 1.45; }
.nick-hint { margin: 0; font-size: .82rem; color: var(--muted); font-weight: 600; }
.res-explain { max-width: 520px; margin: .4rem auto 0; background: rgba(0,0,0,.18); border-radius: var(--radius); padding: .6em 1em; line-height: 1.45; }
.res-explain:empty { display: none; }
.slide-body { max-width: 560px; line-height: 1.5; white-space: pre-wrap; }
.slide-body:empty { display: none; }
.demo-note { max-width: 560px; line-height: 1.5; opacity: .9; }
.demo-cta { margin-top: 1.4rem; max-width: 620px; background: rgba(255,255,255,.1); border-radius: var(--radius-lg); padding: 1rem 1.2rem; display: grid; gap: .8rem; }
.demo-cta p { margin: 0; line-height: 1.5; }

/* ---------- Live Q&A ---------- */
.qa-fab { position: fixed; right: 14px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 11; border: 0; border-radius: var(--pill); background: var(--white); color: var(--navy); font: inherit; font-weight: 800; padding: .7em 1.1em; box-shadow: var(--shadow-lg); cursor: pointer; display: inline-flex; align-items: center; gap: .4em; min-height: 48px; }
.qa-count { background: var(--accent); color: var(--accent-ink); border-radius: var(--pill); padding: .05em .55em; font-size: .8rem; }
.qa-count:empty { display: none; }
.qa-sheet { position: fixed; inset: 0; z-index: 60; background: rgba(8, 18, 26, .6); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.qa-card { background: var(--white); color: var(--navy); width: min(560px, 100%); max-height: 86vh; border-radius: var(--radius-lg); padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-lg); text-align: start; }
.qa-form { display: grid; gap: 8px; }
.qa-form textarea { resize: none; font-size: 1.05rem; }
.qa-form-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.qa-named { display: flex; align-items: center; gap: .5em; font-weight: 700; font-size: .9rem; }
.qa-named input { width: 22px; height: 22px; accent-color: var(--teal); }
.qa-msg { margin: 0; font-weight: 700; color: var(--teal-700); font-size: .9rem; }
.qa-msg:empty { display: none; }
.qa-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; gap: 8px; }
.qa-item { background: var(--cream); border-radius: var(--radius); padding: .7rem .9rem; }
.qa-item p { margin: 0 0 .4rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.qa-item.pending { border: 2px dashed var(--line); background: transparent; }
.qa-item.pending small { color: var(--muted); font-weight: 600; }
.qa-item.answered { opacity: .7; }
.qa-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qa-meta small { color: var(--muted); font-weight: 700; }
.qa-done { color: var(--leaf); font-weight: 800; font-size: .85rem; }
.qa-vote { border: 2px solid var(--line); background: var(--white); color: var(--navy); border-radius: var(--pill); padding: .3em .9em; font: inherit; font-weight: 800; cursor: pointer; min-height: 40px; min-width: 64px; }
.qa-vote.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.qa-vote:disabled { opacity: .5; cursor: default; }
.qa-votes.mine { font-weight: 800; color: var(--muted); font-size: .85rem; }
.qa-empty { color: var(--muted); font-weight: 700; text-align: center; padding: 1rem; }

/* ---------- Display, reading and language settings ---------- */
.play-top .top-tools { display: flex; gap: 8px; align-items: center; }
.a11y-open { font-weight: 800; font-family: var(--font-body); }
.read-btn { border: 0; cursor: pointer; font: inherit; font-weight: 800; min-height: 40px; justify-content: center; align-self: center; margin: -4px auto 10px; }
.read-btn[hidden] { display: none; }
.answer-head .pill { white-space: nowrap; }
.a11y-panel { position: fixed; inset: 0; z-index: 60; background: rgba(8, 18, 26, .6); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.a11y-card { background: var(--white); color: var(--navy); width: min(460px, 100%); border-radius: var(--radius-lg); padding: 1.1rem 1.2rem 1.3rem; box-shadow: var(--shadow-lg); display: grid; gap: 4px; max-height: 88vh; overflow: auto; text-align: start; }
.a11y-head { display: flex; justify-content: space-between; align-items: center; }
.a11y-head h2 { font-size: 1.3rem; margin: 0; }
.a11y-close { background: var(--mint-50); color: var(--navy); }
.a11y-lang { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 800; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.a11y-lang .input { width: auto; min-height: 44px; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: .7rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.a11y-row:last-child { border-bottom: 0; }
.a11y-row small { display: block; color: var(--muted); font-weight: 600; font-size: .82rem; margin-top: .15em; line-height: 1.35; }
.a11y-row input { width: 26px; height: 26px; accent-color: var(--teal); flex: none; }
.extra-ask { display: flex; align-items: flex-start; gap: .6em; text-align: start; background: var(--mint-50); color: var(--navy); border-radius: var(--radius); padding: .7em .8em; cursor: pointer; }
.extra-ask input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.extra-ask small { display: block; font-weight: 600; color: var(--muted); font-size: .8rem; margin-top: .2em; }
.answer-screen .extra-chip { align-self: center; }
.extra-chip { display: inline-block; background: var(--mint); color: var(--navy); border-radius: var(--pill); padding: .3em .9em; font-weight: 800; font-size: .85rem; margin-bottom: 8px; }
.extra-chip:empty { display: none; }

/* Easier-to-read font: Lexend, a little more spacing between letters, words and lines. */
html.a11y-font { --font-body: 'Lexend', 'Plus Jakarta Sans', system-ui, sans-serif; --font-display: 'Lexend', 'Plus Jakarta Sans', system-ui, sans-serif; }
html.a11y-font body { letter-spacing: .02em; word-spacing: .12em; }
html.a11y-font .ans-q, html.a11y-font .answer, html.a11y-font p { line-height: 1.55; }
html.a11y-font .big-text, html.a11y-font h1, html.a11y-font h2 { font-variation-settings: normal; letter-spacing: 0; }

/* Larger text */
html.a11y-large { font-size: 118%; }
html.a11y-large .ans-q { font-size: clamp(1.3rem, 5vw, 1.9rem); }
html.a11y-large .ans-body .answer { font-size: clamp(1.25rem, 5vw, 1.7rem); }

/* High contrast: black stage, white cards with black borders, yellow focus */
html.a11y-contrast { --stage: #000; --stage-ink: #fff; --stage-soft: transparent; --stage-image: none; --muted: #1a1a1a; --line: #000; }
html.a11y-contrast .stage-bg::before, html.a11y-contrast .result-screen::after { display: none; }
html.a11y-contrast body.stage-bg { background: #000; }
html.a11y-contrast .on-stage .muted { opacity: 1; color: #fff; }
html.a11y-contrast .ans-body .answer { background: #fff; color: #000; border: 3px solid #000; outline: 3px solid #fff; box-shadow: inset 12px 0 0 var(--ac); }
html.a11y-contrast .ans-body .answer.picked { background: #000; color: #fff; outline-color: #FFD60A; }
html.a11y-contrast .btn, html.a11y-contrast .pill, html.a11y-contrast .icon-btn { outline: 2px solid currentColor; outline-offset: -2px; }
html.a11y-contrast .card, html.a11y-contrast .ans-panel, html.a11y-contrast .a11y-card { border: 3px solid #fff; box-shadow: none; }
html.a11y-contrast .res-icon { box-shadow: none; border: 4px solid #fff; }
html.a11y-contrast :focus-visible { outline: 4px solid #FFD60A !important; outline-offset: 3px; }
html.a11y-contrast .play-bar { border-top: 3px solid #000; }

/* Less motion */
html.a11y-calm *, html.a11y-calm *::before, html.a11y-calm *::after { animation: none !important; transition: none !important; }

/* Right-to-left languages: put answer rails on the reading side */
[dir="rtl"] .ans-body .answer { box-shadow: inset -10px 0 0 var(--ac), 0 6px 18px rgba(12, 30, 41, .18); padding-left: 1.2rem; padding-right: 1.6rem; text-align: right; }
[dir="rtl"] .a11y-row, [dir="rtl"] .a11y-lang { text-align: right; }
