:root {
  --bg: #14121a;
  --panel: #1d1a26;
  --panel-2: #26222f;
  --line: #34303f;
  --text: #f3f1f7;
  --muted: #a49fb3;
  --accent: #ff4f81;
  --accent-2: #ff7aa2;
  --ok: #3ecf8e;
  --warn: #f5b942;
  --danger: #ff5c5c;
  --speak: #ffd60a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
h1 { margin: 0 0 6px; font-size: 26px; }
h2 { margin: 0 0 10px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.screen { min-height: 100%; }
.screen.center { display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.card.wide { max-width: 520px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 16px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--danger); min-height: 1.2em; font-size: 14px; }
.warn { background: #3a2f12; border: 1px solid var(--warn); color: #ffe3a3; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.small-link { color: var(--accent-2); font-size: 14px; }

.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 15px; cursor: pointer; }
.btn:hover { border-color: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 13px 16px; }
.btn.primary:hover { background: var(--accent-2); }
.btn.icon { width: 42px; padding: 10px 0; }
.btn.off { background: #4a1f28; border-color: var(--danger); }
.btn.danger-ghost { color: var(--danger); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wa { background: #25d366; border-color: #25d366; color: #052b14; font-weight: 700; text-align: center; text-decoration: none; display: block; padding: 14px; border-radius: 10px; }

/* ------- room ------- */
.room { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--accent-2); }
.chips { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.chip, .brand { white-space: nowrap; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.like-chip { border-color: var(--accent); color: var(--accent-2); }
.controls { display: flex; gap: 8px; }
.socialfield-promo { flex: none; display: flex; justify-content: center; padding: 7px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #191624, #28203a, #191624); }
.socialfield-promo a { display: inline-flex; justify-content: center; align-items: center; min-height: 38px; padding: 7px 20px; border: 1px solid #d98cff; border-radius: 999px; color: #fff; background: linear-gradient(110deg, #8839d6, #e34598, #8839d6); background-size: 200% 100%; box-shadow: 0 0 10px #c653ff99, 0 0 24px #b638e866; font-weight: 700; text-align: center; text-decoration: none; animation: socialfield-glow 2.4s ease-in-out infinite; }
.socialfield-promo a:hover, .socialfield-promo a:focus-visible { box-shadow: 0 0 14px #e28aff, 0 0 32px #c653ffbb; outline: 2px solid #fff; outline-offset: 2px; }
@keyframes socialfield-glow { 0%, 100% { background-position: 0% 50%; box-shadow: 0 0 10px #c653ff99, 0 0 24px #b638e866; } 50% { background-position: 100% 50%; box-shadow: 0 0 16px #e28affcc, 0 0 34px #b638e899; } }
@media (prefers-reduced-motion: reduce) { .socialfield-promo a { animation: none; } }
.banner { padding: 12px 16px; background: #2a1d33; border-bottom: 1px solid var(--accent); text-align: center; font-size: 15px; }
.banner.ok { background: #14301f; border-color: var(--ok); }
/* phones: smaller top bar and banner, so the videos get the space */
@media (max-width: 520px) {
  .top { padding: 8px 10px; gap: 8px; }
  .banner { font-size: 13px; padding: 7px 12px; line-height: 1.35; }
}
/* phones held sideways (short screens): keep the bars as thin as possible */
@media (max-height: 500px) {
  .top { padding: 4px 10px; }
  .top .btn { padding: 6px 10px; }
  .top .btn.icon { width: 36px; padding: 6px 0; }
  .banner { font-size: 12px; padding: 4px 10px; line-height: 1.3; }
  main { padding: 6px; }
}
/* the videos always fit the space left under the top bar: no scrolling on any screen. app.js works out
   the biggest tile size where everyone fits and gives each tile its place (--x, --y, --w, --h). */
main { flex: 1; min-height: 0; overflow: hidden; padding: 10px; }
.grid { position: relative; width: 100%; height: 100%; }
.tile { position: absolute; left: var(--x, 0); top: var(--y, 0); width: var(--w, 0); height: var(--h, 0); background: #0e0d13; border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; transition: left .25s, top .25s, width .25s, height .25s; }
.tile .avatar { font-size: clamp(18px, calc(var(--h, 120px) * .32), 120px); }
.tile { border-width: 3px; }
/* whoever is talking gets a yellow frame */
.tile.speaking { border-color: var(--speak); box-shadow: 0 0 18px rgba(255, 214, 10, .55); }
.tile .hand { font-size: 22px; background: rgba(0,0,0,.6); border-radius: 999px; padding: 2px 8px; }
.tile .tile-controls { position: absolute; z-index: 4; top: 8px; right: 8px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: calc(100% - 16px); }
.tile .tile-controls[hidden] { display: none; }
.tile-control { display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; padding: 0; border: 1px solid rgba(255,255,255,.4); border-radius: 50%; background: rgba(0,0,0,.82); color: #fff; font: inherit; font-size: 19px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.45); touch-action: manipulation; }
.tile-control:hover, .tile-control:focus-visible { background: #34303f; border-color: var(--accent-2); outline: 2px solid #fff; outline-offset: 1px; }
.tile-control.allow { color: var(--ok); }
.tile-control.mute, .tile-control.eliminate { color: var(--danger); }
.tile-control.vote { color: #ffe3a3; }
.tile-control.tile-expand { display: none; }
/* only the hand waves, its dark pill stays still, so it never swings onto the badge next to it */
.tile .hand span { display: inline-block; animation: wave 1.2s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
.btn.hand-btn.raised { background: #3a2f12; border-color: var(--speak); color: var(--speak); }
.btn.locked { opacity: .45; }
.modpanel textarea { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; font-size: 14px; resize: vertical; margin: 6px 0; }
.modpanel .actions.left { justify-content: flex-start; }
.modpanel details { margin-top: 10px; font-size: 13px; }
.modpanel summary { cursor: pointer; color: var(--accent-2); }
.ticket-list { margin: 6px 0 0; padding-left: 18px; max-height: 200px; overflow: auto; }
.ticket-list li { margin: 2px 0; }
.modpanel .warn.small { font-size: 13px; }
.tag.bad { color: var(--danger); border-color: var(--danger); }
.bad-text { color: var(--danger); }
.pair.no-ticket { border: 1px solid var(--danger); }
.modpanel h3 { font-size: 14px; margin: 14px 0 6px; }
.modpanel .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hand-mode { margin-top: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.hand-mode p { margin: 6px 0 8px; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: none; }
.tile.has-video video { display: block; }
.tile.local video { transform: scaleX(-1); }
.avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 700; color: var(--muted); }
.tile.has-video .avatar { display: none; }
.tile .label { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); padding: 3px 9px; border-radius: 8px; font-size: 14px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .badge { color: var(--warn); font-size: 12px; margin-left: 6px; text-transform: uppercase; }
.tile .mic-off { font-size: 14px; background: rgba(0,0,0,.6); border-radius: 8px; padding: 2px 6px; }
.like-btn { position: absolute; right: 8px; bottom: 8px; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 8px 14px; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.like-btn:hover { background: var(--accent-2); }
#phone-fields { display: flex; flex-direction: column; gap: 10px; }
#phone-fields p { margin: 0; }
.safe { background: #14301f; border: 1px solid var(--ok); color: #c9f5dc; padding: 10px 12px; border-radius: 10px; }
.wa-check { color: var(--text); }
#screen-match { flex-direction: column; gap: 14px; }
.countdown { text-align: center; }
.cd-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cd-heart { color: var(--accent); }
.cd-label { color: var(--muted); font-size: 14px; }
.countdown.urgent .cd-row { font-size: 72px; color: var(--danger); }
.countdown.urgent .cd-heart { animation: heartbeat 1s infinite; color: var(--danger); }
.countdown.urgent .cd-label { color: var(--danger); font-weight: 600; }
@keyframes heartbeat { 0% { transform: scale(1); } 12% { transform: scale(1.35); } 24% { transform: scale(1); } 36% { transform: scale(1.25); } 60%, 100% { transform: scale(1); } }
.count-badge { display: inline-block; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 8px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 14px; font-weight: 800; line-height: 22px; text-align: center; animation: badgepulse 1.6s ease-in-out infinite; }
@keyframes badgepulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 92, .6); } 50% { box-shadow: 0 0 0 6px rgba(255, 92, 92, 0); } }
.fab { position: fixed; bottom: 16px; z-index: 30; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.fab-left { left: 16px; }
.fab-center { left: 50%; transform: translateX(-50%); font-size: 16px; font-weight: 700; padding: 12px 20px; border-radius: 999px; background: #2b1d3a; border-color: var(--accent); }

/* ------- Mafia game ------- */
.night { position: fixed; inset: 0; z-index: 45; background: radial-gradient(circle at 50% 30%, #1b1840, #05050b 70%); display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.night-box { max-width: 420px; }
.night .moon { font-size: 90px; animation: glow 4s ease-in-out infinite; }
.night h1 { font-size: 30px; margin: 10px 0; }
.night p { color: #b9b4d6; }
@keyframes glow { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
.count-input { width: 58px; padding: 6px 4px; text-align: center; font-size: 15px; font-weight: 700; }
.tile .votes { background: var(--accent); color: #fff; font-weight: 800; font-size: 18px; padding: 4px 14px; border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.tile.eliminated video { filter: grayscale(1) brightness(.55); }
.tile.eliminated::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(70px, 16vw, 200px); font-weight: 900; color: rgba(255, 45, 45, .85); text-shadow: 0 0 18px rgba(0,0,0,.6); pointer-events: none; }
.tile.eliminated .label { color: #ff8a8a; }
/* the name and the character of an eliminated player stay readable: they sit above the big red cross, not under it */
.tile.eliminated .label, .tile.eliminated .badges { z-index: 3; }
.badge.role { color: #d7c8ff; text-transform: none; font-size: 12px; }
.role-row { display: flex; justify-content: space-between; align-items: center; margin: 6px 0; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper b { min-width: 22px; text-align: center; }
.phase-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.modpanel tr.elim td { color: #ff8a8a; }
.rules { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rules h2, .modal h2 { margin: 0 0 6px; font-size: 16px; }
.rules ol, .modal ol { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text); }
.rules li, .modal li { margin: 4px 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.tile .thumbs { background: rgba(0,0,0,.65); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 999px; padding: 3px 11px; font-size: 16px; font-weight: 700; }
.tile .thumbs.pop { animation: pop .6s ease-out; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.6); background: var(--accent); } 100% { transform: scale(1); } }
.float-thumb { position: absolute; left: 50%; top: 50%; font-size: 64px; pointer-events: none; animation: floatup 1.4s ease-out forwards; }
@keyframes floatup { 0% { transform: translate(-50%, -30%) scale(.5); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); } 100% { transform: translate(-50%, -200%) scale(1); opacity: 0; } }
.like-btn.liked { background: #3b2a35; color: var(--accent-2); cursor: default; }

.tile { cursor: pointer; }
.tile.featured { background: #000; }
.tile.featured video { object-fit: contain; }
.tile.spotlight { position: fixed; inset: 0; left: 0; top: 0; width: auto; height: auto; z-index: 40; border: 0; border-radius: 0; background: #000; cursor: zoom-out; transition: none; }
.tile.spotlight video { object-fit: contain; }
.tile.spotlight .avatar { font-size: 120px; }
.tile.spotlight .label { left: 16px; bottom: 18px; font-size: 18px; padding: 6px 12px; }
.tile.spotlight .like-btn { right: 16px; bottom: 16px; font-size: 18px; padding: 12px 22px; }
.tile.spotlight .badges { left: 16px; top: 16px; }
.grid.has-spotlight .tile:not(.spotlight) { display: none; }
.spot-ui { position: fixed; inset: 0; z-index: 41; pointer-events: none; }
.spot-btn { pointer-events: auto; position: absolute; width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.3); font-size: 26px; line-height: 1; cursor: pointer; }
.spot-btn:hover { background: rgba(0,0,0,.8); }
.spot-close { top: 12px; right: 12px; font-size: 20px; }
.spot-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.spot-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ------- moderator panel ------- */
.modpanel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 16px; z-index: 20; box-shadow: -8px 0 30px rgba(0,0,0,.5); }
.modpanel .row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modpanel section { margin-bottom: 18px; }
.modpanel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.modpanel th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px; }
.modpanel td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--ok); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); margin-left: 4px; }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.codebox { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 3px; background: var(--panel-2); border: 1px dashed var(--line); padding: 8px 12px; border-radius: 10px; display: inline-block; }
.pair { padding: 8px 10px; background: var(--panel-2); border-radius: 10px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }

/* ------- match page ------- */
.choice { display: flex; flex-direction: row; color: var(--text); align-items: center; gap: 12px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; font-size: 18px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: #35202b; }
.choice input { width: 20px; height: 20px; }
.phone-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; }
.big-number { font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.match-name { font-size: 28px; color: var(--accent-2); font-weight: 700; }
.center-text { text-align: center; }

#toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); background: #2d2a38; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
/* "Tap to turn on the sound": above the cameras, the full-screen camera and the night screen, never under the role card */
.sound-on { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 48; min-height: 44px; max-width: calc(100vw - 32px); padding: 10px 18px; border: 1px solid var(--accent); border-radius: 999px; background: #2b1d3a; color: #fff; font: inherit; font-size: 15px; font-weight: 700; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.5); cursor: pointer; }

/* ------- mobile fixes (from the mobile check of 17 Oct 2026) ------- */
/* 1 + 6. top bar: labels never break inside a button; on phones the buttons get their own row and short labels */
.lbl-short { display: none; }
.top .btn { white-space: nowrap; }
.btn.icon { flex: 0 0 42px; }
@media (max-width: 420px) {
  .controls { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .top .btn { padding: 10px; font-size: 14px; }
  .top .btn .lbl-long { display: none; }
  .top .btn .lbl-short { display: inline; }
}
/* 2. room for the Mafia character button, so it never covers a Like button */
.has-fab #screen-room main { padding-bottom: 84px; }
#role-card { white-space: nowrap; }
/* 3. Like buttons are big enough to tap, names never hide under them (sizes updated on 18 Oct, see below) */
.tile .like-btn { min-height: 40px; }
.tile .label { max-width: calc(100% - 108px); } /* room for "❤ Liked" (86px) */
.tile:not(.has-like) .label { max-width: calc(100% - 16px); }
.tile.spotlight .label { max-width: calc(100% - 150px); }
.tile.spotlight:not(.has-like) .label { max-width: calc(100% - 32px); }
.tile.compact:not(.spotlight) { border-radius: 8px; }
.tile.compact:not(.spotlight) .label { left: 3px; bottom: 3px; font-size: 12px; line-height: 1.2; padding: 1px 5px; max-width: calc(100% - 6px); }
.tile.compact:not(.spotlight) .like-btn { top: 3px; right: 3px; bottom: auto; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; font-size: 17px; line-height: 40px; }
.tile.compact:not(.spotlight) .like-btn .lbl-long { display: none; }
.tile.compact:not(.spotlight) .mic-off { font-size: 11px; padding: 0 3px; } /* the crossed microphone is also shown on small cameras: it tells the moderator who cannot speak (fitBadges drops it when there is no room) */
.tile.compact:not(.spotlight) .badge:not(.role) { display: none; }
/* 4. match page on a phone held sideways: everything, including "Say hi", fits on the screen */
.big-emoji { font-size: 52px; }
@media (max-height: 500px) {
  #screen-match { padding-top: 8px; padding-bottom: 8px; gap: 6px; }
  .cd-row { font-size: 26px; }
  .countdown.urgent .cd-row { font-size: 40px; }
  #match-body { padding: 14px 18px; gap: 8px; }
  #match-body h1 { font-size: 22px; margin: 0; }
  #match-body .match-name { font-size: 22px; }
  .big-emoji { font-size: 30px; }
}
/* 5. a window taller than the screen starts at the top and scrolls, instead of being cut off */
.modal { align-items: flex-start; }
.modal .card { margin: auto; }
/* 8. moderator panel: buttons and number boxes big enough for fingers (16px text stops iPhones zooming in) */
.modpanel .btn.small { min-height: 40px; padding: 8px 12px; }
.stepper .btn.small { min-width: 40px; }
.count-input { font-size: 16px; min-height: 40px; }
.tag { white-space: nowrap; display: inline-block; font-size: 12px; }
/* 9. join page: the country box is wide enough for "United Kingdom (+44)"; on phones it gets its own line */
.phone-row { grid-template-columns: 1.5fr 1fr; }
@media (max-width: 480px) { .phone-row { grid-template-columns: 1fr; } }
/* 11. phone held sideways: top bar buttons stay big enough to tap */
@media (max-height: 500px) {
  .top .btn { min-height: 40px; }
  .top .btn.icon { width: 40px; flex-basis: 40px; }
}
/* 12. join page: easier to tap */
.small-link { align-self: flex-start; padding: 12px 0; }
label.check { min-height: 44px; }
label.check input { width: 22px; height: 22px; flex: none; }
#mod-fields { display: flex; flex-direction: column; gap: 10px; }
/* 13. the moderator sees each player's character on its own line, not cut off */
.tile .label .badge.role { display: block; margin-left: 0; }
/* 14. wide screens: the videos make room for the open Moderator panel instead of hiding under it */
@media (min-width: 900px) {
  body.mod-open #screen-room .banner, body.mod-open #screen-room main { margin-right: 440px; }
}

/* ------- mobile fixes (from the mobile check of 18 Oct 2026) ------- */
/* N2. every badge has its own spot: votes, likes count, raised hand and the muted icon share one box in the top
   left corner and flow side by side (around the heart on small tiles). app.js gives the box its width and leaves
   out what does not fit above the name: first the muted icon, then the likes count while votes show, and the
   raised hand then moves into the name label. */
.tile .badges { position: absolute; left: 8px; top: 8px; display: flow-root; pointer-events: none; }
.tile .badges > * { float: left; margin: 0 3px 3px 0; height: 30px; line-height: 30px; padding-top: 0; padding-bottom: 0; white-space: nowrap; } /* one height per tile size: a second row always starts at the left */
.tile .badges > .mic-off { float: right; }
.tile .badges::before { content: ''; float: right; }
.tile.no-mic .mic-off, .tile.no-thumbs .thumbs, .tile.hand-in-label .hand { display: none; }
.tile.hand-in-label .label::before { content: '✋'; margin-right: 4px; }
.tile .label .badge.role { overflow: hidden; text-overflow: ellipsis; }
/* N1. medium tiles (130 to 220 px wide): a round 44px heart bottom right, so the name keeps its room */
.tile.narrow:not(.spotlight) .badges { left: 6px; top: 6px; }
.tile.narrow:not(.spotlight) .label { left: 6px; bottom: 6px; font-size: 13px; padding: 2px 7px; max-width: calc(100% - 60px); }
.tile.narrow:not(.spotlight):not(.has-like) .label { max-width: calc(100% - 12px); }
.tile.narrow:not(.spotlight) .like-btn { right: 6px; bottom: 6px; width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; font-size: 19px; line-height: 44px; }
.tile.narrow:not(.spotlight) .like-btn .lbl-long { display: none; }
.tile.narrow:not(.spotlight) .badges > * { height: 24px; line-height: 24px; }
.tile.narrow:not(.spotlight) .thumbs, .tile.narrow:not(.spotlight) .votes { font-size: 14px; padding: 0 7px; }
.tile.narrow:not(.spotlight) .hand { font-size: 16px; padding: 0 5px; }
.tile.narrow:not(.spotlight) .mic-off { font-size: 13px; padding: 0 4px; }
/* small tiles: the heart in the top right corner, the badges beside or under it, the name along the bottom */
.tile.compact:not(.spotlight) .badges { left: 3px; top: 3px; }
.tile.compact.has-like:not(.spotlight) .badges::before { width: 42px; height: 42px; }
.tile.compact:not(.spotlight) .badges > * { height: 17px; line-height: 17px; }
.tile.compact:not(.spotlight) .thumbs, .tile.compact:not(.spotlight) .votes, .tile.compact:not(.spotlight) .hand { font-size: 12px; padding: 0 4px; }
.tile.compact:not(.spotlight) .tile-controls, .tile.narrow:not(.spotlight) .tile-controls { display: none; }
.tile.spotlight .tile-controls { top: 68px; right: 8px; }
.tile.spotlight .tile-control.tile-expand { display: none; }
/* N3. speaker view on a screen too small for it: the speaker is first in the grid and keeps the yellow frame */
.tile.lead { border-color: var(--speak); box-shadow: 0 0 18px rgba(255, 214, 10, .55); }

/* the month's video data in the moderator panel */
.usage-bar { height: 12px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin: 6px 0; }
.usage-fill { display: block; height: 100%; min-width: 2px; background: var(--ok); }
.usage-fill.l1 { background: var(--warn); }
.usage-fill.l2 { background: var(--danger); }

/* ------- the lobby: men on the left, women on the right, six places each ------- */
.screen.lobby { padding: 20px 16px 32px; }
.lobby-wrap { width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.lobby-wrap h1 { text-align: center; margin: 0; }
.lobby-when { text-align: center; color: var(--accent-2); font-weight: 600; margin: 0; }
.lobby-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lobby-side { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.lobby-side h2 { text-align: center; margin: 0 0 10px; font-size: 17px; }
.lobby-frames { display: flex; flex-direction: column; gap: 8px; }
.lobby-frame { min-height: 48px; display: flex; align-items: center; justify-content: center; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); font-size: 16px; text-align: center; overflow: hidden; }
.lobby-frame .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
button.lobby-frame { font: inherit; font-size: 16px; color: var(--accent-2); border-style: dashed; border-color: var(--accent-2); cursor: pointer; width: 100%; }
button.lobby-frame:hover:not(:disabled) { background: #35202b; }
button.lobby-frame:disabled { color: var(--muted); border-color: var(--line); opacity: .6; cursor: default; }
.lobby-frame.taken { border-color: var(--accent); background: #2a1d33; font-weight: 600; }
.lobby-frame.mine { border-color: var(--ok); background: #14301f; }
.lobby-frame .you { font-size: 11px; color: var(--ok); margin-left: 6px; }
.lobby-foot { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.lobby-foot p { margin: 0; }
.lobby-foot .small-link { align-self: center; }
#lobby-enter { min-height: 48px; }
.modpanel input[type=datetime-local] { min-height: 44px; }
.lobby-reg { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.lobby-reg .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 380px) {
  .screen.lobby { padding: 14px 8px 24px; }
  .lobby-sides { gap: 8px; }
  .lobby-side { padding: 8px; }
  .lobby-frame, button.lobby-frame { font-size: 15px; padding: 6px 6px; }
}

/* the dates: a guest picks the date of their ticket, then sees that date's places */
.lobby-pick { display: flex; flex-direction: column; gap: 8px; }
.lobby-step { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
.lobby-dates { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lobby-date { min-height: 56px; min-width: 92px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lobby-date:hover { border-color: var(--accent-2); }
.lobby-date.sel { border-color: var(--accent); background: #35202b; }
.lobby-date .ld-day { font-weight: 600; font-size: 15px; }
.lobby-date .ld-time { font-size: 13px; color: var(--muted); }
.lobby-date .ld-in { font-size: 11px; color: var(--ok); }
.lobby-date-admin { padding: 8px 10px; background: var(--panel-2); border-radius: 10px; margin-bottom: 8px; }
.lobby-date-admin .ld-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.lobby-date-admin .lobby-reg:first-of-type { margin-top: 6px; }

/* ------- 23 Oct 2026: speaking turns, muting, game notices, main page bars, the moderator panel ------- */
/* a microphone with a red line through it: this person cannot speak right now (the picture is made in app.js, MIC_SVG) */
.xmic { width: 1.2em; height: 1.2em; vertical-align: middle; overflow: visible; flex: none; }
.xmic .xline { stroke: var(--danger); paint-order: stroke; }
.tile-control.mute:not(.is-muted) .xline { display: none; }
.tile-control.mute { color: #fff; }
.tile-control.mute.is-muted { color: #ffc2c2; }
.tile .mic-off { display: inline-flex; align-items: center; }
.tile .mic-off[hidden] { display: none; } /* a display rule beats the hidden attribute: without this line the crossed microphone showed on every camera */
.tile-control.is-muted { border-color: var(--danger); background: #3a161c; }
.tile-control.timer { color: var(--warn); }
.tile-control.raise.raised { border-color: var(--speak); color: var(--speak); background: #3a2f12; }

/* the countdown of a timed turn (and of last words), on the speaker's camera */
.tile .speak-timer { padding: 0 10px; border: 1px solid var(--warn); border-radius: 999px; background: rgba(0,0,0,.82); color: #ffe3a3; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .speak-timer[hidden] { display: none; }
.tile .speak-timer.urgent { color: #fff; border-color: var(--danger); background: #7a1f28; animation: timerpulse .7s ease-in-out infinite alternate; }
@keyframes timerpulse { to { box-shadow: 0 0 0 4px rgba(255, 92, 92, .45); } }
.tile.spotlight .badges > .speak-timer { height: 38px; line-height: 36px; font-size: 20px; padding: 0 14px; }
.tile.narrow:not(.spotlight) .speak-timer { font-size: 13px; padding: 0 7px; }
.tile.compact:not(.spotlight) .speak-timer { display: none; }
.tile.has-turn:not(.spotlight) { border-color: var(--warn); box-shadow: 0 0 14px rgba(255, 190, 80, .6); }
.turn-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; padding: 6px 12px; text-align: center; background: #3a2f12; border-bottom: 1px solid var(--speak); color: #ffe3a3; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.turn-bar .tb-next:empty { display: none; }
.turn-bar .tb-next { font-weight: 600; opacity: .9; }
.turn-bar .tb-end { min-height: 34px; padding: 3px 10px; font-size: 13px; }
.turn-bar.urgent { background: #5a1b22; border-color: var(--danger); color: #fff; }

/* the moderator's buttons on the main page (hand mode, the Mafia game) */
.quick-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; background: #1b1724; border-bottom: 1px solid var(--line); }
.quick-bar .btn { padding: 7px 10px; font-size: 13px; min-height: 40px; }
@media (max-height: 500px) { .quick-bar { padding: 3px 8px; } .quick-bar .btn { min-height: 36px; padding: 4px 9px; } }
/* shortcuts: round chips (waiting, hands, likes) that open a short list under the bar; the Reveal button takes two taps */
.quick-chip { border-radius: 999px; }
.quick-chip b { font-variant-numeric: tabular-nums; }
.quick-chip.attn { border-color: var(--warn); background: #3a2f12; color: #ffe3a3; }
.quick-chip.open { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 79, 129, .45); }
.mod-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mod-chips .quick-chip { min-height: 36px; padding: 3px 12px; font-size: 14px; }
@media (max-width: 480px) { .quick-bar .lbl-long, .mod-chips .lbl-long { display: none; } .quick-bar .lbl-short { display: inline; } }
/* a phone held sideways has no height to spare: the chips say only the number, so the top bar stays one row */
@media (max-height: 500px) { .mod-chips .lbl-long { display: none; } }
/* small phones: tighter buttons, so the Mafia bar still fits two rows on a 360 pixel wide phone */
@media (max-width: 400px) { .quick-bar { gap: 4px; padding: 6px 8px; } .quick-bar .btn { padding: 7px 7px; } }
/* a phone held sideways and narrower than 800 pixels has no height to spare, and the chips are in this bar too: the bar is ONE row
   that scrolls sideways when it is longer than the screen (the outer buttons keep the row centred when it is shorter). A wider
   sideways phone wraps the bar to at most two rows, so every button stays on the screen. */
@media (max-height: 500px) and (max-width: 799px) {
  .quick-bar { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .quick-bar::-webkit-scrollbar { display: none; }
  .quick-bar > * { flex: none; white-space: nowrap; }
  .quick-bar > :first-child { margin-left: auto; }
  .quick-bar > :last-child { margin-right: auto; }
}
.quick-pop { position: fixed; z-index: 25; width: min(420px, calc(100vw - 16px)); max-height: calc(100vh - var(--qp-top, 0px) - 12px); overflow-y: auto; overscroll-behavior: contain; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
@supports (height: 100dvh) { .quick-pop { max-height: calc(100dvh - var(--qp-top, 0px) - 12px); } }
.quick-pop .qp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.quick-pop .qp-all { width: 100%; margin-bottom: 8px; }
.quick-pop .btn.small { min-height: 40px; padding: 8px 12px; }
.quick-pop .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.quick-pop .pair { flex-wrap: wrap; align-items: center; }
.quick-pop p { margin: 4px 0 8px; }
.quick-pop .qp-ok { color: var(--ok); font-weight: 600; }
/* wide screens: the bars make room for the open Moderator panel, as the videos and the banner do */
@media (min-width: 900px) { body.mod-open #screen-room .quick-bar, body.mod-open #screen-room .turn-bar, body.mod-open #screen-room .socialfield-promo { margin-right: 440px; } }

/* a game event (cards dealt, game over, a win, an elimination): a message over the cameras, which stay visible */
.game-notice { position: fixed; z-index: 70; left: 50%; top: 42%; transform: translate(-50%, -50%); width: max-content; max-width: min(92vw, 680px); padding: 14px 26px; border: 2px solid rgba(255,255,255,.75); border-radius: 18px; background: rgba(12,10,18,.8); color: #fff; text-align: center; box-shadow: 0 0 35px rgba(255,214,10,.45); pointer-events: none; animation: notice-in .35s ease-out; }
.game-notice.mafia { border-color: var(--danger); box-shadow: 0 0 35px rgba(255,60,60,.55); }
.gn-icon { font-size: clamp(40px, 11vw, 84px); line-height: 1.1; }
.gn-title { font-size: clamp(30px, 8.5vw, 64px); font-weight: 800; line-height: 1.1; text-shadow: 0 0 18px rgba(255,214,10,.7); }
.gn-text { font-size: clamp(14px, 3.6vw, 20px); color: #e6e1f2; margin-top: 6px; }
.gn-text:empty { display: none; }
@keyframes notice-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@media (max-height: 500px) { .game-notice { top: 50%; padding: 6px 18px; } .gn-icon { font-size: 34px; } .gn-title { font-size: 28px; } .gn-text { font-size: 13px; margin-top: 2px; } }
@media (prefers-reduced-motion: reduce) { .game-notice, .tile .speak-timer.urgent { animation: none; } }

/* stars and sparks on the camera of someone who just received a like */
.like-burst { position: absolute; z-index: 4; inset: 0; overflow: hidden; pointer-events: none; }
.like-burst span { position: absolute; left: 50%; top: 55%; color: #ffe66d; font-size: 24px; text-shadow: 0 0 8px #ff9d00, 0 0 16px #ff4f81; animation: like-sparkle 1s ease-out forwards; }
.like-burst .spark { color: #fff; font-size: 18px; }
@keyframes like-sparkle { 0% { opacity: 0; transform: rotate(var(--angle)) translateY(8px) scale(.2); } 20% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--angle)) translateY(-95px) scale(1.1); } }

/* the moderator panel: a fixed top, its own scrolling middle, and a bottom that is always on the screen (the Reset button) */
.modpanel { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mp-head { flex: none; padding: 14px 16px 6px; }
.mp-head .row-head { margin-bottom: 0; }
.mp-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 16px 16px; }
.mp-foot { flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--panel); }
.mp-foot { display: flex; flex-direction: column; gap: 8px; }
.mp-foot .btn { width: 100%; }
/* a phone held sideways: Reset and Log out side by side, so the scrolling part of the panel keeps its height */
@media (max-height: 500px) { .mp-foot { flex-direction: row; } .mp-foot .btn { flex: 1 1 0; width: auto; padding: 8px 6px; font-size: 13px; line-height: 1.2; } }
@supports (height: 100dvh) { .modpanel { bottom: auto; height: calc(100dvh - var(--mp-top, 0px)); } }

/* the top bar has one more button (Log out): a little tighter on phones */
@media (max-width: 420px) { #btn-logout, #btn-leave { padding: 10px 8px; } }

/* The Like button (bottom right) and the name with the character under it (bottom left) never share a place: on a big camera the
   name gets the room that is left. (A moderator who takes part sees the character of every player under the name.) */
.tile.has-like:not(.narrow):not(.compact):not(.spotlight) .label { max-width: calc(100% - 112px); }
/* A moderator who takes part sees the character under every name. On cameras too small for the heart AND that line, the heart goes and
   the moderator likes from the full-screen view (tap the camera). Everyone else keeps the heart. */
.tile.tiny.has-role:not(.spotlight) .like-btn { display: none; }
/* the smallest cameras (12 people on a 320 pixel wide phone): a smaller heart that stays above the name, as the name line is short */
.tile.tiny:not(.spotlight) .like-btn { top: 2px; right: 2px; width: 24px; height: 24px; font-size: 12px; line-height: 24px; }
.tile.tiny.has-like:not(.spotlight) .badges::before { width: 26px; height: 26px; }
