:root {
  --ink: #171913;
  --cream: #f1e7cf;
  --paper: #fffaf0;
  --green: #173e32;
  --green-dark: #0d2d24;
  --acid: #d3e34b;
  --red: #b12b31;
  --gold: #c89b45;
  --line: rgba(241, 231, 207, 0.22);
  --display: "Bodoni 72", "Didot", "Iowan Old Style", Georgia, serif;
  --body: "Avenir Next Condensed", "Gill Sans", sans-serif;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

#app {
  min-height: 100vh;
  overflow-anchor: none;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--cream);
  font-family: var(--body);
}

button, input, select { font: inherit; }
button { color: inherit; }

.play-mode-nav {
  position: fixed;
  z-index: 1000;
  top: 14px;
  right: 14px;
  display: flex;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}
.play-mode-nav a {
  padding: 8px 12px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
}
.play-mode-nav a + a { border-left: 2px solid var(--ink); }
.play-mode-nav a.active { background: var(--acid); }

.setup-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(380px, 0.75fr) 170px;
  gap: clamp(30px, 5vw, 88px);
  align-items: center;
  padding: clamp(28px, 5vw, 84px);
  overflow: hidden;
  position: relative;
}

.setup-shell::before {
  content: "";
  position: absolute;
  width: 52vw;
  aspect-ratio: 1;
  left: -24vw;
  top: -20vw;
  border: 1px solid rgba(23, 25, 19, 0.17);
  border-radius: 50%;
  box-shadow: 0 0 0 4vw var(--cream), 0 0 0 calc(4vw + 1px) rgba(23, 25, 19, 0.17), 0 0 0 12vw var(--cream), 0 0 0 calc(12vw + 1px) rgba(23, 25, 19, 0.17);
  pointer-events: none;
}

.masthead { position: relative; z-index: 1; }
.edition, .kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.masthead h1 {
  margin: 28px 0 18px;
  font-family: var(--display);
  font-size: clamp(76px, 10vw, 160px);
  font-weight: 400;
  line-height: 0.72;
  letter-spacing: -0.075em;
}
.masthead h1 span {
  display: block;
  color: var(--red);
  font-style: italic;
  transform: translateX(-0.06em);
}
.lede { max-width: 440px; font-family: var(--display); font-size: clamp(18px, 2vw, 27px); line-height: 1.25; }

