html { scrollbar-gutter: stable; scroll-padding-block-start: 160px; }
.rules-facts { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.rules-facts dt { color: #c2ceb9; font: 700 13px Arial, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.rules-facts dd { margin: 4px 0 0; color: #ffe5a7; font-size: 19px; }
.rules-table { border-collapse: collapse; width: 100%; color: #e6e8dc; font: 14px/1.4 Arial, sans-serif; }
.rules-table th, .rules-table td { border-bottom: 1px solid #60806780; padding: 6px; text-align: left; }
.rules-table th { color: #ffe1a1; }
.topbar { height: 70px; }
.brand { gap: 9px; }
.brand > svg { width: 39px; height: 39px; }
.brand h1 { font-size: 25px; }
.header-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.turn-display {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 12px 3% 0;
}
.turn-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 17px;
  background: #22352b;
  border: 1px solid #59705a;
  border-radius: 9px;
}
.turn-banner[data-your-turn="true"],
.turn-banner[data-phase="matchEnd"] {
  background: #2a3f30;
  border-color: #d1b776;
}
.turn-banner[data-your-turn="true"] {
  animation: gold-cue 950ms ease-out both;
}
@keyframes gold-cue {
  0% { box-shadow: 0 0 0 0 #f9cc7280, inset 0 0 14px #f9cc7240; }
  36% { box-shadow: 0 0 0 4px #f9cc7270, inset 0 0 20px #f9cc7250; }
  100% { box-shadow: 0 0 0 0 #f9cc7200, inset 0 0 0 #f9cc7200; }
}
.turn-context, .turn-hint {
  margin: 0;
  color: #c9d3bd;
  font: 14px/1.4 Arial, sans-serif;
}
.turn-context { color: #aabfae; }
.turn-hint:empty, #held-count:empty { display: none; }
#table-message {
  margin: 4px 0;
  color: #f5f1e2;
  font-size: clamp(23px, 3vw, 37px);
  line-height: 1.08;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.turn-banner > div { min-width: 0; }
[data-phase="result"] #table-message { font-size: clamp(17px, 2vw, 24px); line-height: 1.35; }
[data-your-turn="true"] #table-message,
[data-phase="matchEnd"] #table-message { color: #ffe1a1; }
.turn-banner .deal-button { flex-shrink: 0; }
.toolbar { padding-top: 10px; padding-bottom: 4px; }
.toolbar:not(:has(> :not([hidden]))) { display: none; }
#rematch-button { margin-left: auto; }
.online-toolbar { flex-wrap: nowrap; color: #aabfae; font: 13px Arial, sans-serif; white-space: nowrap; }
.table[data-opponents] { min-height: 300px; padding-bottom: 22px; }
.table-emblem { width: 48px; height: 48px; color: #e4d8ae45; margin: auto; }
.table .opponent-label strong { font-size: 15px; color: #e8e8db; }
.table .acting-seat .opponent-label strong { color: #ffe1a1; font-weight: 700; }
.table .opponent-label > span { font-size: 12px; }
.table .bottom-seat .opponent-label { margin: 0; }
.seat-front { display: flex; justify-content: center; align-items: flex-start; }
.seat-front .seat-pool { min-width: 0; }
.seat-name { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.seat-name strong { overflow-wrap: anywhere; }
.pass-status {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 4px;
  color: #ffe1a1;
  font: 700 12px/1.2 Arial, sans-serif;
}
.pass-flash { animation: pass-cue 850ms ease-out; }
@keyframes pass-cue {
  from, 25% { color: #302712; background-color: #ffe1a1; box-shadow: 0 0 9px #e9be5caa; }
  to { color: #ffe1a1; background-color: transparent; box-shadow: none; }
}
.passed-seat .opponent-hand .mini-card, #hand[data-passed="true"] .fan-card { filter: grayscale(1) brightness(.82); }
.dealer-chip {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  flex: 0 0 19px;
  height: 19px;
  border: 1px solid #f1d89e;
  border-radius: 50%;
  background: #d8bb7d;
  color: #192c26;
  box-shadow: inset 0 0 0 2px #8d774e, 0 2px 4px #07171277;
  font: 700 11px/1 Arial, sans-serif;
}
.winnings-pile {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px auto 0;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #ad9d6966;
  color: #ddd1a5;
  font: 11px/1.15 Arial, sans-serif;
}
.winnings-pile svg { width: 12px; height: 12px; }
#card-flight-layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
.flight-card {
  position: absolute;
  translate: -50% -50%;
  display: grid;
  justify-items: center;
  align-content: space-evenly;
  width: 62px;
  height: 76px;
  padding: 5px;
  border: 1px solid #c5b786;
  border-radius: 6px;
  background: #eee9d7;
  color: var(--suit-color, #604973);
  box-shadow: 0 5px 12px #07171288;
  text-align: center;
  font: 700 14px/1.1 Arial, sans-serif;
}
.flight-card svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
.flight-card.flight-back { background: #233a2c; color: #d8bb7d; }
.flight-back svg { fill: currentColor; stroke: none; }
.flight-card.resolving-tactic {
  z-index: 1;
  border-color: #fff4bf;
  background: #ffdb83;
  color: #3e2a20;
  box-shadow: 0 0 0 2px #ffe5a0, 0 0 28px 8px #fbca5eaa;
}
.pool-card.awaiting-flight { visibility: hidden; }
.played-stack.showdown-cards { flex-wrap: wrap; justify-content: center; width: auto; gap: 8px; padding: 4px; }
.showdown-cards .pool-card { top: 0; margin: 0 auto; }
.showdown-cards li { min-width: 0; max-width: 75px; text-align: center; }
.showdown-owner { display: block; margin-top: 4px; color: #e8e9db; font: 700 12px/1.25 Arial, sans-serif; overflow-wrap: anywhere; }
.live-center:has(.showdown-cards:not([hidden])) .table-emblem { display: none; }
.award-label { color: #e5c88e; font: 700 11px/1.3 Arial, sans-serif; }
.played-stack.award-stack { flex-wrap: wrap; justify-content: center; width: auto; gap: 4px; padding: 4px 4px 6px; }
.award-stack .award-card + .award-card { margin-left: 0; }
.table .opponent-hand { height: 45px; transform: scale(.6); }
.table .mini-character { width: 18px; height: 25px; }
.played-stack .just-played { animation: played-arrival 520ms ease-out both; }
.played-stack .leading-card {
  border-color: #f3cd75;
  box-shadow: 0 0 0 2px #f3cd75, 0 0 9px #efbc5baf, inset 0 0 8px #efbc5b73;
}
.played-stack .cancelled-king {
  border-color: #4b4c4a;
  box-shadow: 0 0 0 2px #414340, -2px 3px 6px #07171288;
}
.played-stack .king-just-cancelled { animation: king-cancelled 440ms ease-out; }

@keyframes played-arrival {
  from { translate: 0 -12px; filter: brightness(1.4); }
  to { translate: 0 0; filter: brightness(1); }
}
@keyframes king-cancelled {
  from { border-color: #fff0b9; box-shadow: 0 0 0 3px #ffe7a0, 0 0 12px #f7c965; }
  to { border-color: #4b4c4a; box-shadow: 0 0 0 2px #414340, -2px 3px 6px #07171288; }
}

.player-zone { margin-top: 14px; }
#round-results[hidden] + .player-zone:has(#hand .fan-card) { margin-top: -10px; }
.player-heading { margin-bottom: 12px; align-items: center; }
.player-heading .you-label { min-width: 0; }
.board-player .player-heading { justify-content: center; gap: 12px; margin: 8px 0 0; }
.board-player #player-name { display: none; }
.board-player .you-label { text-align: left; }
.board-player .player-heading:has(.characters-area:not([hidden])) .you-label { flex-direction: column; gap: 3px; text-align: center; }
.board-player .player-heading:has(.characters-area:not([hidden])) #scoring-summary { margin: 0; max-width: 10ch; }
.player-heading .avatar { flex-shrink: 0; }
.you-label h2 { font-size: 23px; }
.you-label p { color: #c3ceba; line-height: 1.35; }
.you-label p:empty { display: none; }
.cards-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.hand-area { min-width: 0; }
.hand-area > .section-label {
  margin: 0;
  color: #d6e0c9;
  justify-content: center;
  gap: 8px;
  font: 600 15px/1.35 Arial, sans-serif;
  letter-spacing: 0;
}
.hand-area > .section-label::after { content: none; }
.hand-area > .section-label > span { display: inline; color: #a9bba3; font-weight: 400; }
.hand-area > .section-label > span::before { content: '· '; }
.characters-area { flex-shrink: 0; }
.characters-area .characters { gap: 7px; }
.characters-area .character-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 86px;
  height: 84px;
  background: #eee9d7;
}
.characters-area .character-card:is(:hover, :focus-visible, .selected) { transform: none; }
.character-tip-layer { position: fixed; inset: 0; z-index: 60; touch-action: none; }
.character-tooltip {
  position: fixed;
  max-width: min(260px, calc(100% - 16px));
  padding: 10px 13px;
  border: 1px solid #d8b875;
  border-radius: 7px;
  background: #20362b;
  color: #f2ebd6;
  box-shadow: 0 5px 16px #07110d99;
  font: 14px/1.4 Arial, sans-serif;
}
.character-tooltip strong { color: #ffe1a1; }
.character-tooltip p { margin: 4px 0 0; }
.character-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: var(--tip-arrow);
  translate: -50% -1px;
  border: 6px solid transparent;
  border-top-color: #d8b875;
}
.character-symbol { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 3; }
.character-title { color: #263129; font: 700 15px/1.15 Arial, sans-serif; }
.character-flavor { color: #5e6050; font: 10px/1.15 Arial, sans-serif; }
.hand-tools { display: flex; justify-content: flex-end; gap: 8px; }
.hand-tools:not(:has(button:not([hidden]))) { display: none; }
.deal-status { color: #ffe1a1; font: 600 16px Arial, sans-serif; }
[data-dealing="true"] .opponent-hand, [data-dealing="true"] .opponent-label > span { visibility: hidden; }
.deal-characters .character-card, .deal-hand .fan-card {
  animation: card-dealt 340ms ease-out both;
  animation-delay: calc(var(--i) * 34ms);
}
.deal-characters .character-card { animation-delay: calc(var(--i) * 160ms); }
@keyframes card-dealt {
  from { opacity: 0; translate: 0 -14px; }
  to { opacity: 1; translate: 0 0; }
}
.hand {
  position: relative;
  display: block;
  min-height: 0;
  padding: 0;
  isolation: isolate;
  touch-action: pan-y;
}
.hand .fan-card {
  position: absolute;
  height: var(--fan-height);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  /* Keep each rank and suit in the same paint layer as its own card face. */
  isolation: isolate;
  transition: none;
  user-select: none;
}
.hand .fan-card::after { content: none; }
.hand .fan-card:is(:hover, :focus-visible, .selected) {
  transform: none;
  z-index: auto;
  box-shadow: none;
  outline: 0;
}
.fan-face, .fan-index {
  position: absolute;
  inset: 0 auto auto 0;
  width: var(--fan-width);
  height: var(--fan-height);
  pointer-events: none;
  transform: translateY(var(--lifted, 0px)) rotate(var(--card-angle, var(--fan-angle)));
  transform-origin: top left;
  transition: transform 155ms ease, box-shadow 155ms ease;
}
.fan-face {
  z-index: 0;
  display: block;
  border: 1px solid #bdb89e;
  border-radius: 7px;
  background: #eee9d7;
  box-shadow: -2px 3px 6px #0a191866;
}
.tactic-card .fan-face { background: #e7dce8; }
.fan-face .card-art { top: 38%; left: 29%; right: 17%; height: 43%; }
.fan-face .card-name { bottom: 9px; font-size: clamp(8px, 1.1vw, 11px); font-weight: 700; letter-spacing: .02em; }
.fan-index {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 20px;
  height: 37px;
  padding-top: 4px;
  color: #202c25;
}
.fan-index strong { font: 700 14px/1 Arial, sans-serif; font-variant-numeric: tabular-nums; }
.fan-index svg { width: 14px; height: 14px; fill: none; stroke: var(--suit-color); stroke-width: 4; }
.fan-card[data-playable="false"] .fan-face { filter: saturate(.75); }
#hand:is([data-phase="commit"], [data-phase="tie"]) .tactic-card .fan-face { filter: saturate(.22) brightness(.79); }
.fan-card:is(.previewed, .selected, :focus-visible) {
  --lifted: calc(var(--fan-height) * -.63);
  --card-angle: 0deg;
}
.fan-card:is(.selected, .previewed, :focus-visible) .fan-face {
  border-color: #d6ae59;
  box-shadow: 0 0 0 2px #e4c687, 0 9px 19px #07110caa;
}
.inspection {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 9px;
  min-height: 82px;
  border: 1px solid #ffffff20;
  border-radius: 7px;
  outline: 0 solid transparent;
  outline-offset: -1px;
  padding: 12px;
  font-size: 14px;
  color: #ccd8c3;
  overflow-wrap: anywhere;
}
.inspection strong { font-size: 16px; font-weight: 700; color: #ffe5a7; }
.inspection.tactic-inspection {
  border-color: #e0b867;
  background: #322b1c;
  box-shadow: inset 0 0 16px #f6c76b45;
}
.turn-display .played-action { margin-top: 6px; min-height: 0; }
.private-actions { padding: 2px 0 12px; }
.play-control { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; max-width: 100%; margin-left: auto; }
.play-note { margin: 0; max-width: 35ch; color: #f2d79e; font: 14px/1.35 Arial, sans-serif; text-align: right; }
.play-note:empty { display: none; }
.play-buttons { flex: 0 0 auto; max-width: 100%; }
.play-buttons:has(#pass-button:not([hidden])) {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 4fr);
  gap: 8px;
  width: 19.75rem;
}
#play-button, #pass-button, #continue-button { min-height: 44px; font-size: 15px; }
#play-button { max-width: 100%; }
#play-button:not(:disabled), #pass-button, #continue-button { background: #f0cc83; color: #1c2b22; }
#play-button:not(:disabled), #pass-button { animation: gold-cue 760ms ease-out both; }
.table-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 18px; margin-top: 10px; }
.table-stats caption { text-align: left; font-weight: 700; }
.score-suits { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.score-suit { display: inline-flex; align-items: center; gap: 4px; }
.score-suit svg { width: 16px; height: 16px; color: #e5c88e; fill: none; stroke: currentColor; stroke-width: 3; }

@media (min-width: 1000px) {
  .fan-index { width: 26px; height: 45px; }
  .fan-index strong { font-size: 17px; }
  .fan-index svg { width: 16px; height: 16px; }
}
@media (min-width: 1200px) and (orientation: landscape) {
  .player-zone {
    --nest-side-width: clamp(179px, 13vw, 220px);
    display: grid;
    grid-template-columns: var(--nest-side-width) minmax(0, 1fr) var(--nest-side-width);
    grid-template-areas:
      "identity fan suits"
      ". tools ."
      "actions actions actions"
      "inspection inspection inspection"
      "error error error";
    column-gap: 16px;
    align-items: center;
  }
  .player-zone .player-heading, .player-zone .cards-layout { display: contents; }
  .player-zone .you-label { grid-area: identity; overflow-wrap: anywhere; }
  .player-zone .characters-area, #reveal-inline { grid-area: suits; justify-self: end; }
  .player-zone .private-actions { grid-area: actions; }
  .player-zone .hand-area, .player-zone .deal-status { grid-area: fan; }
  .player-zone .hand-tools { grid-area: tools; margin-top: 8px; }
  .player-zone .inspection { grid-area: inspection; }
  .player-zone #action-error { grid-area: error; }
}
@media (max-width: 800px) {
  .table[data-opponents] { min-height: 205px; padding-top: 10px; gap: 7px; }
  .table .opponent-characters { display: none; }
  [data-dealing="true"] .table .opponent-characters { display: flex; }
  .table .opponent-hand { height: 28px; transform: scale(.41); }
  .table .live-center { padding: 0; }
  .table-emblem { display: none; }
  .table .opponent-label { margin-bottom: 4px; }
  .table .opponent-label strong { font-size: 14px; }
  .player-zone { padding-inline: 4%; }
  .you-label h2 { font-size: 21px; }
}
@media (max-width: 480px) {
  .characters-area .character-card { width: 64px; height: 69px; gap: 3px; }
  .character-symbol { width: 21px; height: 21px; }
  .character-title { font-size: 13px; }
  .character-flavor { font-size: 9px; }
  .topbar { height: 61px; }
  .topbar:has(.online-toolbar:not([hidden])) { height: auto; min-height: 61px; padding: 7px 3%; flex-wrap: wrap; gap: 6px; }
  .topbar:has(.online-toolbar:not([hidden])) .brand { gap: 5px; }
  .topbar:has(.online-toolbar:not([hidden])) .brand h1 { font-size: 18px; }
  .topbar:has(.online-toolbar:not([hidden])) .brand > svg { width: 27px; height: 27px; }
  .header-controls, .online-toolbar { gap: 6px; }
  #exit-online { padding-inline: 8px; }
  .turn-display { margin-inline: 2%; }
  .turn-banner { padding: 9px 11px; }
  .turn-hint, .turn-context { font-size: 13px; }
  .turn-banner #continue-button { max-width: 42%; white-space: normal; padding-inline: 10px; }
  .table .played-stack { --played-card-width: 50px; }
  .table .pool-card { height: 56px; }
  .table .played-emblem { height: 21px; width: 21px; }
  .inspection { min-height: 166px; }
  .play-control { gap: 8px; }
  .play-control:has(#pass-button:not([hidden])) { flex-wrap: wrap; }
  .play-control:has(#pass-button:not([hidden])) .play-note { flex-basis: 100%; max-width: none; }
  .play-note { font-size: 12px; }
  #play-button { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .fan-face, .fan-index { transition: none; }
  .pass-flash { animation: none; }
  .played-stack :is(.just-played, .king-just-cancelled) { animation: none; }
}
