:root {
  --bg: #110d0b;
  --ink: #f4eadc;
  --muted: #b7a89a;
  --gold: #e4c27a;
  --felt: #17352f;
  --felt-2: #102824;
  --danger: #e07a6a;
  --line: rgba(228, 194, 122, 0.32);
  --wood: #4a2e1e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-weight: 380;
  background:
    radial-gradient(ellipse at 50% -8%, rgba(228, 194, 122, 0.16), transparent 42%),
    radial-gradient(ellipse at 100% 100%, rgba(120, 28, 22, 0.28), transparent 38%),
    var(--bg);
}

button, input { font: inherit; color: inherit; }

button {
  background: transparent;
  border: 0;
  cursor: pointer;
}

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.game {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.top, .menu-tools, .top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand, h1, h2 { overflow-wrap: anywhere; }

.brand, h1, h2, .call strong, .stamp {
  font-family: Fraunces, Palatino, "Palatino Linotype", serif;
  font-weight: 500;
}

.brand { letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold);
}

h1 {
  margin: 0;
  font-size: clamp(64px, 12vw, 104px);
  line-height: 0.86;
  letter-spacing: -0.04em;
}

h2 {
  margin: 0;
  font-size: clamp(40px, 7vw, 68px);
  line-height: 0.95;
}

.menu {
  width: min(480px, 100%);
  margin: 8px auto 0;
  display: grid;
  gap: 16px;
}

.tag, .quiet, .bridge, .private, .verdict {
  color: var(--muted);
  line-height: 1.45;
}

.tag { margin: 0; max-width: 28ch; font-size: 18px; }

.brand-dots { display: flex; gap: 7px; }

.brand-dots i, .dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
  background: #3a332c;
}

.brand-dots i.hot, .dots i.spent { background: var(--gold); }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 8px;
}

.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: 13px;
}

fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }

legend { color: var(--muted); font-size: 13px; }

.seg { display: flex; gap: 8px; }

.seg button, .btn {
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 12px 16px;
  line-height: 1.2;
  white-space: normal;
}

.seg button { flex: 1; }

.seg button.on, .btn.primary {
  background: var(--gold);
  color: #1a120c;
  border-color: transparent;
  font-weight: 640;
}

.btn.danger { color: #f0c2ba; border-color: rgba(224, 122, 106, 0.8); }

.btn.ghost { color: var(--muted); border-color: transparent; min-height: 40px; }

.btn.primary:hover, .seg button.on:hover { filter: brightness(1.06); }

.btn.danger:hover { background: rgba(196, 73, 58, 0.16); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.btn:active:not(:disabled) { transform: translateY(1px); }

.cta { width: min(100%, 420px); }

.names { display: grid; gap: 10px; }

.name-row { display: grid; gap: 6px; }

.name-row span { font-size: 13px; color: var(--muted); }

input.name {
  width: 100%;
  background: #1c1612;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.felt {
  margin-top: 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(180deg, var(--felt), var(--felt-2));
  border-radius: 28px;
  border: 1px solid rgba(228, 194, 122, 0.22);
  box-shadow: inset 0 0 0 8px rgba(74, 46, 30, 0.45), 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 22px 18px;
}

.center-col, .drama, .dock {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
}

.seats, .logbox, .dock { width: min(100%, 720px); }

.seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  text-align: left;
}

.seat {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--c);
}

.seat strong { display: block; font-weight: 640; }

.seat p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.seat.turn { box-shadow: inset 0 0 0 1px var(--gold); }

.seat.dead { opacity: 0.48; }

.seat.last-chamber { box-shadow: inset 0 0 0 1px var(--danger); }

.dots { display: flex; gap: 4px; margin-top: 8px; }

.call {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 140px;
  padding: 12px 18px 10px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
}

.call strong { font-size: 42px; line-height: 1; }

.call em { font-style: normal; color: var(--muted); font-size: 13px; }

