/* ============================================================
   MARKET OF MASKS — Midnight Market design system
   ============================================================ */
:root {
  --night: #100d1e;
  --night-2: #16122c;
  --velvet: #221c3a;
  --velvet-2: #2b2450;
  --parchment: #f2e8d5;
  --parchment-dim: #cdbfa4;
  --ink: #1d1731;
  --lantern: #f5a83c;
  --lantern-soft: #ffd28a;
  --brass: #c9a25e;
  --brass-dim: #7d6a45;
  --coins: #e8b04b;
  --lanterns: #41c1b5;
  --roses: #e05c78;
  --masks: #a58bff;
  --masks-deep: #47337e;
  --good: #86d98a;
  --bad: #e0796a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .55);
  --radius: 14px;
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body: "Alegreya Sans", "Gill Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: clamp(14px, 2.2vmin, 19px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--parchment);
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(165, 139, 255, .12), transparent 60%),
    radial-gradient(900px 600px at 12% 110%, rgba(245, 168, 60, .10), transparent 55%),
    linear-gradient(180deg, var(--night-2), var(--night) 55%);
  font-family: var(--font-body);
  line-height: 1.45;
  overflow-x: hidden;
}
body.tv { font-size: 1.15rem; overflow: hidden; height: 100vh; }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: .06em; margin: 0; }
p { margin: .35em 0; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- shared atoms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid var(--brass);
  background: linear-gradient(180deg, #f7b95c, var(--lantern));
  color: #2a1c05;
  font-weight: 700; font-size: 1.05rem;
  padding: .8em 1.6em; border-radius: 999px;
  box-shadow: 0 4px 0 #8a5f1c, 0 10px 24px rgba(245, 168, 60, .25);
  transition: transform .12s ease, box-shadow .12s ease, filter .2s;
  text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a5f1c; }
.btn:disabled { filter: grayscale(.7) brightness(.7); cursor: default; box-shadow: none; }
.btn.ghost {
  background: transparent; color: var(--parchment);
  border: 1px solid var(--brass-dim); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--brass); }
.btn.small { font-size: .85rem; padding: .5em 1.1em; }
.btn.danger { background: linear-gradient(180deg, #e0796a, #c25a4c); border-color: #8a4034; box-shadow: 0 4px 0 #6d2c22; color: #2a0d08; }

input[type=text], select {
  font-family: inherit; font-size: 1.1rem; color: var(--parchment);
  background: rgba(0, 0, 0, .35); border: 1px solid var(--brass-dim);
  border-radius: 10px; padding: .7em .9em; outline: none; width: 100%;
}
input[type=text]:focus, select:focus { border-color: var(--lantern); box-shadow: 0 0 0 3px rgba(245, 168, 60, .18); }
:focus-visible { outline: 2px solid var(--lantern-soft); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: .4em;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(201, 162, 94, .35);
  border-radius: 999px; padding: .25em .8em; font-size: .85rem; color: var(--parchment-dim);
}
.eyebrow { font-size: .72rem; letter-spacing: .34em; text-transform: uppercase; color: var(--brass); font-weight: 600; }

.avatar { display: inline-block; flex: 0 0 auto; }
.avatar svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45)); }