.setup-card {
  position: relative;
  z-index: 2;
  padding: clamp(24px, 4vw, 48px);
  background: var(--green);
  color: var(--cream);
  box-shadow: 20px 24px 0 var(--ink);
}
.setup-heading { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 8px; }
.setup-heading > span { color: var(--acid); font-weight: 800; }
.setup-heading p, .setup-heading h2 { margin: 0; }
.setup-heading p { opacity: 0.6; font-size: 13px; text-transform: uppercase; letter-spacing: 0.13em; }
.setup-heading h2 { font-family: var(--display); font-weight: 400; font-size: 32px; }
.name-row { display: grid; grid-template-columns: 26px 1fr 34px; align-items: center; border-bottom: 1px solid var(--line); }
.name-row > span { color: var(--acid); font-size: 11px; }
.name-row input { width: 100%; padding: 15px 0; border: 0; outline: 0; background: transparent; color: var(--paper); font-size: 19px; }
.human-name { grid-template-columns: 42px 1fr; }
.solo-setup { padding-top: 4px; }
.bot-picker { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.bot-picker > span { color: rgba(241,231,207,.65); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.bot-picker > div { display: flex; gap: 5px; }
.bot-count { width: 30px; height: 30px; border: 1px solid var(--line); background: transparent; color: var(--cream); cursor: pointer; }
.bot-count.active { border-color: var(--acid); background: var(--acid); color: var(--ink); font-weight: 900; }
.bot-roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 14px 0 2px; }
.bot-roster > div { min-width: 0; padding: 9px 6px; border: 1px solid var(--line); text-align: center; }
.bot-roster b, .bot-roster small { display: block; overflow: hidden; text-overflow: ellipsis; }
.bot-roster b { margin-top: 5px; font-family: var(--display); font-size: 14px; font-weight: 400; }
.bot-roster small { margin-top: 2px; opacity: .5; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.bot-face { display: grid; place-items: center; width: 28px; height: 28px; margin: auto; border: 1px solid var(--acid); border-radius: 50%; color: var(--acid); font-family: var(--display); font-size: 16px; }
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 14px; }
.mode-picker button { min-height: 58px; border: 1px solid var(--line); padding: 9px 11px; background: transparent; color: var(--cream); text-align: left; cursor: pointer; }
.mode-picker button.active { border-color: var(--acid); background: rgba(211,227,75,.1); box-shadow: inset 3px 0 0 var(--acid); }
.mode-picker b, .mode-picker span { display: block; }
.mode-picker b { color: var(--acid); text-transform: uppercase; letter-spacing: .1em; font-size: 10px; }
.mode-picker span { margin-top: 4px; opacity: .58; font-size: 9px; line-height: 1.25; }
.icon-button { border: 0; background: none; color: var(--cream); font-size: 24px; cursor: pointer; opacity: 0.6; }
button:disabled { cursor: not-allowed !important; opacity: 0.3 !important; }
.text-button { border: 0; background: none; padding: 14px 0; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; font-weight: 700; }
.setup-card .text-button { color: var(--cream); }
.setup-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0 24px; }
.setup-options label > span { display: block; margin-bottom: 7px; color: rgba(241,231,207,0.6); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.setup-options select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 0; background: var(--green-dark); color: var(--cream); }
.static-option { min-height: 43px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); background: var(--green-dark); color: var(--cream); font-size: 12px; }
.primary-button, .secondary-button {
  min-height: 52px;
  border: 1px solid var(--ink);
  padding: 0 20px;
  background: var(--acid);
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled) { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); }
.deal-button { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.deal-button span, .play-button span { font-size: 22px; }
.rule-strip { border-left: 1px solid rgba(23, 25, 19, 0.25); padding-left: 25px; }
.rule-strip p { font-size: 12px; line-height: 1.35; padding: 15px 0; margin: 0; border-bottom: 1px solid rgba(23, 25, 19, 0.2); }
.rule-strip b { display: block; font-family: var(--display); font-size: 28px; color: var(--red); }

.game-surface {
  min-height: 100vh;
  color: var(--cream);
  background-color: var(--green);
  background-image: radial-gradient(circle at 50% 40%, rgba(65, 117, 90, 0.34), transparent 45%), repeating-linear-gradient(115deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 5px);
  position: relative;
  overflow: hidden;
}
.game-surface::before {
  content: "";
  position: fixed;
  inset: 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  pointer-events: none;
}
.game-header { position: relative; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 28px 42px; border-bottom: 1px solid var(--line); }
.mini-logo { font-family: var(--display); font-size: 26px; letter-spacing: -0.04em; }
.mini-logo span { color: var(--acid); font-style: italic; }
.dealer-stamp, .round-data { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; }
.round-data { display: flex; gap: 28px; }

.ritual-shell { display: grid; grid-template-columns: 1fr 1.35fr; grid-template-rows: auto 1fr auto; }
.ritual-shell .game-header { grid-column: 1 / -1; }
.ritual-copy { padding: clamp(40px, 8vw, 110px); align-self: center; }
.ritual-copy .kicker, .race-copy .kicker, .verdict .kicker { color: var(--acid); }
.ritual-copy h1, .race-copy h1, .verdict h1 { margin: 12px 0 20px; font-family: var(--display); font-weight: 400; font-size: clamp(62px, 8vw, 118px); line-height: 0.82; letter-spacing: -0.06em; }
.ritual-copy > p:last-child, .race-copy > p:last-child, .verdict > p:last-child { max-width: 440px; opacity: 0.72; font-size: 16px; line-height: 1.5; }
.packets { align-self: center; display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 18px; padding: 40px 8vw 40px 0; }
.packet { min-height: 150px; border: 1px solid var(--line); background: rgba(0,0,0,0.1); color: var(--cream); cursor: pointer; text-align: left; padding: 18px; position: relative; transition: background 160ms, transform 160ms; }
.packet:hover { background: rgba(211, 227, 75, 0.08); transform: rotate(-1deg); }
.packet b, .packet small { display: block; margin-left: 76px; }
.packet b { margin-top: 22px; font-family: var(--display); font-size: 23px; }
.packet small { opacity: 0.55; margin-top: 5px; }
.packet.dealer { border-color: var(--acid); }
.packet.bot-packet { cursor: default; opacity: .76; }
.packet.bot-packet:hover { background: rgba(0,0,0,.1); transform: none; }
.card-back {
  display: block;
  border: 5px solid var(--paper);
  border-radius: 8px;
  background-color: var(--red);
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, rgba(255,255,255,.15) 0 1px, transparent 1px 6px);
  box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 3px rgba(255,255,255,0.7), 3px 5px 8px rgba(0,0,0,0.25);
}
.mini-back { position: absolute; width: 58px; height: 83px; left: 19px; top: 28px; transform: rotate(-7deg); }
.mini-back.second { transform: rotate(3deg); left: 27px; }
.count-button { grid-column: 1 / -1; margin: 0 auto 34px; min-width: 260px; border: 1px solid var(--acid); padding: 18px 30px; background: transparent; color: var(--acid); cursor: pointer; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; }
.count-button span { display: block; color: var(--cream); opacity: 0.55; font-size: 9px; margin-bottom: 5px; }
.event-log { border-left: 1px solid var(--line); padding: 18px 26px; }
.event-log h2 { margin: 0 0 10px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--acid); }
.event-log ol { margin: 0; padding: 0; list-style: none; }
.event-log li { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px solid rgba(241,231,207,0.1); font-size: 12px; line-height: 1.35; opacity: 0.65; }
.event-log li:first-child { opacity: 1; }
.event-log li > span { flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; margin-top: 5px; background: var(--cream); }
.event-log li.good > span, .event-log li.shout > span { background: var(--acid); }
.event-log li.bad > span { background: #f35b63; }
.event-log li.shout { color: var(--acid); font-weight: 900; letter-spacing: 0.08em; }
.ritual-log { position: absolute; right: 28px; bottom: 80px; width: 310px; max-height: 180px; overflow: hidden; }
.countdown { display: none; position: fixed; inset: 0; z-index: 20; place-items: center; background: rgba(12, 38, 30, 0.94); font-family: var(--display); font-size: min(42vw, 460px); }
.countdown.active { display: grid; }
.countdown span { animation: count-in 650ms ease both; color: var(--cream); }
.countdown strong { font-family: var(--body); color: var(--acid); font-size: min(20vw, 250px); transform: rotate(-5deg); }
@keyframes count-in { from { transform: scale(1.8) rotate(10deg); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.race-shell { display: grid; grid-template-columns: 1.05fr 1fr 300px; }
.race-shell.normal-race { grid-template-columns: 1.05fr 1fr; }
.race-shell .game-header { grid-column: 1 / -1; }
.race-copy { padding: 10vh 7vw; }
.claim-grid { display: grid; align-content: center; gap: 10px; padding: 50px 40px 50px 0; }
.claim-button { display: grid; grid-template-columns: 45px 1fr; align-items: center; min-height: 66px; border: 1px solid var(--line); background: rgba(0,0,0,0.08); color: var(--cream); text-align: left; padding: 0 22px; font-family: var(--display); font-size: 24px; cursor: pointer; transition: 120ms ease; }
.claim-button span { font-family: var(--body); font-size: 10px; color: var(--acid); }
.claim-button:hover { background: var(--acid); color: var(--ink); transform: translateX(-8px); }
.claim-button:hover span { color: var(--red); }
.claim-button.nobody { margin-top: 12px; border-style: dashed; font-family: var(--body); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.claim-button.checked { text-decoration: line-through; }
.race-shell > .event-log { padding-top: 10vh; }
.bot-race { align-self: center; padding: 40px 55px 40px 0; }
.racing-bots { display: flex; justify-content: center; gap: 14px; margin-bottom: 42px; }
.racing-bots > div { min-width: 74px; text-align: center; }
.racing-bots b, .racing-bots small { display: block; }
.racing-bots b { margin-top: 6px; font-family: var(--display); font-size: 16px; font-weight: 400; }
.racing-bots small { margin-top: 2px; opacity: .5; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.racing-bots small.searching { color: var(--acid); animation: blink 900ms alternate infinite; }
.grab-button { width: min(330px, 100%); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: auto; border: 8px double var(--ink); border-radius: 50%; background: var(--acid); color: var(--ink); cursor: pointer; box-shadow: 12px 15px 0 rgba(0,0,0,.32); transition: 120ms ease; }
.grab-button:hover:not(:disabled) { transform: translate(3px, 4px); box-shadow: 9px 11px 0 rgba(0,0,0,.32); }
.grab-button span { font-family: var(--display); font-size: clamp(50px, 7vw, 86px); line-height: .9; }
.grab-button small { margin-top: 12px; text-transform: uppercase; letter-spacing: .16em; font-weight: 900; }
.grab-button.missed { border-color: var(--line); background: transparent; color: var(--cream); border-style: dashed; border-width: 1px; box-shadow: none; }
.grab-button.missed span { max-width: 210px; font-family: var(--body); font-size: 16px; text-transform: uppercase; letter-spacing: .1em; }
.race-hand { width: min(620px, 100%); margin: auto; text-align: center; }
.race-hand > p { margin: 0 0 18px; color: var(--acid); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 900; }
.race-hand > div { min-height: 170px; display: flex; justify-content: center; align-items: end; overflow-x: auto; padding: 28px 15px 8px; }
.race-hand .playing-card { margin-left: -42px; }
.race-hand .playing-card:first-child { margin-left: 0; }
.race-hand .playing-card:not(:disabled) { animation: ten-pulse 600ms alternate infinite; }
.normal-race .race-hand .playing-card:not(:disabled) { animation: none; }
.slam-button { min-width: 220px; margin-top: 24px; }
.race-decisions { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 24px; }
.race-decisions .slam-button { margin-top: 0; }
.opening-drop { position: relative; width: 84px; height: 118px; margin: -22px auto 8px; }
.opening-drop .empty-discard { width: 84px; height: 118px; color: rgba(241,231,207,.5); }
.opening-drop.drop-ready::before { content: ""; position: absolute; z-index: 8; inset: -13px; border: 2px dashed var(--acid); border-radius: 14px; box-shadow: 0 0 34px rgba(211,227,75,.26); animation: drop-pulse 500ms alternate infinite; }
.hold-only { min-height: 38px; margin-top: 12px; padding: 0 14px; box-shadow: 3px 3px 0 var(--ink); font-size: 9px; }
@keyframes ten-pulse { to { transform: translateY(-8px); box-shadow: 0 12px 25px rgba(211,227,75,.35); } }
@keyframes blink { to { opacity: .2; } }

.rules-drawer { position: fixed; z-index: 60; right: 28px; bottom: 24px; }
.rules-drawer > summary { list-style: none; display: flex; align-items: center; gap: 9px; padding: 10px 12px 10px 16px; border: 1px solid currentColor; background: var(--cream); color: var(--ink); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 900; cursor: pointer; box-shadow: 4px 4px 0 var(--ink); }
.rules-drawer > summary::-webkit-details-marker { display: none; }
.rules-drawer > summary span { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--red); color: white; }
.rules-sheet { position: absolute; right: 0; bottom: 46px; width: min(440px, calc(100vw - 40px)); max-height: min(680px, calc(100vh - 100px)); overflow-y: auto; padding: 30px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); }
.table-shell .rules-drawer { top: 22px; bottom: auto; }
.table-shell.easy-table .rules-drawer { top: 82px; }
.table-shell .rules-sheet { top: 46px; bottom: auto; }
.rules-title { display: flex; align-items: baseline; gap: 12px; padding-bottom: 14px; border-bottom: 3px double var(--ink); }
.rules-title p { margin: 0; color: var(--red); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .13em; }
.rules-title h2 { margin: 0; font-family: var(--display); font-size: 34px; font-weight: 400; }
.rules-sheet section { padding: 16px 0; border-bottom: 1px solid rgba(23,25,19,.2); }
.rules-sheet h3 { margin: 0 0 8px; font-family: var(--display); font-size: 20px; font-weight: 400; }
.rules-sheet p { font-size: 12px; line-height: 1.45; }
.special-list p { display: grid; grid-template-columns: 35px 1fr; gap: 8px; margin: 9px 0; }
.special-list b { font-family: var(--display); font-size: 20px; color: var(--red); }
.fine-print { margin-bottom: 0; font-style: italic; opacity: .68; }

.table-shell { display: grid; grid-template-columns: 1fr 270px; grid-template-rows: auto auto minmax(220px, 1fr) auto; min-height: 100vh; }
.table-shell.normal-table { grid-template-columns: 1fr; grid-template-rows: auto minmax(400px, 1fr) auto; }
.table-shell .game-header { grid-column: 1 / -1; }
.normal-table .game-header { border-bottom: 0; padding-bottom: 12px; }
.opponents { grid-column: 1 / -1; display: flex; justify-content: center; gap: clamp(12px, 4vw, 62px); padding: 18px 34px; border-bottom: 1px solid var(--line); }
.normal-table .opponents-table { grid-column: 1; grid-row: 2; z-index: 3; position: relative; display: block; padding: 0; border: 0; overflow: visible; pointer-events: none; }
.opponents-table .opponent { position: absolute; width: 140px; min-width: 0; }
.opponents-table .seat-north { left: 50%; top: 4%; transform: translateX(-50%); }
.opponents-table .seat-northwest { left: 27%; top: 8%; transform: translateX(-50%); }
.opponents-table .seat-northeast { left: 73%; top: 8%; transform: translateX(-50%); }
.opponents-table .seat-west { left: 2%; top: 48%; transform: translateY(-50%); }
.opponents-table .seat-east { right: 2%; top: 48%; transform: translateY(-50%); }
.opponents-table .seat-west-high { left: 7%; top: 18%; }
.opponents-table .seat-west-low { left: 2%; top: 64%; }
.opponents-table .seat-east-high { right: 7%; top: 18%; }
.opponents-table .seat-east-low { right: 2%; top: 64%; }
.opponent { min-width: 90px; text-align: center; opacity: 0.7; position: relative; }
.opponent.current { opacity: 1; color: var(--acid); }
.opponent.current::after { content: ""; position: absolute; width: 6px; height: 6px; background: var(--acid); border-radius: 50%; left: 50%; top: -22px; }
.normal-table .opponent.current::after { top: auto; bottom: -13px; box-shadow: 0 0 14px var(--acid); }
.normal-table .opponent.current .opponent-hand { filter: drop-shadow(0 0 8px rgba(211,227,75,.34)); }
.opponent.drawing .opponent-stack, .opponent.drawing .opponent-hand { animation: opponent-draw 650ms cubic-bezier(.2,.8,.2,1); }
.opponent.drawing b { color: var(--acid); }
@keyframes opponent-draw { 0% { transform: translateY(-35px) scale(.7); opacity: .2; } 65% { transform: translateY(5px) scale(1.12); } 100% { transform: none; opacity: 1; } }
.opponent.finished { opacity: 0.32; }
.opponent b, .opponent small { display: block; }
.opponent b { font-family: var(--display); font-size: 16px; margin-top: 4px; }
.opponent small { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; }
.opponent-stack { height: 24px; display: flex; justify-content: center; }
.opponent-stack span { width: 17px; height: 24px; margin-left: -8px; border: 2px solid var(--paper); border-radius: 2px; background: var(--red); transform: rotate(-9deg); }
.opponent-stack span:nth-child(2) { transform: rotate(0); }
.opponent-stack span:nth-child(3) { transform: rotate(9deg); }
.opponent-hand { min-height: 36px; display: grid; justify-items: center; align-content: end; gap: 3px; }
.opponent-card-row { height: 34px; display: flex; justify-content: center; padding-right: 12px; }
.opponent-card-row .card-back { position: relative; z-index: calc(var(--card) + 1); flex: 0 0 23px; width: 23px; height: 34px; margin-right: -12px; border-width: 2px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--red), inset 0 0 0 2px rgba(255,255,255,.65), 2px 3px 5px rgba(0,0,0,.24); transform: rotate(calc((var(--card) - 4.5) * .65deg)); transform-origin: 50% 120%; }
.opponent.current .opponent-card-row .card-back { border-color: var(--acid); }
.table-center { display: flex; align-items: center; justify-content: center; gap: clamp(35px, 7vw, 110px); min-height: 260px; }
.normal-table .table-center { grid-column: 1; grid-row: 2; z-index: 1; position: relative; min-height: 400px; }
.normal-table .table-center::before { content: ""; position: absolute; inset: 7% 11%; border: 1px solid rgba(241,231,207,.12); border-radius: 50%; box-shadow: inset 0 0 70px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.08); pointer-events: none; }
.normal-table .table-center > * { z-index: 1; }
.deck-zone, .discard-zone { position: relative; text-align: center; font-size: 9px; text-transform: uppercase; letter-spacing: .13em; opacity: .95; }
.discard-zone.drop-ready::before { content: "DROP TO TRY"; position: absolute; z-index: 8; inset: -15px; display: grid; place-items: center; border: 2px dashed var(--acid); background: rgba(13,45,36,.88); color: var(--acid); font-weight: 900; animation: drop-pulse 500ms alternate infinite; }
.normal-table .discard-zone.drop-ready::before { content: ""; inset: -22px; border-radius: 16px; background: rgba(211,227,75,.035); box-shadow: 0 0 42px rgba(211,227,75,.24), inset 0 0 28px rgba(211,227,75,.08); }
.discard-zone.drop-impact::after, .opening-drop.drop-impact::after { content: ""; position: absolute; z-index: 9; inset: -24px; border: 2px solid var(--acid); border-radius: 18px; pointer-events: none; animation: table-impact 360ms cubic-bezier(.18,.8,.2,1) both; }
@keyframes drop-pulse { to { transform: scale(1.05); } }
@keyframes table-impact { from { transform: scale(.72); opacity: 1; } to { transform: scale(1.28); opacity: 0; } }
.deck-zone > span, .discard-zone > span { display: block; margin-top: 13px; }
.draw-stack { position: relative; width: 104px; height: 146px; }
.draw-stack::after { content: ""; position: absolute; z-index: 11; left: 7px; width: 100%; bottom: calc(0px - var(--deck-depth)); height: var(--deck-depth); min-height: 3px; border: 1px solid rgba(23,25,19,.36); border-top: 0; border-radius: 0 0 7px 7px; background: repeating-linear-gradient(to bottom, #f2e8d2 0 1px, #b7ad99 1px 2px, #e5dac4 2px 3px); box-shadow: 3px 5px 8px rgba(0,0,0,.2); }
.draw-stack .deck-layer { position: absolute; inset: 0; z-index: calc(10 - var(--layer)); width: 104px; height: 146px; border-color: #e4dac4; transform: translate(var(--layer-x), var(--layer-y)); box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 3px rgba(255,255,255,.65), 0 2px 0 rgba(22,24,18,.32); }
.draw-deck { position: absolute; inset: 0; z-index: 12; width: 104px; height: 146px; cursor: pointer; }
.deck-count { position: absolute; right: -10px; top: -10px; z-index: 30; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--acid); color: var(--ink); font-weight: 900; }
.declared-suit { position: absolute; right: -14px; bottom: -14px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--green); background: var(--cream); color: var(--ink); font-style: normal; font-size: 21px; box-shadow: 5px 6px 0 rgba(0,0,0,.25); }
.declared-suit.red { color: var(--red); }
.direction-mark { font-size: 72px; color: rgba(241,231,207,.18); transition: transform .3s; }
.direction-mark.reversed { transform: scaleX(-1); }
.empty-discard { width: 104px; height: 146px; display: grid; place-content: center; border: 1px dashed rgba(241,231,207,.35); border-radius: 8px; font-family: var(--display); font-size: 30px; }
.empty-discard small { font-family: var(--body); font-size: 8px; }
.empty-discard.bare { border-color: rgba(241,231,207,.16); background: rgba(0,0,0,.035); }
.discard-stack { position: relative; width: 104px; height: 146px; }
.discard-card { position: absolute; inset: 0; z-index: var(--stack); transform: translate(var(--offset-x), var(--offset-y)) rotate(var(--tilt)); transform-origin: 50% 55%; transition: transform 180ms ease; }
.discard-card:not(.top) { filter: brightness(.82) saturate(.84); }
.discard-card > .playing-card.small { position: absolute; inset: 0; width: 104px; height: 146px; opacity: 1 !important; }
.discard-card.top > .playing-card { box-shadow: 0 10px 18px rgba(0,0,0,.34); }
.table-log { grid-column: 2; grid-row: 3; overflow: hidden; }
.hand-area { grid-column: 1 / -1; position: relative; border-top: 1px solid var(--line); background: rgba(5, 25, 19, .45); padding: 18px 34px 28px; min-height: 300px; }
.turn-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; max-width: 1300px; margin: 0 auto 12px; }
.turn-heading span { color: var(--acid); font-size: 9px; text-transform: uppercase; letter-spacing: .15em; }
.turn-heading h1 { display: inline; margin: 0 0 0 8px; font-family: var(--display); font-size: 31px; font-weight: 400; }
.turn-heading p { max-width: 500px; margin: 0; opacity: .58; font-size: 12px; text-align: right; }
.hand { min-height: 170px; display: flex; justify-content: center; align-items: end; padding: 10px 0 0; overflow-x: auto; overflow-y: hidden; }
.playing-card {
  flex: 0 0 104px;
  width: 104px;
  height: 146px;
  margin-left: clamp(-44px, calc((100vw - 940px) / max(var(--cards, 7), 1)), -8px);
  position: relative;
  border: 1px solid #cfc6b2;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(0,0,0,.3);
  cursor: pointer;
  transition: transform 150ms ease, margin 150ms ease;
}
.playing-card:first-child { margin-left: 0; }
.playing-card:hover:not(:disabled) { transform: translateY(-13px) rotate(-1deg); z-index: 3; }
.playing-card.selected { transform: translateY(-24px); border: 3px solid var(--acid); z-index: 4; }
.playing-card[data-can-drag="true"], .draw-deck[data-can-drag="true"] { cursor: grab; touch-action: none; }
.playing-card.dragging { opacity: .28; transform: translateY(-30px) rotate(5deg); }
.drag-ghost { position: fixed !important; z-index: 100 !important; margin: 0 !important; pointer-events: none !important; transform: translate(-50%, -50%) rotate(5deg) scale(.9) !important; opacity: .88 !important; box-shadow: 12px 16px 28px rgba(0,0,0,.42) !important; }
.drag-ghost[data-stack-count] { box-shadow: 5px 5px 0 var(--cream), 10px 10px 0 var(--red), 18px 22px 32px rgba(0,0,0,.46) !important; }
.drag-ghost[data-stack-count]::after { content: attr(data-stack-count); position: absolute; right: -18px; top: -18px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--acid); color: var(--ink); font-family: var(--body); font-size: 13px; font-style: normal; font-weight: 900; }
.playing-card.fresh { animation: fresh-card 720ms cubic-bezier(.18,.8,.24,1) both; }
@keyframes fresh-card { from { transform: translate(-35vw, -36vh) rotate(-18deg) scale(.65); opacity: 0; } 75% { transform: translateY(-10px) rotate(2deg); } to { transform: none; opacity: 1; } }
.playing-card.small { margin: 0; cursor: default; }
.playing-card.red { color: var(--red); }
.corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .9; }
.corner b { font-family: var(--display); font-size: 20px; }
.corner i { font-style: normal; font-size: 15px; }
.corner.top { left: 9px; top: 9px; }
.corner.bottom { right: 9px; bottom: 9px; transform: rotate(180deg); }
.pip { font-family: var(--display); font-size: 46px; }
.empty-hand { margin: auto; font-family: var(--display); font-size: 20px; opacity: .65; }
.bot-thinking { min-height: 210px; display: grid; place-content: center; text-align: center; overflow: hidden; }
.thinking-cards { display: flex; justify-content: center; padding-left: 26px; }
.thinking-cards .card-back { width: 66px; height: 94px; margin-left: -26px; transform: rotate(calc((var(--i, 0) - 3) * 2deg)); }
.bot-thinking p { margin: 20px 0 0; color: var(--acid); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; }
.bot-thinking p i { display: inline-block; width: 5px; height: 5px; margin-right: 3px; border-radius: 50%; background: var(--acid); animation: think-dot 800ms infinite alternate; }
.bot-thinking p i:nth-child(2) { animation-delay: 180ms; }
.bot-thinking p i:nth-child(3) { animation-delay: 360ms; }
@keyframes think-dot { to { opacity: .2; transform: translateY(-4px); } }
.hand-area.draw-ready { box-shadow: inset 0 0 0 3px var(--acid); background: rgba(211,227,75,.08); }
.card-flight { position: absolute; z-index: 35; left: 33%; top: 39%; display: grid; justify-items: center; pointer-events: none; }
.card-flight .card-back, .card-flight > .playing-card { width: 74px; height: 104px; margin: 0; }
.card-flight b { margin-top: 9px; padding: 6px 9px; background: var(--acid); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 9px; letter-spacing: .11em; white-space: nowrap; }
.card-flight.pickup { left: var(--from-x); top: var(--from-y); opacity: 0; }
.card-flight.pickup.flight-active { animation: routed-pickup 950ms cubic-bezier(.2,.72,.22,1) both; }
.card-flight.played.to-human { animation: play-human 950ms cubic-bezier(.2,.72,.22,1) both; }
.card-flight.played.to-bot { animation: play-bot 950ms cubic-bezier(.2,.72,.22,1) both; }
.normal-table .card-flight b { display: none; }
@keyframes routed-pickup {
  0% { left: var(--from-x); top: var(--from-y); transform: translate(-50%,-50%) rotate(-11deg) scale(.68); opacity: 0; }
  16% { opacity: 1; }
  72% { opacity: 1; }
  100% { left: var(--to-x); top: var(--to-y); transform: translate(-50%,-50%) rotate(7deg) scale(.58); opacity: 0; }
}
@keyframes play-human { 0% { transform: translate(25vw,45vh) rotate(8deg); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(22vw,2vh) rotate(-4deg) scale(.8); opacity: 0; } }
@keyframes play-bot { 0% { transform: translate(24vw,-28vh) rotate(-8deg); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(22vw,2vh) rotate(4deg) scale(.8); opacity: 0; } }
.action-bar { max-width: 1300px; margin: 12px auto 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.normal-table .hand-area { grid-column: 1; grid-row: 3; min-height: 250px; padding-top: 26px; background: linear-gradient(180deg, rgba(5,25,19,.18), rgba(5,25,19,.62)); }
.normal-table .hand-area.human-turn { box-shadow: inset 0 2px 0 rgba(211,227,75,.72); }
.normal-table .hand { min-height: 150px; }
.normal-table.bot-active .hand .playing-card { pointer-events: none; cursor: default; }
.normal-table .bot-thinking { min-height: 170px; }
.normal-actions { margin-top: 18px; }
.call-buttons { display: flex; gap: 8px; }
.call-button { border: 1px solid var(--line); padding: 12px 15px; background: transparent; color: var(--cream); cursor: pointer; text-transform: uppercase; font-size: 10px; letter-spacing: .09em; }
.call-button.active { background: var(--acid); color: var(--ink); border-color: var(--acid); }
.call-button.piss.active { background: var(--red); color: white; border-color: var(--red); }
.main-actions { display: flex; justify-content: end; gap: 11px; }
.secondary-button { background: var(--cream); }
.validation { grid-column: 1 / -1; margin: 0; text-align: center; opacity: .55; font-size: 10px; letter-spacing: .04em; }
.validation.error { color: #ff8c91; opacity: 1; }
.suit-picker { display: flex; border: 1px solid var(--line); }
.suit-picker button { width: 38px; height: 38px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--cream); cursor: pointer; font-size: 21px; }
.suit-picker button:last-child { border: 0; }
.suit-picker button.red { color: #ff6c72; }
.suit-picker button.active { background: var(--cream); color: var(--ink); }
.privacy-cover { position: absolute; inset: 0; z-index: 8; border: 0; background: var(--green-dark); color: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.privacy-cover::before { content: ""; position: absolute; inset: 13px; border: 1px dashed var(--line); }
.privacy-cover span, .privacy-cover small { text-transform: uppercase; letter-spacing: .15em; font-size: 9px; opacity: .55; }
.privacy-cover strong { margin: 8px 0; font-family: var(--display); font-size: 42px; font-weight: 400; color: var(--acid); }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 34px; padding: 13px 20px; background: var(--ink); color: var(--paper); font-size: 13px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: 180ms ease; box-shadow: 5px 5px 0 var(--red); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.gameover-shell { display: grid; grid-template-columns: 1fr 360px; grid-template-rows: auto 1fr auto; }
.gameover-shell .game-header { grid-column: 1 / -1; }
.verdict { align-self: center; padding: 60px 9vw; }
.loser-card { width: min(52vw, 520px); aspect-ratio: 1.6; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 8px double var(--cream); border-radius: 18px; background: var(--red); box-shadow: 18px 18px 0 rgba(0,0,0,.3); transform: rotate(-2deg); }
.loser-card span { font-size: 11px; letter-spacing: .45em; font-weight: 900; }
.loser-card strong { font-family: var(--display); font-size: clamp(42px, 7vw, 88px); font-weight: 400; }
.verdict h1 { font-size: clamp(36px, 5vw, 68px); margin-top: 38px; }
.results { align-self: center; border-left: 1px solid var(--line); padding: 35px; }
.results h2 { font-family: var(--display); font-weight: 400; }
.results ol { list-style: none; padding: 0; }
.results li { display: grid; grid-template-columns: 35px 1fr auto; padding: 15px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.results li > span { color: var(--acid); font-size: 11px; }
.results li b { font-family: var(--display); font-size: 21px; font-weight: 400; }
.results li small { opacity: .5; text-transform: uppercase; font-size: 9px; letter-spacing: .1em; }
.gameover-actions { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 30px; padding: 28px; border-top: 1px solid var(--line); }
.gameover-actions .text-button { color: var(--cream); }

@media (max-width: 960px) {
  .setup-shell { grid-template-columns: 1fr 1fr; align-items: start; }
  .rule-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); border-left: 0; border-top: 1px solid; padding: 0; }
  .rule-strip p { padding-right: 15px; }
  .race-shell { grid-template-columns: 1fr 1fr; }
  .race-shell > .event-log { display: none; }
  .table-shell { grid-template-columns: 1fr; }
  .table-log { display: none; }
  .action-bar { grid-template-columns: 1fr 1fr; }
  .suit-picker { grid-row: 2; }
}

@media (max-width: 680px) {
  .setup-shell { display: block; padding: 45px 24px; }
  .masthead { margin-bottom: 42px; }
  .masthead h1 { font-size: 88px; }
  .setup-card { box-shadow: 10px 12px 0 var(--ink); }
  .rule-strip { margin-top: 50px; grid-template-columns: 1fr 1fr; }
  .game-header { padding: 24px; }
  .round-data span:first-child { display: none; }
  .round-data { gap: 12px; font-size: 8px; }
  .ritual-shell, .race-shell { display: block; }
  .ritual-copy, .race-copy { padding: 50px 28px 20px; }
  .ritual-copy h1, .race-copy h1 { font-size: 65px; }
  .packets, .claim-grid, .bot-race { padding: 20px 28px 110px; }
  .grab-button { width: 230px; }
  .race-hand .playing-card { flex-basis: 72px; width: 72px; height: 102px; margin-left: -30px; }
  .ritual-log { display: none; }
  .count-button { position: fixed; z-index: 10; bottom: 18px; left: 50%; transform: translateX(-50%); margin: 0; background: var(--green-dark); }
  .opponents { justify-content: flex-start; overflow-x: auto; padding: 16px 28px; }
  .opponent { min-width: 72px; }
  .table-center { min-height: 230px; gap: 30px; }
  .table-shell.normal-table { grid-template-rows: auto minmax(330px, 1fr) auto; }
  .normal-table .opponents-table { display: block; padding: 0; overflow: visible; }
  .opponents-table .opponent { width: 88px; min-width: 0; }
  .opponents-table .seat-north { top: 2%; }
  .opponents-table .seat-northwest { left: 27%; top: 5%; }
  .opponents-table .seat-northeast { left: 73%; top: 5%; }
  .opponents-table .seat-west { left: 0; top: 47%; }
  .opponents-table .seat-east { right: 0; top: 47%; }
  .opponents-table .seat-west-high { left: 1%; top: 18%; }
  .opponents-table .seat-west-low { left: 0; top: 65%; }
  .opponents-table .seat-east-high { right: 1%; top: 18%; }
  .opponents-table .seat-east-low { right: 0; top: 65%; }
  .opponents-table .opponent b { font-size: 12px; }
  .opponent-hand { min-height: 29px; gap: 2px; }
  .opponent-card-row { height: 28px; padding-right: 9px; }
  .opponent-card-row .card-back { flex-basis: 18px; width: 18px; height: 27px; margin-right: -9px; border-width: 1px; }
  .normal-table .table-center { min-height: 330px; gap: 34px; }
  .normal-table .table-center::before { inset: 5% 6%; }
  .direction-mark { font-size: 38px; }
  .draw-deck, .playing-card.small, .empty-discard { width: 82px; height: 116px; }
  .draw-stack, .draw-stack .deck-layer, .discard-stack, .discard-card > .playing-card.small { width: 82px; height: 116px; }
  .playing-card { flex-basis: 82px; width: 82px; height: 116px; margin-left: -25px; }
  .corner b { font-size: 16px; }
  .pip { font-size: 34px; }
  .hand-area { padding: 16px 18px 24px; }
  .normal-table .hand-area { min-height: 210px; padding-top: 18px; }
  .turn-heading { align-items: start; }
  .turn-heading p { max-width: 190px; }
  .action-bar { grid-template-columns: 1fr; }
  .main-actions { justify-content: stretch; }
  .main-actions button { flex: 1; }
  .suit-picker { grid-row: auto; justify-self: start; }
  .validation { grid-column: 1; }
  .gameover-shell { display: block; padding-bottom: 120px; }
  .verdict { padding: 60px 28px 30px; }
  .loser-card { width: 100%; }
  .results { border-left: 0; padding: 28px; }
  .gameover-actions { position: fixed; bottom: 0; left: 0; right: 0; background: var(--green-dark); }
  .rules-drawer { right: 18px; bottom: 16px; }
  .gameover-shell .rules-drawer { bottom: 92px; }
}

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

/* UI adapter host */
.ui-switcher {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px 5px 9px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(13, 27, 23, .88);
  color: #fffaf0;
  box-shadow: 0 4px 18px rgba(0,0,0,.16);
  transform: translateX(-50%);
  backdrop-filter: blur(9px);
}
.ui-switcher span { font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.ui-switcher select {
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  color-scheme: light;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.ui-switcher option {
  background: #fffaf0;
  color: #171913;
}

.ui-load-error { min-height: 100vh; display: grid; place-content: center; padding: 30px; background: #211; color: #fff; }
.ui-load-error h1 { font-family: var(--display); font-weight: 400; }

/* Deliberately plain second adapter */
.plain-shell {
  min-height: 100vh;
  padding: clamp(70px, 9vw, 130px) clamp(20px, 7vw, 100px);
  background: #ece9df;
  color: #191919;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}
.plain-panel { width: min(1040px, 100%); margin: 0 auto; }
.plain-panel header { display: flex; justify-content: space-between; gap: 30px; align-items: end; border-bottom: 2px solid #191919; }
.plain-panel h1 { max-width: 780px; margin: 8px 0 20px; font: 700 clamp(38px, 7vw, 88px)/.92 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: -.07em; }
.plain-panel p { max-width: 680px; line-height: 1.6; }
.plain-eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .16em; font-size: 10px; font-weight: 900; }
.plain-start { min-height: calc(100vh - 200px); display: grid; place-content: center start; }
.plain-game { min-height: 590px; }
.plain-primary, .plain-actions button, .plain-player-grid button {
  border: 2px solid #191919;
  padding: 13px 16px;
  background: #fff;
  color: #191919;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 4px 4px 0 #191919;
}
.plain-primary { background: #e5ff45; }
.plain-player-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 28px 0; }
.plain-player-grid > div, .plain-player-grid button { min-height: 72px; padding: 13px; text-align: left; }
.plain-player-grid .current { outline: 3px solid #191919; background: #e5ff45; }
.plain-player-grid b, .plain-player-grid span { display: block; }
.plain-player-grid span { margin-top: 7px; opacity: .58; font-size: 10px; }
.plain-piles { display: grid; justify-items: end; gap: 8px; padding-bottom: 20px; }
.plain-piles span { font-size: 10px; }
.plain-piles strong { padding: 8px 12px; border: 2px solid; background: #fff; font-size: 22px; }
.plain-hand { display: flex; align-items: end; gap: 8px; margin: 32px 0; overflow-x: auto; padding: 8px 8px 14px; }
.plain-card { flex: 0 0 78px; height: 112px; border: 2px solid #191919; border-radius: 5px; background: #fff; cursor: pointer; font-size: 20px; box-shadow: 3px 3px 0 #191919; }
.plain-card b, .plain-card span { display: block; }
.plain-card.selected { background: #e5ff45; transform: translateY(-8px); }
.plain-actions, .plain-calls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.plain-actions { margin-top: 25px; }
.plain-calls { padding: 16px 0; border-block: 1px solid #aaa; }
.plain-calls label { display: flex; align-items: center; gap: 7px; }
.plain-calls select { padding: 6px; border: 1px solid; background: #fff; }
.plain-waiting { padding: 28px; border: 2px dashed; text-align: center; }
.plain-turn-zone { min-height: 330px; }
.plain-message { position: fixed; left: 50%; bottom: 22px; margin: 0; padding: 12px 16px; background: #191919; color: #fff; transform: translateX(-50%); box-shadow: 4px 4px 0 #d43b43; }

@media (max-width: 680px) {
  .ui-switcher { top: 8px; }
  .plain-panel header { display: block; }
  .plain-piles { justify-items: start; padding-bottom: 18px; }
}
