:root {
  --bg: #0e2a21;
  --ink: #fff7ee;
  --ink-dark: #12301f;
  --muted: rgba(255, 247, 238, 0.68);
  --faint: rgba(255, 247, 238, 0.12);
  --card: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 247, 238, 0.16);
  --gold: #e9c47e;
  --gold-deep: #d0a052;
  --a0: #d84f6f;
  --a1: #3d72c8;
  --a2: #c08410;
  --a3: #2a8f5f;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background:
    radial-gradient(1100px 760px at 12% -12%, rgba(52, 128, 92, 0.55), transparent 60%),
    radial-gradient(900px 640px at 110% 115%, rgba(28, 98, 84, 0.45), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
code, kbd { font-family: ui-monospace, Menlo, monospace; }
kbd { border: 1px solid var(--line); border-radius: 0.3em; padding: 0.05em 0.4em; font-size: 0.9em; }
.muted { color: var(--muted); }

.a0 { --c: var(--a0); }
.a1 { --c: var(--a1); }
.a2 { --c: var(--a2); }
.a3 { --c: var(--a3); }

.eyebrow {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
}

.btn {
  font: 600 1.05rem/1 var(--sans);
  padding: 0.95em 1.9em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s, background 0.2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
a.btn { display: inline-block; text-decoration: none; color: var(--ink); }
.btn.primary { background: linear-gradient(180deg, #f4d79d, var(--gold-deep)); color: var(--ink-dark); }
.btn.primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { color: var(--ink); border-color: var(--muted); }
.btn.small { font-size: 0.9rem; }
.btn.block { width: 100%; }

#offline {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  background: var(--a0); color: #fff; text-align: center;
  font-weight: 600; padding: 0.5rem;
  transform: translateY(-110%); transition: transform 0.25s;
}
body.offline #offline { transform: none; }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
.petals { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#app { position: relative; z-index: 1; }

.heart-fx {
  position: fixed; z-index: 40; pointer-events: none;
  width: var(--s); height: var(--s); opacity: 0;
  animation: heartFloat var(--t) ease-out forwards;
}
.heart-fx svg { width: 100%; height: 100%; fill: currentColor; display: block; }
@keyframes heartFloat {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--r)); }
}

/* A slow band of light across the couple's and the winner's names */
@keyframes shimmer {
  0% { background-position: 130% 0; }
  45%, 100% { background-position: -30% 0; }
}
.couple, .winner-name {
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.couple {
  background-image: linear-gradient(100deg, var(--ink) 40%, #f6dca6 50%, var(--ink) 60%);
  animation: shimmer 7s ease-in-out infinite;
}
.winner-name { background-image: linear-gradient(100deg, var(--gold) 40%, #fff6dc 50%, var(--gold) 60%); }
.winner-name.r3 { animation: fadeUp 0.8s ease-out 3.4s forwards, shimmer 5s ease-in-out 4.4s infinite; }

/* Two rings drawing themselves, then a twinkling diamond */
.rings-art { width: 7.5rem; height: auto; margin-bottom: 0.4rem; overflow: visible; }
.rings-art circle {
  fill: none; stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 139; stroke-dashoffset: 139;
  animation: drawRing 1.6s ease-out forwards;
}
.rings-art .ring-l { stroke: var(--gold); }
.rings-art .ring-r { stroke: #f4e2b8; animation-delay: 0.5s; }
.rings-art .ring-gem {
  fill: #fff7ee; opacity: 0; transform-origin: 74px 10px;
  animation: gemIn 0.5s ease-out 1.9s forwards, twinkle 2.4s ease-in-out 2.4s infinite;
}
@keyframes drawRing { to { stroke-dashoffset: 0; } }
@keyframes gemIn { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { filter: none; transform: scale(1); } 50% { filter: drop-shadow(0 0 6px #fff); transform: scale(1.25); } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(0.6); } 70% { transform: scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes grow { from { height: 0; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ============ Host (projector) ============ */

html.host { font-size: clamp(13px, 1.12vw, 30px); }
html.host body { height: 100vh; overflow: hidden; }

.host-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hint { color: var(--muted); font-size: 0.9rem; }
.host-center { height: 100vh; display: grid; place-content: center; text-align: center; gap: 1rem; }

/* Lobby */
.host-lobby {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 3rem;
  padding: 3rem 4rem;
}
.lobby-intro { display: flex; flex-direction: column; justify-content: center; gap: 0.6rem; min-height: 0; }
.couple { font: 700 4.4rem/1.05 var(--serif); }
.quiz-title { font: italic 500 2rem/1.2 var(--serif); color: var(--gold); margin-bottom: 1.6rem; }
.join-card { display: flex; align-items: center; gap: 2rem; }
.qr {
  width: min(44vh, 26rem); aspect-ratio: 1;
  background: #fff; padding: 0.9rem; border-radius: 1.2rem;
  box-shadow: 0 0 0 6px rgba(233, 196, 126, 0.35), 0 20px 60px rgba(0, 0, 0, 0.4);
}
.join-text { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.join-label { font: 700 2.2rem/1.1 var(--serif); }
.join-url { font-size: 1.15rem; font-weight: 600; color: var(--gold); word-break: break-all; }
.join-hint { color: var(--muted); }

.lobby-players {
  display: flex; flex-direction: column; gap: 1rem; min-height: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 1.5rem;
  padding: 2rem;
}
.players-head { display: flex; align-items: baseline; gap: 0.8rem; font-size: 1.3rem; }
.big-count { font: 700 3.6rem/1 var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; }
.waiting { color: var(--muted); font-size: 1.15rem; flex: 1; }
.chips {
  list-style: none; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0.6rem;
}
.chip {
  font-size: 1.2rem; font-weight: 600;
  padding: 0.5rem 1.1rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line);
  cursor: pointer; animation: pop 0.45s ease-out both;
  transition: background 0.2s, opacity 0.3s;
}
.chip:hover { background: rgba(216, 79, 111, 0.45); text-decoration: line-through; }
.chip.away { opacity: 0.45; }
.flag { margin-right: 0.45em; }

/* Avatars: a guest's photo, or their initials on a colour */
.avatar {
  --av: 2rem;
  width: var(--av); height: var(--av); flex: none; border-radius: 50%;
  display: inline-grid; place-items: center; object-fit: cover;
  background: var(--avbg, #2a8f5f); color: #fff;
  font: 700 calc(var(--av) * 0.4)/1 var(--sans); letter-spacing: 0.02em;
  border: 2px solid rgba(233, 196, 126, 0.75); vertical-align: middle;
}
.av-xs { --av: 1.7rem; border-width: 1px; }
.av-sm { --av: 2.1rem; }
.av-md { --av: 3rem; }
.av-lg { --av: 6rem; border-width: 3px; }
.av-xl { --av: 7.5rem; border-width: 4px; box-shadow: 0 0 0 0.5rem rgba(233, 196, 126, 0.18), 0 1rem 3rem rgba(0, 0, 0, 0.35); }
.chip { display: inline-flex; align-items: center; gap: 0.55rem; padding-left: 0.4rem; }
.board .name { display: flex; align-items: center; gap: 0.8rem; }
.board .name .nm { overflow: hidden; text-overflow: ellipsis; }
.diversity { margin-left: auto; color: var(--gold); font-size: 1.05rem; font-weight: 600; }
.lobby-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.lobby-actions .btn.primary { font-size: 1.3rem; }

/* Question & reveal */
.host-q {
  height: 100vh;
  display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.8rem 3rem 1.5rem;
}
.q-head { display: flex; justify-content: space-between; align-items: center; }
.pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.5rem 1.2rem; font-weight: 600; font-size: 1.1rem;
}
.answered { font-size: 1.2rem; color: var(--muted); }
.answered b { color: var(--ink); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.q-text {
  background: var(--ink); color: var(--ink-dark);
  font: 700 2.5rem/1.2 var(--serif); text-align: center;
  padding: 1.3rem 2rem; border-radius: 1.1rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  animation: fadeUp 0.5s ease-out both;
}
.q-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 3rem; }
.q-img { max-height: 100%; max-width: 45vw; border-radius: 1rem; object-fit: contain; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); }

.timer { position: relative; height: min(100%, 13rem); aspect-ratio: 1; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 8; }
.timer .track { stroke: var(--faint); }
.timer .ring {
  stroke: var(--gold); stroke-linecap: round;
  stroke-dasharray: 339.29; transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
}
.timer span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 4rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.timer.urgent .ring { stroke: var(--a0); }
.timer.urgent span { color: #ff8fa6; animation: pulse 1s ease-in-out infinite; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.opt {
  display: flex; align-items: center; gap: 1.2rem;
  min-height: 5.6rem; padding: 1.2rem 1.6rem; border-radius: 1rem;
  background: var(--c); color: #fff;
  font-size: 1.75rem; font-weight: 600; line-height: 1.2;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.2);
  transition: opacity 0.4s, transform 0.4s, filter 0.4s;
}
.opt .shape svg { width: 2.4rem; height: 2.4rem; fill: #fff; display: block; }
.opt .tick { margin-left: auto; font-size: 2.4rem; }
.opt.wrong { opacity: 0.25; filter: saturate(0.4); }
.opt.correct { outline: 4px solid #fff; outline-offset: 3px; transform: scale(1.02); }

.bars { height: 100%; max-height: 18rem; display: flex; align-items: stretch; gap: 2.2rem; }
.bar { width: 7rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.bar-n { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%; height: calc(var(--h) * 100%); min-height: 0.5rem;
  background: var(--c); border-radius: 0.6rem 0.6rem 0 0;
  animation: grow 0.9s cubic-bezier(.2, .8, .2, 1) both;
}
.bar-shape { display: flex; align-items: center; gap: 0.4rem; font-size: 1.6rem; }
.bar-shape svg { width: 1.7rem; height: 1.7rem; fill: var(--c); }
.bar:not(.is-correct) { opacity: 0.45; }

/* Scoreboard */
.host-board {
  height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 3rem 3rem 1.5rem; gap: 0.6rem;
}
.host-board .host-foot { width: 100%; margin-top: auto; }
.board-title { font: 700 3.6rem/1.1 var(--serif); margin-bottom: 1.5rem; }
.board { list-style: none; width: min(58rem, 92vw); display: flex; flex-direction: column; gap: 0.75rem; }
.board li {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto auto; align-items: center; gap: 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 1rem;
  padding: 1rem 1.6rem; font-size: 1.7rem;
  animation: fadeUp 0.5s ease-out both; animation-delay: calc(var(--d) * 0.12s);
}
.board li:first-child { background: linear-gradient(180deg, #f4d79d, var(--gold-deep)); color: var(--ink-dark); border: 0; }
.board .rank { font: 700 1.8rem var(--serif); }
.board .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .gain { font-size: 1.1rem; font-weight: 600; color: var(--gold); }
.board li:first-child .gain { color: var(--ink-dark); opacity: 0.7; }
.board .score { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 7rem; text-align: right; display: flex; flex-direction: column; line-height: 1.1; }
.board .score small { font-size: 0.95rem; font-weight: 600; opacity: 0.7; }

/* Rules */
.host-rules {
  height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 3rem 3rem 1.5rem; gap: 0.6rem;
}
.host-rules .host-foot { width: 100%; margin-top: auto; }
.rules { list-style: none; width: min(64rem, 92vw); display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.rules li {
  display: flex; align-items: flex-start; gap: 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 1.2rem;
  padding: 1.6rem 1.8rem;
  animation: fadeUp 0.5s ease-out both; animation-delay: calc(var(--d) * 0.15s);
}
.rule-icon { font-size: 2.6rem; line-height: 1; }
.rule-text { display: flex; flex-direction: column; gap: 0.4rem; font-size: 1.25rem; color: var(--muted); line-height: 1.35; }
.rule-text b { font: 700 1.7rem/1.2 var(--serif); color: var(--gold); }

/* Final */
.host-final {
  height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 2.5rem 3rem 1.5rem; text-align: center;
}
.host-final .eyebrow { font-size: 1.2rem; }
.host-final .host-foot { width: 100%; margin-top: 1.5rem; }
.foot-actions { display: flex; align-items: center; gap: 1rem; }

/* Recap */
.host-recap {
  height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 2.5rem 3rem 1.5rem; gap: 0.4rem;
}
.host-recap .board-title { margin-bottom: 1rem; }
.host-recap .host-foot { width: 100%; margin-top: auto; }
.recap-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; width: min(96rem, 94vw); }
.recap-card {
  display: flex; flex-direction: column; gap: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 1.5rem; padding: 1.8rem 2rem;
  animation: fadeUp 0.6s ease-out both; animation-delay: calc(var(--d) * 0.6s + 0.2s);
}
.recap-card.best { border-color: rgba(127, 200, 165, 0.5); }
.recap-card.worst { border-color: rgba(216, 79, 111, 0.55); }
.recap-tag {
  align-self: flex-start; font-weight: 700; font-size: 1.1rem;
  padding: 0.35rem 0.95rem; border-radius: 999px;
  background: rgba(127, 200, 165, 0.18); color: #a9e3c6;
}
.worst .recap-tag { background: rgba(216, 79, 111, 0.2); color: #ffb3c2; }
.recap-q { font: 600 1.6rem/1.3 var(--serif); }
.recap-num { color: var(--gold); margin-right: 0.6rem; }
.recap-pct { display: flex; align-items: baseline; gap: 0.8rem; }
.recap-pct b { font: 700 4.2rem/1 var(--serif); color: #a9e3c6; }
.worst .recap-pct b { color: #ffb3c2; }
.recap-pct span { color: var(--muted); font-size: 1.2rem; }
.recap-opts { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.recap-opts li {
  display: grid; grid-template-columns: 1.5rem minmax(0, 11rem) 1fr 2.5rem; align-items: center; gap: 0.9rem;
  font-size: 1.15rem; opacity: 0.7;
}
.recap-opts li.is-answer, .recap-opts li.is-decoy { opacity: 1; font-weight: 700; }
.recap-opts .shape svg { width: 1.4rem; height: 1.4rem; fill: var(--c); display: block; }
.ro-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-answer .ro-text::after { content: ' ✓'; color: #7fc8a5; }
.ro-bar { height: 0.9rem; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ro-bar span {
  display: block; height: 100%; width: calc(var(--w) * 100%); border-radius: inherit;
  background: rgba(255, 255, 255, 0.3); transform-origin: left;
  animation: growX 0.9s ease-out both; animation-delay: calc(var(--d) * 0.6s + 0.7s);
}
.is-answer .ro-bar span { background: #7fc8a5; }
.is-decoy .ro-bar span { background: var(--a0); }
.ro-n { text-align: right; font-variant-numeric: tabular-nums; }
.recap-note { color: var(--muted); font-size: 1.1rem; margin-top: auto; }
.recap-note b { color: var(--ink); }
@keyframes growX { from { transform: scaleX(0); } }
.winner-name { font: 700 5.4rem/1.1 var(--serif); color: var(--gold); margin-top: 0.4rem; }
.winner-meta { color: var(--muted); font-size: 1.3rem; }
.ladder { margin-top: auto; display: flex; align-items: flex-end; }
.step {
  width: 11rem; display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  opacity: 0; animation: fadeUp 0.7s ease-out forwards; animation-delay: var(--delay);
}
.step.rank-1 { width: 14rem; }
.step-name { font-size: 1.3rem; font-weight: 700; max-width: 95%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-1 .step-name { font-size: 1.7rem; color: var(--gold); }
.step-score { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.5rem; white-space: nowrap; }
.step-block {
  width: 100%; height: var(--h); display: grid; place-items: center;
  border-radius: 0.8rem 0.8rem 0 0; font: 700 2.6rem var(--serif);
  background: rgba(255, 255, 255, 0.1); box-shadow: inset -1px 0 rgba(0, 0, 0, 0.18);
}
.rank-1 .step-block { background: linear-gradient(180deg, #f4d79d, var(--gold-deep)); color: var(--ink-dark); font-size: 3.4rem; }
.rank-2 .step-block { background: rgba(255, 255, 255, 0.24); }
.rank-3 .step-block { background: rgba(205, 140, 95, 0.45); }
.champion-crown { font-size: 2.8rem; line-height: 1; margin-bottom: -0.8rem; position: relative; z-index: 2; transform: rotate(-12deg); }
.rank-1 .avatar { position: relative; z-index: 1; }
.r0, .r1, .r2, .r3 { opacity: 0; animation: fadeUp 0.8s ease-out forwards; }
.r0 { animation-delay: 0.2s; }
.r1 { animation-delay: 1.1s; }
.r2 { animation-delay: 2.1s; }
.r3 { animation-delay: 3.4s; }

/* ============ Player (phone) ============ */

html.play body { min-height: 100dvh; transition: background-color 0.4s; }
body[data-mood="correct"] { background-color: #1d6b45; }
body[data-mood="wrong"] { background-color: #5a1f2c; }
body[data-mood="win"] { background-color: #4a3512; }

html.play #app {
  max-width: 34rem; margin: 0 auto; min-height: 100dvh;
  padding: max(0.75rem, env(safe-area-inset-top)) 16px max(1rem, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}

.p-join { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1.5rem; }
.p-brand { text-align: center; display: flex; flex-direction: column; gap: 0.5rem; }
.p-brand h1 { font: 700 2.3rem/1.15 var(--serif); }
.p-join form { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.7rem; }
.p-join label { font-weight: 600; }
.p-join input + label, .picker + label { margin-top: 0.5rem; }
.picker { position: relative; }
.picker-flag { position: absolute; left: 1rem; top: 0.95rem; font-size: 1.2rem; line-height: 1; pointer-events: none; }
.picker.picked input { padding-left: 2.9rem; border-color: var(--gold); }
.picker-opts {
  list-style: none; margin-top: 0.4rem; overflow: hidden;
  border-radius: 0.8rem; border: 1px solid var(--line); background: rgba(8, 30, 22, 0.92);
}
.picker-opts li {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1rem; font-size: 1.1rem; cursor: pointer;
}
.picker-opts li + li { border-top: 1px solid var(--line); }
.picker-opts li:active, .picker-opts li:hover { background: rgba(233, 196, 126, 0.18); }
.picker-opts small { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.picker-opts .none { color: var(--muted); cursor: default; }
.p-join input {
  width: 100%; font: 500 1.25rem var(--sans); color: var(--ink);
  padding: 0.85rem 1rem; border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line);
}
.p-join input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.error { color: #ff9fb2; min-height: 1.2em; font-size: 0.95rem; }
.fine { color: var(--muted); font-size: 0.85rem; text-align: center; }

.p-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-bottom: 0.8rem; margin-bottom: 0.4rem; border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.p-name { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.p-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.photo-pick { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.4rem; }
.photo-btn { position: relative; cursor: pointer; flex: none; }
.photo-badge {
  position: absolute; right: -0.2rem; bottom: -0.2rem; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem; background: var(--gold); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.photo-text { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.photo-text label { font-size: 1.05rem; cursor: pointer; }
.link { align-self: flex-start; background: none; border: 0; padding: 0; color: #ff9fb2; font: inherit; text-decoration: underline; cursor: pointer; }
/* The native "Choose file" control stays hidden; the avatar and its label open it. */
.p-join input[type="file"] { display: none; }
.p-score { color: var(--gold); font-variant-numeric: tabular-nums; flex: none; }

.p-screen { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.p-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 0.7rem; animation: fadeUp 0.45s ease-out both;
}
.p-hero h1 { font: 700 2.4rem/1.15 var(--serif); }
.p-bigname { font: italic 500 1.7rem var(--serif); color: var(--gold); }
.p-origin { font-size: 1.1rem; font-weight: 600; }

.p-rings { position: relative; width: 6rem; height: 4rem; margin-bottom: 0.5rem; }
.p-rings span {
  position: absolute; top: 0; width: 4rem; height: 4rem; border-radius: 50%;
  border: 0.45rem solid var(--gold);
}
.p-rings span:first-child { left: 0; animation: ringJoinL 1s cubic-bezier(.3, 1.4, .5, 1) both; }
.p-rings span:last-child { right: 0; border-color: #f4e2b8; animation: ringJoinR 1s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes ringJoinL { from { opacity: 0; transform: translateX(-1.6rem); } }
@keyframes ringJoinR { from { opacity: 0; transform: translateX(1.6rem); } }

.p-q { flex: 1; display: flex; flex-direction: column; gap: 0.8rem; }
.p-qmeta { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-weight: 600; }
.p-secs { font-size: 1.6rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.p-secs.urgent { color: #ff8fa6; }
.p-timebar { height: 0.45rem; background: var(--faint); border-radius: 999px; overflow: hidden; }
#timebar { height: 100%; width: 100%; background: var(--gold); border-radius: 999px; transition: width 0.1s linear; }
.p-qtext { font: 700 1.35rem/1.3 var(--serif); padding: 0.4rem 0; }
.p-options { flex: 1; min-height: 52vh; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 0.7rem; }
.p-opt {
  border: 0; border-radius: 1rem; background: var(--c); color: #fff;
  font: 600 1.05rem/1.25 var(--sans);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 1rem 0.7rem; text-align: center; cursor: pointer;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}
.p-opt:active { transform: scale(0.96); }
.p-opt .shape svg { width: 2.2rem; height: 2.2rem; fill: #fff; display: block; }

.p-locked {
  width: 6.5rem; height: 6.5rem; border-radius: 1.4rem; background: var(--c);
  display: grid; place-items: center; animation: pulse 1.6s ease-in-out infinite;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22);
}
.p-locked svg { width: 3rem; height: 3rem; fill: #fff; display: block; }
.p-choice { font-weight: 600; font-size: 1.15rem; }

.p-badge {
  width: 6rem; height: 6rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 3rem; font-weight: 700;
  background: rgba(255, 255, 255, 0.14); animation: pop 0.5s ease-out both;
}
body[data-mood="correct"] .p-badge { background: var(--gold); color: var(--ink-dark); }
body[data-mood="wrong"] .p-badge { background: var(--a0); }
.p-points { font-size: 1.6rem; font-weight: 700; color: var(--gold); }

.standing { padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.standing b { font: 700 1.8rem var(--serif); }

.p-rules { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; margin: 0.6rem 0; width: 100%; }
.p-rules li { background: var(--card); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.8rem 1rem; }
.p-rules b { color: var(--gold); }

.p-trophy { font-size: 4.5rem; animation: pop 0.6s ease-out both; }
.p-congrats { font-size: 1.15rem; margin-top: 0.6rem; }
.p-congrats b { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition: none !important; }
}