.rank-A .call strong, .call.rank-A strong { color: #f0d7a0; }
.rank-K .call strong, .call.rank-K strong { color: #f0b2aa; }
.rank-Q .call strong, .call.rank-Q strong { color: #c9dff0; }

.pile { display: flex; justify-content: center; min-height: 96px; }

.card {
  width: 108px;
  height: 156px;
  border-radius: 12px;
  position: relative;
  padding: 8px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
  user-select: none;
}

.card.mini { width: 68px; height: 96px; }

.pile .card { margin-left: -32px; }

.pile .card:first-child { margin-left: 0; }

.card.back {
  background:
    radial-gradient(circle at 50% 42%, rgba(228, 194, 122, 0.16), transparent 36%),
    #3a1718;
  color: var(--gold);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px rgba(228, 194, 122, 0.45), 0 10px 18px rgba(0, 0, 0, 0.28);
}

.card.back span {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card.face { border: 0; }

.rank-A { background: #f7f1e4; color: #8a6420; }
.rank-K { background: #f6ebe7; color: #8d2e2e; }
.rank-Q { background: #e7eef3; color: #1d4d73; }
.rank-J { background: #241c33; color: #e4c27a; }

.corner {
  position: absolute;
  font-family: Fraunces, Palatino, serif;
  font-size: 16px;
}

.corner.tl { top: 8px; left: 8px; }

.pip {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: Fraunces, Palatino, serif;
  font-size: 42px;
  line-height: 1;
}

.pip small {
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 6px;
}

.hand {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  padding: 20px 4px 6px;
  min-height: 182px;
  justify-content: safe center;
}

.card.face { cursor: pointer; flex: 0 0 auto; }

.card.selected {
  transform: translateY(-16px);
  box-shadow: 0 0 0 3px var(--gold), 0 14px 22px rgba(0, 0, 0, 0.32);
}

.card.deal { animation: rise 0.35s ease both; animation-delay: calc(var(--d) * 45ms); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.dock {
  width: 100%;
  margin-top: 12px;
  padding: 14px 14px 16px;
  border-radius: 20px;
  background: rgba(17, 13, 11, 0.94);
  border: 1px solid var(--line);
  text-align: left;
  justify-items: stretch;
}

.dock h2 { font-size: clamp(28px, 4vw, 40px); }

.notice { min-height: 1.2em; margin: 0; color: #f0c2ba; font-size: 14px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.actions .btn { flex: 1 1 160px; }

.logbox {
  text-align: left;
  background: rgba(0, 0, 0, 0.16);
  border-radius: 14px;
  padding: 8px 12px;
}

summary { cursor: pointer; color: var(--gold); }

.log { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }

.log .last { color: var(--ink); }

.reveal-row, .figures {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

figure { margin: 0; }

figcaption { margin-top: 6px; font-size: 13px; }

figcaption.good { color: #b7e0c2; }
figcaption.bad { color: #f0b2aa; }

.card.good { box-shadow: 0 0 0 3px #7dcea0, 0 10px 18px rgba(0, 0, 0, 0.28); }
.card.bad { box-shadow: 0 0 0 3px #e06a5c, 0 10px 18px rgba(0, 0, 0, 0.28); }

.stamp {
  border: 3px solid currentColor;
  padding: 0.15em 0.55em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-6deg);
  font-size: 28px;
}

.stamp.good { color: var(--gold); }
.stamp.bad { color: var(--danger); }

.cylinder {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 38% 32%, #6d655e, #161311 62%);
  box-shadow: inset 0 0 0 8px #3a342e, 0 16px 40px rgba(0, 0, 0, 0.4);
}

.cylinder::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px;
  border-radius: 50%;
  background: #2a2622;
  box-shadow: inset 0 0 0 2px rgba(228, 194, 122, 0.45);
}

.cylinder.spin { animation: spin 1s cubic-bezier(0.15, 0.7, 0.2, 1); }

.cylinder.boom { box-shadow: 0 0 0 6px rgba(224, 106, 92, 0.45), 0 16px 40px rgba(0, 0, 0, 0.4); }

@keyframes spin { to { transform: rotate(720deg); } }

.rotor { position: absolute; inset: 0; transform: rotate(calc(var(--i) * 60deg)); }

.hole {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  border-radius: 50%;
  background: #0c0b0a;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.85);
}

.hole.spent { background: radial-gradient(circle at 35% 35%, #b7aea4, #4a453f); }
.hole.fatal { background: #e06a5c; box-shadow: 0 0 14px #e06a5c; }

.epilogue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  text-align: left;
  width: min(100%, 420px);
}

.epilogue li {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

dialog {
  width: min(520px, calc(100% - 24px));
  background: #1a1411;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
}

dialog h2 { font-size: 40px; margin-bottom: 8px; }

dialog ul { margin: 0 0 16px; padding-left: 18px; color: var(--muted); display: grid; gap: 8px; }

dialog::backdrop { background: rgba(0, 0, 0, 0.66); }

#boot {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

body.flash::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(150, 18, 14, 0.4);
  pointer-events: none;
  animation: fadewash 0.8s ease forwards;
}

@keyframes fadewash { to { opacity: 0; } }

.is-hit h2 { color: #f0b2aa; }
.is-miss h2 { color: var(--gold); }

.stage-wrap {
  width: min(100%, 920px);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.stage-slot {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(228, 194, 122, 0.16), transparent 55%),
    #120e0c;
  box-shadow: inset 0 0 0 1px rgba(228, 194, 122, 0.28);
}

.stage-host {
  position: absolute;
  inset: 0;
}

.stage-host canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-slot.bleeding::before,
.stage-slot.bleeding::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.stage-slot.bleeding::before {
  background:
    radial-gradient(circle at 48% 46%, rgba(176, 14, 20, 0.9) 0 5px, transparent 16px),
    radial-gradient(circle at 56% 40%, rgba(140, 8, 14, 0.85) 0 9px, transparent 26px),
    radial-gradient(circle at 40% 52%, rgba(120, 6, 10, 0.7) 0 4px, transparent 12px),
    radial-gradient(ellipse at 50% 62%, rgba(90, 0, 6, 0.28), transparent 42%);
  animation: splatter 0.28s ease-out both;
}

.stage-slot.bleeding::after {
  background:
    radial-gradient(circle at 52% 44%, rgba(255, 70, 60, 0.55), transparent 18%),
    radial-gradient(circle at 30% 24%, rgba(120, 0, 0, 0.35) 0 4px, transparent 14px),
    radial-gradient(circle at 72% 26%, rgba(150, 10, 14, 0.5) 0 8px, transparent 20px);
  mix-blend-mode: screen;
  animation: splatter 0.18s ease-out both;
}

@keyframes splatter {
  from { opacity: 0; transform: scale(0.72); }
  to { opacity: 1; transform: scale(1); }
}

.cast.names {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.nameplate { text-align: center; min-width: 0; flex: 1 1 0; max-width: 180px; }
.nameplate strong { display: block; font-size: 14px; font-weight: 640; }
.nameplate.mood-turn strong,
.nameplate.mood-win strong { color: var(--gold); }
.nameplate em {
  display: block;
  color: var(--gold);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nameplate span { color: var(--muted); font-size: 11px; }
.nameplate .dots { justify-content: center; }

.actor {
  position: relative;
  flex: 1 1 0;
  width: auto;
  max-width: 150px;
  min-width: 0;
  margin: 0;
  padding-top: 22px;
  text-align: center;
}

.actor.hero { width: min(210px, 52vw); }
.actor.mini { width: 92px; padding-top: 16px; }
.actor.mini figcaption { display: none; }

.actor svg { width: 100%; height: auto; display: block; overflow: visible; }

.actor figcaption { display: grid; justify-items: center; gap: 2px; margin-top: 0; }
.actor figcaption strong { font-size: 14px; font-weight: 640; }
.actor figcaption em { font-style: normal; color: var(--gold); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.actor figcaption span { color: var(--muted); font-size: 11px; }
.actor .dots { justify-content: center; }

.bubble {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: #f4eadc;
  color: #1a120c;
  font-size: 12px;
  font-weight: 640;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.bubble:empty { display: none; }

.mood-doubt .bubble,
.mood-fear .bubble,
.mood-win .bubble,
.mood-miss .bubble,
.mood-caught .bubble,
.mood-smug .bubble,
.mood-play .bubble {
  opacity: 1;
  animation: pop 0.35s ease both;
}

.mood-turn figcaption strong { color: var(--gold); }

.shadow { fill: rgba(0, 0, 0, 0.28); }
.mood-turn .shadow { fill: rgba(228, 194, 122, 0.5); }

.bob {
  transform-box: view-box;
  transform-origin: 80px 190px;
  animation: breathe 2.6s ease-in-out infinite;
  animation-delay: calc(var(--lag, 0) * 0.35s);
}

.head {
  transform-box: view-box;
  transform-origin: 80px 78px;
  animation: look 4.2s ease-in-out infinite;
  animation-delay: calc(var(--lag, 0) * 0.4s);
}

.pupil { animation: glance 3.2s ease-in-out infinite; }
.lid {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4.8s infinite;
  animation-delay: calc(var(--lag, 0) * 0.65s);
}

.mouth.open, .xeye, .sweat { opacity: 0; }

.arm-pivot {
  transform-box: view-box;
  transform-origin: 112px 120px;
}

.you-row {
  display: flex;
  gap: 8px;
  align-items: center;
  text-align: left;
}

.you-row .copy { display: grid; gap: 4px; min-width: 0; }
.you-row h2 { font-size: clamp(28px, 4vw, 40px); }

.mood-play .arm-pivot { animation: toss 0.85s ease; }
.mood-play .cardlet { animation: flycard 0.85s ease forwards; }
.mood-play .bob { animation: none; }

.mood-doubt .mouth.open,
.mood-fear .mouth.open,
.mood-win .mouth.open,
.mood-caught .mouth.open { opacity: 1; }

.mood-doubt .mouth.shut,
.mood-fear .mouth.shut,
.mood-win .mouth.shut,
.mood-caught .mouth.shut { opacity: 0; }

.mood-doubt .head { animation: shout 0.28s ease-in-out infinite; }
.mood-turn .head { animation: nod 1.15s ease-in-out infinite; }
.mood-smug .head { animation: nod 1.4s ease-in-out infinite; }

.mood-fear .sweat { opacity: 1; animation: drip 0.8s ease-in-out infinite; }
.mood-fear .puppet { animation: shake 0.12s linear infinite; }
.mood-fear .bob { animation: none; }

.mood-hit .eye, .mood-out .eye { opacity: 0; }
.mood-hit .xeye, .mood-out .xeye { opacity: 1; }
.mood-hit .puppet { animation: fall 0.7s ease forwards; }
.mood-out .puppet { transform: rotate(10deg) translateY(8px); filter: grayscale(0.75); }
.mood-out .bob, .mood-hit .bob, .mood-out .head, .mood-hit .head, .mood-out .lid, .mood-hit .lid { animation: none; }

.mood-win .puppet { animation: hop 0.55s ease-in-out infinite; }
.mood-win .bob { animation: none; }
.mood-miss .puppet { animation: relief 0.8s ease; }

@keyframes breathe {
  50% { transform: translateY(2px) scale(1.03, 0.98); }
}

@keyframes look {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

@keyframes glance {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2px, 1px); }
}

@keyframes blink {
  0%, 90%, 100% { transform: scaleY(0.05); }
  94%, 97% { transform: scaleY(1); }
}

@keyframes nod {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(3px) rotate(4deg); }
}

@keyframes shout {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes toss {
  0% { transform: rotate(0deg); }
  45% { transform: rotate(-58deg); }
  100% { transform: rotate(-12deg); }
}

@keyframes flycard {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(-36px, -78px) rotate(-24deg); opacity: 0; }
}

@keyframes pop {
  from { transform: translateX(-50%) scale(0.6); }
  to { transform: translateX(-50%) scale(1); }
}

@keyframes drip {
  50% { transform: translateY(10px); opacity: 0.35; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes fall {
  to { transform: translateY(18px) rotate(16deg); opacity: 0.55; }
}

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes relief {
  40% { transform: translateY(5px) scale(0.96, 1.05); }
  100% { transform: none; }
}

@media (max-width: 700px) {
  .card { width: 84px; height: 122px; }
  .pip { font-size: 32px; }
  .hand { min-height: 148px; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; flex-basis: auto; }
  h1 { font-size: 72px; }
  .stage-slot { height: 250px; }
  .actor figcaption em,
  .actor figcaption span { display: none; }
  .bubble { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
