:root {
  color-scheme: light;
  --ink: #17342f;
  --muted: #6b746d;
  --cream: #f7f0de;
  --paper: #fffaf0;
  --green: #1d5147;
  --green-2: #2d6b5e;
  --terracotta: #ce5d3b;
  --gold: #edae49;
  --line: rgba(23, 52, 47, .14);
  --shadow: 0 18px 50px rgba(32, 41, 33, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--cream); }
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .32;
  background-image: radial-gradient(rgba(29,81,71,.16) .6px, transparent .6px);
  background-size: 7px 7px;
}

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(18px, 4vw, 52px); background: rgba(255,250,240,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(15px); }
.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50% 50% 45% 55%; background: var(--terracotta); color: #fff9e9; font: 800 15px/1 Georgia, serif; transform: rotate(-4deg); box-shadow: inset 0 0 0 3px rgba(255,255,255,.24); }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { font: 800 23px/1 Georgia, serif; letter-spacing: -.03em; }
.brand small { color: var(--muted); font-size: 10px; margin-top: 4px; text-transform: uppercase; letter-spacing: .12em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.ghost { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.5); padding: 9px 14px; cursor: pointer; font-weight: 700; }
.ghost:hover { border-color: var(--green-2); background: white; }
.connection { color: var(--muted); font-size: 12px; }
.connection::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--gold); }
.connection.online::before { background: #36a269; }
.connection.offline::before { background: var(--terracotta); }

.landing { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); align-items: center; gap: clamp(40px, 8vw, 120px); padding: clamp(42px, 8vw, 100px) clamp(20px, 7vw, 110px); position: relative; overflow: hidden; }
.landing::after { content: "LA CUENTA"; position: absolute; right: -3vw; bottom: -3vw; font: 900 clamp(72px, 15vw, 230px)/.7 Georgia, serif; color: rgba(29,81,71,.045); transform: rotate(-6deg); white-space: nowrap; pointer-events: none; }
.hero-copy { max-width: 760px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--terracotta); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .15em; }
h1 { margin: 0; font: 900 clamp(52px, 8vw, 104px)/.88 Georgia, serif; letter-spacing: -.065em; max-width: 800px; }
.hero-copy > p:not(.eyebrow) { max-width: 630px; color: #4f5f58; font-size: clamp(18px, 2vw, 23px); line-height: 1.5; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.hero-chips span { background: rgba(255,255,255,.6); border: 1px solid var(--line); padding: 8px 11px; border-radius: 99px; font-size: 12px; font-weight: 750; }

.join-card, .lobby-card { position: relative; z-index: 2; background: rgba(255,250,240,.92); border: 1px solid rgba(23,52,47,.12); border-radius: 28px; padding: clamp(24px, 4vw, 38px); box-shadow: var(--shadow); }
.join-card h2, .lobby-card h1 { font: 800 32px/1.05 Georgia, serif; margin: 0 0 8px; letter-spacing: -.035em; }
.join-card > p, .lobby-card > p { color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 7px; margin: 20px 0; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; background: white; outline: none; }
.field input:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(45,107,94,.12); }
.button-stack { display: grid; gap: 10px; }
.primary, .secondary, .danger, .action-button { border: 0; border-radius: 13px; padding: 13px 16px; font-weight: 800; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.primary { background: var(--green); color: white; box-shadow: 0 9px 20px rgba(29,81,71,.2); }
.secondary { background: #e9deca; color: var(--ink); }
.danger { background: var(--terracotta); color: white; }
.primary:hover, .secondary:hover, .danger:hover, .action-button:hover { transform: translateY(-1px); }
.primary:disabled, .secondary:disabled, .action-button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.lobby { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 36px 20px; }
.lobby-card { width: min(720px, 100%); }
.room-code { display: inline-flex; align-items: baseline; gap: 12px; margin: 15px 0 25px; padding: 11px 16px; background: var(--ink); color: white; border-radius: 13px; }
.room-code small { text-transform: uppercase; font-size: 10px; letter-spacing: .13em; opacity: .72; }
.room-code strong { font: 800 25px/1 ui-monospace, monospace; letter-spacing: .16em; }
.seat-list { display: grid; gap: 8px; margin: 20px 0; }
.seat { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.7); border-radius: 14px; padding: 11px 13px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: white; font-weight: 850; }
.seat-info { flex: 1; }
.seat-info strong { display: block; }
.seat-info small { color: var(--muted); }
.icon-button { border: 0; background: transparent; color: var(--terracotta); font-weight: 800; cursor: pointer; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.game-shell { min-height: calc(100vh - 72px); padding: 14px clamp(10px, 2vw, 26px) 28px; background: #e7dcc5; }
.players-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; margin-bottom: 12px; }
.player-pill { display: grid; grid-template-columns: 34px 1fr; gap: 9px; align-items: center; background: rgba(255,250,240,.82); border: 1px solid rgba(23,52,47,.11); border-radius: 14px; padding: 8px 10px; min-width: 0; }
.player-pill.current { outline: 2px solid var(--gold); background: white; }
.player-pill.you { box-shadow: inset 0 -3px 0 var(--green-2); }
.player-pill .avatar { width: 34px; height: 34px; font-size: 12px; }
.player-meta { min-width: 0; }
.player-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.player-meta span { font-size: 12px; color: var(--muted); }
.status-icons { grid-column: 1/-1; display: flex; gap: 5px; margin-top: -3px; }
.status-icons b { font-size: 9px; text-transform: uppercase; padding: 3px 5px; border-radius: 5px; background: #eee2c9; }

.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: stretch; }
.table { position: relative; overflow: hidden; border-radius: 26px; min-height: 525px; padding: clamp(18px, 3vw, 35px); color: #fef8e8; background: radial-gradient(circle at 50% -20%, #39786b, transparent 52%), var(--green); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), inset 0 0 90px rgba(0,0,0,.17), var(--shadow); }
.table::before { content: ""; position: absolute; inset: 0; opacity: .08; background: repeating-linear-gradient(96deg, transparent 0 29px, #fff 30px 31px); }
.table-header { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 28px; }
.table-header h2 { margin: 0; font: 800 clamp(24px, 4vw, 38px)/1 Georgia, serif; }
.table-header p { margin: 5px 0 0; color: rgba(255,255,255,.66); font-size: 12px; }
.turn-chip { padding: 9px 12px; border-radius: 99px; background: rgba(0,0,0,.17); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.stacks { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(135px, .85fr); gap: 14px; }
.stack-zone { min-height: 260px; border: 1px dashed rgba(255,255,255,.28); border-radius: 19px; padding: 13px; display: flex; flex-direction: column; background: rgba(0,0,0,.08); }
.stack-zone.locked { border-color: rgba(255,178,139,.74); background: rgba(99,29,17,.18); }
.zone-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 850; }
.zone-title span:last-child { opacity: .65; font-weight: 650; letter-spacing: 0; text-transform: none; }
.stack-cards { flex: 1; display: grid; place-items: center; margin-top: 10px; }
.empty-stack { text-align: center; color: rgba(255,255,255,.46); font-size: 12px; max-width: 110px; }
.mini-card { width: 112px; aspect-ratio: 5/7; border-radius: 11px; display: grid; align-content: space-between; padding: 10px; box-shadow: 0 12px 22px rgba(0,0,0,.25); background: #fff9ed; color: var(--ink); transform: rotate(-1deg); }
.mini-card .mini-icon { font-size: 28px; }
.mini-card strong { font: 750 14px/1.1 Georgia, serif; }
.mini-card b { font-size: 20px; }
.mini-card.vegetable { border-top: 8px solid #7fa551; }
.mini-card.fish { border-top: 8px solid #7978bd; }
.mini-card.meat { border-top: 8px solid #e5a326; }
.wine-sets { display: grid; gap: 10px; align-content: center; width: 100%; }
.wine-set { display: flex; align-items: center; justify-content: space-between; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.1); }
.wine-bottles { letter-spacing: -4px; }
.coffee-lock { position: relative; z-index: 1; margin-top: 18px; border-radius: 13px; padding: 11px 13px; background: #f4dcc2; color: #5c2e1d; font-size: 12px; font-weight: 750; }

.receipt { position: relative; z-index: 2; width: min(330px, 90%); margin: 24px auto -85px; padding: 17px 20px 24px; background: #fffaf0; color: var(--ink); box-shadow: 0 13px 28px rgba(0,0,0,.25); transform: rotate(.7deg); }
.receipt::after { content: ""; position: absolute; height: 9px; left: 0; right: 0; bottom: -8px; background: linear-gradient(135deg,#fffaf0 5px,transparent 0) 0 0/10px 10px repeat-x; }
.receipt h3 { margin: 0 0 10px; text-align: center; font: 800 21px/1 Georgia, serif; }
.receipt-row { display: flex; justify-content: space-between; gap: 15px; padding: 3px 0; font-size: 12px; }
.receipt-row.total { margin-top: 7px; padding-top: 9px; border-top: 1px dashed #8f958d; font-size: 18px; font-weight: 900; }

.side-panel { display: grid; grid-template-rows: auto minmax(0,1fr); gap: 12px; }
.coach, .game-log { background: rgba(255,250,240,.9); border: 1px solid rgba(23,52,47,.11); border-radius: 20px; padding: 18px; }
.coach .eyebrow { margin-bottom: 7px; }
.coach h3 { margin: 0 0 8px; font: 800 22px/1.1 Georgia, serif; }
.coach p { margin: 0 0 15px; color: #56625c; line-height: 1.45; font-size: 13px; }
.coach-actions { display: grid; gap: 8px; }
.action-button { width: 100%; background: var(--green); color: white; padding: 11px 12px; }
.action-button.alt { background: #e5dac5; color: var(--ink); }
.action-button.bill { background: var(--terracotta); }
.game-log { min-height: 0; }
.game-log h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.log-scroll { max-height: 265px; overflow: auto; display: grid; gap: 8px; padding-right: 4px; }
.log-item { padding-left: 10px; border-left: 2px solid #c6c3b9; color: #66716b; font-size: 11px; line-height: 1.35; }
.log-item.alert { border-color: var(--terracotta); color: #743f2f; }
.log-item.good { border-color: #4b9c72; color: #356b50; }

.hand-panel { margin-top: 12px; padding: 17px; border-radius: 24px; background: rgba(255,250,240,.92); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hand-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hand-header h2 { margin: 0; font: 800 22px/1 Georgia, serif; }
.hand-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.premium-counter { padding: 7px 10px; border-radius: 9px; background: #f2d45c; font-size: 11px; font-weight: 850; }
.hand { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 14px; scroll-snap-type: x proximity; }

.card { flex: 0 0 120px; aspect-ratio: 5/7; position: relative; border: 1px solid rgba(26,38,32,.16); border-radius: 13px; padding: 11px; background: #fffaf0; box-shadow: 0 8px 16px rgba(31,42,34,.15); display: flex; flex-direction: column; text-align: left; overflow: hidden; scroll-snap-align: start; transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
button.card { cursor: pointer; }
.card::before { content: ""; position: absolute; inset: 0; opacity: .1; background: repeating-radial-gradient(circle at 20% 10%, currentColor 0 1px, transparent 1px 7px); }
.card > * { position: relative; z-index: 1; }
.card.playable { outline: 3px solid #e6ad3e; outline-offset: 2px; }
.card.playable:hover { transform: translateY(-8px) rotate(-1deg); box-shadow: 0 16px 22px rgba(31,42,34,.2); }
.card.selected { transform: translateY(-8px); outline: 3px solid var(--green-2); outline-offset: 2px; }
.card.unplayable { opacity: .56; filter: saturate(.7); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 5px; }
.card-value { font: 900 18px/1 Georgia, serif; }
.card-kind { text-transform: uppercase; font-size: 8px; letter-spacing: .09em; font-weight: 850; opacity: .72; }
.card-icon { display: grid; place-items: center; flex: 1; font-size: 35px; font-weight: 950; }
.card-name { font: 800 14px/1.05 Georgia, serif; }
.card small { margin-top: 5px; font-size: 9px; line-height: 1.25; opacity: .72; }
.card.tapa-vegetable { color: #29431f; background: #dce9bf; border-top: 8px solid #73974b; }
.card.tapa-fish { color: #2f315e; background: #dddafa; border-top: 8px solid #716cb3; }
.card.tapa-meat { color: #5d3914; background: #fae0a3; border-top: 8px solid #dd9826; }
.card.wine { color: #ecf9f4; background: #307369; border-top: 8px solid #153f3a; }
.card.burnt { color: #fff3df; background: #3f3732; border-top: 8px solid #e04b28; }
.card.coffee, .card.toilet { background: #f6efe1; border-top: 8px solid #766858; }
.card.premium { background: #f7dc54; border-top: 8px solid #1d5147; }
.card.birthday { background: #f5c5c9; border-top: 8px solid #d9586a; }
.card.tip, .card.fifty, .card.dutch { color: white; background: #253832; border-top: 8px solid #cf714e; }
.card.reverse { background: #ece7da; border-top: 8px solid #2b544a; }
.card-action-label { position: absolute; left: 8px; right: 8px; bottom: 7px; z-index: 3; padding: 4px; border-radius: 6px; color: white; background: var(--terracotta); text-align: center; font-size: 7px; font-weight: 950; letter-spacing: .12em; box-shadow: 0 3px 8px rgba(0,0,0,.18); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; color: white; background: #2d2925; border-radius: 11px; padding: 11px 15px; box-shadow: var(--shadow); transition: .2s ease; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
dialog { border: 0; color: var(--ink); background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,32,28,.58); backdrop-filter: blur(4px); }
.rules-dialog { width: min(850px, calc(100% - 28px)); max-height: calc(100vh - 28px); border-radius: 26px; padding: clamp(24px, 5vw, 48px); }
.rules-dialog h2, .choice-dialog h2 { font: 850 clamp(30px,5vw,48px)/1 Georgia,serif; margin: 0 0 24px; letter-spacing: -.04em; }
.dialog-close { position: absolute; top: 15px; right: 15px; border: 0; width: 38px; height: 38px; border-radius: 50%; background: #eee3cf; cursor: pointer; font-size: 22px; }
.rules-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; margin-bottom: 24px; }
.rules-grid section { position: relative; border: 1px solid var(--line); border-radius: 17px; padding: 20px; background: white; }
.rules-grid h3 { margin: 13px 0 7px; font: 800 17px/1.1 Georgia,serif; }
.rules-grid p, .rules-dialog details, .rules-note { font-size: 13px; line-height: 1.5; color: #55615b; }
.step { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--terracotta); color: white; font-weight: 850; }
.rules-dialog details { border-top: 1px solid var(--line); padding: 13px 0; }
.rules-dialog summary { color: var(--ink); font-weight: 800; cursor: pointer; }
.rules-note { padding: 12px 14px; border-radius: 11px; background: #e8eee5; }
.choice-dialog { width: min(480px, calc(100% - 28px)); border-radius: 24px; padding: 30px; }
.choice-options { display: grid; gap: 9px; }
.choice-option { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; cursor: pointer; font-weight: 800; }
.choice-option:hover { border-color: var(--green-2); }

@media (max-width: 980px) {
  .landing { grid-template-columns: 1fr; padding-top: 55px; }
  .hero-copy { text-align: center; margin: auto; }
  .hero-copy > p:not(.eyebrow) { margin-left: auto; margin-right: auto; }
  .hero-chips { justify-content: center; }
  .join-card { width: min(560px,100%); margin: auto; }
  .game-grid { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .receipt { margin-bottom: -30px; }
}

@media (max-width: 720px) {
  .topbar { height: 62px; padding: 0 12px; }
  .brand strong { font-size: 19px; }
  .brand small, .connection { display: none; }
  .ghost { padding: 8px 10px; font-size: 12px; }
  .landing { min-height: calc(100vh - 62px); padding: 34px 16px; gap: 34px; }
  h1 { font-size: clamp(48px, 16vw, 72px); }
  .game-shell { padding: 8px; }
  .players-strip { display: flex; overflow-x: auto; }
  .player-pill { flex: 0 0 145px; }
  .table { border-radius: 20px; min-height: auto; padding: 18px 12px 70px; }
  .stacks { grid-template-columns: repeat(3, minmax(105px,1fr)); overflow-x: auto; padding-bottom: 7px; }
  .stack-zone { min-height: 220px; }
  .stack-zone:last-child { grid-column: 1/-1; min-height: 120px; }
  .wine-sets { grid-template-columns: repeat(2,1fr); }
  .side-panel { grid-template-columns: 1fr; }
  .game-log { display: none; }
  .hand-panel { padding: 14px 9px; border-radius: 18px; }
  .card { flex-basis: 108px; }
  .rules-grid { grid-template-columns: 1fr; }
}

/* V2 game table: state first, transcript second. */
.game-shell { padding: 12px clamp(10px, 2vw, 24px) 28px; background: #dfd1b7; }
.game-hud { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 10px; max-width: 1500px; margin: 0 auto 10px; }
.round-stat, .deck-stat, .turn-status, .direction-status, .next-status { min-height: 64px; border: 1px solid rgba(23,52,47,.12); border-radius: 17px; background: rgba(255,250,240,.9); box-shadow: 0 8px 24px rgba(32,41,33,.08); }
.round-stat { width: 68px; display: grid; place-items: center; align-content: center; }
.round-stat span, .turn-status small, .direction-status small, .next-status small { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.round-stat strong { font: 900 27px/1 Georgia,serif; }
.turn-status, .direction-status, .next-status { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.turn-status > div, .direction-status > div, .next-status > div { display: grid; gap: 2px; }
.turn-status strong, .direction-status strong, .next-status strong { font: 850 17px/1.05 Georgia,serif; }
.turn-status.is-you { color: white; background: var(--terracotta); border-color: transparent; }
.turn-status.is-you small { color: rgba(255,255,255,.72); }
.turn-pulse { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(237,174,73,.6); animation: pulse-turn 1.6s infinite; }
.turn-status.is-you .turn-pulse { background: white; }
.direction-arrow { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 23px; transition: transform .5s ease; }
.direction-arrow.counter { transform: scaleX(-1); }
.direction-status.just-reversed .direction-arrow { animation: direction-pop .9s ease; }
.next-arrow { width: 54px; height: 34px; flex: 0 0 auto; fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; transition: transform .45s ease; }
.next-arrow.counter { transform: scaleX(-1); }
.next-status.just-reversed .next-arrow { animation: next-arrow-flip .9s ease; }
.deck-stat { display: grid; justify-items: center; align-content: center; min-width: 90px; padding: 8px 12px; }
.deck-stat strong { font: 900 23px/1 Georgia,serif; }
.deck-stat span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }

.arena.table { isolation: isolate; display: grid; place-items: center; max-width: 1500px; height: clamp(630px, 67vh, 790px); min-height: 630px; margin: auto; padding: 0; overflow: hidden; border-radius: 42%; background: radial-gradient(ellipse at center, #39796b 0, #245d52 54%, #19493f 75%, #12382f 100%); border: 12px solid #75492f; box-shadow: inset 0 0 0 3px rgba(255,255,255,.12), inset 0 0 100px rgba(0,0,0,.3), 0 20px 45px rgba(51,36,25,.22); }
.arena.table::before { opacity: .07; background: repeating-linear-gradient(97deg, transparent 0 35px, #fff 36px 37px); }
.seating-ring { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.player-seat { pointer-events: auto; position: absolute; left: var(--seat-x); top: var(--seat-y); width: clamp(128px, 11vw, 170px); min-height: 68px; transform: translate(-50%,-50%); display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; padding: 9px 9px; color: var(--ink); background: rgba(255,250,240,.96); border: 2px solid rgba(255,255,255,.45); border-radius: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.22); transition: transform .25s ease, box-shadow .25s ease, background .25s ease; }
.player-seat .avatar { width: 40px; height: 40px; font-size: 12px; }
.player-seat .player-meta strong { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.player-seat .player-meta strong i { padding: 2px 4px; border-radius: 4px; color: var(--muted); background: #eee3cf; font: 850 7px/1 sans-serif; letter-spacing: .08em; }
.player-seat .player-meta span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.player-seat .card-count { display: flex; justify-content: flex-end; align-items: center; gap: 2px; min-width: 38px; padding-right: 2px; }
.player-seat .card-count i { width: 9px; height: 14px; flex: 0 0 auto; border: 1px solid #fff7e5; border-radius: 2px; background: linear-gradient(135deg,#cc603d 0 45%,#efae45 45% 55%,#194c43 55%); box-shadow: 0 1px 2px rgba(0,0,0,.24); transform: rotate(calc((var(--card-index) - 2) * .5deg)); }
.player-seat .seat-turn { position: absolute; left: 50%; top: -19px; transform: translateX(-50%); min-width: 68px; height: 20px; color: var(--ink); font-size: 8px; font-weight: 950; letter-spacing: .08em; text-align: center; }
.player-seat.current { z-index: 2; transform: translate(-50%,-50%) scale(1.1); background: #fff; border-color: var(--gold); box-shadow: 0 0 0 5px rgba(237,174,73,.23), 0 14px 32px rgba(0,0,0,.28); }
.player-seat.current .seat-turn { padding: 5px 9px; border-radius: 999px; background: var(--gold); }
.player-seat.you { box-shadow: inset 0 -4px 0 var(--terracotta), 0 10px 24px rgba(0,0,0,.22); }
.player-seat.current.you { box-shadow: inset 0 -4px 0 var(--terracotta), 0 0 0 5px rgba(237,174,73,.23), 0 14px 32px rgba(0,0,0,.28); }
.player-seat .status-icons { position: absolute; left: 50%; bottom: -23px; transform: translateX(-50%); display: flex; gap: 4px; white-space: nowrap; }
.player-seat .status-icons b { display: flex; align-items: center; gap: 3px; padding: 4px 7px; border-radius: 7px; color: #4b2e21; background: #fff2cc; border: 1px solid rgba(237,174,73,.7); box-shadow: 0 4px 10px rgba(0,0,0,.18); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.player-seat .status-icons b span { font-size: 13px; }

.direction-ring { position: absolute; inset: 9%; z-index: 1; border: 1px dashed rgba(255,255,255,.22); border-radius: 50%; pointer-events: none; transition: transform .6s ease; }
.direction-ring.counter { transform: scaleX(-1); }
.direction-ring span { position: absolute; color: rgba(255,255,255,.42); font-size: 13px; }
.direction-ring span:nth-child(1) { left: 49%; top: -8px; transform: rotate(0deg); }
.direction-ring span:nth-child(2) { right: -6px; top: 49%; transform: rotate(90deg); }
.direction-ring span:nth-child(3) { left: 49%; bottom: -8px; transform: rotate(180deg); }
.direction-ring span:nth-child(4) { left: -6px; top: 49%; transform: rotate(270deg); }
.has-motion-reverse .direction-ring { animation: ring-spin 1.05s cubic-bezier(.2,.8,.2,1); }

.table-core { position: relative; z-index: 2; width: min(67%, 850px); margin-top: 6px; }
.live-event { display: flex; justify-content: center; align-items: baseline; gap: 9px; min-height: 28px; margin: 0 auto 8px; color: rgba(255,255,255,.9); text-align: center; }
.live-event span { opacity: .54; font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .13em; }
.live-event strong { max-width: 600px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.table-effects { display: flex; justify-content: center; gap: 7px; margin: 0 auto 8px; }
.table-effect { display: flex; align-items: center; gap: 8px; min-width: 180px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.3); border-radius: 11px; color: var(--ink); background: #fff6df; box-shadow: 0 7px 16px rgba(0,0,0,.2); transform: rotate(-.5deg); }
.table-effect .effect-icon { display: grid; place-items: center; width: 34px; height: 42px; flex: 0 0 auto; border-radius: 6px; color: white; background: #202a26; font-size: 26px; }
.table-effect .effect-icon.counter { transform: scaleX(-1); }
.effect-card-art { width: 34px; height: 42px; flex: 0 0 auto; overflow: hidden; border: 2px solid #171d1a; border-radius: 6px; background: #f4ead6; transition: transform .5s ease; }
.effect-card-art.counter { transform: rotate(-3deg); }
.effect-card-art img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 45%; }
.table-effect > span:last-child { display: grid; gap: 2px; }
.table-effect strong { font: 800 12px/1.05 Georgia,serif; }
.table-effect small { color: var(--muted); font-size: 8px; }
.coffee-effect .effect-icon { color: var(--ink); background: #e9d7bd; }
.table-core .stacks { grid-template-columns: repeat(4,minmax(105px,1fr)); gap: 8px; }
.table-core .stack-zone { min-height: 238px; padding: 10px; border-radius: 15px; }
.table-core .stack-cards { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 8px; padding-top: 7px; }
.stack-pile { position: relative; width: min(100%,var(--pile-width)); height: 120px; margin: 0 auto; }
.stack-pile .mini-card { position: absolute; left: calc(var(--pile-index) * var(--pile-step)); top: calc(var(--pile-index) * 1px); z-index: calc(var(--pile-index) + 1); height: 116px; aspect-ratio: auto; transform: rotate(calc((var(--pile-index) - 2) * .55deg)); transform-origin: 50% 100%; }
.table-core .mini-card { width: 82px; padding: 8px; border-radius: 9px; }
.table-core .mini-card .mini-icon { display: grid; place-items: center; min-height: 54px; font-size: 25px; }
.table-core .mini-card strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.table-core .mini-card b { font-size: 15px; }
.mini-value { display: block; font: 900 13px/1 Georgia,serif; }
.mini-art { display: block; height: 56px; margin: 3px -3px; overflow: hidden; border: 1px solid rgba(17,43,38,.18); border-radius: 5px; background: #efe6d4; }
.mini-art img, .card-art img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 48%; }
.stack-ledger { display: flex; justify-content: center; flex-wrap: wrap; gap: 3px; width: 100%; min-height: 19px; }
.stack-ledger-card, .older-cards { display: inline-flex; align-items: center; justify-content: center; min-width: 31px; padding: 4px 5px 3px; border: 1px solid rgba(255,255,255,.28); border-radius: 6px; color: #fffbea; background: rgba(0,0,0,.2); box-shadow: 0 2px 5px rgba(0,0,0,.12); }
.stack-ledger-card b, .older-cards { font: 800 9px/1 sans-serif; }
.stack-ledger-card.burnt { color: #ffd9c8; background: rgba(110,28,15,.65); }
.empty-stack { display: grid; justify-items: center; gap: 5px; max-width: 125px; }
.empty-stack::before { content: ""; width: 66px; height: 66px; border: 2px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: inset 0 0 0 7px rgba(255,255,255,.04); }
.empty-stack b { color: rgba(255,255,255,.72); font: 800 11px/1 Georgia,serif; }
.empty-stack small { max-width: 110px; color: rgba(255,255,255,.45); font-size: 8px; line-height: 1.25; }
.wine-sets { height: 100%; align-content: center; }
.table-core .wine-set { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 5px; padding: 0; background: transparent; font-size: 10px; }
.wine-pile { position: relative; width: min(100%,var(--pile-width)); height: 103px; }
.wine-pile .mini-card { position: absolute; left: calc(var(--pile-index) * var(--pile-step)); top: calc(var(--pile-index) * 1px); z-index: calc(var(--pile-index) + 1); width: 70px; height: 98px; padding: 6px; transform: rotate(calc((var(--pile-index) - 2) * .6deg)); }
.wine-pile .mini-card strong { font-size: 9px; }
.wine-pile .mini-card .mini-icon { min-height: 48px; }
.wine-total { display: grid; justify-items: end; align-self: center; gap: 2px; padding: 5px 6px; border-radius: 8px; color: #17342f; background: #fff5dd; box-shadow: 0 4px 9px rgba(0,0,0,.18); }
.wine-total small { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.wine-total strong { font: 900 12px/1 Georgia,serif; white-space: nowrap; }
.wine-placeholder { display: grid; justify-items: center; gap: 4px; color: rgba(255,255,255,.78); }
.wine-placeholder .mini-icon { width: 58px; height: 78px; display: grid; place-items: center; border: 2px dashed rgba(255,255,255,.3); border-radius: 9px; }
.wine-placeholder strong { font: 900 15px/1 Georgia,serif; }
.wine-placeholder small { font-size: 8px; }
.wine-symbol { width: 32px; height: 40px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wine-symbol .wine-fill { fill: #a33036; stroke: none; opacity: .9; }
.table-core .coffee-lock { margin: 8px auto 0; width: max-content; max-width: 100%; padding: 7px 10px; }
.table-core .receipt { display: flex; align-items: center; justify-content: center; gap: 12px; width: max-content; min-width: 210px; max-width: 100%; margin: 9px auto 0; padding: 9px 16px 11px; transform: rotate(.3deg); }
.table-core .receipt h3 { margin: 0; font-size: 13px; }
.table-core .receipt-row:not(.total):not(.tip) { display: none; }
.table-core .receipt-row.tip { gap: 5px; color: var(--terracotta); font-size: 10px; }
.table-core .receipt-row.total { margin: 0; padding: 0 0 0 12px; border-top: 0; border-left: 1px dashed #8f958d; font-size: 17px; }
.table-core .receipt::after { height: 6px; bottom: -5px; background-size: 7px 7px; }
.action-dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(680px,100%); margin: 10px auto 0; padding: 10px 11px 10px 14px; color: var(--ink); background: rgba(255,250,240,.96); border-radius: 15px; box-shadow: 0 12px 26px rgba(0,0,0,.2); }
.action-dock > div:first-child { display: grid; gap: 2px; min-width: 0; }
.action-dock small { color: var(--terracotta); font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.action-dock strong { font: 850 15px/1.1 Georgia,serif; }
.action-dock span { color: var(--muted); font-size: 10px; }
.dock-actions { display: flex; gap: 7px; flex: 0 0 auto; }
.dock-actions .action-button { width: auto; min-width: 96px; padding: 9px 11px; font-size: 11px; }

.hand-panel { max-width: 1500px; margin: 10px auto 0; padding: 13px 15px; border-radius: 20px; }
.hand-header { margin-bottom: 7px; }
.hand-header h2 { font-size: 18px; }
.hand-header h2 span { color: var(--muted); font: 800 12px/1 sans-serif; }
.hand { justify-content: center; gap: 14px; padding: 7px 7px 14px; }
.card { flex-basis: 126px; }
.card.has-art { padding-top: 9px; }
.card-art { display: block; height: 75px; flex: 0 0 auto; margin: 7px -4px 6px; overflow: hidden; border: 1px solid rgba(20,46,40,.2); border-radius: 7px; background: #eee4d0; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.card.has-art .card-name { min-height: 28px; }
.card .wine-symbol { width: 42px; height: 52px; }
.card.playable { padding-bottom: 31px; }

.motion-layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.motion-card { position: absolute; left: var(--start-x); top: var(--start-y); width: 116px; aspect-ratio: 5/7; display: grid; align-content: space-between; padding: 11px; border: 4px solid #fff6df; border-radius: 13px; color: var(--ink); background: #fff4dc; box-shadow: 0 18px 42px rgba(0,0,0,.38); animation: card-to-table .9s cubic-bezier(.16,.8,.24,1) forwards; }
.motion-card > b { font: 900 18px/1 Georgia,serif; }
.motion-card > span { place-self: center; font-size: 36px; }
.motion-card > strong { font: 850 12px/1.05 Georgia,serif; }
.motion-card .card-art { width: 100%; height: 78px; margin: 5px 0; border-radius: 7px; }
.motion-card.tapa-vegetable { background: #dce9bf; }
.motion-card.tapa-fish { background: #dddafa; }
.motion-card.tapa-meat { background: #fae0a3; }
.motion-card.reverse, .motion-card.toilet, .motion-card.coffee { background: #f5efe3; }
.reverse-burst { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; transform: translate(-50%,-50%); color: white; text-shadow: 0 3px 12px rgba(0,0,0,.35); animation: burst-in 1.15s ease both; }
.reverse-burst span { font-size: 110px; line-height: .8; }
.reverse-burst strong { margin-top: 8px; padding: 7px 10px; border-radius: 99px; color: var(--ink); background: var(--gold); font-size: 10px; letter-spacing: .12em; }
.bill-call, .bill-stamp { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) rotate(-2deg); display: grid; justify-items: center; gap: 8px; min-width: 260px; padding: 25px; color: var(--ink); background: #fffaf0; box-shadow: 0 22px 55px rgba(0,0,0,.38); animation: bill-pop 1.25s cubic-bezier(.2,.8,.2,1) both; }
.bill-call span, .bill-stamp small { color: var(--terracotta); font: 900 11px/1 sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.bill-call strong, .bill-stamp strong { font: 900 38px/1 Georgia,serif; }
.flying-payment { position: absolute; left: 50%; top: 50%; animation: coin-to-player 1.1s cubic-bezier(.25,.7,.25,1) var(--delay) both; }
.flying-payment b { display: block; padding: 7px 10px; border-radius: 99px; color: #513114; background: var(--gold); box-shadow: 0 8px 18px rgba(0,0,0,.28); font-size: 11px; white-space: nowrap; }

@keyframes pulse-turn { 70% { box-shadow: 0 0 0 10px rgba(237,174,73,0); } 100% { box-shadow: 0 0 0 0 rgba(237,174,73,0); } }
@keyframes direction-pop { 50% { transform: rotate(200deg) scale(1.24); } }
@keyframes next-arrow-flip { 50% { transform: scaleX(-1) rotate(18deg) scale(1.2); } }
@keyframes point-next { 50% { transform: translateX(5px) rotate(4deg); } }
@keyframes ring-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes card-to-table { 0% { left: var(--start-x); top: var(--start-y); transform: translate(-50%,-50%) scale(.55) rotate(-18deg); opacity: .25; } 65% { left: 50%; top: 49%; transform: translate(-50%,-50%) scale(1.28) rotate(4deg); opacity: 1; } 100% { left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.9) rotate(-2deg); opacity: 0; } }
@keyframes burst-in { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.3) rotate(-120deg); } 45% { opacity: 1; transform: translate(-50%,-50%) scale(1.08) rotate(5deg); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25) rotate(18deg); } }
@keyframes bill-pop { 0% { opacity: 0; transform: translate(-50%,-65%) rotate(-10deg) scale(.6); } 30%,75% { opacity: 1; transform: translate(-50%,-50%) rotate(-2deg) scale(1); } 100% { opacity: 0; transform: translate(-50%,-40%) rotate(2deg) scale(1.06); } }
@keyframes coin-to-player { 0% { left: 50%; top: 50%; opacity: 0; transform: translate(-50%,-50%) scale(.5); } 25% { opacity: 1; transform: translate(-50%,-50%) scale(1.1); } 100% { left: var(--end-x); top: var(--end-y); opacity: 0; transform: translate(-50%,-50%) scale(.7); } }

@media (prefers-reduced-motion: reduce) {
  .turn-pulse, .motion-card, .reverse-burst, .bill-call, .bill-stamp, .flying-payment, .has-motion-reverse .direction-ring { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 980px) {
  .game-hud { grid-template-columns: 58px 1fr; }
  .deck-stat { display: none; }
  .arena.table { height: 650px; min-height: 650px; border-radius: 31%; }
  .player-seat { width: 135px; grid-template-columns: 34px 1fr auto; padding: 7px; }
  .player-seat .avatar { width: 34px; height: 34px; }
  .table-core { width: 66%; }
}

@media (max-width: 720px) {
  .topbar { height: 54px; }
  .game-shell { padding: 6px 6px 18px; }
  .game-hud { grid-template-columns: 46px 1fr; gap: 5px; margin-bottom: 6px; }
  .round-stat, .turn-status { min-height: 48px; border-radius: 13px; }
  .round-stat { width: 46px; }
  .round-stat strong { font-size: 21px; }
  .turn-status { padding: 7px 11px; }
  .turn-status strong { font-size: 16px; }
  .arena.table { display: block; height: auto; min-height: 0; overflow: visible; padding: 7px; border: 5px solid #75492f; border-radius: 18px; }
  .direction-ring { display: none; }
  .seating-ring { position: relative; inset: auto; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; gap: 5px; overflow: visible; padding: 18px 0 7px; }
  .player-seat { position: relative; left: auto; top: auto; width: auto; min-width: 0; min-height: 58px; transform: none; grid-template-columns: 27px minmax(0,1fr); gap: 5px; padding: 6px 5px 5px; border-radius: 12px; }
  .player-seat.current { transform: translateY(-2px); }
  .player-seat .avatar { width: 27px; height: 27px; font-size: 9px; }
  .player-seat .player-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .player-seat .player-meta strong i { display: none; }
  .player-seat .player-meta span { font-size: 8px; }
  .player-seat .card-count { grid-column: 1/-1; min-width: 0; min-height: 15px; justify-content: center; gap: 2px; padding: 0; }
  .player-seat .card-count i { width: 8px; height: 13px; transform: none; }
  .player-seat .seat-turn { top: -16px; min-width: 57px; height: 17px; font-size: 7px; }
  .player-seat.current .seat-turn { padding: 4px 7px; }
  .player-seat .status-icons { position: static; grid-column: 1/-1; transform: none; justify-content: center; margin-top: 1px; }
  .player-seat .status-icons b { padding: 3px 5px; font-size: 6px; }
  .player-seat .status-icons b span { font-size: 11px; }
  .table-core { width: 100%; margin: 4px 0 0; }
  .live-event { justify-content: flex-start; min-height: 23px; margin-bottom: 5px; padding: 0 3px; }
  .live-event span { display: none; }
  .live-event strong { text-align: left; font-size: 10px; }
  .table-effects { justify-content: flex-start; overflow-x: auto; padding: 2px 1px 5px; }
  .table-effect { flex: 0 0 164px; min-width: 0; padding: 6px 8px; }
  .table-effect .effect-icon { width: 29px; height: 36px; font-size: 22px; }
  .table-effect strong { font-size: 10px; }
  .table-core .stacks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; overflow: visible; padding: 2px 0 6px; }
  .table-core .stack-zone { min-width: 0; min-height: 220px; padding: 8px; }
  .table-core .stack-zone:last-child { grid-column: auto; min-height: 220px; }
  .zone-title { font-size: 9px; }
  .table-core .stack-cards { padding-top: 8px; }
  .stack-pile { height: 124px; }
  .stack-ledger { gap: 4px; }
  .stack-ledger-card, .older-cards { min-width: 35px; padding: 5px 4px 4px; }
  .stack-ledger-card b, .older-cards { font-size: 9px; }
  .wine-sets { align-content: start; padding-top: 2px; }
  .table-core .wine-set { grid-template-columns: 1fr; justify-items: center; gap: 4px; }
  .wine-pile { margin: 0 auto; }
  .wine-total { grid-auto-flow: column; align-items: baseline; justify-items: center; justify-content: center; gap: 5px; width: max-content; }
  .table-core .receipt { flex-wrap: wrap; width: min(100%,280px); margin-top: 6px; }
  .table-core .receipt-row.tip { order: 2; width: 100%; justify-content: center; }
  .action-dock { align-items: stretch; flex-direction: column; }
  .dock-actions .action-button { flex: 1; }
  .hand-panel { margin-top: 6px; padding: 11px 8px; border-radius: 16px; }
  .hand-header { margin-bottom: 7px; }
  .hand-header h2 { font-size: 17px; }
  .hand-header p { font-size: 10px; }
  .hand { justify-content: flex-start; gap: 14px; padding: 7px 6px 16px; }
  .card { flex-basis: 132px; padding: 11px; }
  .card-art { height: 84px; margin-top: 8px; }
  .card-name { font-size: 15px; }
  .card-value { font-size: 20px; }
  .card small { display: none; }
  .card.playable { outline: 0; box-shadow: 0 0 0 3px #fff7e5, 0 0 0 6px var(--terracotta), 0 12px 24px rgba(0,0,0,.2); }
  .card.unplayable { opacity: .62; filter: grayscale(.3); }
  .card-action-label { left: 6px; right: 6px; bottom: 6px; }
  .motion-layer { position: fixed; z-index: 90; }
}
