/* Party Arena: a console-like party show. Bold, warm, readable across a meeting room on the master screen;
   thumb-friendly in portrait on a phone. Fonts: Titan One (display) and Rubik (text), both SIL OFL 1.1. */
@font-face { font-family: 'Titan One'; src: url('../assets/fonts/TitanOne-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; src: url('../assets/fonts/Rubik-latin.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  --bg: #1d0b38; --bg2: #2a1248; --card: #34195f; --card2: #43237a; --line: rgba(255,255,255,.14);
  --ink: #fff8ef; --muted: #cbb9e8; --dark: #1d1b26;
  --draw: #ff7a3d; --telephone: #20c4b4; --answers: #ff4f9a; --ccr: #ffc93c; --go: #3ddc84; --danger: #ff5a5a;
  --accent: #ffc93c; --shadow: 0 .35em 0 rgba(0,0,0,.28); --radius: 1.1rem;
  --display: 'Titan One', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --text: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--text); font-size: 17px; line-height: 1.35;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
body::before {
  content: ''; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 20%, rgba(255,79,154,.35), transparent 70%),
    radial-gradient(35% 30% at 85% 15%, rgba(32,196,180,.28), transparent 70%),
    radial-gradient(45% 40% at 70% 90%, rgba(255,122,61,.28), transparent 70%),
    radial-gradient(35% 35% at 20% 85%, rgba(255,201,60,.2), transparent 70%), var(--bg);
  animation: drift 30s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(3%, -2%, 0) rotate(3deg) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { body::before, * { animation: none !important; transition: none !important; } }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: .01em; }
.g-draw { --accent: var(--draw); } .g-telephone { --accent: var(--telephone); } .g-answers { --accent: var(--answers); } .g-ccr { --accent: var(--ccr); }

/* ---------- buttons, fields ---------- */
.btn {
  appearance: none; border: 0; border-radius: 999px; padding: .75em 1.4em; min-height: 48px; cursor: pointer;
  background: var(--card2); color: var(--ink); font-family: var(--display); font-size: 1.05em; letter-spacing: .02em;
  box-shadow: var(--shadow); transition: transform .12s, filter .12s, box-shadow .12s; touch-action: manipulation;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(.2em); box-shadow: 0 .15em 0 rgba(0,0,0,.28); }
