:root {
  --felt: #0d3b2a;
  --felt2: #145238;
  --ink: #f3f1e8;
  --muted: #a9c4b5;
  --gold: #f2c14e;
  --red: #d8323c;
  --bs: #e8473c;
  --card-w: 50px;
  --card-h: 72px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at top, var(--felt2), var(--felt) 70%) fixed;
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
b { color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.screen { max-width: 520px; margin: 0 auto; padding: 0 14px 40px; }

/* top bar */
.top { display: flex; align-items: center; gap: 8px; padding: 10px 0; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--felt2) 70%, transparent); }
.top .ttl { flex: 1; font-weight: 700; font-size: 18px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .right { min-width: 48px; display: flex; justify-content: flex-end; }
.icon { width: 48px; height: 48px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); font-size: 22px; }
.bs-btn { height: 52px; padding: 0 18px; border-radius: 14px; border: 0; background: var(--bs); color: #fff;
  font-weight: 900; font-size: 22px; letter-spacing: 1px; box-shadow: 0 4px 0 #8f1f18, 0 0 0 3px rgba(255,255,255,.15);
  animation: pulse 1.6s ease-in-out infinite; }
.bs-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8f1f18; }
@keyframes pulse { 50% { box-shadow: 0 4px 0 #8f1f18, 0 0 0 7px rgba(232,71,60,.35); } }

/* buttons */
.big { display: block; width: 100%; min-height: 56px; margin: 10px 0; border-radius: 14px; border: 0;
  background: rgba(255,255,255,.12); font-size: 18px; font-weight: 700; padding: 12px; }
.big.primary { background: var(--gold); color: #2a1d00; box-shadow: 0 4px 0 #a37a1c; }
.big.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #a37a1c; }
.big.ghost { background: transparent; border: 2px solid rgba(255,255,255,.25); }
.big:disabled { opacity: .4; box-shadow: none; cursor: default; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 14px; display: block; margin: 0 auto; }

/* setup */
.setup { text-align: center; padding-top: 30px; }
.logo { font-size: 84px; margin: 10px 0 0; letter-spacing: 4px; color: var(--gold); text-shadow: 0 5px 0 #7a5a10; }
.logo2 { display: block; font-size: 30px; letter-spacing: 10px; margin-top: -6px; padding-left: 10px; text-shadow: 0 3px 0 #7a5a10; }
.tag { color: var(--muted); margin-top: 4px; }
.field { margin: 22px 0 12px; }
.field label { display: block; font-weight: 700; margin-bottom: 8px; }
.stepper { display: inline-flex; align-items: center; gap: 18px; }
.stepper button { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); font-size: 28px; }
.stepper .num { font-size: 36px; font-weight: 800; min-width: 48px; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.name { width: 100%; min-height: 50px; border-radius: 12px; border: 2px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.2); color: var(--ink); font: inherit; font-size: 17px; padding: 0 12px; -webkit-user-select: text; user-select: text; }
.name:focus { outline: none; border-color: var(--gold); }

/* pass screen */
.banner { background: rgba(0,0,0,.25); border-left: 4px solid var(--gold); border-radius: 10px; padding: 12px 14px; margin: 6px 0; font-size: 17px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 2px; }
.handoff { text-align: center; padding: 18px 0 8px; }
.nextname { font-size: 38px; font-weight: 800; color: var(--gold); margin: 2px 0 6px; word-break: break-word; }
.log { list-style: none; padding: 0; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.log li { padding: 3px 0; border-top: 1px solid rgba(255,255,255,.06); }

/* table */
.table { background: rgba(0,0,0,.18); border-radius: 16px; padding: 12px; margin-top: 10px; }
.pilebox { display: flex; gap: 14px; align-items: center; }
.pilevis { position: relative; }
.pilen { position: absolute; right: -8px; top: -8px; background: var(--bs); color: #fff; font-weight: 800;
  border-radius: 99px; min-width: 26px; height: 26px; display: grid; place-items: center; font-size: 14px; padding: 0 6px; }
.pileinfo { font-size: 15px; }
.players { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.players li { display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.06); border-radius: 10px; padding: 7px 9px; font-size: 14px; }
.players li.now { outline: 2px solid var(--gold); }
.players .pn { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .pc { color: var(--muted); font-variant-numeric: tabular-nums; }

/* cards */
.card { width: var(--card-w); height: var(--card-h); border-radius: 7px; background: #fbfaf5; color: #1b1b1b;
  position: relative; flex: none; box-shadow: 0 2px 4px rgba(0,0,0,.35); transition: transform .12s; }
.card.red { color: var(--red); }
.card .cr { position: absolute; top: 4px; left: 6px; font-weight: 800; font-size: 19px; line-height: 1; }
.card .cs { position: absolute; bottom: 4px; right: 6px; font-size: 22px; line-height: 1; }
.card.back { background: repeating-linear-gradient(45deg, #9c2430 0 6px, #b8323e 6px 12px); border: 3px solid #fbfaf5; }
.card.empty { background: transparent; border: 2px dashed rgba(255,255,255,.25); box-shadow: none; }
.card.gone { visibility: hidden; }
.card.big { --card-w: 58px; --card-h: 84px; width: 58px; height: 84px; }
.card.pick { cursor: pointer; }
.card.sel { transform: translateY(-12px); box-shadow: 0 0 0 3px var(--gold), 0 6px 10px rgba(0,0,0,.4); }
.card.covered { filter: brightness(.6); }
.card.ok { box-shadow: 0 0 0 3px #3ccf73; }
.card.bad { box-shadow: 0 0 0 3px var(--bs); }

/* turn screen */
.strip { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px 10px; }
h2 { font-size: 17px; margin: 16px 0 8px; }
h2.small { font-size: 14px; }
.hand { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.stackpile { position: relative; margin-left: 10px; opacity: .9; }
.stackpile .pilen { background: #555; }
.hand.center { justify-content: center; }
.pyramid { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.prow { display: flex; gap: 6px; position: relative; }
.prow + .prow { margin-top: -38px; }
.pyramid .card.back.pick { filter: none; }
.claim { margin-top: 20px; background: rgba(0,0,0,.18); border-radius: 14px; padding: 12px; }
.claimlbl { font-weight: 700; margin-bottom: 8px; }
.ranks { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px; }
.rank { min-height: 46px; border-radius: 10px; border: 2px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); font-weight: 800; font-size: 18px; }
.rank.wild { border-color: rgba(242,193,78,.6); }
.rank.on { background: var(--gold); color: #2a1d00; border-color: var(--gold); }
.rank:disabled { opacity: .25; }
.actions { margin-top: 8px; }

/* reveal */
.reveal { text-align: center; }
.lead { font-size: 19px; }
.verdict { font-size: 64px; font-weight: 900; letter-spacing: 3px; margin: 12px 0 0; }
.verdict.lie { color: var(--bs); }
.verdict.truth { color: #3ccf73; }

/* game over */
.over { text-align: center; padding-top: 40px; }
.trophy { font-size: 80px; }
.over h1 { font-size: 38px; margin: 6px 0; color: var(--gold); }
.score { list-style: none; padding: 0; margin: 18px 0; text-align: left; }
.score li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.06); margin: 4px 0; }

/* overlay */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
#overlay[hidden] { display: none; }
.sheet { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: #10291f; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.5); }
.sheet h2 { margin-top: 0; font-size: 20px; }
.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.rules p { margin: 0 0 10px; font-size: 15px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #000c; padding: 10px 16px; border-radius: 99px; z-index: 30; font-size: 15px; }
#toast[hidden] { display: none; }

@media (max-width: 360px) { :root { --card-w: 44px; --card-h: 64px; } .ranks { grid-template-columns: repeat(7, 1fr); gap: 4px; } }

.mefield select { min-height: 50px; border-radius: 12px; border: 2px solid rgba(255,255,255,.18); background: rgba(0,0,0,.2); color: var(--ink);
  font: inherit; font-size: 17px; padding: 0 12px; width: 100%; max-width: 320px; }
.setup a { color: var(--gold); }

/* keep the felt color under short pages */
html { background: #0d3b2a; }
