/* Sottovoce — tavolo notturno, carte color carta, sigillo vermiglio */
:root {
  --bg: #15132a;
  --bg-2: #1d1a39;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.11);
  --ink: #eeeaf8;
  --muted: #a7a1c6;
  --faint: #7a7499;
  --paper: #f6efe2;
  --paper-2: #ebe1cf;
  --paper-ink: #2b2340;
  --accent: #ff6a4d;
  --accent-2: #e2492d;
  --gold: #f3c35a;
  --keeper: #4fc9a6;
  --mole: #f2a63c;
  --shadow: #a993ff;
  --danger: #ff5f73;
  --ok: #5fd38d;
  --radius: 18px;
  --radius-sm: 12px;
  /* solo font di sistema: nessuna richiesta a servizi esterni */
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -200px, #2e2758 0%, rgba(46, 39, 88, 0) 70%),
    radial-gradient(800px 500px at 100% 100%, rgba(255, 106, 77, 0.07) 0%, rgba(255, 106, 77, 0) 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.noscript { padding: 24px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ layout */
.shell { max-width: 1080px; margin: 0 auto; padding: 0 16px calc(28px + var(--safe-b)); }
.layout { display: grid; gap: 16px; }
.main { display: grid; gap: 16px; min-width: 0; align-content: start; }
.aside { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
  .aside { position: sticky; top: 76px; }
}
.narrow { max-width: 560px; margin: 0 auto; width: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  margin: 0 -16px 12px;
  background: rgba(21, 19, 42, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin-right: auto; }
.brand svg { width: 28px; height: 28px; flex: none; }
.room-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 6px 12px; font-size: 0.85rem; color: var(--muted);
}
.room-chip b { color: var(--ink); letter-spacing: 0.12em; font-size: 0.95rem; }
.conn { font-size: 0.75rem; color: var(--gold); display: inline-flex; align-items: center; gap: 6px; }
[hidden] { display: none !important; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1s infinite; }

/* ------------------------------------------------------------------ panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel > h3 { font-size: 1.05rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.panel > h3 .count { font-family: var(--body); font-weight: 600; font-size: 0.8rem; color: var(--muted); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.phase-head { display: grid; gap: 6px; padding: 4px 2px; }
.phase-head h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.phase-head p { color: var(--muted); }
.pill {
  justify-self: start;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 106, 77, 0.14); color: var(--accent);
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink);
  font-weight: 650; text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(226, 73, 45, 0.35); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); background: transparent; border-color: rgba(255, 95, 115, 0.35); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.05rem; border-radius: 16px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.85rem; border-radius: 10px; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ------------------------------------------------------------------ form */
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 0.8rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border-radius: 14px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25); color: var(--ink);
  font-size: 1.05rem; outline: none;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243, 195, 90, 0.18); }
