:root {
  --pine: #0f3d2e;
  --pine-dark: #0a2a20;
  --pine-light: #1f5c45;
  --cream: #fff8ec;
  --cream-dark: #f3e6cf;
  --berry: #c8102e;
  --berry-dark: #9c0c24;
  --gold: #e8b04b;
  --ink: #2a1d14;
  --muted: #7a6a5a;
  --ok: #1f7a4d;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 176, 75, 0.18), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(200, 16, 46, 0.22), transparent 60%),
    var(--pine);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.15; }

button, input, textarea, select { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 0.75em 1.3em;
  font-weight: 700;
  background: var(--berry);
  color: #fff;
  box-shadow: 0 3px 0 var(--berry-dark);
  transition: transform 0.08s ease, background 0.15s ease;
}
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--berry-dark); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
button.secondary { background: var(--cream-dark); color: var(--ink); box-shadow: 0 3px 0 #d6c3a3; }
button.ghost { background: transparent; color: inherit; box-shadow: none; border: 2px solid currentColor; }
button.gold { background: var(--gold); color: var(--ink); box-shadow: 0 3px 0 #b98727; }
button.ok { background: var(--ok); box-shadow: 0 3px 0 #145236; }
button.small { padding: 0.45em 0.9em; font-size: 0.9rem; }
button.danger { background: #fff; color: var(--berry); box-shadow: 0 3px 0 #e3c9c9; }

input[type='text'], input[type='number'], input[type='password'], input:not([type]), textarea {
  width: 100%;
  padding: 0.8em 1em;
  border-radius: 14px;
  border: 2px solid var(--cream-dark);
  background: #fff;
  color: var(--ink);
  font-size: 1.05rem;
}
input:focus, textarea:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; min-height: 4.5em; }

label { display: block; font-weight: 700; margin: 0.9em 0 0.35em; }
label small { font-weight: 400; color: var(--muted); }

.card {
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- shared bits */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.6rem;
  max-width: 760px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.25rem; letter-spacing: 0.01em; }
.brand .logo { font-size: 1.6rem; }
.whoami { font-weight: 600; opacity: 0.9; text-align: right; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 1rem 7rem; }

.banner {
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 0.4rem 0 1.2rem;
  background: rgba(255, 248, 236, 0.1);
  border: 1px solid rgba(255, 248, 236, 0.18);
  line-height: 1.4;
}
.banner strong { display: block; font-size: 1.15rem; margin-bottom: 0.2rem; }
.banner.open { background: rgba(31, 122, 77, 0.35); border-color: rgba(127, 200, 169, 0.6); }
.banner.closed { background: rgba(200, 16, 46, 0.25); border-color: rgba(255, 140, 140, 0.45); }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.tag { font-size: 0.78rem; font-weight: 700; padding: 0.25em 0.65em; border-radius: 999px; background: #efe3cc; color: #5d4a35; }
.tag-vegetarian, .tag-vegan { background: #dcefdc; color: #1f5c2e; }
.tag-spicy { background: #ffe0d6; color: #a8321b; }
.tag-nuts, .tag-seafood { background: #fff0c2; color: #7a5600; }

.photo { position: relative; background: var(--cream-dark); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.empty { display: grid; place-items: center; font-size: 3.5rem; background: linear-gradient(135deg, #f6e7cd, #ead3ad); }

.num-badge {
  display: inline-grid;
  place-items: center;
  min-width: 2.6em;
  height: 2.6em;
  padding: 0 0.5em;
  border-radius: 999px;
  background: var(--berry);
  color: #fff;
  font-weight: 900;
  font-size: 1rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(6.5rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--cream);
  padding: 0.75em 1.2em;
  border-radius: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: min(92vw, 460px);
  text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--berry); color: #fff; }

.conn {
  position: fixed;
  top: 0.7rem;
  right: 0.7rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7fc8a9;
  box-shadow: 0 0 0 3px rgba(127, 200, 169, 0.25);
  z-index: 40;
}
.conn.bad { background: var(--gold); box-shadow: 0 0 0 3px rgba(232, 176, 75, 0.35); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.snow span { position: absolute; top: -5%; color: #fff; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh) translateX(30px) rotate(180deg); } }

.empty-state { text-align: center; padding: 2.5rem 1rem; opacity: 0.85; }
.empty-state .big { font-size: 3rem; }

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(94vw, 560px);
  width: 100%;
  background: var(--cream);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(5, 20, 14, 0.7); }

dialog.lightbox { background: transparent; box-shadow: none; max-width: 96vw; width: auto; }
dialog.lightbox img { max-width: 96vw; max-height: 86vh; border-radius: var(--radius); display: block; }
dialog.lightbox p { color: #fff; text-align: center; font-weight: 700; margin: 0.6rem 0 0; }

/* ---------------------------------------------------------------- voter page */

.join-card { padding: 1.6rem 1.4rem 1.5rem; margin-top: 1.5rem; text-align: center; }
.join-card .bowl { font-size: 4rem; line-height: 1; }
.join-card h1 { font-size: 1.7rem; margin: 0.5rem 0 0.4rem; }
.join-card p { color: var(--muted); margin: 0 0 1.2rem; line-height: 1.45; }
.join-card form { display: grid; gap: 0.8rem; text-align: left; }
.join-card input { font-size: 1.2rem; text-align: center; }
.join-card button { font-size: 1.15rem; padding: 0.9em; }
.form-error { color: var(--berry); font-weight: 600; min-height: 1.2em; margin: 0; text-align: center; }

.soup-list { display: grid; gap: 1.1rem; }

.soup-card { overflow: hidden; position: relative; transition: transform 0.2s, box-shadow 0.2s; }
.soup-card .photo { aspect-ratio: 16 / 10; cursor: zoom-in; }
.soup-card .photo.empty { cursor: default; }
.soup-card .num-badge { position: absolute; top: 0.8rem; left: 0.8rem; font-size: 1.15rem; }
.soup-card .body { padding: 0.95rem 1.1rem 1.1rem; }
.soup-card h3 { font-size: 1.3rem; }
.soup-card .desc { margin: 0.35rem 0 0; color: #5d4a35; line-height: 1.4; }
.soup-card .actions { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.9rem; flex-wrap: wrap; }
.soup-card .vote-btn { flex: 1 1 auto; font-size: 1.05rem; }
.soup-card.mine { box-shadow: 0 0 0 4px var(--gold), var(--shadow); }
.soup-card .mine-flag {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: var(--gold);
  color: var(--ink);
  font-weight: 800;
  border-radius: 999px;
  padding: 0.35em 0.8em;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.stars { display: flex; align-items: center; gap: 0.15rem; }
.stars .label { font-size: 0.8rem; color: var(--muted); margin-right: 0.3rem; }
.stars button {
  background: none;
  box-shadow: none;
  padding: 0.1em 0.12em;
  font-size: 1.45rem;
  line-height: 1;
  color: #d8c6a6;
}
.stars button.on { color: var(--gold); }
.stars button:active { transform: scale(0.9); }

.votebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: rgba(10, 42, 32, 0.96);
  border-top: 1px solid rgba(255, 248, 236, 0.15);
  backdrop-filter: blur(8px);
  z-index: 30;
}
.votebar .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 0.8rem; }
.votebar .what { flex: 1; min-width: 0; line-height: 1.25; }
.votebar .what small { display: block; opacity: 0.7; font-size: 0.8rem; }
.votebar .what b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.votebar .count { font-size: 0.85rem; opacity: 0.75; text-align: right; white-space: nowrap; }

/* results (phone) */
.results h2 { font-size: 1.6rem; margin: 0.4rem 0 0.3rem; }
.results .sub { opacity: 0.8; margin: 0 0 1rem; }
.result-list { display: grid; gap: 0.8rem; }
.result-row { display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem; }
.result-row .photo { width: 76px; height: 76px; border-radius: 12px; flex: none; }
.result-row .photo.empty { font-size: 2rem; }
.result-row .place { font-size: 1.9rem; width: 2.4rem; text-align: center; flex: none; font-weight: 900; }
.result-row .info { flex: 1; min-width: 0; }
.result-row .info h3 { font-size: 1.1rem; }
.result-row .chef { color: var(--muted); font-size: 0.92rem; margin-top: 0.15rem; }
.result-row .votes { font-weight: 800; white-space: nowrap; }
.result-row.hidden-row { background: rgba(255, 248, 236, 0.08); color: var(--cream); box-shadow: none; border: 2px dashed rgba(255, 248, 236, 0.25); justify-content: center; min-height: 92px; font-size: 1.3rem; font-weight: 800; }
.result-row.first { box-shadow: 0 0 0 4px var(--gold), var(--shadow); }
.result-row .you { display: inline-block; background: var(--gold); color: var(--ink); border-radius: 999px; padding: 0.1em 0.55em; font-size: 0.75rem; font-weight: 800; margin-left: 0.3rem; vertical-align: middle; }
.pop { animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.winner-banner { text-align: center; padding: 1.3rem 1rem 1.4rem; margin-bottom: 1.1rem; }
.winner-banner .trophy { font-size: 3.4rem; line-height: 1; }
.winner-banner h2 { margin: 0.4rem 0 0.2rem; }
.winner-banner p { margin: 0; color: var(--muted); }

/* ---------------------------------------------------------------- admin page */

.admin .wrap { padding-bottom: 4rem; }
.panel { padding: 1.1rem 1.2rem 1.25rem; margin-bottom: 1.1rem; }
.panel h2 { font-size: 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.panel h2 .aside { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.panel p.hint { color: var(--muted); margin: 0.3rem 0 0.8rem; font-size: 0.92rem; line-height: 1.4; }

.phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; background: var(--cream-dark); padding: 0.35rem; border-radius: 16px; }
.phases button { background: transparent; color: var(--ink); box-shadow: none; border-radius: 12px; padding: 0.65em 0.3em; font-size: 0.92rem; }
.phases button.active { background: var(--pine); color: var(--cream); }
.phase-next { margin-top: 0.9rem; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.phase-next button { flex: 1 1 auto; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-top: 0.9rem; }
.stat { background: #fff; border-radius: 14px; padding: 0.65rem; text-align: center; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { font-size: 0.8rem; color: var(--muted); }

.admin-soups { display: grid; gap: 0.7rem; }
.admin-soup { display: flex; gap: 0.8rem; align-items: center; background: #fff; border-radius: 14px; padding: 0.6rem; }
.admin-soup .photo { width: 72px; height: 72px; border-radius: 10px; flex: none; }
.admin-soup .photo.empty { font-size: 1.8rem; }
.admin-soup .info { flex: 1; min-width: 0; }
.admin-soup .info h3 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-soup .chef { color: var(--muted); font-size: 0.88rem; }
.admin-soup .tally { font-weight: 900; font-size: 1.25rem; min-width: 2.2rem; text-align: center; }
.admin-soup .btns { display: flex; flex-direction: column; gap: 0.35rem; }

.bar { height: 8px; background: var(--cream-dark); border-radius: 99px; overflow: hidden; margin-top: 0.35rem; }
.bar i { display: block; height: 100%; background: var(--berry); border-radius: 99px; transition: width 0.4s; }

.soup-form { padding: 1.2rem 1.3rem 1.3rem; }
.soup-form h2 { margin-bottom: 0.3rem; }
.soup-form .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.8rem; }
.photo-pick { display: grid; gap: 0.6rem; }
.photo-pick .preview { aspect-ratio: 16 / 10; border-radius: 14px; }
.photo-pick .preview.empty { font-size: 2.4rem; }
.photo-pick .picks { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.photo-pick .picks label { margin: 0; }
.file-btn { display: inline-block; cursor: pointer; border-radius: 999px; padding: 0.55em 1em; font-weight: 700; background: var(--cream-dark); color: var(--ink); box-shadow: 0 3px 0 #d6c3a3; }
.file-btn input { display: none; }
.tag-picks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-picks label { margin: 0; font-weight: 600; font-size: 0.9rem; padding: 0.4em 0.8em; border-radius: 999px; background: #fff; border: 2px solid var(--cream-dark); cursor: pointer; user-select: none; }
.tag-picks label:has(input:checked) { background: var(--pine); color: var(--cream); border-color: var(--pine); }
.tag-picks input { display: none; }
.form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.secret-note { font-size: 0.82rem; color: var(--muted); margin-top: 0.3rem; }

.voter-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.voter-chip { display: inline-flex; align-items: center; gap: 0.35rem; background: #fff; border-radius: 999px; padding: 0.3em 0.4em 0.3em 0.8em; font-weight: 600; }
.voter-chip.voted { background: #dcefdc; }
.voter-chip button { padding: 0.1em 0.55em; font-size: 0.85rem; background: transparent; color: var(--muted); box-shadow: none; }

.reveal-box { display: grid; gap: 0.6rem; }
.reveal-box .next-up { font-weight: 700; }
.reveal-box .btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.reveal-box .btn-row button { flex: 1 1 auto; }

.share { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.share img { width: 132px; height: 132px; background: #fff; border-radius: 12px; padding: 6px; }
.share .links { display: grid; gap: 0.45rem; flex: 1; min-width: 12rem; }
.share a { color: var(--berry); font-weight: 700; word-break: break-all; }

.toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.9rem; margin: 0; cursor: pointer; }

.danger-zone { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.login-card { padding: 1.6rem 1.4rem; margin-top: 2rem; text-align: center; }
.login-card input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; }
.login-card form { display: grid; gap: 0.9rem; margin-top: 1rem; }

/* ---------------------------------------------------------------- screen (TV) */

.screen { overflow: hidden; height: 100vh; }
.screen main { position: relative; z-index: 1; height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 2.2vh 2.4vw; gap: 2vh; }
.screen header { display: flex; align-items: center; justify-content: space-between; }
.screen header h1 { font-size: clamp(1.8rem, 4.2vh, 3.6rem); font-weight: 900; }
.screen header .phase-pill { font-size: clamp(1rem, 2.4vh, 1.7rem); font-weight: 800; padding: 0.4em 1em; border-radius: 999px; background: rgba(255, 248, 236, 0.12); }
.screen header .phase-pill.open { background: var(--ok); }
.screen header .phase-pill.closed { background: var(--berry); }

.screen .stage { display: grid; grid-template-columns: minmax(0, 32vw) 1fr; gap: 2.4vw; min-height: 0; }
.screen .qr-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2.5vh 1.5vw; }
.screen .qr-panel img { width: min(26vw, 48vh); aspect-ratio: 1; }
.screen .qr-panel h2 { font-size: clamp(1.4rem, 3.6vh, 3rem); margin-top: 1.4vh; }
.screen .qr-panel .url { font-size: clamp(0.9rem, 2.1vh, 1.5rem); font-weight: 700; color: var(--berry); margin-top: 0.6vh; word-break: break-all; }

.screen .soup-grid { display: grid; gap: 1.4vw; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); min-height: 0; align-content: center; }
.screen .tile { overflow: hidden; display: flex; flex-direction: column; min-height: 0; position: relative; }
.screen .tile .photo { flex: 1; min-height: 0; }
.screen .tile .photo.empty { font-size: 7vh; }
.screen .tile .num-badge { position: absolute; top: 1vh; left: 1vh; font-size: clamp(1rem, 2.6vh, 2rem); }
.screen .tile .cap { padding: 1vh 1vw 1.2vh; font-weight: 800; font-size: clamp(0.9rem, 2.3vh, 1.8rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.screen footer { display: flex; align-items: center; gap: 1.5vw; min-height: 0; }
.screen footer .counts { font-size: clamp(1.1rem, 3vh, 2.4rem); font-weight: 900; white-space: nowrap; }
.screen footer .chips { display: flex; flex-wrap: wrap; gap: 0.6vh 0.5vw; max-height: 12vh; overflow: hidden; }
.screen footer .chip { padding: 0.35em 0.9em; border-radius: 999px; background: rgba(255, 248, 236, 0.12); font-weight: 700; font-size: clamp(0.8rem, 1.9vh, 1.4rem); }
.screen footer .chip.voted { background: var(--cream); color: var(--pine); }

.screen .overlay-msg { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: rgba(10, 42, 32, 0.78); text-align: center; }
.screen .overlay-msg .big { font-size: clamp(3rem, 12vh, 9rem); }
.screen .overlay-msg h2 { font-size: clamp(2rem, 7vh, 5.5rem); }
.screen .overlay-msg p { font-size: clamp(1.2rem, 3vh, 2.4rem); opacity: 0.85; }

.screen .results-stage { display: grid; grid-template-rows: 1fr auto auto; gap: 2.2vh; min-height: 0; }
.screen .podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 2vw; min-height: 0; padding: 0 4vw; }
.screen .podium .spot { display: flex; flex-direction: column; min-height: 0; height: 100%; justify-content: flex-end; }
.screen .podium .spot .entry { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.screen .podium .spot.p1 .entry { height: 100%; }
.screen .podium .spot.p2 .entry { height: 84%; }
.screen .podium .spot.p3 .entry { height: 72%; }
.screen .podium .entry .photo { flex: 1; min-height: 0; }
.screen .podium .entry .photo.empty { font-size: 8vh; }
.screen .podium .entry .meta { padding: 1.2vh 1vw 1.4vh; text-align: center; }
.screen .podium .entry .place { font-size: clamp(1.6rem, 5vh, 4rem); line-height: 1; }
.screen .podium .entry h3 { font-size: clamp(1rem, 3vh, 2.4rem); margin-top: 0.6vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen .podium .entry .chef { font-size: clamp(0.9rem, 2.4vh, 1.9rem); color: var(--berry); font-weight: 800; margin-top: 0.4vh; }
.screen .podium .entry .votes { font-size: clamp(0.8rem, 2vh, 1.5rem); color: var(--muted); font-weight: 700; margin-top: 0.3vh; }
.screen .podium .p1 .entry { box-shadow: 0 0 0 6px var(--gold), var(--shadow); }
.screen .mystery { display: grid; place-items: center; height: 100%; background: rgba(255, 248, 236, 0.08); border: 3px dashed rgba(255, 248, 236, 0.3); border-radius: var(--radius); font-size: clamp(3rem, 12vh, 9rem); color: var(--cream); }
.screen .rest { display: flex; gap: 1vw; justify-content: center; flex-wrap: wrap; }
.screen .rest .mini { display: flex; align-items: center; gap: 0.8vw; padding: 0.8vh 1.2vw 0.8vh 0.8vh; border-radius: 999px; font-weight: 800; font-size: clamp(0.8rem, 2vh, 1.4rem); }
.screen .rest .mini .photo { width: 5vh; height: 5vh; border-radius: 50%; }
.screen .rest .mini .photo.empty { font-size: 2.6vh; }
.screen .rest .mini small { color: var(--muted); font-weight: 700; }
.screen .rest .mini.unknown { background: rgba(255, 248, 236, 0.1); color: var(--cream); border: 2px dashed rgba(255, 248, 236, 0.3); padding: 0.8vh 1.6vw; }
.screen .controls { position: fixed; bottom: 1rem; right: 1rem; z-index: 20; display: flex; gap: 0.5rem; opacity: 0.3; transition: opacity 0.2s; }
.screen .controls:hover { opacity: 1; }

/* ---------------------------------------------------------------- print */

.print-page { background: #fff; color: var(--ink); }
.print-page .sheet { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem; text-align: center; }
.print-page .sheet h1 { font-size: 2.6rem; color: var(--pine); }
.print-page .sheet .lead { font-size: 1.5rem; margin: 0.6rem 0 1.4rem; }
.print-page .sheet img.qr { width: min(80vw, 440px); }
.print-page .sheet .url { font-size: 1.3rem; font-weight: 800; color: var(--berry); margin-top: 0.8rem; word-break: break-all; }
.print-page .sheet .steps { font-size: 1.15rem; margin-top: 1.4rem; line-height: 1.7; }
.print-page .no-print { margin: 1rem auto; display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.print-page .cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; break-before: page; }
.print-page .table-card { border: 2px dashed #bbb; padding: 2.2rem 1rem; text-align: center; break-inside: avoid; }
.print-page .table-card .n { font-size: 6rem; font-weight: 900; color: var(--berry); line-height: 1; }
.print-page .table-card .t { font-size: 1.5rem; font-weight: 800; margin-top: 0.6rem; }
@media print {
  .no-print { display: none !important; }
  .print-page .sheet { padding-top: 0; }
}

@media (max-width: 420px) {
  .phases button { font-size: 0.8rem; }
  .soup-form .row { grid-template-columns: 5.2rem 1fr; }
}

.result-row .place.txt { font-size: 1.05rem; }
.big-emoji { font-size: 3rem; line-height: 1; }
.login-card h1 { margin-top: 0.4rem; }
.input-row { display: flex; gap: 0.5rem; }
.input-row input { flex: 1; }
.admin-soup .tags { margin-top: 0.3rem; }
.admin-soup .tag { font-size: 0.7rem; }

/* The soup form is taller than a phone screen: keep Save in reach. */
#soup-dialog { max-height: calc(100dvh - 24px); overscroll-behavior: contain; scroll-padding-bottom: 6rem; }
.soup-form .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--cream);
  margin: 1rem -1.3rem -1.3rem;
  padding: 0.8rem 1.3rem calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--cream-dark);
}

/* Grid items default to min-width:auto, so one long nowrap title would widen the column past the screen. */
.soup-list, .result-list, .admin-soups { grid-template-columns: minmax(0, 1fr); }

/* ---------------------------------------------------------------- extras: countdown, guessing, reactions, invite */

.top-right { display: flex; align-items: center; gap: 0.6rem; }
.top-right .ghost { padding: 0.35em 0.8em; font-size: 0.85rem; white-space: nowrap; }

.votebar .count { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }
.votebar .timer { font-weight: 800; font-size: 0.95rem; opacity: 1; color: var(--gold); }
.votebar .timer.urgent, .countdown.urgent { color: #ff8a8a; animation: blink 1s infinite; }
.votebar .reactions { max-width: 760px; margin: 0.6rem auto 0; display: flex; justify-content: space-between; gap: 0.2rem; }
.votebar .reactions button { background: rgba(255, 248, 236, 0.1); box-shadow: none; padding: 0.35em 0; flex: 1; font-size: 1.35rem; border-radius: 12px; }
.votebar .reactions button.sent { animation: sent 0.45s ease; }
@keyframes sent { 40% { transform: scale(1.35) translateY(-6px); } }
body.with-reactions .wrap { padding-bottom: 11rem; }

.guess-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.8rem 0 0; font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.guess-row span { white-space: nowrap; }
.guess-row select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 600;
  padding: 0.5em 0.7em;
  border-radius: 12px;
  border: 2px solid var(--cream-dark);
  background: #fff;
  color: var(--ink);
}
.guess-row b { color: var(--pine-light); }
.guess-result { font-size: 0.85rem; font-weight: 700; margin-top: 0.2rem; }
.guess-result.right { color: var(--ok); }
.guess-result.wrong { color: var(--muted); }

.detective-card { padding: 1rem 1.2rem; margin-top: 1rem; }
.detective-card h3 { font-size: 1.2rem; }
.detective-card .mine { font-weight: 700; margin: 0.4rem 0 0.2rem; }
.detective-card ol { margin: 0.5rem 0 0; padding-left: 1.4rem; }
.detective-card li { padding: 0.2rem 0; }
.detective-card li span { display: inline-block; min-width: 8rem; }

.result-row.drumroll { font-size: 2.2rem; border-color: var(--gold); animation: shake 0.12s infinite alternate; }
@keyframes shake { from { transform: translateX(-3px) rotate(-1deg); } to { transform: translateX(3px) rotate(1deg); } }

dialog.invite .invite-body { padding: 1.4rem; text-align: center; }
dialog.invite h2 { font-size: 1.4rem; }
dialog.invite p { color: var(--muted); margin: 0.3rem 0 0.8rem; }
dialog.invite img { width: min(70vw, 300px); aspect-ratio: 1; }
dialog.invite .url { font-weight: 800; color: var(--berry); margin: 0.6rem 0 1rem; word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  .result-row.drumroll, .screen .drumroll, .pop { animation: none; }
}

.screen header .phase-pill.urgent { background: var(--berry); animation: blink 1s infinite; }
.screen .drumroll { animation: shake 0.1s infinite alternate; border-color: var(--gold); }
.screen .mystery.drumroll { font-size: clamp(3rem, 14vh, 10rem); }

.final-count {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  pointer-events: none;
  font-size: 40vh;
  font-weight: 900;
  color: var(--cream);
  text-shadow: 0 1vh 4vh rgba(0, 0, 0, 0.5);
  background: rgba(10, 42, 32, 0.45);
}
.final-count.beat { animation: beat 1s ease-out; }
@keyframes beat { from { transform: scale(1.35); opacity: 1; } to { transform: scale(0.9); opacity: 0.75; } }

.reaction-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.reaction-layer span { position: absolute; bottom: -10vh; animation: float-up linear forwards; filter: drop-shadow(0 0.5vh 1vh rgba(0, 0, 0, 0.35)); }
@keyframes float-up {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  10% { opacity: 1; transform: translate(0, -10vh) scale(1); }
  100% { transform: translate(var(--drift, 0), -105vh) scale(1.1); opacity: 0; }
}

.screen .detectives { display: flex; justify-content: center; align-items: center; gap: 1.6vw; flex-wrap: wrap; font-weight: 800; font-size: clamp(0.9rem, 2.4vh, 1.8rem); }
.screen .detectives .lead { opacity: 0.85; }
.screen .detectives .det { background: var(--cream); color: var(--ink); border-radius: 999px; padding: 0.4em 1em; }
.screen .detectives small { color: var(--muted); }

.timer-box { flex: 1 1 100%; background: #fff; border-radius: 14px; padding: 0.7rem 0.8rem; display: grid; gap: 0.5rem; }
.timer-box .timer-label { display: flex; justify-content: space-between; font-weight: 700; }
.timer-box .btn-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.timer-box .btn-row button { flex: 1 1 auto; }
.voter-chip .guessed { font-size: 0.75rem; color: var(--muted); }
.admin-detectives { font-size: 0.92rem; background: #fff; border-radius: 12px; padding: 0.6rem 0.8rem; }
.toggle.setting { font-size: 1rem; margin-bottom: 0.2rem; }
