html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] {
  --turn-aware-felt: #0d5036;
  --turn-aware-felt-deep: #073724;
  --turn-aware-panel: rgba(4, 38, 25, .86);
  --turn-aware-line: rgba(239, 220, 166, .28);
  --turn-aware-line-strong: rgba(239, 220, 166, .58);
  --turn-aware-cream: #fff8e8;
  --turn-aware-muted: #d6e5d9;
  --turn-aware-gold: #d9ae45;
  --turn-aware-gold-light: #ffe49a;
  width: 100%;
  /* A late iPhone rotation reading cannot make the play surface taller than the viewport. */
  height: min(var(--turn-aware-viewport-height, 100dvh), 100dvh);
  min-height: 0;
  overflow: hidden;
  background: var(--turn-aware-felt-deep);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] body {
  width: 100%;
  height: min(var(--turn-aware-viewport-height, 100dvh), 100dvh);
  min-height: 0;
  overflow: hidden;
  color: var(--turn-aware-cream);
  background:
    radial-gradient(circle at 50% -20%, rgba(61, 139, 95, .55), transparent 48%),
    linear-gradient(155deg, var(--turn-aware-felt), var(--turn-aware-felt-deep));
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game {
  display: grid;
  grid-template-rows: minmax(min-content, 1fr);
  width: 100%;
  height: min(var(--turn-aware-viewport-height, 100dvh), 100dvh);
  min-height: 0;
  overflow-y: auto;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game.has-expiry-warning {
  grid-template-rows: auto minmax(min-content, 1fr);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-expiry-warning {
  z-index: 2;
  width: min(calc(100% - 20px), 1160px);
  margin: calc(env(safe-area-inset-top) + 8px) auto 0;
  color: #fff8e8;
  background: #672f27;
  border-color: #d9ae45;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game.has-expiry-warning .table {
  padding-top: 8px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "turn"
    "surface"
    "hand";
  grid-template-rows: auto minmax(min-content, 1fr) auto;
  box-sizing: border-box;
  gap: 8px;
  width: min(100%, 1180px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 8px)
    calc(env(safe-area-inset-right) + 10px)
    calc(env(safe-area-inset-bottom) + 8px)
    calc(env(safe-area-inset-left) + 10px);
  overflow: hidden;
  background: transparent;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner {
  grid-area: turn;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "status menu"
    "seats seats";
  align-items: center;
  gap: 7px 10px;
  min-width: 0;
  min-height: 88px;
  padding: 8px 11px;
  overflow: hidden;
  color: var(--turn-aware-cream);
  background: var(--turn-aware-panel);
  border: 1px solid var(--turn-aware-line);
  border-radius: 10px;
  box-shadow: none;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner.mine {
  color: #302710;
  background: var(--turn-aware-gold-light);
  border-color: var(--turn-aware-gold);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status {
  grid-area: status;
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .turn-nudge-slot {
  margin: -5px -8px -5px -3px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .turn-nudge-button {
  color: inherit;
  background: transparent;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .turn-nudge-button:hover {
  background: rgba(48, 39, 16, .1);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: Georgia, serif;
  font-size: clamp(15px, .95rem, 20px);
  line-height: 1.05;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status > span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(12px, .78rem, 15px);
  line-height: 1.2;
  color: inherit;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail {
  grid-area: seats;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 3px 8px;
  color: var(--turn-aware-muted);
  background: rgba(13, 80, 54, .78);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.05;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat.local {
  border-color: var(--turn-aware-line-strong);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat.active {
  color: #302710;
  background: var(--turn-aware-gold-light);
  border-color: var(--turn-aware-gold);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner.mine .turn-seat.active {
  color: var(--turn-aware-gold-light);
  background: #302710;
  border-color: #302710;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat.offline {
  opacity: .72;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat b {
  font-variant-numeric: tabular-nums;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat > span {
  color: inherit;
  font-size: 12px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-arrow,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-summary {
  flex: 0 0 auto;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-tools {
  grid-area: menu;
  position: relative;
  z-index: 6;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #table-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 7px;
  color: inherit;
  background: rgba(4, 37, 24, .72);
  border-color: currentColor;
  font-size: 12px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner.mine #table-menu {
  color: #302710;
  background: rgba(255, 248, 232, .42);
  border-color: rgba(48, 39, 16, .45);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #table-menu.needs-attention {
  border-color: var(--turn-aware-gold);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .menu-connection-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--turn-aware-gold-light);
  box-shadow: 0 0 0 2px rgba(4, 38, 25, .45);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-sheet {
  width: min(calc(100% - 24px), 440px);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--turn-aware-cream);
  background: #052f1f;
  border: 1px solid var(--turn-aware-line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 18, 10, .55);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-sheet::backdrop {
  background: rgba(0, 18, 10, .66);
  backdrop-filter: blur(3px);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-sheet form {
  display: grid;
  gap: 10px;
  max-height: inherit;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-heading .eyebrow {
  margin: 0;
  color: var(--turn-aware-muted);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-heading h2 {
  margin: 0;
  color: var(--turn-aware-cream);
  font-family: Georgia, serif;
  font-size: 24px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #table-menu-close {
  min-width: 60px;
  min-height: 44px;
  color: var(--turn-aware-cream);
  background: transparent;
  border-color: var(--turn-aware-line);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #table-connection {
  margin: 0;
  color: var(--turn-aware-muted);
  font-size: 12px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-items {
  display: grid;
  gap: 8px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-items > button {
  min-height: 44px;
  padding: 9px 12px;
  color: var(--turn-aware-cream);
  background: rgba(13, 80, 54, .5);
  border-color: var(--turn-aware-line);
  text-align: left;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-switch-copy strong,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-group > h3 {
  color: var(--turn-aware-cream);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-switch-state {
  color: var(--turn-aware-gold-light);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-switch-copy small,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-actions button span {
  color: var(--turn-aware-muted);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-menu-items > button[role="switch"][aria-checked="true"] {
  border-color: var(--turn-aware-gold);
  box-shadow: inset 3px 0 0 var(--turn-aware-gold);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-actions button {
  color: var(--turn-aware-cream);
  background: rgba(13, 80, 54, .5);
  border-color: var(--turn-aware-line);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-danger {
  background: rgba(99, 31, 31, .34);
  border-color: rgba(236, 151, 141, .38);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-danger > h3,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game-controls-danger > p {
  color: #f1c1ba;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .tabletop-surface {
  grid-area: surface;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "top"
    "melds";
  /* Keep tabs and a complete target row even when the hand grows. */
  grid-template-rows: auto minmax(11rem, 1fr);
  gap: 8px;
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 9px;
  background:
    radial-gradient(circle at 42% 10%, rgba(80, 157, 112, .34), transparent 48%),
    var(--turn-aware-felt);
  border: 1px solid var(--turn-aware-line-strong);
  border-radius: 15px;
  box-shadow: inset 0 0 34px rgba(0, 27, 17, .32);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
  grid-area: top;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "scores"
    "piles";
  gap: 8px;
  min-width: 0;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-strip {
  grid-area: scores;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-strip.multi-side {
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip {
  min-width: 0;
  min-height: 76px;
  padding: 8px 10px;
  overflow: hidden;
  color: var(--turn-aware-muted);
  background: var(--turn-aware-panel);
  border: 1px solid var(--turn-aware-line);
  border-radius: 9px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-strip.multi-side .score-chip {
  flex: 0 0 min(210px, 70vw);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip.mine {
  border-color: var(--turn-aware-line-strong);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-heading {
  display: grid;
  gap: 1px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-name {
  overflow: hidden;
  color: var(--turn-aware-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-value {
  color: var(--turn-aware-cream);
  font-family: Georgia, serif;
  font-size: clamp(20px, 1.5rem, 30px);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-requirement {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--turn-aware-muted);
  font-size: 13px;
  line-height: 1.1;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-requirement.urgent {
  color: var(--turn-aware-gold-light);
  font-weight: 700;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .piles {
  grid-area: piles;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "card label"
    "card detail";
  align-items: center;
  justify-items: start;
  gap: 2px 8px;
  min-width: 0;
  min-height: 60px;
  height: 64px;
  padding: 5px 8px;
  overflow: hidden;
  color: var(--turn-aware-cream);
  background: var(--turn-aware-panel);
  border: 1px solid var(--turn-aware-line);
  border-radius: 10px;
  box-shadow: none;
  text-align: left;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile:not(:disabled) {
  border-color: var(--turn-aware-gold);
  box-shadow: inset 0 0 0 1px var(--turn-aware-gold);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile > :first-child {
  grid-area: card;
  align-self: center;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile strong {
  grid-area: label;
  align-self: end;
  overflow: hidden;
  max-width: 100%;
  color: inherit;
  font-size: clamp(12px, .78rem, 15px);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  grid-area: detail;
  align-self: start;
  overflow: hidden;
  max-width: 100%;
  max-height: 2.2em;
  color: var(--turn-aware-muted);
  font-size: clamp(12px, .75rem, 14px);
  line-height: 1.1;
  text-overflow: ellipsis;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile .card-back,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile .playing-card {
  width: 38px;
  height: 52px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .stock .card-back {
  gap: 0;
  padding: 0 2px;
  overflow: hidden;
  font-size: 12px;
  letter-spacing: -.08em;
  line-height: 1;
  white-space: nowrap;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .stock .card-back span {
  flex: 0 0 auto;
  font-size: 1em;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .compact-card-face {
  padding: 8px 2px 2px 8px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .compact-card-face .corner {
  top: 3px;
  left: 4px;
  font-size: 12px;
  line-height: .8;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .compact-card-face .card-center {
  font-size: .88em;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt {
  color: #5c4a17;
  background: rgba(255, 228, 154, .22);
  border-color: var(--turn-aware-gold);
  box-shadow: inset 0 0 0 1px rgba(217, 174, 69, .5);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt:not(:disabled) {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  color: #302710;
  background: var(--turn-aware-gold-light);
  border-color: var(--turn-aware-gold);
  box-shadow: 0 0 0 2px rgba(255, 228, 154, .28);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt:not(:disabled) small {
  color: #5c4a17;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(48, 39, 16, .18);
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt.holding:not(:disabled)::after {
  transform: scaleX(1);
  transition: transform 400ms linear;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt.hold-ready:not(:disabled) {
  box-shadow: 0 0 0 3px var(--turn-aware-cream);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt > * {
  position: relative;
  z-index: 1;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-area {
  grid-area: melds;
  /* Size the scrollport from the grid, not from every pile in the stack. */
  contain: size;
  min-width: 0;
  min-height: 11rem;
  height: 100%;
  margin: 0;
  padding: 8px;
  overflow: auto;
  color: var(--turn-aware-cream);
  background: var(--turn-aware-panel);
  border: 1px solid var(--turn-aware-line);
  border-radius: 10px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-aware-controls {
  position: sticky;
  z-index: 4;
  top: -8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 44px;
  margin: -8px -8px 6px;
  padding: 5px 8px;
  background: rgba(3, 31, 20, .97);
  border-bottom: 1px solid var(--turn-aware-line);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-tabs {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-tabs button {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--turn-aware-muted);
  background: rgba(13, 80, 54, .48);
  border: 1px solid var(--turn-aware-line);
  border-radius: 8px;
  font-size: 12px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-tabs button[aria-selected="true"] {
  color: var(--turn-aware-cream);
  background: rgba(13, 80, 54, .9);
  border-color: var(--turn-aware-line-strong);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-active {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  padding: 0;
  border-radius: 50%;
  background: var(--turn-aware-gold-light);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-unseen:not(.side-active) {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  height: 16px;
  margin-left: 6px;
  padding: 0 4px;
  color: var(--turn-aware-cream);
  background: rgba(214, 229, 217, .14);
  border: 1px solid rgba(214, 229, 217, .46);
  border-radius: 3px;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-unseen:not(.side-active)::before {
  content: "New";
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-active.side-unseen {
  box-shadow: 0 0 0 3px rgba(214, 229, 217, .32);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #melds {
  position: relative;
  min-width: 0;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .team-melds {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: none;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .team-melds h3 {
  margin: 0 0 7px;
  color: var(--turn-aware-muted);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-finish::before {
  content: " · ";
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  padding: 0;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-areas: "visual copy";
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: none;
  min-height: 66px;
  padding: 6px;
  overflow: hidden;
  color: var(--turn-aware-cream);
  background: rgba(3, 31, 20, .82);
  border: 1px solid var(--turn-aware-line);
  border-radius: 8px;
  box-shadow: none;
  text-align: left;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld.red-three-tile {
  color: #f1d8d3;
  background: rgba(75, 25, 24, .72);
  border-color: rgba(210, 116, 105, .58);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .red-three-tile .meld-kind {
  color: #ddb0a9;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld.complete {
  border-color: var(--turn-aware-line-strong);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld.available-target {
  border-color: var(--turn-aware-gold-light);
  box-shadow: 0 0 0 2px var(--turn-aware-gold);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld.meld-changed {
  border-color: var(--turn-aware-gold-light);
  animation: card-change-ring 1400ms ease-out 1 both;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld.red-three-tile.meld-changed {
  border-color: rgba(210, 116, 105, .58);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-visual {
  grid-area: visual;
  display: block;
  width: 38px;
  height: 52px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-visual .playing-card {
  width: 38px;
  height: 52px;
  border-radius: 5px;
  font-size: .9rem;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-visual .playing-card .corner {
  top: 3px;
  left: 4px;
  font-size: 12px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-copy {
  grid-area: copy;
  min-width: 0;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-copy strong {
  display: block;
  overflow: hidden;
  color: var(--turn-aware-cream);
  font-family: Georgia, serif;
  font-size: clamp(14px, 1rem, 20px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-copy small {
  display: block;
  overflow: hidden;
  color: var(--turn-aware-muted);
  font-size: 12px;
  line-height: 1.15;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-kind {
  display: block;
  color: #c9decf;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-dirty .meld-kind,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-dirty .meld-wild-count {
  color: var(--turn-aware-gold-light);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-dirty .meld-wild-count {
  font-weight: 800;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-wild .meld-kind {
  color: #dcc9f2;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-target {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  color: transparent;
  background: transparent;
  border: 0;
  border-radius: inherit;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-target span,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-target small {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-compact-kind,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-compact-count {
  display: none;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area {
  grid-area: hand;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(84px, 1fr) auto;
  grid-template-areas:
    "heading"
    "hand"
    "actions";
  gap: 5px;
  min-width: 0;
  max-height: min(320px, 48dvh);
  margin: 0;
  padding: 8px 10px;
  overflow: hidden;
  color: var(--turn-aware-cream);
  background: var(--turn-aware-panel);
  border: 1px solid var(--turn-aware-line);
  border-radius: 10px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area .section-heading {
  grid-area: heading;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 2px 5px;
  min-width: 0;
  margin: 0;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area h2 {
  color: var(--turn-aware-cream);
  font-family: inherit;
  font-size: clamp(15px, .95rem, 20px);
  text-shadow: none;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area .muted {
  color: var(--turn-aware-muted);
  font-size: clamp(12px, .75rem, 15px);
  line-height: 1.2;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand {
  grid-area: hand;
  min-height: 84px;
  padding-block: 5px 9px;
  overflow-y: hidden;
  scrollbar-color: rgba(239, 220, 166, .4) transparent;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .card-button {
  flex: 0 0 48px;
  width: 70px;
  min-width: 44px;
  min-height: 82px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .card-button:last-child {
  flex-basis: 72px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .playing-card {
  width: 70px;
  height: 80px;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .card-button.selected .playing-card {
  transform: translateY(-6px);
  box-shadow: 0 0 0 2px var(--turn-aware-gold), 0 7px 11px rgba(0, 18, 10, .34);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .opening-progress {
  color: var(--turn-aware-cream);
  background: rgba(4, 37, 24, .62);
  border-color: var(--turn-aware-line);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .opening-progress-label,
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .opening-progress small {
  color: var(--turn-aware-muted);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .action-dock {
  position: static;
  z-index: auto;
  grid-area: actions;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(44px, auto);
  align-items: stretch;
  width: 100%;
  min-height: 46px;
  height: auto;
  margin: 0;
  padding: 0;
  gap: 6px;
  transform: none;
  background: #052f1f;
  border: 1px solid var(--turn-aware-line);
  border-radius: 9px;
  box-shadow: none;
  overflow: hidden;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .action-dock button {
  min-height: 44px;
  font-size: clamp(12px, .75rem, 15px);
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .action-dock button:only-child {
  grid-column: 1 / -1;
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] button:focus-visible {
  outline: 3px solid var(--turn-aware-gold-light);
  outline-offset: 2px;
}

@media (orientation: landscape) and (min-width: 700px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "status seats menu";
    min-height: 58px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail {
    max-width: min(48vw, 620px);
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .tabletop-surface {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 210px);
    grid-template-areas: "melds top";
    grid-template-rows: minmax(11rem, 1fr);
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
    grid-template-areas:
      "piles"
      "scores";
    grid-template-rows: auto minmax(0, 1fr);
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .piles {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row {
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  }
}

@media (orientation: landscape) and (min-width: 560px) and (max-height: 500px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table {
    grid-template-rows: 48px minmax(0, 1fr) 106px;
    gap: 5px;
    width: 100%;
    max-width: none;
    padding:
      calc(env(safe-area-inset-top) + 6px)
      calc(env(safe-area-inset-right) + 6px)
      calc(env(safe-area-inset-bottom) + 6px)
      calc(env(safe-area-inset-left) + 6px);
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "status seats menu";
    gap: 5px;
    min-height: 48px;
    height: 48px;
    padding: 2px 5px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status strong {
    font-size: 15px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status > span {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail {
    max-width: min(52vw, 470px);
    overflow: hidden;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat {
    min-height: 34px;
    padding: 2px 7px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #table-menu {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .tabletop-surface {
    grid-template-columns: minmax(0, 1fr) 152px;
    grid-template-areas: "melds top";
    grid-template-rows: minmax(11rem, 1fr);
    gap: 5px;
    height: 100%;
    padding: 5px;
    border-radius: 10px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
    grid-template-areas:
      "piles"
      "scores";
    grid-template-rows: auto minmax(0, 1fr);
    gap: 5px;
    min-height: 0;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .piles {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 44px 64px;
    gap: 5px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile {
    gap: 1px 7px;
    min-height: 44px;
    height: 100%;
    padding: 3px 5px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile .card-back,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile .playing-card {
    width: 26px;
    height: 36px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .compact-card-face {
    padding: 6px 1px 1px 6px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .compact-card-face .corner {
    top: 2px;
    left: 3px;
    font-size: 12px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-area {
    height: 100%;
    padding: 4px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-aware-controls {
    top: -4px;
    min-height: 44px;
    margin: -4px -4px 4px;
    padding: 0 5px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-tabs button {
    min-height: 44px;
    padding: 4px 8px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .team-melds h3 {
    position: absolute;
    top: -42px;
    right: 5px;
    z-index: 5;
    display: flex;
    align-items: center;
    max-width: 38%;
    min-height: 40px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-team-name,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-pile-count {
    display: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-finish::before {
    content: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    grid-auto-rows: 48px;
    gap: 3px 4px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row:has(> .meld:nth-child(8):last-child) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row:has(> .meld:nth-child(9):last-child),
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row:has(> .meld:nth-child(10):last-child) {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row:has(> .meld:nth-child(11):last-child),
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row:has(> .meld:nth-child(12):last-child) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row:has(> .red-three-tile:first-child):has(> .meld:nth-child(13):last-child) {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 4px;
    min-height: 48px;
    height: 48px;
    padding: 3px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-visual {
    width: 26px;
    height: 36px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-visual .playing-card {
    width: 26px;
    height: 36px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-copy strong {
    font-size: 14px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-copy small,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-kind {
    font-size: 12px;
    line-height: 1.05;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-kind,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-count,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-wild-count {
    display: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-compact-kind,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-compact-count {
    display: inline;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "heading actions"
      "hand actions";
    gap: 3px 7px;
    height: 106px;
    max-height: 106px;
    padding: 4px 6px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area:not(:has(.action-dock:not(.hidden))) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "hand";
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area .section-heading {
    overflow: hidden;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area h2 {
    display: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area .muted {
    display: block;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand {
    width: 100%;
    height: 68px;
    min-height: 0;
    padding: 1px 2px 2px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .card-button {
    flex: 0 0 52px;
    width: 52px;
    min-height: 64px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .card-button:last-child {
    flex-basis: 54px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand .playing-card {
    width: 52px;
    height: 62px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .action-dock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(44px, 1fr);
    align-content: stretch;
    width: min(300px, 42vw);
    height: 100%;
    padding: 2px;
    gap: 2px;
    overflow: hidden;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .action-dock button {
    min-height: 44px;
    padding: 3px 6px;
    font-size: 12px;
  }
}

@media (orientation: landscape) and (min-width: 1001px) and (max-width: 1280px) and (max-height: 900px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table {
    width: 100%;
    max-width: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area {
    grid-template-columns: minmax(170px, 210px) minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "heading hand actions";
    height: 132px;
    max-height: 132px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area:not(:has(.action-dock:not(.hidden))) {
    grid-template-columns: minmax(170px, 210px) minmax(0, 1fr);
    grid-template-areas: "heading hand";
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand {
    min-height: 112px;
    overflow-y: hidden;
  }
}

@media (max-width: 420px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table {
    gap: 7px;
    padding:
      calc(env(safe-area-inset-top) + 8px)
      calc(env(safe-area-inset-right) + 8px)
      calc(env(safe-area-inset-bottom) + 8px)
      calc(env(safe-area-inset-left) + 8px);
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-banner {
    gap: 3px 8px;
    padding: 5px 10px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .tabletop-surface {
    gap: 7px;
    padding: 8px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip {
    padding: 7px 8px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile {
    gap: 2px 5px;
    height: 60px;
    padding: 4px 5px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile .card-back,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile .playing-card {
    width: 34px;
    height: 48px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-area {
    padding: 7px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-aware-controls {
    top: -7px;
    margin: -7px -7px 6px;
    padding-inline: 7px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .team-melds h3 {
    position: absolute;
    top: -50px;
    right: 7px;
    z-index: 5;
    display: flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-team-name {
    display: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-finish {
    display: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld {
    min-height: 66px;
    height: 66px;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-kind,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-count,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-wild-count {
    display: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-compact-kind,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-compact-count {
    display: inline;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .hand-area {
    grid-template-rows: auto minmax(60px, 1fr) auto;
    padding: 7px 9px;
  }
}

/* Give large tables roomier piles without changing the one-row hand. */
@media (min-width: 1001px) and (min-height: 901px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
    grid-template-rows: auto auto;
    align-content: start;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-row {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld {
    min-height: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld.meld-changed,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .card-button.card-changed {
    animation: none;
    box-shadow: 0 0 0 4px rgba(217, 174, 69, .92), 0 0 12px 4px rgba(217, 174, 69, .36);
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt.holding:not(:disabled)::after {
    transform: scaleX(.2);
    transition: none;
  }

  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .pile.discard-prompt.hold-ready:not(:disabled)::after {
    transform: scaleX(1);
  }
}

/* Keep every seat and both scoring sides readable without another panel. */
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  overflow: visible;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail[data-players="6"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  min-width: 0;
  min-height: 52px;
  padding: 3px 6px;
  border-radius: 8px;
  gap: 0 4px;
  text-align: left;
  font-size: .75rem;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat > span {
  font-size: inherit;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-name {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .foot-pile-cue {
  grid-column: 1 / -1;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-books {
  white-space: normal;
  overflow: visible;
  font-size: .75rem;
  line-height: 1.25;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip {
  width: auto;
  max-width: none;
  min-height: 0;
}
@media (min-width: 700px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail[data-players="6"] {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .foot-pile-cue {
  display: inline-flex;
  margin: 0;
  line-height: 1;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .foot-pile-cue > span {
  display: inline;
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat b {
  white-space: nowrap;
}
@media (orientation: landscape) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat {
    padding: 1px 3px;
    min-height: 0;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-strip:not(.multi-side) {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 3px;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip {
    padding: 4px 6px;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-chip-value {
    font-size: 1.25rem;
  }
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat b {
  grid-column: 1 / -1;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat:has(.turn-nudge-slot:not(.hidden)) {
  grid-template-columns: minmax(0, 1fr) 44px;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat:has(.turn-nudge-slot:not(.hidden)) > :not(.turn-nudge-slot) {
  grid-column: 1;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat .turn-nudge-slot {
  grid-column: 2;
  grid-row: 1 / 4;
  margin: 0;
}
@media (orientation: landscape) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail,
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail[data-players="6"] {
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
    width: min(72vw, 620px);
    max-width: min(72vw, 620px);
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat {
    flex: 1 0 144px;
    min-height: 48px;
    margin-top: 0;
  }
}

html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .score-strip.multi-side .score-chip {
  flex: 0 0 100%;
  max-width: 100%;
  min-width: 0;
}

/* Scores and book progress select the meld view beside the draw/discard piles. */
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #score-strip.hidden {
  display: none;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
  grid-template-areas: "piles" "sides";
  grid-template-rows: auto auto;
  align-content: start;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  align-items: start;
  gap: 2px;
  flex: 1 0 10rem;
  min-width: 0;
  min-height: 44px;
  padding: 5px 8px;
  text-align: left;
  white-space: normal;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: .75rem;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip-value {
  flex: 0 0 auto;
  font-size: 1rem;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip[aria-selected="true"] {
  box-shadow: inset 0 -3px var(--turn-aware-gold-light);
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip:focus::after {
  content: none;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-state {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .6875rem;
  line-height: 1;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .side-state i {
  margin: 0;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .team-melds h3.meld-summary {
  position: absolute;
  top: 0;
  right: auto;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-width: 420px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip {
    flex-basis: 8rem;
  }
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip:focus-visible::after {
  content: attr(data-side-name);
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-aware-controls {
  grid-area: sides;
  position: static;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: none;
  border: 0;
}
@media (orientation: landscape) and (min-width: 560px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip {
    flex: 0 0 auto;
    width: 100%;
  }
  /* A landscape banner is one short row, so the recap pill shares the detail line. */
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title title"
      "detail pill";
    align-items: center;
    column-gap: 6px;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status > strong {
    grid-area: title;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-status > span {
    grid-area: detail;
  }
}
@media (orientation: landscape) and (min-width: 560px) and (max-height: 500px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game {
    grid-template-rows: minmax(0, 1fr);
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .game.has-expiry-warning {
    grid-template-rows: auto minmax(0, 1fr);
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .tabletop-surface {
    grid-template-rows: minmax(0, 1fr);
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .meld-area {
    min-height: 0;
  }
  /* One touch-scroll region keeps complete score tiles reachable below piles. */
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .table-top {
    grid-template-rows: max-content max-content;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-aware-controls {
    overflow: visible;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs {
    overflow: visible;
  }
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] #side-tabs .score-chip-name {
    -webkit-line-clamp: 1;
  }
}

/* Identify local teammates without another player row. */
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-name {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-label {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-relationship {
  margin: 0;
  flex: 0 0 auto;
  color: inherit;
  font-size: .625rem;
  line-height: inherit;
  font-weight: 500;
}
/* Keep room for a reminder target without resizing the active player's box. */
@media (orientation: portrait) and (max-width: 559px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail[data-players="6"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (orientation: portrait) and (min-width: 700px) and (max-width: 899px) {
  html[data-ui="tabletop"][data-tabletop-layout="turn-aware"][data-phase="playing"] .turn-seat-rail[data-players="6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