.input::placeholder { color: var(--faint); }
.input.code { text-transform: uppercase; letter-spacing: 0.35em; font-weight: 800; text-align: center; font-size: 1.3rem; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; min-width: 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 0.85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 46px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.15); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--keeper); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--gold); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.switch .text { flex: 1; }
.switch .text small { display: block; color: var(--muted); font-size: 0.8rem; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper b { min-width: 28px; text-align: center; font-size: 1.2rem; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.segmented button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button svg { width: 18px; height: 18px; }
.segmented button[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.setting { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; padding-top: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------------------------ home */
.home { min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; gap: 22px; padding: calc(28px + var(--safe-t)) 0 calc(28px + var(--safe-b)); }
.hero { text-align: center; display: grid; gap: 10px; justify-items: center; }
.hero h1 { font-size: clamp(2.6rem, 12vw, 3.6rem); }
.hero p { color: var(--muted); max-width: 30ch; }
.fan { position: relative; width: 180px; height: 150px; margin-bottom: 4px; }
.fan .mini-card {
  position: absolute; left: 50%; bottom: 0; width: 84px; height: 118px; margin-left: -42px;
  border-radius: 12px; background: var(--paper);
  background-image: repeating-linear-gradient(45deg, rgba(43,35,64,.05) 0 6px, transparent 6px 12px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); transform-origin: 50% 120%;
  display: grid; place-items: center;
}
.fan .mini-card:nth-child(1) { transform: rotate(-18deg); }
.fan .mini-card:nth-child(2) { transform: rotate(0deg) translateY(-8px); }
.fan .mini-card:nth-child(3) { transform: rotate(18deg); }
.fan .mini-card svg { width: 40px; height: 40px; }
.fan .mini-card:nth-child(2) { animation: bob 4s ease-in-out infinite; }
.foot-note { text-align: center; color: var(--faint); font-size: 0.85rem; }
.link-btn { background: none; border: 0; color: var(--gold); font-weight: 650; padding: 8px; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ lobby */
.room-code { display: flex; justify-content: center; gap: 8px; }
.room-code span {
  width: 54px; height: 66px; display: grid; place-items: center;
  border-radius: 12px; background: var(--paper); color: var(--paper-ink);
  font-family: var(--display); font-weight: 800; font-size: 2rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.room-code span:nth-child(odd) { transform: rotate(-3deg); }
.room-code span:nth-child(even) { transform: rotate(2deg); }
.qr { display: grid; justify-items: center; gap: 8px; }
.qr-box { background: #fff; padding: 10px; border-radius: 12px; line-height: 0; }
.qr-box img, .qr-box canvas { width: 148px !important; height: 148px !important; }
.compo { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ players */
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.player {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid transparent;
  min-height: 52px;
}
.player.me { border-color: rgba(243,195,90,.35); }
.player.out { opacity: 0.55; }
.player.offline .av { filter: grayscale(1); }
.player .who { flex: 1; min-width: 0; display: grid; }
.player .who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.player .who small { color: var(--muted); font-size: 0.78rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.player .pts { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--gold); }
.av {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 0.95rem;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
  position: relative;
}
.av.lg { width: 72px; height: 72px; font-size: 1.8rem; }
.av .crown { position: absolute; top: -10px; right: -6px; width: 20px; height: 20px; color: var(--gold); filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--faint); }
.tick { color: var(--ok); display: inline-flex; }
.tick svg { width: 18px; height: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 750;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); white-space: nowrap;
}
.badge.keeper { color: var(--keeper); background: rgba(79,201,166,.12); border-color: rgba(79,201,166,.35); }
.badge.mole { color: var(--mole); background: rgba(242,166,60,.12); border-color: rgba(242,166,60,.35); }
.badge.shadow { color: var(--shadow); background: rgba(169,147,255,.12); border-color: rgba(169,147,255,.35); }
.badge.gold { color: var(--gold); background: rgba(243,195,90,.12); border-color: rgba(243,195,90,.35); }

/* ------------------------------------------------------------------ secret card */
.secret {
  display: block; width: min(78vw, 300px); aspect-ratio: 5 / 7; margin: 0 auto;
  padding: 0; border: 0; background: none; perspective: 1200px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.secret-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform 0.35s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.secret.peek .secret-inner { transform: rotateY(180deg); }
.secret-face {
  position: absolute; inset: 0; border-radius: 22px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center; align-content: center; gap: 10px; padding: 20px; text-align: center;
  background: var(--paper); color: var(--paper-ink);
  box-shadow: 0 20px 50px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.6), inset 0 0 0 8px var(--paper), inset 0 0 0 9px rgba(43,35,64,.18);
}
.secret-back { background-image: repeating-linear-gradient(45deg, rgba(43,35,64,.055) 0 8px, transparent 8px 16px); }
.secret-back svg { width: 84px; height: 84px; }
.secret-hint { font-weight: 700; font-size: 0.95rem; color: #6b5f86; max-width: 18ch; }
.secret-front { transform: rotateY(180deg); }
.secret-front small { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; font-weight: 800; color: #7c6f97; }
.secret-front strong { font-family: var(--display); font-size: clamp(1.8rem, 9vw, 2.6rem); line-height: 1.05; word-break: break-word; }
.secret-front em { font-style: normal; color: #6b5f86; font-size: 0.9rem; max-width: 22ch; }
.secret.is-shadow .secret-front { background: #2a2446; color: #efe9ff; box-shadow: 0 20px 50px rgba(0,0,0,.5), inset 0 0 0 1px rgba(169,147,255,.5); }
.secret.is-shadow .secret-front small, .secret.is-shadow .secret-front em { color: #c9bcff; }

.secret.compact { width: 100%; aspect-ratio: auto; height: 64px; perspective: 800px; }
.secret.compact .secret-face { border-radius: 14px; padding: 8px 16px; grid-auto-flow: column; justify-content: center; gap: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.secret.compact .secret-back svg { width: 34px; height: 34px; }
.secret.compact .secret-front strong { font-size: 1.5rem; }
.secret.compact .secret-front em { display: none; }
.secret.compact .secret-inner { transform-origin: 50% 50%; }
.secret.compact.peek .secret-inner { transform: rotateX(180deg); }
.secret.compact .secret-front { transform: rotateX(180deg); }

/* ------------------------------------------------------------------ clues */
.turn-banner {
  display: grid; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,106,77,.18), rgba(169,147,255,.12));
  border: 1px solid rgba(255,106,77,.35);
}
.turn-banner.waiting { background: var(--panel); border-color: var(--line); }
.turn-banner h3 { font-size: 1.3rem; }
.clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.clue {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px;
  background: rgba(255,255,255,.03); min-height: 54px;
}
.clue.current { background: rgba(255,106,77,.1); box-shadow: inset 0 0 0 1px rgba(255,106,77,.4); }
.clue .name { width: 96px; flex: none; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble {
  flex: 1; min-width: 0; padding: 8px 12px; border-radius: 12px 12px 12px 4px;
  background: var(--paper); color: var(--paper-ink); font-weight: 700; word-break: break-word;
}
.bubble.wait { background: transparent; color: var(--faint); font-weight: 500; padding-left: 0; }
.bubble.voice { background: rgba(169,147,255,.16); color: var(--shadow); }
.bubble.skip { background: transparent; color: var(--faint); font-style: italic; font-weight: 500; padding-left: 0; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
details.past { border-top: 1px solid var(--line); padding-top: 10px; }
details.past summary { cursor: pointer; color: var(--muted); font-weight: 650; padding: 4px 0; }
details.past .clues { margin-top: 8px; }

/* ------------------------------------------------------------------ vote */
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vote-card {
  display: grid; gap: 8px; justify-items: center; text-align: center; padding: 14px 10px;
  border-radius: 16px; border: 2px solid var(--line); background: var(--panel); min-height: 140px;
  transition: border-color .15s, background .15s, transform .08s;
}
.vote-card:active:not(:disabled) { transform: scale(0.97); }
.vote-card:disabled { cursor: default; opacity: .5; }
.vote-card.self { opacity: .55; }
.vote-card.selected { border-color: var(--accent); background: rgba(255,106,77,.14); }
.vote-card b { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-card .said { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.vote-card .said span { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--paper-ink); font-weight: 700; }
.vote-card .said span.voice { background: rgba(169,147,255,.16); color: var(--shadow); }
.vote-card .mark { font-size: 0.72rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: inherit; transition: width .3s; }
.tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tally li { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; }
.tally li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally .bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.tally .bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.who-voted { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ result / end */
.reveal { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 22px 16px; animation: rise .45s ease both; }
.reveal h2 { font-size: clamp(1.5rem, 6vw, 2rem); }
.reveal .role-big { font-family: var(--display); font-weight: 800; font-size: 1.6rem; }
.reveal .role-big.keeper { color: var(--keeper); }
.reveal .role-big.mole { color: var(--mole); }
.reveal .role-big.shadow { color: var(--shadow); }
.banner {
  border-radius: 22px; padding: 22px 18px; text-align: center; display: grid; gap: 8px; justify-items: center;
  border: 1px solid var(--line); animation: rise .45s ease both;
}
.banner h2 { font-size: clamp(1.8rem, 8vw, 2.5rem); }
.banner.keeper { background: linear-gradient(160deg, rgba(79,201,166,.25), rgba(79,201,166,.05)); border-color: rgba(79,201,166,.4); }
.banner.mole { background: linear-gradient(160deg, rgba(242,166,60,.25), rgba(242,166,60,.05)); border-color: rgba(242,166,60,.4); }
.banner.shadow { background: linear-gradient(160deg, rgba(169,147,255,.28), rgba(169,147,255,.05)); border-color: rgba(169,147,255,.45); }
.banner .trophy { width: 44px; height: 44px; color: var(--gold); }
.words { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.word-card { border-radius: 16px; padding: 14px; background: var(--paper); color: var(--paper-ink); text-align: center; display: grid; gap: 2px; }
.word-card small { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: #7c6f97; }
.word-card strong { font-family: var(--display); font-size: 1.35rem; }
.word-card.mole { box-shadow: inset 0 0 0 3px var(--mole); }
.word-card.keeper { box-shadow: inset 0 0 0 3px var(--keeper); }
.gain { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.medal { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }

.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.log li { padding-left: 14px; position: relative; }
.log li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.log li:first-child { color: var(--ink); }

.notice { padding: 12px 14px; border-radius: 14px; background: rgba(243,195,90,.1); border: 1px solid rgba(243,195,90,.3); color: #f6dea4; font-size: 0.92rem; }
.waiting-note { display: flex; align-items: center; gap: 10px; color: var(--muted); justify-content: center; padding: 8px; text-align: center; }

/* ------------------------------------------------------------------ sheet / toast */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 6, 20, 0.6);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease both;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 18px 18px calc(22px + var(--safe-b));
  animation: slideup .25s cubic-bezier(.2,.8,.2,1) both;
}
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 1.4rem; }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn { justify-content: flex-start; }
.rules { display: grid; gap: 12px; color: #d9d4ec; }
.rules h3 { font-size: 1.05rem; color: var(--ink); margin-top: 6px; }
.rules ul, .rules ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.rules .roles { display: grid; gap: 8px; }
.rules .role-line { display: flex; gap: 10px; align-items: flex-start; }

#toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); z-index: 100;
  transform: translate(-50%, 140%); transition: transform .25s ease;
  max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 14px;
  background: #2b2548; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  font-weight: 600; text-align: center; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); }
#toast.error { border-color: rgba(255,95,115,.5); }

.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-16px) rotate(2deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 380px) {
  .clue .name { width: 72px; }
  .room-code span { width: 46px; height: 58px; font-size: 1.7rem; }
  .tally li { grid-template-columns: 84px 1fr auto; }
}

/* ------------------------------------------------------------------ account */
.av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av .crown { z-index: 1; }
.profile-card { display: flex; align-items: center; gap: 14px; }
.profile-card .who { flex: 1; min-width: 0; display: grid; }
.profile-card .who b { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-card .who small { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats > div { display: grid; justify-items: center; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.stats b { font-size: 1.4rem; font-family: var(--display); }
.stats small { color: var(--muted); font-size: 0.8rem; }
.panel-title { font-size: 1.05rem; }
.provider-btn { justify-content: flex-start; gap: 12px; border: 1px solid rgba(255,255,255,.18); font-weight: 650; }
.provider-btn .pmark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: .85rem; background: rgba(127,127,127,.18);
}
.room-tag {
  flex: none; padding: 6px 8px; border-radius: 8px; background: var(--paper); color: var(--paper-ink);
  font-family: var(--display); font-weight: 800; letter-spacing: .08em;
}
.panel > h3 svg { width: 18px; height: 18px; color: var(--muted); }
.foot-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 12px; }
.inline-link { color: var(--gold); }
a.btn { cursor: pointer; }
