.room { align-items: start; }
.table-wrap { min-width: 0; }
#opening-screen { overflow: auto; overscroll-behavior: contain; }
#resume-button { margin-top: 16px; border-radius: 4px; }
#resume-note {
  margin: 7px 0 0;
  color: #d8ded1;
  text-align: center;
  font-size: .875rem;
  line-height: 1.35;
}
#resume-button:not([hidden]) ~ #quick-play {
  border-color: #aec4a478;
  background: #244637;
  color: #f4ead3;
}
#quick-play { margin-top: 16px; border-radius: 4px; }
#quick-preset {
  margin: 7px 0 0;
  color: #d3bd8b;
  font-size: .875rem;
  line-height: 1.35;
  text-align: center;
}
.quick-tip-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  color: #d8ded1;
  font-size: .875rem;
  cursor: pointer;
}
#quick-tips { width: 1rem; height: 1rem; margin: 0; accent-color: #aad0ae; }
#practice-button {
  width: 100%;
  min-height: 44px;
  margin: 6px 0 0;
  padding: 8px 16px;
  border: 1px solid #aec4a478;
  border-radius: 4px;
  color: #f4ead3;
  background: #244637;
  font-weight: 700;
}
#practice-button:hover { background: #305741; }
#practice-description {
  margin: 7px 0 16px;
  text-align: center;
  font-size: .875rem;
  line-height: 1.35;
  color: #d8ded1;
}
.tile.practice-target {
  outline: 2px solid #ffdc83;
  outline-offset: 2px;
  z-index: 1;
}
.tile.practice-target:focus-visible { outline: 3px solid #fff2c8; }
.tile.winning-tile {
  outline: 2px solid #e9b956;
  outline-offset: 1px;
  z-index: 1;
}
#score-dialog {
  width: min(34rem, calc(100% - 24px));
  padding: clamp(16px, 4vw, 32px);
}
#score-dialog .score-mark {
  width: clamp(52px, 10vw, 72px);
  height: clamp(52px, 10vw, 72px);
  margin: 12px auto 8px;
  border-radius: 8px;
  background: radial-gradient(ellipse at 40% 22%, #74362e62, transparent 85%);
  font-size: clamp(30px, 5vw, 42px);
}
#score-dialog .fan-list { margin-block: 10px; }
#score-dialog .payment-line { padding: 9px; }
#score-dialog .quiet { min-height: 44px; font-size: .875rem; }
.score-followups { display: flex; gap: 8px; }
#winning-hand {
  margin: 12px 0 14px;
  padding: 10px 8px;
  border: 1px solid #9abda645;
  border-radius: 8px;
  background: #0b2f28;
}
#winning-hand-title, #winning-tile-label { margin: 0; font-size: .875rem; }
#winning-tile-label { margin-top: 7px; color: #f0ce86; }
.winning-rack {
  --small-tile: clamp(19px, 4.8vw, 25px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding-block: 9px 3px;
}
.winning-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  border-radius: 3px;
  background: #061f1bb8;
}
.custom-setup { border-block: 1px solid #7eab873c; }
.custom-setup > summary {
  min-height: 44px;
  padding: 12px 3px;
  color: #e3e8d9;
  font-weight: 700;
  cursor: pointer;
}
.custom-setup .setup-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.custom-setup .opening-level { margin: 0; }
.opening-card .custom-start {
  min-height: 44px;
  margin: 0 0 10px;
  border: 1px solid #91b298;
  border-radius: 4px;
  color: #f4ead3;
  background: #254536;
}
.opening-card .custom-start:hover { background: #345a47; }
.setup-options .setup-note { grid-column: 1 / -1; margin: 0 0 4px; }
.table-rail {
  position: relative;
  --rack-tile: clamp(28px, 3vw, 45px);
  --small-tile: clamp(17px, 1.8vw, 27px);
  --side-rail: clamp(95px, 12%, 155px);
  display: grid;
  height: auto;
  min-height: clamp(550px, calc(100dvh - 156px), 800px);
  padding: 12px;
  background:
    repeating-linear-gradient(4deg, #edb77b17 0 1px, transparent 1px 6px),
    linear-gradient(130deg, #755039, #482e22 48%, #6e4730);
  box-shadow: inset 0 0 0 2px #2d1c16, inset 0 0 0 4px #8a5b3c, 0 20px 45px #0006;
}
.felt {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  height: auto;
  padding-block: 15px 14px;
  background:
    repeating-linear-gradient(119deg, #d4e4c70c 0 1px, transparent 1px 4px),
    repeating-linear-gradient(29deg, #001a151e 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 50% 48%, #256350, #164b40 57%, #123831);
  box-shadow: inset 0 0 50px #061f1c9c, inset 0 0 0 1px #90a79638;
}
.felt::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #d3bd7740;
  pointer-events: none;
}
.seat.north, .seat.south {
  position: relative;
  inset: auto;
  width: auto;
  min-width: 0;
  margin-inline: 11px;
  transform: none;
}
.seat.north { grid-row: 1; }
.seat.south { grid-row: 3; }
.seat.west, .seat.east { width: var(--side-rail); top: 50%; }
.seat.west { left: 12px; }
.seat.east { right: 12px; }
.seat-head {
  letter-spacing: .05em;
  font-size: .8125rem;
  gap: 5px;
  margin-bottom: 6px;
}
.seat-head b { font-size: .875rem; }
.seat-head em { padding-left: 5px; }
.seat.thinking .seat-head::before { animation: seat-thinking 1.1s ease-in-out infinite; }
.dealing .seat .hand .tile { animation: deal-tile .38s cubic-bezier(.22,.8,.28,1) var(--deal-delay, 0ms) both; }
.seat.east { --deal-delay: 45ms; }
.seat.south { --deal-delay: 90ms; }
.seat.west { --deal-delay: 135ms; }
.hand, .meld-row, .flower-row { min-height: 0; align-items: center; }
.hand:empty, .meld-row:empty, .flower-row:empty { display: none; }
.flower-row { margin-bottom: 5px; }
.meld-row { gap: 4px; margin-bottom: 6px; }
.meld {
  display: flex;
  padding: 2px;
  background: #051b16a6;
  border-color: #b8ccb32b;
  border-radius: 4px;
}
.north .meld-row, .south .meld-row { flex-wrap: wrap; }
.north .hand, .south .hand { flex-wrap: wrap; }
.west .meld-row, .east .meld-row { flex-direction: column; align-items: flex-start; }
.east .meld-row { align-items: flex-end; }
.west .hand, .east .hand { max-width: min(var(--side-rail), calc(var(--small-tile) * 3 + 6px)); justify-content: flex-start; }
.east .hand { justify-content: flex-end; }
.tile {
  --tile-width: var(--rack-tile);
  width: var(--tile-width);
  height: calc(var(--tile-width) * 1.42);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: calc(var(--tile-width) * .10);
  isolation: isolate;
  font-size: calc(var(--tile-width) * .52);
  color: #193f72;
  background: linear-gradient(143deg, #fffefa, #f7f2e6 64%, #e8dfc9);
  box-shadow: inset 0 1px 1px #fff, inset -1px 0 2px #86754758, 0 2px 3px #041c15b8;
}
.tile::after {
  inset: auto 0 0;
  height: 9%;
  border-radius: 0;
  background: linear-gradient(#71ad8a, #2f765c 46%, #245945);
  box-shadow: 0 -1px #7d715944;
  opacity: 1;
  pointer-events: none;
}
.tile.z5 { color: #a5242b; }
.tile.z6 { color: #176445; }
.tile.mini, .tile.tiny, .tile.back {
  --tile-width: var(--small-tile);
  width: var(--tile-width);
  height: calc(var(--tile-width) * 1.42);
  padding: 0;
  border-radius: calc(var(--tile-width) * .10);
  font-size: calc(var(--tile-width) * .52);
  box-shadow: inset 0 1px 1px #fff, inset -1px 0 1px #86754755, 0 1px 2px #061c16b3;
}
.tile.tiny { --tile-width: calc(var(--small-tile) * .78); }
.river .tile { --tile-width: var(--river-tile); }
.tile.back {
  background: radial-gradient(ellipse at 28% 20%, #69a583, transparent 72%),
    linear-gradient(145deg, #387a61, #20513e 82%);
  border: 1px solid #91b396;
  box-shadow: inset 0 1px #d5ebbc9c, inset -1px -1px #17392ecc, 0 2px 3px #061d19a8;
}
.tile.back::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 8%;
  background: #e5dbbd;
  box-shadow: 0 -1px #285a4580;
}
.tile small {
  left: 10%;
  top: 7%;
  color: #60594d;
  font-size: calc(var(--tile-width) * .24);
  z-index: 1;
}
.tile .tile-glyph {
  font-family: "Jade Lettering", "Kaiti SC", "STKaiti", "Songti SC", serif;
  font-weight: 700;
  text-shadow: 0 -.025em #1e16085c, 0 .034em #fffdf1;
}
.tile .character-suit {
  position: absolute;
  inset: 10% 0 13%;
  display: grid;
  align-content: center;
  justify-items: center;
  font-size: calc(var(--tile-width) * .58);
  line-height: .9;
  color: #214f86;
}
.character-suit b:last-child { color: #aa292b; }
.tile .honor-glyph {
  margin-bottom: 8%;
  font-size: calc(var(--tile-width) * .77);
  line-height: 1;
}
.tile .engraving {
  position: absolute;
  inset: 8% 6% 12%;
  background: center / contain no-repeat;
  pointer-events: none;
}
.tile.mini .engraving { inset: 4% 3% 10%; }
.tile.f .engraving { inset: 24% 3% 8%; }
.tile .flower-mark {
  position: absolute;
  inset: 6% 13% auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 1;
}
.tile .flower-mark i { font: 800 calc(var(--tile-width) * .22)/1 system-ui, sans-serif; color: #9d292d; }
.tile .flower-mark b { font-size: calc(var(--tile-width) * .31); color: #214f86; }
.tile.f5 .flower-mark i, .tile.f6 .flower-mark i, .tile.f7 .flower-mark i, .tile.f8 .flower-mark i { color: #214f86; }
.tile.f5 .flower-mark b, .tile.f6 .flower-mark b, .tile.f7 .flower-mark b, .tile.f8 .flower-mark b { color: #9d292d; }
.tile.drawn { margin-left: clamp(4px, .7vw, 10px); }
.seat.south .hand { gap: 7px; }
.hand-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-bottom: 5px;
}
.hand-group.set::after, .hand-group.pair::after {
  content: "";
  position: absolute;
  inset: auto 2px 0;
  height: 2px;
  border-radius: 2px;
  background: #93c6a6;
}
.hand-group.pair::after { background: #cfab68; }
.seat.south .hand .tile.drawn { margin-left: 0; }
.seat.south .tile.drawn::before {
  content: "";
  position: absolute;
  right: 8%;
  top: 6%;
  width: 15%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #daac53;
  box-shadow: 0 0 0 1px #93692a85;
  pointer-events: none;
  z-index: 2;
}
button.tile:focus-visible, button.tile:hover { translate: 0 -3px; transform: none; outline-offset: 0; }
.seat.south button.tile:focus-visible { outline: 3px solid #ffe8aa; outline-offset: 1px; z-index: 2; }
.river-grid {
  --river-tile: var(--small-tile);
  position: relative;
  inset: auto;
  grid-row: 2;
  margin-inline: calc(var(--side-rail) + 20px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 1fr auto 1fr;
  gap: 6px 10px;
}
.river:nth-child(n+4) { grid-row: 3; }
.river {
  border: 1px solid #a4c7a22b;
  border-radius: 5px;
  background: #082c252b;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-row: 1;
  align-content: stretch;
  justify-content: stretch;
  gap: 0;
  min-height: min-content;
}
.river-label {
  color: #c7d6c6;
  font: 650 .75rem/1.15 system-ui, sans-serif;
  padding: 3px 4px;
  text-align: center;
}
.river-label b { color: #e1e9d9; }
.river-label span { color: #f3d594; }
.river-label em { color: #b5c8be; font-style: normal; }
.river.current-discard { border-color: #e3c179a1; background: #102f26; }
.river-tiles {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 2px 3px 4px;
  /* The history can scroll without changing the table's height. */
  contain: size;
  min-height: calc(var(--river-tile) * 1.42 + 7px);
  overflow: auto;
}
.river .tile:last-child { outline: none; }
.river .tile.latest {
  box-shadow: inset 0 0 0 1px #997035, 0 0 0 1px #d0b475;
}
.river .tile.newest {
  box-shadow: inset 0 0 0 2px #b17b27, 0 0 0 1px #ffe29c;
}
.river .tile.arriving { animation: discard-arrives .37s cubic-bezier(.22,.8,.28,1) both; }
.tile.draw-arrives { animation: draw-arrives .28s cubic-bezier(.22,.8,.28,1); }
.meld.meld-arrives { animation: meld-arrives .30s cubic-bezier(.22,.8,.28,1) both; }
.tile.claim-related { box-shadow: inset 0 0 0 2px #d9a749, 0 0 0 1px #ffe2a0; translate: 0 -3px; }
.meld.just-claimed { background: #715227a8; border-color: #efcd79; }
.table-center, .call-effect {
  grid-area: 2 / 1 / 3 / -1;
  place-self: center;
  inset: auto;
  transform: none;
}
.table-center {
  position: relative;
  width: min(100%, 320px);
  padding-block: 11px 3px;
}
.wind-dial { height: 35px; width: 35px; }
.wind-dial::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid #c6a56878;
  box-shadow: 0 0 0 1px #0c312a9c;
  pointer-events: none;
}
.wind-dial span { font-size: 20px; }
.wind-dial b { display: none; }
.table-center > strong { margin-top: 12px; font: 650 1rem/1.2 system-ui, sans-serif; }
.table-center > .quick-tip { color: #ffe0a2; }
#board-hint {
  display: block;
  margin: 6px auto 0;
  color: #edf0de;
  font-size: .875rem;
  line-height: 1.3;
}
.table-center > strong:focus { outline: none; }
.table-center > small { color: #b5c8be; font-size: .875rem; }
.claim-tray {
  position: static;
  transform: none;
  max-width: none;
  min-height: 52px;
  padding: 7px 3px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
}
.claim-tray button { min-height: 44px; min-width: 74px; border-radius: 4px; font-size: .9375rem; }
.claim-tray button:hover { filter: brightness(1.18); }
.claim-tray .primary-claim { color: #fff; }
.chow-choices {
  --small-tile: 17px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}
.claim-tray .chow-choice {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  padding: 4px 6px;
  border-color: #72978a;
  font-size: .875rem;
}
.chow-choice[aria-pressed="true"] {
  background: #51432a;
  border-color: #f1c775;
  box-shadow: inset 0 0 0 1px #f1c77570;
}
.chow-preview { display: flex; gap: 2px; }
.chow-preview .from-discard { background: #f4d998; box-shadow: inset 0 0 0 1px #835726; }
.match-settings { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: #d0c29c; font-size: .875rem; }
.round-heading p { font-size: .875rem; }
.round-heading .dealer-progress { margin: 6px 0 8px; color: #d9bd80; font-size: .875rem; }
.tile-reference {
  --rack-tile: clamp(18px, calc((100vw - 102px) / 9), 34px);
  margin: 0 0 18px;
  padding: 10px 12px 12px;
  border: 1px solid #7a947168;
  border-radius: 5px;
  background: #0d3027;
}
.tile-reference summary { cursor: pointer; color: #f1d9a1; font-weight: 700; font-size: 1rem; }
.reference-group h3 { margin: 12px 0 5px; color: #c3d0bf; font-size: .875rem; font-weight: 650; }
.reference-rack { display: flex; flex-wrap: wrap; gap: 3px; }
.call-effect {
  position: absolute;
  z-index: 10;
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 125px;
  padding: 9px 22px 12px;
  border: 1px solid #c3a876;
  border-radius: 6px;
  background: #102e28f0;
  color: #ffdc93;
  box-shadow: 0 7px 26px #061611a8;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.call-effect b { font: 700 2.3rem/1 "Kaiti SC", "STKaiti", serif; }
.call-effect span { white-space: nowrap; font-size: .875rem; color: #fff2d7; }
.felt:has(.call-effect.show) .table-center { opacity: .22; }
.call-effect.call-chow { background: #185540f5; border-color: #a6ce99; color: #d7ecaf; }
.call-effect.call-pong { background: #594226f5; border-color: #e8bc6f; }
.call-effect.call-hu { background: #752b22f5; border-color: #f3c580; }
.call-effect.show { animation: table-call .86s ease both; }
@keyframes table-call {
  0% { opacity: 0; scale: .77; }
  20%, 70% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: .97; }
}
@keyframes discard-arrives {
  from { translate: 0 -9px; scale: .86; opacity: .38; filter: brightness(1.28); }
  to { translate: 0 0; scale: 1; opacity: 1; filter: brightness(1); }
}
@keyframes draw-arrives {
  from { translate: 7px -7px; opacity: .38; }
  to { translate: 0 0; opacity: 1; }
}
@keyframes meld-arrives {
  from { translate: 0 6px; scale: .94; opacity: .48; }
  to { translate: 0 0; scale: 1; opacity: 1; }
}
@keyframes deal-tile {
  from { opacity: 0; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes seat-thinking {
  50% { box-shadow: 0 0 0 5px #e0bb6836; background: #ffe3a1; }
}
@media (max-width: 48rem) {
  .game-bar { grid-template-columns: 1fr auto; }
  .game-bar .title { display: none; }
}
@media (max-width: 650px) {
  .table-rail {
    --rack-tile: clamp(17px, calc((100vw - 64px) / 14), 31px);
    --small-tile: clamp(15px, 4.25vw, 21px);
    --side-rail: clamp(62px, 19%, 84px);
    min-height: clamp(530px, calc(100dvh - 143px), 620px);
    padding: 7px;
  }
  .seat-head { flex-wrap: wrap; font-size: .75rem; gap: 3px; }
  .seat.west { left: 5px; }
  .seat.east { right: 5px; }
  .west .hand, .east .hand { max-width: min(var(--side-rail), calc(var(--small-tile) * 3 + 4px)); }
  .west .meld, .east .meld { padding: 1px; }
  .west .meld .tile, .east .meld .tile { --tile-width: calc(var(--small-tile) * .86); }
  .felt { padding-block: 8px; gap: 7px; }
  .seat.north, .seat.south { margin-inline: 6px; }
  .seat.south .hand { gap: 3px; }
  .hand-group { gap: 1px; }
  .seat.south .hand > .tile { margin-inline: -.5px; }
  .river-grid { --river-tile: clamp(13px, 3.7vw, 18px); margin-inline: calc(var(--side-rail) + 9px); column-gap: 5px; }
  .river-tiles { gap: 2px; padding-inline: 2px; }
  .claim-tray { gap: 5px; }
  .claim-tray button { padding-inline: 8px; }
  .tile-emblem { display: none; }
}
@media (max-width: 26rem) {
  .table-rail {
    --rack-tile: clamp(27px, calc((100vw - 60px) / 9), 34px);
    min-height: clamp(495px, calc(100dvh - 145px), 575px);
  }
  .seat.south .hand { row-gap: 8px; }
  .setup-options .setup-note {
    font-size: .875rem;
  }
}
@media (max-width: 22rem) {
  .custom-setup .setup-options { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .call-effect.show { animation: call-fade .86s linear both !important; }
  .river .tile.arriving, .dealing .seat .hand .tile,
  .tile.draw-arrives, .meld.meld-arrives, .seat.thinking .seat-head::before { animation: none; }
  @keyframes call-fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
}
