:root {
  color-scheme: dark;
  --ink: #132523;
  --muted: #66736e;
  --cream: #f7f0df;
  --paper: #fffaf0;
  --paper-deep: #eadfca;
  --green-950: #071f1e;
  --green-900: #0b2927;
  --green-800: #123b35;
  --green-700: #1c5045;
  --navy: #122437;
  --red: #a83935;
  --red-dark: #7f2825;
  --gold: #cba25a;
  --gold-soft: #ead2a1;
  --line: rgba(246, 236, 215, 0.18);
  --shadow: 0 22px 70px rgba(2, 13, 14, 0.28);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--green-950);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 18% 8%, rgba(38, 105, 87, 0.36), transparent 35rem),
    radial-gradient(circle at 92% 48%, rgba(18, 36, 55, 0.7), transparent 38rem),
    linear-gradient(150deg, var(--green-900), #071b20 72%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110' viewBox='0 0 110 110'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  content: "";
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 3px;
}

a {
  color: #f1d296;
  text-underline-offset: 0.18em;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: var(--paper);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.site-footer,
#app {
  width: min(100% - 1.25rem, 1060px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--cream);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  color: var(--green-950);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  background: var(--gold);
  border: 1px solid #f0d19a;
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, Cambria, serif;
  font-size: 1.03rem;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 0.08rem;
  color: rgba(247, 240, 223, 0.66);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#app {
  min-height: calc(100vh - 168px);
  padding: 0.5rem 0 3rem;
}

.site-footer {
  padding: 1.3rem 0 1.8rem;
  color: rgba(247, 240, 223, 0.56);
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
}

.site-footer p {
  max-width: 680px;
  margin: 0 auto;
}

.site-footer span {
  color: #74b89a;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-weight: 600;
}

