:root {
  --green-950: #061f1b;
  --green-900: #0c352d;
  --green-800: #174d40;
  --green-700: #276755;
  --paper: #f1e8d8;
  --paper-light: #fffaf0;
  --ink: #15211c;
  --muted: #9db3a7;
  --red: #dd5142;
  --yellow: #efb847;
  --sans: "DM Sans", sans-serif;
  --serif: "DM Serif Display", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.skip-link { position: fixed; z-index: 100; top: -5rem; left: 1rem; padding: .8rem 1rem; background: var(--yellow); color: var(--ink); }
.skip-link:focus { top: 0; }

.site-header { height: 96px; display: flex; align-items: center; justify-content: space-between; width: min(1440px, calc(100% - 96px)); margin: 0 auto; border-bottom: 1px solid rgba(21,33,28,.18); }
.brand { display: inline-flex; align-items: center; gap: .75rem; }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; place-items: center; width: 44px; height: 44px; border: 1px solid currentColor; border-radius: 50%; font-size: .85rem; transform: rotate(-7deg); }
.brand-mark span:last-child { color: var(--red); }
.brand-name { font-size: .72rem; font-weight: 700; line-height: 1.05; letter-spacing: .12em; text-transform: uppercase; }
.site-header nav { display: flex; gap: 2rem; font-size: .82rem; }
.site-header nav a { border-bottom: 1px solid transparent; }
.site-header nav a:hover { border-color: currentColor; }