.panel {
  background: linear-gradient(180deg, var(--velvet-2), var(--velvet));
  border: 1px solid rgba(201, 162, 94, .4);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* lantern string used on landings + lobby */
.lantern-string { display: flex; justify-content: center; gap: 6vw; padding-top: .4rem; pointer-events: none; }
.lantern-string .lamp {
  width: 16px; height: 22px; border-radius: 5px 5px 8px 8px;
  background: radial-gradient(circle at 50% 40%, var(--lantern-soft), var(--lantern) 60%, #7a4d12);
  box-shadow: 0 0 18px 4px rgba(245, 168, 60, .45);
  position: relative; animation: lampSway 5.5s ease-in-out infinite;
  transform-origin: top center;
}
.lantern-string .lamp::before { content: ""; position: absolute; top: -14px; left: 50%; width: 1px; height: 14px; background: var(--brass-dim); }
.lantern-string .lamp:nth-child(2n) { animation-delay: -1.7s; }
.lantern-string .lamp:nth-child(3n) { animation-delay: -3.1s; }
@keyframes lampSway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

/* ---------- playing cards ---------- */
.card { display: inline-block; width: var(--card-w, 84px); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.card svg { width: 100%; height: auto; display: block; }
.card.dim { filter: grayscale(.75) brightness(.55) drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }

/* phone hand fan */
.hand-wrap { position: relative; height: calc(var(--card-w, 96px) * 1.62); margin-top: auto; }
.hand { position: absolute; inset: 0; }
.hand .card {
  position: absolute; bottom: 0;
  transition: transform .22s cubic-bezier(.2, .9, .3, 1.3), filter .2s;
  touch-action: manipulation;
}
.hand .card.sel { transform: translateY(-26px) scale(1.06) !important; z-index: 60 !important; }

/* ---------- toasts / banners ---------- */
.toast {
  position: fixed; left: 50%; bottom: 18vh; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 15, 40, .92); border: 1px solid var(--brass);
  color: var(--parchment); padding: .7em 1.2em; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: 86vw; text-align: center; z-index: 300; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   TV
   ============================================================ */
.tv-stage { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
.tv-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity .5s; }
.tv-screen.out { opacity: 0; pointer-events: none; }

/* lobby */
.tv-lobby { gap: 1.2rem; padding: 2rem; }
.tv-title { font-size: clamp(2.2rem, 6.5vmin, 4.6rem); text-align: center; color: var(--parchment); text-shadow: 0 0 30px rgba(245, 168, 60, .25); }
.tv-title .amp { color: var(--lantern); }
.tv-tag { color: var(--parchment-dim); letter-spacing: .18em; text-transform: uppercase; font-size: .85rem; }
.join-block { display: flex; gap: 3.5vmin; align-items: center; margin-top: 1rem; }
.qr-card { background: var(--parchment); border-radius: 16px; padding: 1.1vmin; box-shadow: var(--shadow), 0 0 0 6px rgba(201, 162, 94, .5); }
.qr-card svg { display: block; width: 24vmin; height: 24vmin; }
.code-block { text-align: left; }
.room-code { font-family: var(--font-display); font-size: clamp(3rem, 11vmin, 8rem); letter-spacing: .18em; color: var(--lantern); text-shadow: 0 0 40px rgba(245, 168, 60, .5); line-height: 1; }
.join-url { color: var(--parchment-dim); font-size: 1rem; margin-top: .4rem; }
.tv-roster { display: flex; gap: 1.2vmin; flex-wrap: wrap; justify-content: center; min-height: 9vmin; margin-top: 1.4rem; max-width: 80vw; }
.roster-chip {
  display: flex; align-items: center; gap: .6em; padding: .45em 1em .45em .5em;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(201, 162, 94, .45); border-radius: 999px;
  animation: popIn .45s cubic-bezier(.2, 1.4, .3, 1);
  font-weight: 600; font-size: 1.15rem;
}
.roster-chip .avatar { width: 2.2em; height: 2.2em; }
.roster-chip .crown { color: var(--lantern); font-size: .8em; }
.roster-chip.bot { opacity: .8; font-style: italic; }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tv-hint { color: var(--parchment-dim); font-size: .95rem; }
.tv-hostrow { display: flex; gap: .8rem; margin-top: .6rem; }

/* table */
.tv-table { position: absolute; inset: 0; }
.felt {
  position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%);
  width: min(74vw, 130vh); height: min(58vh, 70vw);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(245, 168, 60, .10), transparent 60%),
    radial-gradient(ellipse at 50% 50%, #322a5c 0%, #241e44 55%, #1a1533 100%);
  border: 3px solid rgba(201, 162, 94, .5);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, .6), var(--shadow);
}
.felt::after {
  content: ""; position: absolute; inset: 4%; border-radius: 50%;
  border: 1px solid rgba(201, 162, 94, .22);
}
.seat { position: absolute; width: 15vmin; transform: translate(-50%, -50%); text-align: center; transition: filter .3s; }
.seat .avatar { width: 7.2vmin; height: 7.2vmin; margin: 0 auto; position: relative; border-radius: 50%; transition: box-shadow .3s, transform .3s; }
.seat.turn .avatar { box-shadow: 0 0 0 4px var(--lantern), 0 0 34px 8px rgba(245, 168, 60, .55); transform: scale(1.08); }
.seat .nm { font-weight: 700; font-size: 1.5vmin; margin-top: .3vmin; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .plaque {
  display: inline-flex; align-items: baseline; gap: .5em; margin-top: .2vmin;
  background: linear-gradient(180deg, #3a3160, #292250); border: 1px solid rgba(201, 162, 94, .5);
  border-radius: 8px; padding: .15em .7em; font-size: 1.55vmin;
}
.seat .plaque .sc { font-family: var(--font-display); font-size: 1.9vmin; color: var(--lantern-soft); }
.seat .plaque .hp { color: var(--parchment-dim); font-size: 1.3vmin; }
.seat .cardsleft { display: flex; justify-content: center; gap: 2px; margin-top: .35vmin; height: 1.6vmin; }
.seat .cardsleft i { width: 1.05vmin; height: 1.55vmin; border-radius: 2px; background: linear-gradient(160deg, var(--masks-deep), #2a1f52); border: 1px solid rgba(201, 162, 94, .5); }
.seat .sigtag { position: absolute; top: -1.2vmin; right: 8%; font-size: 2vmin; filter: drop-shadow(0 2px 4px #000); }
.seat.dealer .nm::after { content: " ·D"; color: var(--brass); }

.trick-area { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.played {
  position: absolute; width: 9.2vmin; transform: translate(-50%, -50%);
  transition: transform .5s cubic-bezier(.2, .9, .25, 1.15), opacity .4s;
}
.played .card { width: 100%; }
.played .who { position: absolute; left: 50%; bottom: -1.9vmin; transform: translateX(-50%); font-size: 1.3vmin; color: var(--parchment-dim); white-space: nowrap; }

.led-chip { position: absolute; left: 50%; top: calc(54% - min(29vh, 35vw) - 4.6vmin); transform: translateX(-50%); }
.trickcount { position: absolute; right: 2.2vmin; bottom: 2vmin; color: var(--parchment-dim); font-size: 1.5vmin; text-align: right; }
.gutter-pile { position: absolute; left: 2.2vmin; bottom: 2vmin; display: flex; align-items: center; gap: .6vmin; color: var(--parchment-dim); font-size: 1.5vmin; }
.gutter-pile .stack { position: relative; width: 3.4vmin; height: 4.7vmin; }
.gutter-pile .stack i { position: absolute; inset: 0; border-radius: 5px; background: linear-gradient(160deg, var(--masks-deep), #2a1f52); border: 1px solid rgba(201, 162, 94, .55); }
.gutter-pile .stack i:nth-child(2) { transform: translate(4px, -3px) rotate(6deg); }

.tv-topbar { position: absolute; top: 1.6vmin; left: 50%; transform: translateX(-50%); display: flex; gap: 1.2vmin; align-items: center; z-index: 5; }
.tv-topbar .hand-label { font-family: var(--font-display); letter-spacing: .2em; color: var(--brass); font-size: 1.8vmin; }
.mutebtn { position: absolute; top: 1.4vmin; right: 1.6vmin; z-index: 40; display: inline-flex; align-items: center; gap: .8vmin; background: rgba(255,255,255,.06); border: 1px solid var(--brass-dim); color: var(--parchment); border-radius: 999px; padding: .8vmin 1.6vmin; font-size: 1.7vmin; cursor: pointer; }
.mutebtn.is-silent { color: var(--parchment-dim); }
.roomtag { position: absolute; top: 1.4vmin; left: 1.6vmin; z-index: 40; color: var(--parchment-dim); font-size: 1.6vmin; letter-spacing: .2em; }
.roomtag b { color: var(--lantern); font-family: var(--font-display); }

/* trick end banner */
.sweep-banner {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.8);
  font-family: var(--font-display); font-size: 4vmin; color: var(--lantern-soft);
  text-shadow: 0 0 30px rgba(245, 168, 60, .6); opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .4s cubic-bezier(.2, 1.5, .3, 1); text-align: center; z-index: 10;
}
.sweep-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.sweep-banner .pts { display: block; font-size: 2.2vmin; color: var(--parchment); letter-spacing: .25em; }

/* reveal cinematic */
.reveal-veil { position: absolute; inset: 0; background: rgba(6, 4, 14, .88); z-index: 60; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2.4vmin; opacity: 0; pointer-events: none; transition: opacity .5s; }
.reveal-veil.show { opacity: 1; }
.reveal-veil .eyebrow { font-size: 1.6vmin; }
.reveal-title { font-size: 5.4vmin; color: var(--lantern); text-shadow: 0 0 50px rgba(245, 168, 60, .6); }
.reveal-masks { display: flex; gap: 6vmin; align-items: center; }
.reveal-masks .avatar { width: 13vmin; height: 13vmin; animation: maskIn .8s cubic-bezier(.2, 1.3, .3, 1); }
.reveal-masks .linkmark { font-size: 5vmin; color: var(--brass); animation: sealStamp .6s .5s backwards cubic-bezier(.3, 2, .4, 1); }
.reveal-name { text-align: center; font-weight: 700; font-size: 2.2vmin; margin-top: .6vmin; }
.reveal-sub { color: var(--parchment-dim); font-size: 1.9vmin; max-width: 60vw; text-align: center; }
@keyframes maskIn { from { transform: translateY(4vmin) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sealStamp { from { transform: scale(2.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* hand end + game over sheets on TV */
.tv-sheet { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; background: rgba(8, 6, 18, .78); opacity: 0; pointer-events: none; transition: opacity .45s; }
.tv-sheet.show { opacity: 1; pointer-events: auto; }
.sheet-card { width: min(78vw, 100vh); max-height: 88vh; overflow: auto; padding: 3vmin 3.6vmin; }
.sheet-card h2 { font-size: 3.2vmin; color: var(--lantern); text-align: center; }
.sheet-card .sub { text-align: center; color: var(--parchment-dim); margin-bottom: 1.6vmin; font-size: 1.7vmin; }
.score-rows { display: flex; flex-direction: column; gap: .9vmin; margin: 1.6vmin 0; }
.score-row { display: grid; grid-template-columns: 4.6vmin 1fr auto auto; gap: 1.4vmin; align-items: center; background: rgba(255, 255, 255, .05); border: 1px solid rgba(201, 162, 94, .3); border-radius: 10px; padding: .8vmin 1.4vmin; font-size: 2vmin; }
.score-row .avatar { width: 4vmin; height: 4vmin; }
.score-row .who { font-weight: 700; }
.score-row .who small { display: block; color: var(--parchment-dim); font-weight: 400; font-size: 1.4vmin; }
.score-row .delta { font-family: var(--font-display); color: var(--lantern-soft); font-size: 2.4vmin; }
.score-row .total { color: var(--parchment-dim); font-size: 1.7vmin; min-width: 9vmin; text-align: right; }
.score-row.win { border-color: var(--lantern); box-shadow: 0 0 22px rgba(245, 168, 60, .25); }
.gutter-reveal { display: flex; gap: 1vmin; justify-content: center; align-items: center; margin: 1.2vmin 0; color: var(--parchment-dim); font-size: 1.7vmin; }
.gutter-reveal .card { width: 6vmin; }
.note-line { text-align: center; color: var(--parchment); font-size: 1.9vmin; margin-top: .6vmin; }
.note-line b { color: var(--lantern); }
.sheet-foot { text-align: center; color: var(--parchment-dim); font-size: 1.6vmin; margin-top: 1.6vmin; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 2.4vmin; margin: 2vmin 0; }
.podium .col { text-align: center; }
.podium .col .avatar { width: 8vmin; height: 8vmin; margin: 0 auto .6vmin; }
.podium .col.first .avatar { width: 12vmin; height: 12vmin; }
.podium .bar { background: linear-gradient(180deg, var(--velvet-2), var(--velvet)); border: 1px solid rgba(201, 162, 94, .5); border-bottom: none; border-radius: 8px 8px 0 0; display: flex; flex-direction: column; justify-content: flex-start; padding-top: .8vmin; font-family: var(--font-display); color: var(--lantern-soft); font-size: 2.4vmin; }
.podium .col.first .bar { height: 16vmin; width: 15vmin; box-shadow: 0 0 34px rgba(245, 168, 60, .25); }
.podium .col:not(.first) .bar { height: 9.5vmin; width: 12vmin; }
.podium .nm { font-weight: 700; font-size: 1.9vmin; margin-top: .4vmin; }

/* emote bubbles on tv */
.emote-float { position: absolute; font-size: 4vmin; animation: floatUp 2.4s ease-out forwards; z-index: 45; filter: drop-shadow(0 3px 6px #000); }
@keyframes floatUp { from { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-1vmin) scale(1.1); } to { transform: translateY(-14vmin) scale(1); opacity: 0; } }

canvas.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ============================================================
   PHONE
   ============================================================ */
.app { display: flex; flex-direction: column; min-height: 100dvh; padding: max(10px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.ph-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .2rem 0 .6rem; }
.ph-head .brand { font-family: var(--font-display); letter-spacing: .12em; font-size: 1.02rem; color: var(--parchment); }
.ph-head .brand .amp { color: var(--lantern); }
.conn-dot { width: .55em; height: .55em; border-radius: 50%; background: var(--good); display: inline-block; margin-right: .35em; box-shadow: 0 0 8px var(--good); }
.conn-dot.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

.join-card { padding: 1.3rem 1.2rem; display: flex; flex-direction: column; gap: 1rem; margin-top: 4vh; }
.mask-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.mask-opt { background: rgba(255, 255, 255, .04); border: 2px solid transparent; border-radius: 12px; padding: .45rem; transition: border-color .15s, transform .15s; }
.mask-opt.sel { border-color: var(--lantern); transform: scale(1.05); background: rgba(245, 168, 60, .08); }
.mask-opt svg { width: 100%; height: auto; }
.field label { display: block; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); margin-bottom: .35rem; }

.lobby-list { display: flex; flex-direction: column; gap: .55rem; margin: .8rem 0; }
.lobby-row { display: flex; align-items: center; gap: .7rem; background: rgba(255, 255, 255, .05); border: 1px solid rgba(201, 162, 94, .3); border-radius: 12px; padding: .5rem .8rem; }
.lobby-row .avatar { width: 2.3rem; height: 2.3rem; }
.lobby-row .nm { font-weight: 700; flex: 1; }
.lobby-row .tagx { font-size: .75rem; color: var(--parchment-dim); }
.host-tools { display: flex; flex-direction: column; gap: .7rem; margin-top: .6rem; }
.target-row { display: flex; gap: .5rem; }
.target-row .btn { flex: 1; }
.target-row .btn.on { border-color: var(--lantern); color: var(--lantern-soft); }

.status-strip { text-align: center; padding: .5rem .8rem; border-radius: 12px; border: 1px solid transparent; transition: background .3s, border-color .3s, box-shadow .3s; font-weight: 600; }
.status-strip.you { background: rgba(245, 168, 60, .14); border-color: var(--lantern); box-shadow: 0 0 24px rgba(245, 168, 60, .25); color: var(--lantern-soft); animation: pulseGlow 1.6s ease-in-out infinite; }
.status-strip small { display: block; font-weight: 400; color: var(--parchment-dim); font-size: .8rem; }
@keyframes pulseGlow { 0%, 100% { box-shadow: 0 0 14px rgba(245, 168, 60, .18); } 50% { box-shadow: 0 0 30px rgba(245, 168, 60, .4); } }

.mini-table { position: relative; margin: .7rem auto .2rem; display: flex; justify-content: center; gap: .45rem; min-height: 96px; align-items: center; }
.mini-table .mini-slot { text-align: center; width: 62px; }
.mini-table .mini-slot .card { width: 56px; }
.mini-table .mini-slot .who { font-size: .68rem; color: var(--parchment-dim); margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-table .mini-slot.winner .card { filter: drop-shadow(0 0 12px rgba(245, 168, 60, .8)); }
.mini-empty { color: var(--brass-dim); font-size: .85rem; text-align: center; border: 1px dashed rgba(201, 162, 94, .35); border-radius: 12px; padding: 1.1rem 1rem; }

.sig-badge { display: flex; gap: .7rem; align-items: center; background: linear-gradient(90deg, rgba(165, 139, 255, .16), rgba(165, 139, 255, .05)); border: 1px solid var(--masks); border-radius: 12px; padding: .55rem .8rem; margin-top: .6rem; font-size: .88rem; }
.sig-badge .ico { font-size: 1.4rem; }
.sig-badge b { color: var(--masks); }

.scorebar { display: flex; gap: .4rem; overflow-x: auto; padding: .5rem 0 .2rem; scrollbar-width: none; }
.scorebar::-webkit-scrollbar { display: none; }
.score-pill { display: flex; align-items: center; gap: .4rem; background: rgba(255, 255, 255, .05); border: 1px solid rgba(201, 162, 94, .3); border-radius: 999px; padding: .25rem .7rem .25rem .3rem; font-size: .8rem; white-space: nowrap; }
.score-pill .avatar { width: 1.6rem; height: 1.6rem; }
.score-pill.turn { border-color: var(--lantern); box-shadow: 0 0 12px rgba(245, 168, 60, .3); }
.score-pill b { color: var(--lantern-soft); }

.emote-bar { display: flex; justify-content: center; gap: .5rem; padding: .5rem 0 .1rem; }
.emote-bar button { background: rgba(255, 255, 255, .06); border: 1px solid rgba(201, 162, 94, .3); border-radius: 12px; font-size: 1.25rem; padding: .3rem .6rem; transition: transform .1s; }
.emote-bar button:active { transform: scale(1.25); }

.play-cta { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--card-w, 96px) * 1.72); z-index: 160; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.play-cta.show { opacity: 1; pointer-events: auto; }

.sheet { position: fixed; inset: 0; background: rgba(8, 6, 18, .85); display: flex; align-items: flex-end; justify-content: center; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .3s; }
.sheet.show { opacity: 1; pointer-events: auto; }
.sheet .inner { width: 100%; max-width: 560px; max-height: 86dvh; overflow: auto; border-radius: 20px 20px 0 0; padding: 1.2rem 1.2rem 1.6rem; transform: translateY(30px); transition: transform .3s; }
.sheet.show .inner { transform: none; }
.sheet h2 { color: var(--lantern); text-align: center; font-size: 1.3rem; margin-bottom: .3rem; }
.sheet .sub { text-align: center; color: var(--parchment-dim); font-size: .85rem; margin-bottom: .8rem; }
.m-rows { display: flex; flex-direction: column; gap: .5rem; }
.m-row { display: grid; grid-template-columns: 2.2rem 1fr auto auto; gap: .7rem; align-items: center; background: rgba(255, 255, 255, .05); border: 1px solid rgba(201, 162, 94, .3); border-radius: 10px; padding: .45rem .7rem; font-size: .92rem; }
.m-row .avatar { width: 2rem; height: 2rem; }
.m-row .delta { font-family: var(--font-display); color: var(--lantern-soft); }
.m-row .total { color: var(--parchment-dim); font-size: .8rem; }
.m-row.me { border-color: var(--lantern); }
.sheet .actions { display: flex; gap: .7rem; margin-top: 1rem; flex-wrap: wrap; justify-content: center; }

/* tutorial */
.tut-coach { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--card-w, 96px) * 1.72 + 4.2rem); width: min(92vw, 480px); z-index: 150; padding: .9rem 1rem; border: 1px solid var(--lantern); background: linear-gradient(180deg, #2f2758, #241e44); border-radius: 14px; box-shadow: 0 0 34px rgba(245, 168, 60, .2), var(--shadow); }
.tut-coach .step { font-size: .7rem; letter-spacing: .25em; color: var(--brass); text-transform: uppercase; }
.tut-coach p { margin: .3rem 0 .5rem; font-size: .95rem; }
.tut-coach .btn { width: 100%; }
.shake { animation: shakeX .4s; }
@keyframes shakeX { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* ============================================================
   Landing pages
   ============================================================ */
.land { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 0 1.2rem 3rem; }
.land-hero { text-align: center; margin-top: 7vh; max-width: 760px; }
.land-hero h1 { font-size: clamp(2rem, 7vw, 4rem); }
.land-hero h1 .amp { color: var(--lantern); }
.land-hero .tag { color: var(--parchment-dim); letter-spacing: .2em; text-transform: uppercase; font-size: .8rem; margin-top: .6rem; }
.land-actions { display: flex; flex-direction: column; gap: .9rem; width: min(92vw, 420px); margin-top: 2.2rem; }
.land-actions .btn { font-size: 1.1rem; padding: 1em 1.4em; }
.action-note { text-align: center; color: var(--parchment-dim); font-size: .82rem; margin-top: -.4rem; }
.rules-digest { max-width: 640px; margin-top: 3rem; padding: 1.4rem 1.5rem; }
.rules-digest h3 { color: var(--lantern); letter-spacing: .12em; font-size: 1rem; margin-bottom: .6rem; }
.rules-digest p { color: var(--parchment-dim); font-size: .95rem; }
.rules-digest b { color: var(--parchment); }
.suit-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; }
.suit-legend .chip svg { width: 1.15em; height: 1.15em; }

.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(88vw, 300px), 1fr)); gap: 1.3rem; width: min(94vw, 900px); margin-top: 2.6rem; }
.game-tile { display: flex; flex-direction: column; gap: .5rem; padding: 1.5rem 1.4rem; text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s; position: relative; overflow: hidden; }
a.game-tile:hover { transform: translateY(-4px); box-shadow: 0 16px 44px rgba(0, 0, 0, .6), 0 0 30px rgba(245, 168, 60, .12); }
.game-tile h2 { font-size: 1.5rem; }
.game-tile .desc { color: var(--parchment-dim); font-size: .92rem; }
.game-tile .meta { display: flex; gap: .5rem; margin-top: .4rem; }
.game-tile.soon { opacity: .55; }
.game-tile .tilemask { position: absolute; right: -18px; bottom: -22px; width: 120px; opacity: .14; transform: rotate(-12deg); }

@media (max-width: 700px) {
  .join-block { flex-direction: column; }
  .code-block { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- accidental-exit guards & phone sound toggle ---------- */
html, body { overscroll-behavior: none; } /* stops pull-to-refresh + edge back-swipe nav (Chrome/Android) */
.ph-head .brand { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd { font-family: inherit; font-size: .85rem; cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; flex: 0 0 auto; }
.snd .mb-ico { font-size: 1em; }
.snd.snd-silent { color: var(--parchment-dim); }
.leave-veil { position: fixed; inset: 0; z-index: 240; background: rgba(8, 6, 18, .86); display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.leave-veil[hidden] { display: none; }
.leave-card { width: min(92vw, 420px); display: flex; flex-direction: column; gap: .85rem; text-align: center; padding: 1.3rem 1.2rem; }