.btn:focus-visible, .icon-btn:focus-visible, .tile:focus-within, summary:focus-visible, select:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.go { background: var(--go); color: #10331f; }
.btn.big { font-size: 1.3em; padding: .85em 1.6em; width: 100%; }
.btn.small { font-size: .9em; padding: .5em 1em; min-height: 40px; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.danger { background: var(--danger); }
.btn.stop { background: var(--danger); font-size: 1.8em; width: 100%; animation: pulse 1.2s infinite; }
.btn.stop:disabled { animation: none; }
@keyframes pulse { 50% { transform: scale(1.03); } }
.icon-btn { background: transparent; border: 0; font-size: 1.4em; cursor: pointer; padding: .2em .35em; border-radius: .5em; min-width: 44px; min-height: 44px; }
.text {
  width: 100%; border: 3px solid transparent; border-radius: .9em; padding: .7em .9em; min-height: 52px; font-size: 1.1em;
  background: #fff; color: var(--dark); outline: none; box-shadow: inset 0 3px 0 rgba(0,0,0,.08);
}
.text:focus { border-color: var(--accent); }
.text.area { resize: none; min-height: 7em; }
.text.small { min-height: 42px; padding: .5em .7em; font-size: 1em; }
.row { display: flex; gap: .6em; align-items: center; }
.row > .text { flex: 1; }
.field { display: flex; flex-direction: column; gap: .3em; font-size: .95em; color: var(--muted); }
.field select { background: var(--card2); border: 0; border-radius: .7em; padding: .55em .7em; min-height: 44px; color: var(--ink); }
.field.row { flex-direction: row; }
.note { background: var(--card); border-radius: var(--radius); padding: 1em 1.2em; text-align: center; font-size: 1.15em; box-shadow: var(--shadow); }
.note.big { font-family: var(--display); font-size: 1.6em; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.center { min-height: 100vh; display: grid; place-content: center; gap: 1em; justify-items: center; padding: 1em; }
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 8px solid var(--card2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- avatars ---------- */
.avatar {
  --c: #888; width: 2.2em; height: 2.2em; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; font-family: var(--display); font-size: 1em; text-shadow: 0 2px 0 rgba(0,0,0,.25);
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.18), 0 .15em 0 rgba(0,0,0,.25);
}
.avatar.tiny { width: 1.5em; height: 1.5em; font-size: .75em; }
.avatar.small { width: 1.8em; height: 1.8em; font-size: .9em; }
.avatar.big { width: 3.6em; height: 3.6em; font-size: 1.5em; }
.avatar.huge { width: 5em; height: 5em; font-size: 2.4em; margin: 0 auto; }

/* ---------- home ---------- */
.home { min-height: 100vh; padding: max(1.2em, env(safe-area-inset-top)) 1.2em 2em; display: flex; flex-direction: column; align-items: center; gap: 1.6em; }
.home-hero { text-align: center; margin-top: 4vh; }
.logo-big { font-size: 4.5em; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.title { font-size: clamp(2.6em, 8vw, 5.4em); line-height: 1; text-shadow: 0 .08em 0 var(--answers), 0 .16em 0 rgba(0,0,0,.3); }
.tagline { color: var(--muted); font-size: 1.15em; max-width: 30em; margin: .6em auto 0; }
.home-grid { display: grid; gap: 1em; width: 100%; max-width: 1100px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.home-btn {
  appearance: none; border: 0; text-align: left; cursor: pointer; border-radius: 1.4em; padding: 1.3em 1.4em; min-height: 11em;
  display: flex; flex-direction: column; gap: .4em; color: var(--dark); box-shadow: 0 .45em 0 rgba(0,0,0,.3); transition: transform .15s;
}
.home-btn:hover { transform: translateY(-3px) rotate(-.5deg); }
.home-btn:focus-visible { outline: 5px solid #fff; outline-offset: 3px; }
.screen-btn { background: linear-gradient(135deg, var(--ccr), var(--draw)); }
.devices-btn { background: linear-gradient(135deg, var(--telephone), #6ee7b7); }
.join-btn { background: linear-gradient(135deg, var(--answers), #ff9bc4); cursor: default; }
.home-icon { font-size: 2.4em; }
.home-label { font-family: var(--display); font-size: 1.5em; line-height: 1.1; }
.home-sub { font-size: .98em; opacity: .85; }
.join-btn .row { margin-top: auto; }
.code-input { text-transform: uppercase; letter-spacing: .15em; font-family: var(--display); }
.home-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1em; width: 100%; max-width: 1100px; align-items: end; }
.home-card { background: var(--card); border-radius: 1.6em; padding: 1.6em; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 1em; text-align: center; box-shadow: var(--shadow); margin-top: 6vh; }
.join-code-show { font-size: 1.2em; color: var(--muted); } .join-code-show b { color: var(--ink); font-family: var(--display); letter-spacing: .1em; }
.name-field { text-align: left; }

/* ---------- app frame ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: .8em; padding: .5em 1em; padding-top: max(.5em, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: .4em; font-family: var(--display); font-size: 1.1em; }
.logo { font-size: 1.4em; }
.top-mid { flex: 1; }
.corner { display: flex; align-items: center; gap: .5em; }
.code-chip { background: var(--card2); border-radius: 999px; padding: .3em .8em; font-family: var(--display); letter-spacing: .1em; }
.top-actions { display: flex; gap: .2em; }
.status-bar { position: fixed; left: 50%; top: .6em; transform: translate(-50%, -150%); z-index: 50; background: var(--accent); color: var(--dark); font-weight: 700; padding: .5em 1.1em; border-radius: 999px; transition: transform .3s; box-shadow: var(--shadow); }
.status-bar:not(.show) { visibility: hidden; }
.status-bar.show { transform: translate(-50%, 0); }
.room { flex: 1; position: relative; display: flex; flex-direction: column; }
.slot { position: relative; display: grid; }
.slot > .view { grid-area: 1 / 1; transition: opacity .25s, transform .25s; }
.slot > .entering { opacity: 0; transform: translateY(14px) scale(.98); }
.slot > .leaving { opacity: 0; transform: translateY(-14px) scale(.98); pointer-events: none; }
.ended { padding: 2em 1em; display: grid; gap: 1em; max-width: 480px; margin: 10vh auto; }

/* ---------- phone layout ---------- */
.layout-phone .room { width: 100%; max-width: 600px; margin: 0 auto; padding: 0 .9em calc(1.2em + env(safe-area-inset-bottom)); gap: .9em; }
.layout-phone .brand-name { display: none; }
.layout-phone .stage-slot .stage { font-size: .6em; }
.phone-game, .phone-lobby, .phone-intro { display: flex; flex-direction: column; gap: .9em; }
.phone-top { display: flex; align-items: center; gap: .7em; }
.phone-title { flex: 1; font-family: var(--display); font-size: 1.35em; line-height: 1.15; }
.phone-body { display: flex; flex-direction: column; gap: .8em; }
.phone-body.locked { opacity: .6; pointer-events: none; }
.me-card { text-align: center; display: grid; gap: .6em; padding: 1em 0; }
.me-name { font-family: var(--display); font-size: 1.8em; }
.admin-lobby { display: flex; flex-direction: column; gap: .9em; }
.phone-players { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; }
.mini { display: flex; align-items: center; gap: .4em; background: var(--card); padding: .3em .7em .3em .3em; border-radius: 999px; }
.phone-intro { text-align: center; padding-top: 2em; }
.my-score { text-align: center; padding: 1em; }
.big-plus { font-family: var(--display); font-size: 3.4em; color: var(--accent); }
.place { font-family: var(--display); font-size: 4em; text-align: center; color: var(--ccr); }
.podium-phone { text-align: center; position: relative; }

/* ---------- screen layout ---------- */
.layout-screen { font-size: clamp(14px, 1.45vw, 40px); height: 100vh; overflow: hidden; }
.layout-screen .room { padding: 0 2vw 1.5vh; min-height: 0; }
.layout-screen .stage-slot { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.layout-screen .stage-slot > .view { height: 100%; min-height: 0; overflow: hidden; }
.layout-screen .phone-slot { display: none; }
.layout-screen .top { font-size: 1.05em; }

/* ---------- join card ---------- */
.join-card { display: flex; flex-direction: column; align-items: center; gap: .8em; background: #fff; color: var(--dark); border-radius: 1.6em; padding: 1.4em; box-shadow: 0 .5em 0 rgba(0,0,0,.3); }
.qr-wrap { width: min(20em, 34vh); aspect-ratio: 1; }
.qr { width: 100%; height: 100%; display: block; }
.join-text { text-align: center; }
.join-title { font-family: var(--display); font-size: 1.8em; }
.join-link { font-size: 1.05em; } .join-link b { word-break: break-all; }
.join-code-label { color: #6b647a; font-size: .95em; }
.join-code { font-family: var(--display); font-size: 3.2em; letter-spacing: .08em; line-height: 1; color: var(--bg2); }
.join-card.small { flex-direction: row; padding: .4em .7em .4em .4em; border-radius: 1em; gap: .6em; font-size: .7em; }
.join-card.small .qr-wrap { width: 5.6em; }
.join-card.small .join-code { font-size: 2em; }

/* ---------- lobby (screen) ---------- */
.lobby { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 1.5em 2.5em; height: 100%; align-items: center; }
.lobby-left { grid-row: 1; display: grid; place-items: center; }
.lobby-right { display: flex; flex-direction: column; gap: 1em; align-self: stretch; padding-top: 1em; min-height: 0; }
.lobby-count { font-family: var(--display); font-size: 2.6em; }
.lobby-players { display: flex; flex-wrap: wrap; gap: 1.1em; align-content: flex-start; overflow: auto; }
.lobby-player { display: flex; flex-direction: column; align-items: center; gap: .3em; width: 7.5em; text-align: center; font-weight: 700; font-size: 1.05em; animation: popin .45s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--i) * 40ms); }
.lobby-player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lobby-player.offline { opacity: .45; }
.badge { background: var(--ccr); color: var(--dark); border-radius: 999px; padding: .1em .6em; font-size: .75em; font-weight: 800; }
@keyframes popin { from { transform: scale(.3) rotate(-12deg); opacity: 0; } }
.lobby-hint { color: var(--muted); font-size: 1.2em; margin-top: auto; }
.lobby-bottom { grid-column: 1 / -1; display: flex; gap: 1.5em; align-items: flex-start; }
.lobby-bottom .lobby-tiles { flex: 1; }
.lobby-tools { max-width: 26em; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9em; }
.layout-phone .tiles { grid-template-columns: repeat(2, 1fr); }
.tile { background: var(--card); border-radius: 1.2em; padding: .9em; display: flex; flex-direction: column; gap: .35em; box-shadow: inset 0 -.35em 0 var(--accent), var(--shadow); opacity: .55; }
.tile.on { opacity: 1; }
.tile.short .tile-sub { color: var(--danger); }
.tile-icon { font-size: 2em; }
.tile-name { font-family: var(--display); font-size: 1.15em; line-height: 1.1; }
.tile-sub { color: var(--muted); font-size: .85em; }
.tile-actions { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; margin-top: .3em; }
.toggle { display: flex; align-items: center; gap: .3em; font-size: .85em; color: var(--muted); }
.toggle input { width: 1.3em; height: 1.3em; accent-color: var(--go); }
.settings { background: var(--card); border-radius: 1.1em; padding: .6em .9em; box-shadow: var(--shadow); }
.settings summary { cursor: pointer; font-family: var(--display); padding: .3em 0; min-height: 36px; }
.settings-body { display: grid; grid-template-columns: 1fr 1fr; gap: .6em .8em; padding: .6em 0; max-height: 60vh; overflow: auto; }
.settings-body h4 { grid-column: 1 / -1; color: var(--ink); margin-top: .5em; font-size: 1em; }
.settings-body .field:has(.cat-chips), .settings-body .field.row { grid-column: 1 / -1; }
.cat-chips { display: flex; flex-wrap: wrap; gap: .35em; }
.cat { border: 0; border-radius: 999px; padding: .35em .75em; background: var(--card2); color: var(--muted); cursor: pointer; min-height: 34px; }
.cat.on { background: var(--ccr); color: var(--dark); font-weight: 700; }

/* ---------- stage common ---------- */
.stage { display: flex; flex-direction: column; gap: 1em; height: 100%; min-height: 0; }
.stage-head { display: flex; align-items: center; gap: 1em; }
.stage-title { font-family: var(--display); font-size: 1.9em; color: var(--accent); text-shadow: 0 .08em 0 rgba(0,0,0,.3); }
.stage-sub { flex: 1; color: var(--muted); font-size: 1.2em; }
.timer { --size: 3.4em; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; background: var(--card2); border: .22em solid var(--accent); font-family: var(--display); font-size: 1.15em; flex: none; box-shadow: var(--shadow); }
.layout-phone .timer { --size: 2.8em; }
.timer.hurry { background: #6b1f3e; }
.timer.panic { animation: thump 1s infinite; border-color: var(--danger); }
@keyframes thump { 10% { transform: scale(1.15); } 30% { transform: scale(1); } }
.strip { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; }
.chip { display: flex; align-items: center; gap: .4em; background: var(--card); padding: .25em .8em .25em .25em; border-radius: 999px; font-weight: 600; transition: background .2s; }
.chip .avatar { font-size: .85em; }
.chip-score { background: rgba(0,0,0,.25); border-radius: 999px; padding: 0 .5em; font-size: .85em; }
.chip.done { background: var(--go); color: #10331f; }
.chip.done::after { content: '✓'; font-weight: 900; }
.chip.drawing { background: var(--accent); color: var(--dark); }
.chip.busy .avatar { animation: bob 1.6s ease-in-out infinite; }
.chip.offline { opacity: .4; }
.flash { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: var(--ccr); color: var(--dark); padding: .6em 1.2em; border-radius: 999px; font-weight: 800; animation: flash 1.8s forwards; z-index: 5; pointer-events: none; }
@keyframes flash { 0% { opacity: 0; transform: translate(-50%, -30%); } 15%, 80% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }
.work { flex: 1; display: grid; place-content: center; text-align: center; gap: .5em; }
.work-icon { font-size: 5em; animation: bob 2s ease-in-out infinite; }
.work-label { font-family: var(--display); font-size: 2.6em; max-width: 22em; }
.work-sub { color: var(--muted); font-size: 1.4em; }

/* ---------- ink ---------- */
.ink-box { width: 100%; height: 100%; display: grid; place-items: center; min-height: 0; }
canvas.ink { display: block; background: #fff; border-radius: 1em; box-shadow: 0 .4em 0 rgba(0,0,0,.3); touch-action: none; }
.live-ink { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.ink-over { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dark); font-family: var(--display); font-size: 1.5em; text-align: center; padding: 1em; pointer-events: none; }
.pad-wrap { width: 100%; aspect-ratio: 4 / 3; }
.toolbar { display: flex; flex-direction: column; gap: .6em; }
.colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: .45em; }
.swatch { --c: #000; aspect-ratio: 1; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); background: var(--c); cursor: pointer; min-height: 40px; }
.swatch.on { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 3px var(--accent); }
.toolrow { display: flex; gap: .6em; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.sizes { display: flex; gap: .4em; }
.size { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card2); display: grid; place-items: center; cursor: pointer; }
.size.on { box-shadow: 0 0 0 3px var(--accent); }
.size .dot { background: #fff; border-radius: 50%; display: block; }
.pad-actions { display: flex; gap: .4em; }

/* ---------- draw & guess ---------- */
.draw-main { flex: 1; display: grid; grid-template-columns: 1fr 22em; gap: 1.5em; min-height: 0; }
.draw-canvas { position: relative; display: flex; flex-direction: column; gap: .8em; min-height: 0; align-items: center; }
.draw-canvas .live-ink { flex: 1; min-height: 0; aspect-ratio: auto; }
.hint { display: flex; gap: .35em; justify-content: center; flex-wrap: wrap; min-height: 2.4em; }
.letter { width: 1.6em; height: 2em; border-bottom: .18em solid var(--ink); display: grid; place-items: end center; font-family: var(--display); font-size: 1.7em; text-transform: uppercase; animation: popin .4s both; }
.letter.blank { animation: none; }
.letter.reveal { color: var(--accent); border-color: var(--accent); }
.gap { width: .9em; }
.hint.small .letter { font-size: 1.15em; }
.draw-side { display: flex; flex-direction: column; gap: .7em; min-height: 0; }
.drawer-line { font-family: var(--display); font-size: 1.3em; color: var(--accent); }
.feed { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: .4em; min-height: 0; }
.feed-item { display: flex; align-items: center; gap: .5em; background: var(--card); padding: .35em .7em .35em .35em; border-radius: .9em; animation: slidein .3s both; word-break: break-word; }
.feed-item .avatar { font-size: .8em; }
.feed-item.correct { background: var(--go); color: #10331f; font-weight: 700; }
.feed-item.sys { background: var(--card2); color: var(--muted); justify-content: center; }
.feed.small { max-height: 10em; font-size: .9em; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }
.banner { position: absolute; inset: 15% 8% auto; background: var(--card); border-radius: 1.4em; padding: 1.2em; text-align: center; box-shadow: 0 .5em 0 rgba(0,0,0,.35); transform: scale(.6); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.3,1.6,.5,1), opacity .2s; }
.banner.show { transform: none; opacity: 1; }
.banner-label { color: var(--muted); font-size: 1.2em; }
.banner-word { font-family: var(--display); font-size: 3.4em; color: var(--accent); }
.banner-points { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; margin-top: .5em; }
.pts-chip { display: flex; align-items: center; gap: .4em; background: var(--card2); border-radius: 999px; padding: .2em .8em .2em .2em; font-weight: 700; }
.choices { display: grid; gap: .8em; }
.btn.choice { font-size: 1.5em; background: var(--card2); box-shadow: inset 0 -.25em 0 var(--accent), var(--shadow); }
.guess-status { text-align: center; font-weight: 700; font-size: 1.15em; min-height: 1.5em; }
.guess-status.done { color: var(--go); font-family: var(--display); font-size: 1.4em; }
.guess-status.close { color: var(--ccr); }
.guess-form { display: flex; gap: .6em; }
.guess-form .text { flex: 1; }

/* ---------- telephone ---------- */
.phone-stage-body { flex: 1; display: flex; flex-direction: column; gap: .8em; min-height: 0; }
.chain-title { display: flex; align-items: center; gap: .6em; font-family: var(--display); font-size: 1.6em; justify-content: center; }
.pair { flex: 1; overflow: hidden; display: flex; gap: 1.5em; align-items: center; justify-content: center; min-height: 0; padding: 0 1em; }
.arrow { font-size: 3em; color: var(--accent); flex: none; }
.entry.prev { width: 20em; opacity: .85; transform: scale(.9); flex: none; }
.entry.cur { width: min(42em, 55%); flex: none; }
.entry.cur .entry-text { font-size: 2.6em; }
.dots { display: flex; gap: .5em; justify-content: center; }
.dots .dot { width: .9em; height: .9em; border-radius: 50%; background: var(--card2); }
.dots .dot.past { background: var(--accent); opacity: .6; } .dots .dot.now { background: var(--accent); transform: scale(1.3); }
.entry { flex: none; width: 26em; max-height: 100%; min-height: 0; background: var(--card); border-radius: 1.3em; padding: .9em; display: flex; flex-direction: column; gap: .6em; box-shadow: var(--shadow); scroll-snap-align: center; }
.entry.fresh { animation: dealin .55s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes dealin { from { transform: translateY(40px) rotate(6deg) scale(.7); opacity: 0; } }
.entry-who { display: flex; align-items: center; gap: .5em; color: var(--muted); font-weight: 700; }
.entry-who .likes { margin-left: auto; color: var(--answers); }
.entry-text { font-family: var(--display); font-size: 1.7em; line-height: 1.2; padding: .4em .2em; }
.entry-text.small { font-family: var(--text); font-weight: 700; font-size: 1em; padding: 0; }
.entry-hidden { padding: 2em 1em; text-align: center; color: var(--muted); background: var(--card2); border-radius: 1em; }
.entry .ink-box { aspect-ratio: 4 / 3; height: auto; }
.prompt-text { font-family: var(--display); font-size: 1.3em; text-align: center; background: var(--card); border-radius: 1em; padding: .6em; }
.work-state { display: flex; justify-content: center; }
.sent { display: flex; gap: .8em; align-items: center; font-family: var(--display); font-size: 1.3em; color: var(--go); }
.like-row { display: flex; gap: .7em; align-items: center; background: var(--card); border-radius: 1em; padding: .6em .8em; }
.like-row > :first-child { flex: 1; }
.like { border: 0; border-radius: 999px; min-width: 64px; min-height: 48px; font-size: 1.2em; background: var(--card2); color: var(--answers); cursor: pointer; }
.like.on { background: var(--answers); color: #fff; animation: popin .3s; }
.likes { font-weight: 800; color: var(--answers); }
.awards { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(16em, 1fr)); gap: 1.2em; align-items: start; }
.award { background: var(--card); border-radius: 1.3em; padding: 1em; display: flex; flex-direction: column; gap: .6em; animation: popin .5s both; animation-delay: calc(var(--i) * 250ms); box-shadow: inset 0 -.3em 0 var(--ccr), var(--shadow); }
.award.small { flex-direction: row; animation: none; }
.award-title { font-family: var(--display); font-size: 1.3em; color: var(--ccr); }
.award-who { display: flex; align-items: center; gap: .5em; font-weight: 700; }
.award .entry { width: auto; box-shadow: none; background: var(--card2); }

/* ---------- funny answers ---------- */
.answers-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.prompt { font-family: var(--display); font-size: 2.3em; text-align: center; line-height: 1.15; padding: .3em 1em .6em; }
.prompt.small { font-size: 1.3em; padding: .2em 0; }
.duel { flex: 1; display: flex; flex-direction: column; gap: .6em; }
.versus { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 3em; flex: 1; align-items: center; padding: 0 2em; }
.vs { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg); font-family: var(--display); font-size: 2.6em; color: var(--ccr); text-shadow: 0 .1em 0 rgba(0,0,0,.4); }
.option { background: var(--card); border-radius: 1.5em; padding: 1.2em; display: flex; flex-direction: column; gap: .6em; min-height: 9em; box-shadow: var(--shadow); animation: dealin .55s both; animation-delay: calc(var(--i) * 300ms); transition: transform .3s, opacity .3s, box-shadow .3s; }
.option.side0 { transform: rotate(-1.5deg); } .option.side1 { transform: rotate(1.5deg); }
.option.win { box-shadow: 0 0 0 .25em var(--ccr), var(--shadow); transform: scale(1.05) rotate(0); }
.option.lose { opacity: .6; transform: scale(.95); }
.option-letter { width: 1.8em; height: 1.8em; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--dark); font-family: var(--display); flex: none; }
.option-text { font-family: var(--display); font-size: 1.8em; line-height: 1.2; word-break: break-word; }
.option-by { display: flex; align-items: center; gap: .5em; font-weight: 700; margin-top: auto; }
.option-votes { margin-left: auto; background: var(--accent); color: var(--dark); border-radius: 999px; padding: .1em .7em; font-weight: 800; }
.voters { display: flex; gap: .2em; flex-wrap: wrap; }
.sweep { text-align: center; font-family: var(--display); font-size: 2em; color: var(--ccr); animation: popin .5s both; }
.duel-count { text-align: center; color: var(--muted); }
.final-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14em, 1fr)); gap: 1em; overflow: auto; }
.final-opt { min-height: 6em; transform: none; }
.final-opt .option-text { font-size: 1.35em; }
.prompts { display: flex; flex-direction: column; gap: 1em; }
.prompt-card { background: var(--card); border-radius: 1.2em; padding: 1em; display: flex; flex-direction: column; gap: .7em; box-shadow: var(--shadow); }
.prompt-q { font-family: var(--display); font-size: 1.25em; line-height: 1.2; }
.answer-state { color: var(--go); font-weight: 700; min-height: 1.2em; }
.vote-box { display: flex; flex-direction: column; gap: .8em; }
.vote-btn { display: flex; align-items: center; gap: .8em; text-align: left; border: 0; border-radius: 1.2em; padding: 1em; min-height: 64px; background: var(--card); color: var(--ink); font-size: 1.15em; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); }
.vote-btn.on { background: var(--answers); }
.vote-btn.own { opacity: .5; }
.vote-btn:disabled { cursor: default; opacity: .5; }
.vote-count { text-align: center; font-family: var(--display); font-size: 1.3em; }

/* ---------- city country river ---------- */
.ccr-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1em; min-height: 0; }
.letter-big { font-family: var(--display); font-size: 14em; line-height: 1; color: var(--accent); text-shadow: 0 .05em 0 rgba(0,0,0,.35); animation: spinin .9s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes spinin { from { transform: rotate(-200deg) scale(.2); opacity: 0; } }
.cats-line { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; max-width: 60em; }
.cat-pill { background: var(--card); padding: .4em 1em; border-radius: 999px; font-weight: 700; font-size: 1.2em; }
.stop-banner { font-family: var(--display); font-size: 3em; color: var(--danger); animation: thump 1s infinite; }
.review { width: 100%; display: flex; flex-direction: column; gap: 1em; flex: 1; min-height: 0; }
.review-head { display: flex; align-items: center; gap: .6em; justify-content: center; }
.letter-small { font-family: var(--display); font-size: 2.4em; color: var(--accent); background: var(--card); border-radius: .3em; padding: 0 .3em; }
.review-cat { font-family: var(--display); font-size: 2.4em; }
.review-count { color: var(--muted); }
.answers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: .8em; overflow: auto; }
.ans { background: var(--card); border-radius: 1.1em; padding: .8em; display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'av name' 'text text' 'marks marks'; gap: .3em .6em; align-items: center; animation: popin .4s both; animation-delay: calc(var(--i) * 70ms); }
.ans .avatar { grid-area: av; font-size: .8em; } .ans-name { grid-area: name; color: var(--muted); font-weight: 700; } .ans-text { grid-area: text; font-family: var(--display); font-size: 1.5em; word-break: break-word; } .ans-marks { grid-area: marks; display: flex; gap: .4em; }
.ans.bad { opacity: .55; } .ans.bad .ans-text { text-decoration: line-through; }
.tag { background: var(--card2); border-radius: 999px; padding: 0 .6em; font-size: .85em; font-weight: 700; } .tag.bad { background: var(--danger); }
.doubts { color: var(--ccr); font-weight: 800; }
.table-wrap { width: 100%; overflow: auto; flex: 1; }
.ccr-table { width: 100%; border-collapse: separate; border-spacing: .3em; font-size: 1.05em; }
.ccr-table th { font-family: var(--display); font-weight: 400; color: var(--accent); text-align: left; padding: .3em .5em; }
.ccr-table td { background: var(--card); border-radius: .6em; padding: .35em .5em; vertical-align: top; }
.ccr-table td small { display: block; color: var(--go); font-weight: 800; }
.ccr-table td.zero small { color: var(--danger); }
.ccr-table td.who { display: flex; align-items: center; gap: .4em; font-weight: 700; white-space: nowrap; }
.ccr-table td.sum { font-family: var(--display); font-size: 1.3em; text-align: center; }
.letter-mid { font-family: var(--display); font-size: 2.6em; color: var(--accent); background: var(--card); border-radius: .3em; padding: 0 .3em; line-height: 1.1; }
.form { display: flex; flex-direction: column; gap: .6em; }
.form-row { display: flex; flex-direction: column; gap: .2em; font-weight: 700; color: var(--muted); }
.review-phone { display: flex; flex-direction: column; gap: .5em; }
.review-row { display: flex; align-items: center; gap: .6em; background: var(--card); border-radius: 1em; padding: .5em .7em; }
.review-row.bad { opacity: .55; }
.review-text { flex: 1; display: flex; flex-direction: column; } .review-text span { font-family: var(--display); font-size: 1.2em; word-break: break-word; }
.doubt { border: 0; border-radius: 999px; min-width: 64px; min-height: 46px; background: var(--card2); color: var(--ink); cursor: pointer; font-size: 1.05em; }
.doubt.on { background: var(--danger); }

/* ---------- intro, results, podium ---------- */
.intro { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6em; }
.intro-icon { font-size: 7em; animation: popin .6s both, bob 2.4s 0.6s ease-in-out infinite; }
.phone-intro .intro-icon { font-size: 4em; }
.intro-title { font-family: var(--display); font-size: 4.4em; color: var(--accent); text-shadow: 0 .07em 0 rgba(0,0,0,.35); animation: popin .6s .1s both; }
.phone-intro .intro-title { font-size: 2.2em; }
.intro-rules { list-style: none; padding: 0; margin: .5em 0; display: grid; gap: .5em; font-size: 1.5em; }
.intro-rules li { background: var(--card); border-radius: 1em; padding: .5em 1em; animation: dealin .5s both; animation-delay: calc(.4s + var(--i) * .25s); }
.intro-rules.small { font-size: 1.05em; text-align: left; }
.intro-ready { display: flex; align-items: center; gap: .8em; font-family: var(--display); font-size: 1.8em; }
.results { height: 100%; display: flex; flex-direction: column; align-items: center; gap: 1em; }
.results-title { font-family: var(--display); font-size: 3em; }
.results-body { width: min(100%, 44em); display: flex; flex-direction: column; gap: 1em; flex: 1; min-height: 0; }
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45em; overflow: auto; }
.rank { display: flex; align-items: center; gap: .7em; background: var(--card); border-radius: 1em; padding: .45em .9em .45em .5em; font-weight: 700; animation: slidein .4s both; animation-delay: calc(var(--i) * 80ms); }
.rank.mine { box-shadow: 0 0 0 3px var(--accent); }
.ranking.big .rank { font-size: 1.3em; }
.rank-place { font-family: var(--display); width: 1.6em; text-align: center; color: var(--ccr); }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-plus { color: var(--go); font-size: .9em; }
.rank-pts { font-family: var(--display); min-width: 3em; text-align: right; }
.after { display: flex; gap: .7em; flex-wrap: wrap; justify-content: center; }
.after .btn.big { width: auto; }
.layout-phone .after { flex-direction: column; } .layout-phone .after .btn { width: 100%; }
.podium { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 1em; overflow: hidden; }
.podium-title { font-family: var(--display); font-size: 3em; color: var(--ccr); text-shadow: 0 .07em 0 rgba(0,0,0,.35); animation: popin .7s both; text-align: center; }
.steps { display: flex; align-items: flex-end; gap: 1.2em; }
.step { display: flex; flex-direction: column; align-items: center; gap: .2em; width: 9em; animation: rise .8s cubic-bezier(.3,1.4,.5,1) both; }
.step.p1 { animation-delay: 1.1s; } .step.p2 { animation-delay: .6s; } .step.p3 { animation-delay: .2s; }
@keyframes rise { from { transform: translateY(60%); opacity: 0; } }
.step-name { font-family: var(--display); font-size: 1.4em; text-align: center; }
.step-pts { color: var(--muted); font-weight: 700; }
.step-block { width: 100%; display: grid; place-items: center; font-family: var(--display); font-size: 2.4em; color: var(--dark); border-radius: .3em .3em 0 0; box-shadow: inset 0 -.2em 0 rgba(0,0,0,.2); }
.p1 .step-block { height: 3.4em; background: linear-gradient(var(--ccr), #f5a623); }
.p2 .step-block { height: 2.5em; background: linear-gradient(#e6e6f0, #a9a9bd); }
.p3 .step-block { height: 1.8em; background: linear-gradient(#f0a46b, #b9703d); }
.step.empty { width: 9em; }
.layout-screen .podium { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; align-items: end; column-gap: 3em; }
.layout-screen .podium-title { grid-column: 1 / -1; }
.layout-screen .podium .steps { justify-content: center; }
.layout-screen .podium .ranking { width: 22em; align-self: center; max-height: 100%; }
.layout-screen .podium .after { grid-column: 1 / -1; }
.podium .ranking { width: min(100%, 36em); }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }

/* ---------- host tools ---------- */
.tools-panel { position: fixed; right: 1em; top: 4.2em; z-index: 40; width: min(26em, calc(100vw - 2em)); max-height: calc(100vh - 6em); overflow: auto; background: var(--bg2); border-radius: 1.2em; padding: 1em; display: flex; flex-direction: column; gap: .8em; box-shadow: 0 1em 3em rgba(0,0,0,.5), inset 0 0 0 2px var(--line); font-size: 16px; }
.tools-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--display); font-size: 1.2em; }
.tools-row { display: flex; gap: .5em; flex-wrap: wrap; }
.tools-players { display: flex; flex-direction: column; gap: .4em; }
.tools-player { display: flex; align-items: center; gap: .5em; } .tools-player > span:not(.badge) { flex: 1; }

/* ---------- phones in landscape and narrow screens ---------- */
.layout-phone .entry.prev, .layout-phone .arrow { display: none; }
.layout-phone .entry.cur { width: 100%; }
.layout-phone .stage-slot .stage { font-size: .75em; }
@media (max-width: 900px) {
  .layout-screen .lobby { grid-template-columns: 1fr; overflow: auto; }
  .draw-main { grid-template-columns: 1fr; }
  .versus { grid-template-columns: 1fr; gap: 1em; } .vs { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) { body { font-size: 16px; } .settings-body { grid-template-columns: 1fr; } }