.eyebrow {
  margin-bottom: 0.6rem;
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.loading-panel,
.error-panel,
.privacy-panel {
  display: grid;
  min-height: 58vh;
  padding: 2rem;
  place-content: center;
  text-align: center;
}

.loading-panel h1,
.error-panel h1,
.privacy-panel h1 {
  margin: 1.2rem 0 0.6rem;
  font-size: clamp(1.8rem, 8vw, 3rem);
}

.loading-panel p,
.privacy-panel p,
.error-panel p {
  max-width: 34rem;
  color: rgba(247, 240, 223, 0.72);
  line-height: 1.65;
}

.spinner {
  display: inline-block;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto;
  border: 3px solid rgba(247, 240, 223, 0.16);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.setup-layout {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
}

.setup-intro,
.setup-card,
.reveal-card,
.leaderboard-card,
.decision-board,
.resources {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.setup-intro {
  position: relative;
  overflow: hidden;
  min-height: 275px;
  padding: clamp(1.6rem, 6vw, 3.4rem);
  background:
    linear-gradient(140deg, rgba(9, 34, 32, 0.32), rgba(5, 20, 24, 0.78)),
    repeating-linear-gradient(35deg, transparent 0 18px, rgba(255, 255, 255, 0.018) 18px 19px),
    var(--green-800);
  border-radius: var(--radius-lg);
}

.setup-intro::after {
  position: absolute;
  right: -2.5rem;
  bottom: -4.5rem;
  color: rgba(234, 210, 161, 0.08);
  content: "J♠";
  font-family: Georgia, serif;
  font-size: 15rem;
  line-height: 1;
  transform: rotate(10deg);
}

.setup-intro > * {
  position: relative;
  z-index: 1;
}

.setup-intro h1 {
  max-width: 680px;
  margin-bottom: 1rem;
  font-size: clamp(2.4rem, 10vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.setup-intro .lede {
  max-width: 610px;
  margin-bottom: 0;
  color: rgba(247, 240, 223, 0.75);
  font-size: clamp(0.98rem, 3vw, 1.12rem);
  line-height: 1.7;
}

.setup-card {
  padding: clamp(1.3rem, 5vw, 2.2rem);
  color: var(--ink);
  background: var(--cream);
  border-color: rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-lg);
}

.setup-card h2 {
  margin-bottom: 1.5rem;
  font-size: 1.65rem;
}

.form-grid {
  display: grid;
  gap: 1.35rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.field-label {
  display: block;
  margin-bottom: 0.6rem;
  color: #263a36;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(var(--segments, 2), 1fr);
  gap: 0.35rem;
  padding: 0.3rem;
  background: #e3dac9;
  border-radius: 13px;
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 45px;
  padding: 0.55rem;
  place-items: center;
  color: #51605b;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 750;
  text-align: center;
}

.segmented input:checked + span {
  color: var(--cream);
  background: var(--green-800);
  box-shadow: 0 5px 14px rgba(7, 31, 30, 0.22);
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.ambiguity-options {
  display: grid;
  gap: 0.5rem;
}

.ambiguity-options label {
  cursor: pointer;
}

.ambiguity-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ambiguity-options span {
  display: grid;
  gap: 0.18rem;
  padding: 0.75rem 0.85rem;
  color: #4c4a42;
  background: #f3ecdf;
  border: 1px solid #d6c8b0;
  border-radius: 9px;
}

.ambiguity-options strong {
  font-size: 0.84rem;
}

.ambiguity-options small {
  color: #756e63;
  font-size: 0.7rem;
  line-height: 1.35;
}

.ambiguity-options input:checked + span {
  color: var(--green-800);
  background: #e2eadf;
  border-color: #789883;
  box-shadow: inset 0 0 0 1px #789883;
}

.ambiguity-options input:focus-visible + span {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.name-fields {
  display: grid;
  gap: 0.9rem;
}

.text-field label {
  display: block;
  margin-bottom: 0.38rem;
  color: #53615c;
  font-size: 0.78rem;
  font-weight: 700;
}

.text-field input {
  width: 100%;
  min-height: 49px;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #cbbfa9;
  border-radius: 11px;
}

.text-field input::placeholder {
  color: #8b928e;
}

.primary-button,
.secondary-button,
.quiet-button,
.call-button {
  min-height: 48px;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}

.primary-button {
  color: var(--cream);
  background: var(--red);
  box-shadow: 0 8px 20px rgba(127, 40, 37, 0.22);
}

.primary-button:hover {
  background: var(--red-dark);
}

.secondary-button {
  color: var(--cream);
  background: var(--green-700);
}

.quiet-button {
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  color: rgba(247, 240, 223, 0.86);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.setup-submit {
  width: 100%;
  margin-top: 0.2rem;
}

.error-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  color: #fff2e9;
  background: rgba(133, 38, 32, 0.8);
  border: 1px solid rgba(255, 220, 203, 0.3);
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.error-banner button {
  flex: 0 0 auto;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.2rem;
}

.match-shell {
  display: grid;
  gap: 1rem;
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.25rem;
}

.hand-count {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.12rem;
}

.hand-count span {
  color: rgba(247, 240, 223, 0.55);
  font-family: Inter, sans-serif;
  font-size: 0.76rem;
}

.progress-track {
  width: min(45vw, 260px);
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #eed7aa);
  border-radius: inherit;
}

.decision-board {
  overflow: hidden;
  color: var(--ink);
  background: var(--cream);
  border-color: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
}

.board-top {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
  color: var(--cream);
  background:
    radial-gradient(circle at center, rgba(50, 119, 91, 0.58), transparent 70%),
    linear-gradient(145deg, var(--green-800), #0d2b2b);
}

.position-copy h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.75rem, 7vw, 2.6rem);
}

.position-copy p:last-child {
  margin-bottom: 0;
  color: rgba(247, 240, 223, 0.7);
  font-size: 0.84rem;
  line-height: 1.5;
}

.mini-table-wrap {
  display: grid;
  place-items: center;
}

.mini-table {
  position: relative;
  width: min(100%, 340px);
  height: 220px;
}

.table-felt {
  position: absolute;
  inset: 34px 48px;
  display: grid;
  place-items: center;
  color: rgba(247, 240, 223, 0.48);
  background: #16483d;
  border: 5px solid #12372f;
  border-radius: 45%;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.25), 0 12px 25px rgba(0, 0, 0, 0.18);
  font-family: Georgia, serif;
  font-size: 1.5rem;
}

.table-seat {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 120px;
  padding: 0.45rem 0.55rem;
  color: rgba(247, 240, 223, 0.76);
  background: rgba(5, 24, 25, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  font-size: 0.65rem;
  line-height: 1.25;
}

.table-seat strong {
  display: block;
  color: var(--cream);
  font-size: 0.72rem;
}

.table-seat.is-player {
  background: var(--gold);
  border-color: #f2d79f;
  color: #3a3428;
}

.table-seat.is-player strong {
  color: var(--green-950);
}

.seat-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.seat-top { top: 0; left: 50%; transform: translateX(-50%); }
.seat-left { top: 50%; left: 0; transform: translateY(-50%); }
.seat-right { top: 50%; right: 0; transform: translateY(-50%); }

.dealer-chip {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--red-dark);
  background: var(--paper);
  border: 1px solid #d9c8aa;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  font-size: 0.58rem;
  font-weight: 900;
}

.hand-area {
  padding: 1.25rem;
}

.upcard-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid #d7cbb6;
}

.upcard-copy p {
  margin-bottom: 0.25rem;
  color: #727972;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.upcard-copy h2 {
  margin: 0;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  line-height: 1.15;
}

.playing-card {
  position: relative;
  display: grid;
  width: clamp(58px, 17vw, 104px);
  aspect-ratio: 0.7;
  padding: 0.44rem;
  place-content: center;
  color: #142322;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.85), transparent 45%),
    var(--paper);
  border: 1px solid #d4c5aa;
  border-radius: 9px;
  box-shadow: 0 8px 18px rgba(27, 39, 35, 0.15), inset 0 0 0 3px rgba(255, 255, 255, 0.45);
  font-family: Georgia, Cambria, serif;
  user-select: none;
}

.playing-card.red {
  color: var(--red);
}

.playing-card .corner {
  position: absolute;
  top: 0.38rem;
  left: 0.42rem;
  display: grid;
  line-height: 0.88;
  text-align: center;
}

.playing-card .rank {
  font-size: clamp(0.85rem, 3.5vw, 1.12rem);
  font-weight: 700;
}

.playing-card .corner-suit {
  font-size: clamp(0.72rem, 3vw, 0.95rem);
}

.playing-card .main-suit {
  font-size: clamp(1.75rem, 8vw, 3.3rem);
  line-height: 1;
}

.playing-card.upcard {
  width: clamp(66px, 20vw, 88px);
  transform: rotate(-3deg);
}

.cards-label {
  margin: 1.2rem 0 0.65rem;
  color: #69736e;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-hand {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1.2rem;
}

.card-hand .playing-card {
  flex: 0 0 auto;
  margin-left: clamp(-14px, -2.2vw, -5px);
  transform: translateY(var(--lift, 0)) rotate(var(--turn, 0));
  transform-origin: center 120%;
}

.card-hand .playing-card:first-child {
  margin-left: 0;
}

.card-hand .playing-card:nth-child(1) { --turn: -5deg; --lift: 5px; }
.card-hand .playing-card:nth-child(2) { --turn: -2.5deg; --lift: 1px; }
.card-hand .playing-card:nth-child(3) { --turn: 0deg; --lift: -1px; }
.card-hand .playing-card:nth-child(4) { --turn: 2.5deg; --lift: 1px; }
.card-hand .playing-card:nth-child(5) { --turn: 5deg; --lift: 5px; }

.decision-prompt {
  padding-top: 1.1rem;
  border-top: 1px solid #d7cbb6;
  text-align: center;
}

.decision-prompt h2 {
  margin-bottom: 0.35rem;
  font-size: 1.55rem;
}

.decision-prompt p {
  margin-bottom: 1rem;
  color: #69736e;
  font-size: 0.86rem;
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.call-button {
  min-height: 58px;
  color: var(--cream);
  background: var(--green-700);
  font-size: 0.98rem;
}

.call-button.order {
  background: var(--red);
}

.call-button small {
  display: block;
  margin-top: 0.15rem;
  opacity: 0.7;
  font-size: 0.65rem;
  font-weight: 600;
}

.privacy-panel {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  background:
    linear-gradient(90deg, rgba(4, 22, 23, 0.45), transparent 30% 70%, rgba(4, 22, 23, 0.45)),
    repeating-linear-gradient(90deg, #123b35 0 34px, #10352f 34px 68px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.privacy-panel::before {
  display: grid;
  width: 4.6rem;
  height: 4.6rem;
  margin: 0 auto;
  place-items: center;
  color: var(--gold-soft);
  background: rgba(3, 18, 19, 0.4);
  border: 1px solid rgba(234, 210, 161, 0.25);
  border-radius: 50%;
  content: "♠";
  font-family: Georgia, serif;
  font-size: 2rem;
}

.privacy-panel .primary-button {
  justify-self: center;
  min-width: min(100%, 300px);
  margin-top: 0.4rem;
}

.reveal-layout,
.final-layout {
  display: grid;
  gap: 1rem;
}

.reveal-card,
.leaderboard-card {
  overflow: hidden;
  color: var(--ink);
  background: var(--cream);
  border-color: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
}

.reveal-hero,
.final-hero {
  padding: clamp(1.4rem, 6vw, 2.8rem);
  color: var(--cream);
  background: linear-gradient(135deg, var(--green-800), var(--navy));
}

.reveal-hero h1,
.final-hero h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(2rem, 8vw, 3.4rem);
}

.reveal-hero p:last-child,
.final-hero p:last-child {
  margin-bottom: 0;
  color: rgba(247, 240, 223, 0.7);
}

.perfect-call {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.55rem 0.75rem;
  color: #2c281e;
  background: var(--gold-soft);
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 850;
}

.hand-review {
  padding: 1.15rem 1rem;
  background: #eee4d2;
  border-bottom: 1px solid #d6c8b0;
}

.review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.review-heading h2 {
  margin: 0;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
}

.review-turn-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #69736e;
  font-size: 0.68rem;
  line-height: 1.35;
  text-transform: uppercase;
}

.review-turn-card strong {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 0.95rem;
  text-transform: none;
}

.playing-card.review-upcard {
  width: clamp(48px, 14vw, 67px);
  transform: rotate(3deg);
}

.review-card-hand {
  padding-bottom: 1.5rem;
}

.stats-explanation {
  padding: 1rem;
  color: var(--cream);
  background: linear-gradient(140deg, var(--green-800), var(--navy));
  border-radius: var(--radius-md);
}

.stats-explanation h3 {
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.stats-explanation p {
  margin: 0;
  color: rgba(247, 240, 223, 0.84);
  font-size: 0.8rem;
  line-height: 1.5;
}

.stats-explanation p + p {
  margin-top: 0.55rem;
}

.stats-explanation strong {
  color: var(--gold-soft);
}

.demonstration-panel {
  padding: 1.1rem 1rem 1.25rem;
  color: var(--ink);
  background: #f7f0e3;
  border-bottom: 1px solid #d6c8b0;
}

.demo-disclosure {
  background: #f7f0e3;
  border-bottom: 1px solid #d6c8b0;
}

.demo-disclosure > summary {
  padding: 1rem;
  cursor: pointer;
  color: var(--green-800);
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  list-style: none;
}

.demo-disclosure > summary::-webkit-details-marker {
  display: none;
}

.demo-disclosure > summary::after {
  float: right;
  content: "+";
  font-family: Inter, sans-serif;
}

.demo-disclosure[open] > summary::after {
  content: "−";
}

.demo-disclosure[open] > summary {
  border-bottom: 1px solid #d6c8b0;
}

.probability-grid.results-first {
  background: #eee4d2;
  border-bottom: 1px solid #d6c8b0;
}

.demonstration-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.demonstration-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.9rem);
}

.demo-trump {
  flex: 0 0 auto;
  padding: 0.45rem 0.65rem;
  color: var(--cream);
  background: var(--green-800);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.demo-discard,
.demo-note {
  color: #6a6257;
  font-size: 0.78rem;
}

.demo-score {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 1rem 0 0.75rem;
  padding: 0.7rem 0.35rem;
  color: var(--cream);
  background: linear-gradient(135deg, var(--green-800), var(--navy));
  border-radius: 10px;
  text-align: center;
}

.demo-score span {
  display: grid;
  gap: 0.12rem;
  font-size: 0.66rem;
  text-transform: uppercase;
}

.demo-score strong {
  color: var(--gold-soft);
  font-size: 1.15rem;
}

.demo-hands {
  display: grid;
  gap: 0.55rem;
}

.demo-seat {
  min-width: 0;
  padding: 0.65rem;
  background: #ebe0cd;
  border: 1px solid #dacaae;
  border-radius: 9px;
}

.demo-seat.is-you {
  background: #e2eadf;
  border-color: #a4bba9;
}

.demo-seat h4 {
  margin: 0 0 0.45rem;
  color: #4c4a42;
  font-size: 0.72rem;
}

.demo-seat-cards,
.demo-trick-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.demo-mini-card {
  display: inline-grid;
  width: 2.45rem;
  height: 3.35rem;
  place-content: center;
  color: #17201e;
  background: #fffdf7;
  border: 1px solid #c9bdab;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(19, 24, 22, 0.12);
  font-family: Georgia, serif;
  line-height: 1;
  text-align: center;
}

.demo-mini-card strong {
  font-size: 0.85rem;
}

.demo-mini-card.red {
  color: var(--red);
}

.demo-empty {
  align-self: center;
  color: #7a7368;
  font-size: 0.74rem;
}

.demo-trick {
  min-height: 7.2rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  color: var(--cream);
  background: #123b35;
  border-radius: 10px;
}

.demo-trick > p {
  margin: 0 0 0.6rem;
  color: var(--gold-soft);
  font-family: Georgia, serif;
}

.demo-play {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
}

.demo-play.wins .demo-mini-card {
  outline: 3px solid var(--gold);
}

.demo-play small {
  max-width: 4.2rem;
  color: rgba(247, 240, 223, 0.72);
  font-size: 0.58rem;
  text-align: center;
}

.demo-narration {
  min-height: 2.8rem;
  margin: 0.75rem 0 0.55rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.demo-progress {
  overflow: hidden;
  height: 0.35rem;
  background: #ded3c1;
  border-radius: 99px;
}

.demo-progress span {
  display: block;
  height: 100%;
  background: var(--gold-dark);
  transition: width 180ms ease;
}

.demo-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.quiet-demo-button,
.play-demo-button {
  min-height: 2.7rem;
  padding: 0.6rem;
  border-radius: 8px;
  font-weight: 800;
}

.quiet-demo-button {
  color: var(--green-800);
  background: transparent;
  border: 1px solid #a9a08f;
}

.play-demo-button {
  color: var(--cream);
  background: var(--green-700);
  border: 1px solid var(--green-700);
}

.quiet-demo-button:disabled,
.play-demo-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.probability-grid {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
}

.probability-card {
  position: relative;
  overflow: hidden;
  padding: 1.1rem;
  background: var(--paper);
  border: 1px solid #d8ccb7;
  border-radius: var(--radius-md);
}

.probability-card.ideal {
  border: 2px solid var(--gold);
}

.probability-card .best-flag {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.3rem 0.55rem;
  color: #3b311d;
  background: var(--gold-soft);
  border-radius: 0 0 0 8px;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.probability-card h2 {
  margin-bottom: 0.85rem;
  font-size: 1.3rem;
}

.metric-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.metric-row + .metric-row {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2d8c6;
}

.metric-row span {
  color: #737b76;
  font-size: 0.75rem;
}

.metric-row strong {
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.metric-row strong.negative {
  color: var(--red-dark);
}

.decision-results {
  padding: 0 1rem 1rem;
}

.decision-results h2 {
  margin: 0.5rem 0 0.8rem;
  font-size: 1.35rem;
}

.player-result {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid #ddd1bd;
}

.player-result strong,
.player-result span {
  display: block;
}

.player-result span {
  margin-top: 0.15rem;
  color: #6e7772;
  font-size: 0.76rem;
}

.player-result .decision-explanation {
  max-width: 36rem;
  margin: 0.45rem 0 0;
  color: #46534e;
  font-size: 0.76rem;
  line-height: 1.45;
}

.result-badge {
  flex: 0 0 auto;
  padding: 0.4rem 0.55rem;
  color: #1f4b38;
  background: #d9eadb;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 900;
}

.result-badge.missed {
  color: #7c2c29;
  background: #f0d6d2;
}

.reveal-footer {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  background: #e8decc;
}

.method-line {
  margin: 0;
  color: #70766f;
  font-size: 0.68rem;
  line-height: 1.45;
  text-align: center;
}

.final-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.leaderboard-card {
  padding: 1rem;
}

.leaderboard-card h2 {
  margin: 0.4rem 0 1rem;
  font-size: 1.45rem;
}

.leader-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 0;
  border-top: 1px solid #ddd1bd;
}

.leader-rank {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--cream);
  background: var(--green-700);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 900;
}

.leader-row:first-of-type .leader-rank {
  color: #3c321f;
  background: var(--gold);
}

.leader-name {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Inter, sans-serif;
  font-size: 1rem;
  font-weight: 850;
}

.leader-record {
  margin-top: 0.2rem;
  color: #747c77;
  font-size: 0.72rem;
}

.leader-stats {
  text-align: right;
}

.leader-stats strong,
.leader-stats span {
  display: block;
}

.leader-stats strong {
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

.leader-stats span {
  margin-top: 0.2rem;
  color: #747c77;
  font-size: 0.66rem;
}

.final-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.resources {
  overflow: hidden;
  margin-top: 1rem;
  background: rgba(5, 25, 26, 0.54);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.resources details + details {
  border-top: 1px solid var(--line);
}

.resources summary {
  padding: 1rem 1.1rem;
  cursor: pointer;
  color: var(--cream);
  font-family: Georgia, serif;
  font-weight: 600;
  list-style: none;
}

.resources summary::-webkit-details-marker {
  display: none;
}

.resources summary::after {
  float: right;
  color: var(--gold);
  content: "+";
  font-family: Inter, sans-serif;
}

.resources details[open] summary::after {
  content: "−";
}

.details-copy {
  padding: 0 1.1rem 1.15rem;
  color: rgba(247, 240, 223, 0.68);
  font-size: 0.82rem;
  line-height: 1.65;
}

.details-copy p:last-child,
.details-copy ul:last-child {
  margin-bottom: 0;
}

.details-copy h3 {
  margin: 1.1rem 0 0.35rem;
  color: var(--gold-soft);
  font-family: Georgia, serif;
  font-size: 1rem;
}

.details-copy h3:first-child {
  margin-top: 0;
}

.details-copy ul,
.details-copy ol {
  padding-left: 1.2rem;
}

.details-copy li + li {
  margin-top: 0.4rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: min(calc(100% - 2rem), 380px);
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #d9c7a7;
  border-radius: 10px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.noscript {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 100;
  padding: 1rem;
  color: #421a16;
  background: #f6d7c9;
  border-radius: 10px;
  text-align: center;
}

@media (min-width: 700px) {
  .site-header,
  .site-footer,
  #app {
    width: min(100% - 3rem, 1060px);
  }

  .site-header {
    min-height: 90px;
  }

  #app {
    padding-top: 1rem;
  }

  .setup-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    align-items: stretch;
  }

  .setup-intro {
    min-height: 560px;
    display: grid;
    align-content: center;
  }

  .setup-card {
    display: grid;
    align-content: center;
  }

  .name-fields {
    grid-template-columns: 1fr 1fr;
  }

  .ambiguity-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .board-top {
    grid-template-columns: minmax(250px, 0.8fr) minmax(360px, 1.2fr);
    align-items: center;
    padding: 1.6rem 2rem;
  }

  .hand-area {
    padding: 1.8rem 2rem 2rem;
  }

  .upcard-row {
    max-width: 600px;
    margin-inline: auto;
  }

  .playing-card {
    border-radius: 11px;
  }

  .card-hand {
    padding-block: 1rem 1.8rem;
  }

  .decision-prompt {
    max-width: 600px;
    margin-inline: auto;
  }

  .probability-grid {
    grid-template-columns: 1fr 1fr;
    padding: 1.4rem;
  }

  .hand-review {
    padding: 1.5rem 1.4rem;
  }

  .review-heading,
  .review-card-hand,
  .stats-explanation {
    max-width: 760px;
    margin-inline: auto;
  }

  .stats-explanation {
    padding: 1.2rem 1.35rem;
  }

  .demonstration-panel {
    padding: 1.5rem 1.4rem;
  }

  .demonstration-panel > * {
    max-width: 760px;
    margin-inline: auto;
  }

  .demo-hands {
    grid-template-columns: repeat(2, 1fr);
  }

  .demo-controls {
    grid-template-columns: repeat(4, 1fr);
  }

  .decision-results,
  .reveal-footer {
    padding-inline: 1.4rem;
  }

  .reveal-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .reveal-footer .primary-button {
    min-width: 220px;
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .method-line {
    text-align: left;
  }

  .leaderboard-card {
    padding: 1.5rem 2rem;
  }

  .final-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