.game-intro { display: flex; align-items: end; justify-content: space-between; gap: 4rem; width: min(1440px, calc(100% - 96px)); margin: 0 auto; padding: 72px 0 42px; }
.eyebrow { display: flex; align-items: center; gap: .65rem; margin: 0 0 1rem; color: #5d6963; font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow span { width: 26px; height: 1px; background: var(--red); }
.game-intro h1 { margin: 0; font-family: var(--serif); font-size: clamp(4rem, 7vw, 7.5rem); font-weight: 400; line-height: .8; letter-spacing: -.04em; }
.game-intro > p { max-width: 440px; margin: 0; color: #5d6963; line-height: 1.7; }

.game-shell { position: relative; background: var(--green-950); color: var(--paper-light); }
.game-topbar { min-height: 82px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2rem; padding: 0 max(48px, calc((100vw - 1440px) / 2)); border-bottom: 1px solid rgba(255,255,255,.13); }
.scoreboard { display: flex; align-items: center; gap: .85rem; }
.score-team { display: flex; align-items: center; gap: .6rem; }
.score-team span { color: var(--muted); font-size: .69rem; letter-spacing: .08em; text-transform: uppercase; }
.score-team strong { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--paper); color: var(--ink); font-size: .76rem; }
.score-team.them strong { background: var(--red); color: #fff; }
.score-divider { color: #6d887a; }
.deal-data { display: flex; align-items: center; gap: 1.2rem; color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.deal-data b { color: #fff; }
.trump-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .7rem; border-radius: 999px; background: rgba(255,255,255,.09); }
.trump-chip b { color: var(--red); font-size: 1rem; }
.quiet-button { justify-self: end; padding: .6rem .9rem; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: transparent; color: #c0d0c6; font-size: .72rem; cursor: pointer; }
.quiet-button:hover { background: rgba(255,255,255,.08); color: #fff; }

.table-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 270px; min-height: 760px; }
.felt-table { position: relative; min-height: 760px; overflow: hidden; background: var(--green-800); }
.felt-table::before { content: ""; position: absolute; width: 760px; height: 760px; left: 50%; top: 50%; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; transform: translate(-50%,-50%); box-shadow: inset 0 0 0 100px rgba(6,31,27,.06), inset 0 0 0 101px rgba(255,255,255,.06); }
.felt-table::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }

.seat { position: absolute; z-index: 4; display: flex; align-items: center; gap: .65rem; padding: .4rem .7rem .4rem .4rem; border: 1px solid transparent; border-radius: 999px; transition: 180ms ease; }
.seat.is-turn { border-color: var(--yellow); background: rgba(239,184,71,.1); box-shadow: 0 0 0 4px rgba(239,184,71,.07); }
.player-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #d96052; color: #fff; font-family: var(--serif); }
.player-avatar.partner { background: var(--yellow); color: var(--ink); }
.player-avatar.human { background: var(--paper); color: var(--ink); }
.player-copy { display: flex; flex-direction: column; }
.player-copy strong { font-size: .75rem; }
.player-copy span { color: #a6baae; font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; }
.seat-north { left: 50%; top: 24px; transform: translateX(-50%); }
.seat-south { left: 50%; bottom: 194px; transform: translateX(-50%); }
.seat-west { left: 24px; top: 45%; transform: translateY(-50%); }
.seat-east { right: 24px; top: 45%; transform: translateY(-50%); }

.card-stack { position: absolute; width: 84px; height: 58px; top: 54px; left: 50%; transform: translateX(-50%); }
.card-back-mini { position: absolute; width: 34px; height: 48px; border: 2px solid var(--paper); border-radius: 4px; background: var(--red); box-shadow: 0 4px 8px rgba(0,0,0,.25); }
.card-back-mini::after { content: "✦"; position: absolute; inset: 3px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.65); color: rgba(255,255,255,.8); font-size: .55rem; }
.stack-side { top: 50%; left: auto; }
.seat-west .stack-side { left: 114px; transform: translateY(-50%); }
.seat-east .stack-side { right: 114px; transform: translateY(-50%); }
.stack-side .card-back-mini { transform: rotate(90deg); transform-origin: center; }

.trick-area { position: absolute; z-index: 3; width: 330px; height: 310px; left: 50%; top: 47%; transform: translate(-50%,-50%); }
.table-suit { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.035); font-size: 13rem; }
.played-slot { position: absolute; width: 74px; height: 105px; border: 1px dashed rgba(255,255,255,.12); border-radius: 8px; }
.slot-north { left: 50%; top: 0; transform: translateX(-50%); }
.slot-south { left: 50%; bottom: 34px; transform: translateX(-50%); }
.slot-west { left: 22px; top: 50%; transform: translateY(-60%) rotate(-7deg); }
.slot-east { right: 22px; top: 50%; transform: translateY(-60%) rotate(7deg); }
.turn-message { position: absolute; left: 50%; bottom: 0; width: 440px; margin: 0; color: #e3eadf; font-size: .72rem; font-weight: 600; text-align: center; letter-spacing: .05em; transform: translateX(-50%); }

.playing-card { position: relative; width: 74px; height: 105px; flex: 0 0 auto; border: 0; border-radius: 8px; background: var(--paper-light); color: var(--ink); box-shadow: 0 9px 18px rgba(0,0,0,.23); }
button.playing-card { cursor: pointer; transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease; }
button.playing-card:hover:not(:disabled), button.playing-card:focus-visible:not(:disabled) { z-index: 10; outline: 3px solid var(--yellow); outline-offset: 2px; transform: translateY(-16px); box-shadow: 0 18px 25px rgba(0,0,0,.3); }
button.playing-card:disabled { cursor: not-allowed; opacity: .52; }
.playing-card.red { color: var(--red); }
.card-rank { position: absolute; left: 8px; top: 7px; font-family: var(--serif); font-size: 1.25rem; line-height: .78; text-align: center; }
.card-rank small { font-size: .72rem; }
.card-pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; }
.played-slot .playing-card { position: absolute; inset: 0; animation: card-in 200ms ease-out; }
@keyframes card-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }

.human-hand { position: absolute; z-index: 5; left: 50%; bottom: 22px; display: flex; justify-content: center; width: min(850px, calc(100% - 80px)); min-height: 145px; transform: translateX(-50%); }
.human-hand .playing-card { margin-left: -13px; transform-origin: bottom center; }
.human-hand .playing-card:first-child { margin-left: 0; }
.human-hand .playing-card:hover:not(:disabled), .human-hand .playing-card:focus-visible:not(:disabled) { transform: translateY(-16px); }

.deal-panel { display: flex; flex-direction: column; justify-content: space-between; padding: 36px 28px; background: #082821; border-left: 1px solid rgba(255,255,255,.12); }
.panel-kicker { color: #7f998c; font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.deal-score { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; }
.deal-score div { display: flex; flex-direction: column; }
.deal-score strong { font-family: var(--serif); font-size: 3rem; font-weight: 400; line-height: 1; }
.deal-score div:last-child strong { color: #e67668; }
.deal-score span { color: #88a094; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.tricks-row, .seen-row { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 0; border-top: 1px solid rgba(255,255,255,.11); border-bottom: 1px solid rgba(255,255,255,.11); color: #93a99d; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.tricks-row strong { color: #fff; font-size: 1.1rem; }
.tricks-row b { font-weight: 600; }
.seen-row { border-top: 0; }
.tiny-card { position: relative; width: 40px; height: 56px; border-radius: 4px; background: var(--paper-light); color: var(--ink); }
.tiny-card.red { color: var(--red); }
.tiny-card .card-rank { left: 5px; top: 5px; font-size: .9rem; }
.tiny-card .card-pip { font-size: 1.2rem; }
.fair-play { margin: auto 0 0; padding: 1rem; border: 1px solid rgba(239,184,71,.22); background: rgba(239,184,71,.06); color: #91a99d; font-size: .68rem; line-height: 1.5; }
.fair-play > span { float: left; margin-right: .65rem; color: var(--yellow); font-size: 1.2rem; }
.fair-play strong { display: block; color: #e9eee9; font-size: .7rem; }

.result-dialog { position: absolute; z-index: 20; inset: 82px 0 0; display: grid; place-items: center; padding: 2rem; background: rgba(3,20,17,.82); backdrop-filter: blur(8px); }
.result-dialog[hidden] { display: none; }
.result-card { width: min(490px, 100%); padding: 3rem; background: var(--paper); color: var(--ink); text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.result-card .eyebrow { justify-content: center; }
.result-card h2 { margin: .6rem 0 1rem; font-family: var(--serif); font-size: 3.2rem; font-weight: 400; line-height: 1; }
.result-card > p:not(.eyebrow) { color: #657169; line-height: 1.6; }
.result-score { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0; font-family: var(--serif); font-size: 2.5rem; }
.result-score i { color: #89928c; font-family: var(--sans); font-size: 1rem; font-style: normal; }
.primary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 2.5rem; min-width: 190px; padding: .95rem 1.1rem; border: 0; border-radius: 999px; background: var(--red); color: #fff; font-weight: 700; cursor: pointer; }

.ad-section { padding: 54px max(48px, calc((100vw - 1440px) / 2)); background: #e7ddcc; border-bottom: 1px solid rgba(21,33,28,.13); }
.ad-slot { width: min(970px, 100%); min-height: 120px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-content: center; gap: .25rem 2rem; margin: 0 auto; padding: 1.4rem 2rem; border: 1px dashed rgba(21,33,28,.28); background: rgba(255,250,240,.42); color: #68736c; }
.ad-slot span { grid-column: 1 / -1; font-size: .6rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.ad-slot strong { align-self: end; color: #46524b; font-family: var(--serif); font-size: 1.35rem; font-weight: 400; }
.ad-slot small { align-self: end; color: #7c867f; font-size: .66rem; letter-spacing: .1em; }

.rules { display: grid; grid-template-columns: .9fr 2fr; gap: 7rem; padding: 130px max(48px, calc((100vw - 1440px) / 2)); }
.section-label { font-size: .7rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.section-label span { color: var(--red); margin-right: .7rem; }
.rules-heading h2 { margin: 1.5rem 0 2rem; font-family: var(--serif); font-size: clamp(3rem, 5vw, 5rem); font-weight: 400; line-height: .94; letter-spacing: -.035em; }
.rules-heading h2 em { color: var(--red); font-weight: 400; }
.rules-heading > p { max-width: 430px; color: #5f6b64; line-height: 1.75; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid rgba(21,33,28,.2); }
.rules-grid article { min-height: 240px; padding: 2rem; border-right: 1px solid rgba(21,33,28,.2); border-bottom: 1px solid rgba(21,33,28,.2); }
.rules-grid article:nth-child(even) { border-right: 0; }
.rule-number { color: var(--red); font-size: .68rem; font-weight: 700; letter-spacing: .1em; }
.rules-grid h3 { margin: 1.7rem 0 .7rem; font-family: var(--serif); font-size: 1.65rem; font-weight: 400; }
.rules-grid p { margin: 0; color: #657169; font-size: .88rem; line-height: 1.7; }
.rank-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1.4rem 0 0; padding: 0; list-style: none; }
.rank-list li { display: flex; flex-direction: column; padding: .55rem; background: #e6dccb; }
.rank-list b { font-family: var(--serif); font-size: 1.15rem; }
.rank-list span { color: #69746d; font-size: .62rem; text-transform: uppercase; }

footer { display: flex; justify-content: space-between; gap: 2rem; padding: 32px max(48px, calc((100vw - 1440px) / 2)); background: var(--green-950); color: #a8bbb0; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }

@media (max-width: 1050px) {
  .table-wrap { grid-template-columns: 1fr; }
  .deal-panel { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.4fr; gap: 1.5rem; min-height: auto; border-left: 0; border-top: 1px solid rgba(255,255,255,.12); }
  .fair-play { margin: 0; }
  .rules { grid-template-columns: 1fr; gap: 4rem; }
}

@media (max-width: 760px) {
  .site-header { width: calc(100% - 36px); height: 78px; }
  .site-header nav { gap: 1rem; font-size: .72rem; }
  .site-header nav a:first-child { display: none; }
  .game-intro { align-items: flex-start; flex-direction: column; gap: 1.5rem; width: calc(100% - 36px); padding: 55px 0 32px; }
  .game-topbar { grid-template-columns: 1fr auto; padding: .8rem 18px; }
  .deal-data { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .quiet-button { grid-column: 2; grid-row: 1; }
  .score-team span { display: none; }
  .table-wrap, .felt-table { min-height: 660px; }
  .felt-table::before { width: 520px; height: 520px; }
  .seat-west { left: 5px; }
  .seat-east { right: 5px; }
  .player-copy span { display: none; }
  .seat-west .player-copy, .seat-east .player-copy { display: none; }
  .seat-west .stack-side { left: 62px; }
  .seat-east .stack-side { right: 62px; }
  .trick-area { width: 290px; transform: translate(-50%,-53%) scale(.9); }
  .seat-south { bottom: 170px; }
  .human-hand { bottom: 18px; width: calc(100% - 12px); min-height: 130px; }
  .human-hand .playing-card { width: 62px; height: 90px; margin-left: -25px; }
  .human-hand .playing-card:first-child { margin-left: 0; }
  .deal-panel { grid-template-columns: 1fr 1fr; padding: 24px 18px; }
  .fair-play { grid-column: 1 / -1; }
  .ad-section { padding: 34px 22px; }
  .ad-slot { min-height: 100px; padding: 1.15rem; }
  .ad-slot strong { font-size: 1.15rem; }
  .rules { padding: 84px 22px; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-grid article { border-right: 0; padding: 1.5rem 0; }
  footer { align-items: flex-start; flex-direction: column; padding: 32px 22px; }
}

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