:root {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #eee9dc;
  background: #092921;
  font-synthesis: none;
  --ink: #162f29;
  --felt: #174f40;
  --gold: #dac18b;
  --muted: #a8bdb1;
  --paper: #f4f0e5;
  --tile-w: 47px;
  --tile-h: 66px;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #edcf7b;
  outline-offset: 4px;
}
button {
  color: inherit;
}
a {
  color: var(--gold);
}
button,
select {
  min-height: 42px;
}
button {
  border: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button {
  transition:
    background 0.15s,
    transform 0.15s;
}
h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.app-shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 30px 20px;
}
.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ffffff15;
  gap: 20px;
}
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.brand-mark {
  font-family: serif;
  font-size: 31px;
  width: 47px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid #d7be843d;
  color: #dac18b;
  border-radius: 8px;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 5px;
}
.nav {
  display: flex;
  gap: 10px;
  align-items: center;
}
.nav button,
.ghost {
  background: transparent;
  border: 1px solid #ffffff24;
  border-radius: 7px;
  padding: 10px 15px;
  font-size: 14px;
}
.nav button:hover,
.ghost:hover {
  background: #ffffff0c;
}
.nav .new-table {
  background: var(--gold);
  border-color: var(--gold);
  color: #162f29;
  font-weight: 650;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 255px;
  gap: 24px;
  padding-top: 22px;
}
.play-area {
  min-width: 0;
}
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  color: #adbdaf;
  font-size: 13px;
  min-height: 28px;
}
.round-pill {
  font-size: 14px;
  color: #eee6d3;
  display: flex;
  gap: 9px;
  align-items: center;
}
.round-pill strong {
  color: var(--gold);
  font-weight: 500;
}
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  min-height: 30px;
  background: transparent;
  padding: 4px 7px;
  color: #b8c8bb;
  border-radius: 4px;
  font-size: 13px;
}
.icon-btn:hover {
  background: #ffffff12;
}
.board {
  position: relative;
  min-height: 575px;
  height: calc(100vh - 278px);
  max-height: 735px;
  border: 9px solid #332b24;
  border-radius: 29px;
  background: radial-gradient(ellipse at 50% 43%, #23634d 0, #174c3e 66%, #113b32 100%);
  box-shadow:
    0 0 0 1px #68533b,
    0 15px 40px #00190f66,
    inset 0 0 0 2px #9b845031,
    inset 0 0 50px #05291f88;
  overflow: hidden;
}
.board:before {
  content: '';
  position: absolute;
  inset: 16px;
  border: 1px solid #d7c08618;
  border-radius: 14px;
  pointer-events: none;
}
.seat {
  position: absolute;
  z-index: 2;
  text-align: center;
}
.seat-top {
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 65%;
  width: max-content;
}
.seat-right {
  right: 19px;
  top: 44%;
  transform: translateY(-50%);
  max-width: 125px;
}
.seat-left {
  left: 19px;
  top: 44%;
  transform: translateY(-50%);
  max-width: 125px;
}
.player-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 14px;
  white-space: nowrap;
}
.avatar {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  background: #133d32;
  border: 1px solid #e2ca963f;
  border-radius: 50%;
  font-family: Georgia, serif;
  color: #deca98;
  font-size: 17px;
  flex-shrink: 0;
}
.player-name {
  text-align: left;
}
.player-name small {
  display: block;
  font-size: 12px;
  color: #b0c3b2;
  margin-top: 3px;
}
.seat.active .avatar {
  background: #d8c08b;
  color: #173f30;
  box-shadow: 0 0 0 4px #dcc89712;
}
.seat.active .player-name strong {
  color: #f3db9f;
}
.backs {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 10px;
}
.back {
  display: inline-block;
  width: 19px;
  height: 28px;
  border-radius: 3px;
  background: linear-gradient(135deg, #286e5d, #164a3e);
  border: 1px solid #69a18e70;
  box-shadow: 0 2px 0 #092b23;
}
.back:after {
  content: '';
  display: block;
  margin: 4px;
  border: 1px solid #b6d9ba22;
  height: 17px;
  border-radius: 2px;
}
.seat-left .backs,
.seat-right .backs {
  max-width: 95px;
  display: grid;
  grid-template-columns: repeat(5, 15px);
  gap: 3px;
  margin: 12px auto 0;
}
.seat-left .back,
.seat-right .back {
  width: 15px;
  height: 22px;
}
.seat-left .back:after,
.seat-right .back:after {
  margin: 3px;
  height: 13px;
}
.seat-score {
  font-size: 13px;
  color: #a6bda9;
  margin-top: 7px;
}
.bonus-row {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.melds {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.meld {
  display: flex;
  gap: 1px;
  position: relative;
}
.concealed-label {
  font-size: 10px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  color: #a5bba9;
}
.table-center {
  position: absolute;
  inset: 135px 150px 132px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
}
.compass {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  color: #cfbf99;
}
.compass-wind {
  font-family: serif;
  font-size: 35px;
  opacity: 0.95;
}
.wall-count {
  border-left: 1px solid #cbb98530;
  padding-left: 14px;
  text-align: left;
}
.wall-count strong {
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  font-size: 23px;
  color: #e7dbc1;
}
.wall-count small {
  display: block;
  font-size: 11px;
  color: #aabda9;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 1px;
}
.river-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  min-height: 165px;
}
.river-group {
  min-width: 0;
}
.river-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a1b39b;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}
.river-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: start;
  min-height: 47px;
}
.river-empty {
  height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #769b8155;
}
.river-group.latest .river-label {
  color: #e3c993;
}
.river-tiles .last-tile {
  box-shadow:
    0 0 0 2px #eccb77,
    0 2px 0 #89816e;
}
.tile {
  width: var(--tile-w);
  height: var(--tile-h);
  border-radius: 5px;
  background: linear-gradient(115deg, #fffdf4, #e9e7d9);
  box-shadow:
    0 4px 0 #a1a795,
    0 5px 0 #d2d7bc,
    1px 7px 6px #00170f55;
  border: 1px solid #dedbc8;
  color: #223f33;
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
  vertical-align: middle;
  padding: 2px;
  min-height: 0;
  font-family: Georgia, 'Times New Roman', serif;
}
.tile .number {
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}
.tile .symbol {
  font-size: 24px;
  line-height: 1.1;
}
.tile .corner {
  font-family: ui-sans-serif, sans-serif;
  position: absolute;
  right: 3px;
  top: 3px;
  font-size: 9px;
  color: #728175;
  line-height: 1;
}
.tile .honor {
  font-size: 34px;
  line-height: 1;
}
.tile .honor-name {
  font-family: ui-sans-serif, sans-serif;
  letter-spacing: 0.06em;
  font-size: 8px;
  line-height: 1.6;
}
.tile.characters .symbol,
.tile.dragon-red .honor {
  color: #ad3936;
}
.tile.bamboo .number,
.tile.bamboo .symbol,
.tile.dragon-green .honor {
  color: #267650;
}
.tile.dots .number,
.tile.dots .symbol {
  color: #245786;
}
.tile.dragon-white .honor {
  font-size: 34px;
  color: #497998;
}
.tile.bonus {
  color: #825c23;
}
.tile .bonus-glyph {
  font-size: 29px;
  line-height: 1.1;
}
.tile .bonus-name {
  font-family: ui-sans-serif, sans-serif;
  font-size: 7px;
  max-width: 100%;
  white-space: nowrap;
  line-height: 1.6;
}
.tile.small {
  --tile-w: 25px;
  --tile-h: 34px;
  border-radius: 3px;
  box-shadow:
    0 2px 0 #a3ac96,
    0 3px 4px #051f2244;
  padding: 1px;
}
.tile.small .number {
  font-size: 11px;
}
.tile.small .symbol {
  font-size: 14px;
}
.tile.small .corner {
  font-size: 6px;
  right: 1px;
  top: 1px;
}
.tile.small .honor {
  font-size: 21px;
}
.tile.small .honor-name {
  font-size: 5px;
  letter-spacing: 0;
}
.tile.small .bonus-glyph {
  font-size: 17px;
}
.tile.small .bonus-name {
  font-size: 4px;
}
.tile.tiny {
  --tile-w: 21px;
  --tile-h: 29px;
  border-radius: 3px;
  box-shadow: 0 2px 0 #a3ac96;
  padding: 1px;
}
.tile.tiny .number {
  font-size: 10px;
}
.tile.tiny .symbol {
  font-size: 12px;
}
.tile.tiny .honor {
  font-size: 18px;
}
.tile.tiny .honor-name {
  font-size: 4px;
}
.tile.tiny .corner {
  font-size: 5px;
  right: 1px;
  top: 1px;
}
.tile.tiny .bonus-glyph {
  font-size: 15px;
}
.tile.tiny .bonus-name {
  font-size: 4px;
}
.tile.claimed {
  opacity: 0.26;
  box-shadow: none;
}
.tile.selected {
  transform: translateY(-12px);
  box-shadow:
    0 4px 0 #a1a795,
    0 0 0 2px #f0cd77,
    0 10px 18px #061d1666;
}
.tile.playable:hover {
  transform: translateY(-7px);
  background: #fffef7;
}
.tile.selected:hover {
  transform: translateY(-12px);
}
.tile.drawn {
  margin-left: 11px;
}
.tile.hinted:after {
  content: '';
  position: absolute;
  bottom: -14px;
  width: 6px;
  height: 6px;
  background: #e4cc8d;
  border-radius: 50%;
}
.dots-grid {
  display: grid;
  width: 78%;
  height: 68%;
  gap: 2px;
  align-items: center;
  justify-items: center;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #285b82;
  background: #b1c6c6;
}
.pip.red {
  border-color: #ab4641;
  background: #dcc0aa;
}
.pip.green {
  border-color: #347651;
  background: #b3c9a7;
}
.tile.small .pip,
.tile.tiny .pip {
  width: 4px;
  height: 4px;
  border-width: 1px;
}
.tile.small .dots-grid,
.tile.tiny .dots-grid {
  gap: 1px;
}
.hand-zone {
  position: absolute;
  bottom: 20px;
  left: 30px;
  right: 30px;
  text-align: center;
  z-index: 3;
}
.hand-topline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
  min-height: 24px;
}
.hand-topline .you-label {
  font-size: 13px;
  color: #ddd1b4;
  display: flex;
  align-items: center;
  gap: 7px;
}
.wind-token {
  border: 1px solid #cbb58155;
  color: #e8d9ac;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: serif;
}
.own-tiles {
  display: flex;
  justify-content: center;
  gap: 4px;
  min-height: 74px;
  align-items: start;
}
.own-melds {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 12px;
}
.own-melds .meld {
  align-items: center;
}
.own-melds .tile {
  --tile-w: 32px;
  --tile-h: 46px;
}
.own-melds .tile .number {
  font-size: 16px;
}
.own-melds .tile .symbol {
  font-size: 18px;
}
.own-melds .tile .honor {
  font-size: 25px;
}
.turn-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 19px 2px 8px;
  gap: 14px;
  min-height: 83px;
}
.turn-status {
  min-width: 0;
}
.turn-status strong {
  font-size: 17px;
  font-weight: 500;
  display: block;
}
.turn-status p {
  font-size: 13px;
  color: #a8baac;
  margin-top: 6px;
  line-height: 1.5;
}
.move-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}
.primary {
  border-radius: 7px;
  background: var(--gold);
  color: #143a2d;
  font-weight: 650;
  font-size: 14px;
  padding: 12px 20px;
  min-height: 44px;
}
.primary:hover {
  background: #ecd7a8;
}
.primary.win {
  background: #efc466;
  color: #3c2f12;
}
.call-button {
  background: #1d5143;
  border: 1px solid #b8c9b555;
  border-radius: 7px;
  padding: 10px 16px;
  font-size: 14px;
}
.call-button:hover {
  background: #286250;
}
.claim-banner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hint-strip {
  font-size: 13px;
  padding: 13px 15px;
  margin-top: 10px;
  background: #143b30;
  border: 1px solid #dbc88e35;
  border-radius: 8px;
  line-height: 1.6;
  color: #d0d9c4;
}
.hint-strip strong {
  color: #e2c88c;
}
.sidebar {
  padding-top: 41px;
}
.panel {
  border: 1px solid #d9c08a22;
  border-radius: 11px;
  background: #0c3027;
  padding: 20px;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #acbda7;
  margin-bottom: 18px;
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 15px 0;
  font-size: 14px;
  gap: 10px;
}
.score-row:last-child {
  margin-bottom: 0;
}
.score-player {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.score-player span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.small-wind {
  font-family: serif;
  color: #b3c69f;
  font-size: 16px;
  width: 19px;
}
.score-num {
  font-variant-numeric: tabular-nums;
  color: #dde1ce;
}
.positive {
  color: #c5d59a !important;
}
.negative {
  color: #e3aa96 !important;
}
.panel-note {
  border-top: 1px solid #ffffff0e;
  margin-top: 17px;
  padding-top: 13px;
  font-size: 12px;
  color: #8fa992;
  line-height: 1.6;
}
.rule-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin: 12px 0;
  color: #aabaaa;
  gap: 10px;
}
.rule-line b {
  font-weight: 500;
  color: #e2ddc6;
  text-align: right;
}
.rule-link {
  font-size: 13px;
  color: #d0ba88;
  background: transparent;
  padding: 7px 0 0;
  min-height: 30px;
}
.activity {
  max-height: 172px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #466651 transparent;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.activity-entry {
  font-size: 12px;
  line-height: 1.5;
  color: #9eb4a2;
  padding-left: 10px;
  border-left: 2px solid #274a37;
}
.activity-entry:first-child {
  color: #e0ddc6;
  border-color: #c2aa77;
}
.activity-entry.call,
.activity-entry.kong,
.activity-entry.win {
  color: #d7c18e;
}
.footer {
  font-size: 12px;
  color: #72917b;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
}
.footer button {
  background: transparent;
  color: #99ad99;
  font-size: 12px;
  min-height: 22px;
  padding: 0;
}
.privacy {
  position: absolute;
  inset: 0;
  z-index: 9;
  backdrop-filter: blur(12px);
  background: #0b342dd9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 25px;
}
.privacy .privacy-symbol {
  font-family: serif;
  font-size: 64px;
  color: var(--gold);
  margin-bottom: 20px;
}
.privacy h2 {
  font-family: Georgia, serif;
  font-size: 29px;
  font-weight: 400;
}
.privacy p {
  font-size: 15px;
  line-height: 1.7;
  color: #b9c9b9;
  max-width: 320px;
  margin: 12px 0 22px;
}
.pause-tag {
  background: #102f26ed;
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  text-align: center;
  backdrop-filter: blur(5px);
}
.pause-tag h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 30px;
  margin-bottom: 20px;
}
.loading {
  padding: 50px;
  text-align: center;
  color: #d8c38e;
}
dialog {
  width: min(650px, calc(100% - 28px));
  max-height: 90dvh;
  overflow: auto;
  padding: 0;
  background: #11372e;
  color: #e8e6d7;
  border: 1px solid #d1bc824a;
  border-radius: 16px;
  box-shadow: 0 35px 100px #00170ecc;
  scrollbar-width: thin;
}
dialog::backdrop {
  background: #001d18ba;
  backdrop-filter: blur(5px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 27px 20px;
  border-bottom: 1px solid #ffffff12;
  position: sticky;
  top: 0;
  background: #11372e;
  z-index: 2;
}
.dialog-head h2 {
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 400;
}
.close-btn {
  background: #ffffff0a;
  border-radius: 50%;
  font-size: 24px;
  color: #bbc6b2;
  width: 36px;
  height: 36px;
  min-height: 36px;
}
.dialog-content {
  padding: 24px 27px;
}
.dialog-content p {
  font-size: 14px;
  color: #b7c7b6;
  line-height: 1.75;
  margin-bottom: 18px;
}
.dialog-content h3 {
  font-size: 15px;
  color: #e1cf9f;
  margin: 24px 0 13px;
  font-weight: 600;
}
.dialog-content h3:first-child {
  margin-top: 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 27px;
  border-top: 1px solid #ffffff12;
  background: #10352c;
  position: sticky;
  bottom: 0;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: #b7c7b6;
}
.field input,
.field select,
.seat-input input,
.seat-input select {
  background: #082b22;
  border: 1px solid #7f9b7445;
  color: #e9e8d6;
  border-radius: 6px;
  padding: 11px 12px;
  min-width: 0;
  width: 100%;
  font-size: 14px;
}
.field small {
  font-size: 12px;
  line-height: 1.45;
  color: #8fa893;
}
.seat-input {
  display: grid;
  grid-template-columns: 25px 1fr 135px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.seat-input > span {
  font-family: serif;
  color: #d8c18d;
  font-size: 20px;
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 17px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #d1dac8;
  cursor: pointer;
}
.check-row input {
  accent-color: #d4bb7f;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex-shrink: 0;
}
.check-row small {
  display: block;
  color: #95ad98;
  font-size: 12px;
  margin-top: 3px;
}
.settings-grid + .check-row {
  margin-top: 24px;
}
details {
  margin-top: 21px;
  border-top: 1px solid #ffffff12;
  padding-top: 17px;
}
summary {
  cursor: pointer;
  font-size: 14px;
  color: #d8c596;
  padding: 5px 0;
}
.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}
.rules-table td,
.rules-table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #ffffff12;
}
.rules-table th {
  color: #a8bea4;
  font-size: 12px;
  font-weight: 500;
}
.rules-table td:last-child {
  text-align: right;
  color: #e0cb98;
  white-space: nowrap;
}
.rules-table .center {
  text-align: center;
}
.rules-note {
  font-size: 12px !important;
  color: #95ad98 !important;
  margin-top: 13px;
}
.result-banner {
  text-align: center;
  padding: 2px 0 20px;
}
.result-banner .tai-large {
  font-family: Georgia, serif;
  color: #ecd497;
  font-size: 67px;
  line-height: 1;
}
.result-banner .tai-large span {
  font-size: 20px;
}
.result-banner h3 {
  font-family: Georgia, serif;
  color: #ebe4ce;
  font-size: 27px;
  font-weight: 400;
  margin: 12px 0 8px;
}
.result-banner p {
  margin: 0;
}
.result-hand {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 7px 0 20px;
}
.result-hand .tile {
  --tile-w: 33px;
  --tile-h: 47px;
}
.result-hand .tile .number {
  font-size: 16px;
}
.result-hand .tile .symbol {
  font-size: 18px;
}
.result-hand .tile .honor {
  font-size: 25px;
}
.result-hand .meld {
  margin-left: 6px;
}
.pattern-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  padding: 9px 0;
  color: #bccaaf;
}
.pattern-row b {
  color: #e0cda0;
  font-weight: 500;
}
.result-payments {
  margin-top: 20px;
  background: #092b22;
  border-radius: 8px;
  padding: 12px 18px;
}
.result-total {
  font-size: 12px;
  color: #a2b69c;
  margin: 13px 0 0;
}
.history-row {
  border: 1px solid #ffffff15;
  border-radius: 7px;
  padding: 14px;
  margin-top: 12px;
}
.history-row strong {
  font-size: 14px;
  font-weight: 500;
}
.history-row p {
  font-size: 12px;
  margin: 5px 0 0;
}
.tip-example {
  display: flex;
  gap: 4px;
  margin: 12px 0 20px;
  align-items: center;
}
.tip-example span.description {
  font-size: 13px;
  margin-left: 12px;
  color: #b5c4b0;
}
.source-links {
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
}
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 28px);
  background: #e7d5aa;
  color: #173b2d;
  padding: 13px 21px;
  border-radius: 9px;
  box-shadow: 0 5px 25px #001e1999;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.thinking {
  animation: softPulse 1.3s ease-in-out infinite;
}
@keyframes softPulse {
  50% {
    opacity: 0.45;
  }
}
@media (min-width: 1400px) {
  :root {
    --tile-w: 51px;
    --tile-h: 71px;
  }
  .board {
    min-height: 640px;
  }
  .table-center {
    inset: 152px 175px 145px;
  }
  .tile.small {
    --tile-w: 29px;
    --tile-h: 39px;
  }
  .tile.small .number {
    font-size: 13px;
  }
  .tile.small .symbol {
    font-size: 16px;
  }
}
@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
  }
  .app-shell {
    padding: 0 20px 15px;
  }
  .panel {
    padding: 17px;
  }
  .table-center {
    left: 117px;
    right: 117px;
  }
  .seat-left {
    left: 12px;
  }
  .seat-right {
    right: 12px;
  }
  .seat-left,
  .seat-right {
    max-width: 105px;
  }
  .player-badge {
    gap: 6px;
    font-size: 12px;
  }
  .avatar {
    width: 28px;
    height: 28px;
  }
  .player-name small {
    font-size: 11px;
  }
  :root {
    --tile-w: 38px;
    --tile-h: 56px;
  }
  .tile .number {
    font-size: 18px;
  }
  .tile .symbol {
    font-size: 21px;
  }
  .tile .honor {
    font-size: 30px;
  }
  .hand-zone {
    left: 16px;
    right: 16px;
  }
  .own-tiles {
    gap: 3px;
  }
  .own-melds .tile {
    --tile-w: 26px;
    --tile-h: 37px;
  }
  .own-melds .tile .number {
    font-size: 12px;
  }
  .own-melds .tile .symbol {
    font-size: 15px;
  }
  .own-melds {
    margin-left: 6px;
    gap: 5px;
  }
  .own-melds .tile .honor {
    font-size: 21px;
  }
  .turn-status strong {
    font-size: 15px;
  }
  .primary {
    padding: 12px 16px;
  }
  .river-grid {
    gap: 11px;
  }
  .tile.small {
    --tile-w: 23px;
    --tile-h: 31px;
  }
  .tile.small .number {
    font-size: 10px;
  }
  .tile.small .symbol {
    font-size: 13px;
  }
}
@media (max-width: 950px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 13px;
  }
  .sidebar .activity-panel {
    display: none;
  }
  .panel {
    margin-bottom: 0;
  }
  .board {
    height: calc(100dvh - 260px);
    min-height: 545px;
    max-height: 700px;
  }
  :root {
    --tile-w: 43px;
    --tile-h: 61px;
  }
  .topbar {
    height: 78px;
  }
  .table-center {
    left: 140px;
    right: 140px;
  }
  .player-badge {
    font-size: 14px;
  }
  .player-name small {
    font-size: 12px;
  }
  .seat-left,
  .seat-right {
    max-width: 115px;
  }
  .tile.small {
    --tile-w: 27px;
    --tile-h: 36px;
  }
  .tile.small .number {
    font-size: 12px;
  }
  .tile.small .symbol {
    font-size: 15px;
  }
  .own-melds .tile {
    --tile-w: 30px;
    --tile-h: 42px;
  }
  .nav .nav-label {
    display: none;
  }
  .footer {
    padding-top: 20px;
  }
}
@media (max-width: 640px) {
  .app-shell {
    padding: 0 10px 14px;
  }
  .topbar {
    height: 70px;
    gap: 8px;
  }
  .brand {
    gap: 9px;
  }
  .brand-mark {
    width: 34px;
    height: 39px;
    font-size: 25px;
    border-radius: 5px;
  }
  h1 {
    font-size: 18px;
  }
  .brand small {
    font-size: 10px;
    letter-spacing: 0.14em;
  }
  .nav {
    gap: 5px;
  }
  .nav button {
    font-size: 12px;
    padding: 8px 9px;
    min-height: 37px;
  }
  .nav button[data-command='scorebook'] {
    display: none;
  }
  .workspace {
    padding-top: 12px;
  }
  .table-toolbar {
    margin-bottom: 9px;
    font-size: 11px;
    gap: 4px;
  }
  .round-pill {
    font-size: 12px;
    gap: 6px;
  }
  .table-actions {
    gap: 1px;
  }
  .icon-btn {
    font-size: 12px;
    padding: 4px 5px;
  }
  .board {
    min-height: 540px;
    height: calc(100dvh - 238px);
    max-height: 670px;
    border-width: 5px;
    border-radius: 19px;
  }
  .board:before {
    inset: 10px;
    border-radius: 10px;
  }
  .seat-top {
    top: 14px;
    max-width: 80%;
  }
  .seat-left,
  .seat-right {
    top: 28%;
    transform: translateY(-10%);
    max-width: 94px;
  }
  .seat-left {
    left: 9px;
  }
  .seat-right {
    right: 9px;
  }
  .seat-left .backs,
  .seat-right .backs {
    display: none;
  }
  .player-badge {
    font-size: 12px;
    gap: 5px;
  }
  .avatar {
    width: 27px;
    height: 27px;
    font-size: 14px;
  }
  .player-name small {
    font-size: 10px;
  }
  .seat-score {
    font-size: 11px;
    margin-top: 5px;
  }
  .backs {
    gap: 2px;
    margin-top: 8px;
  }
  .back {
    width: 16px;
    height: 24px;
  }
  .back:after {
    height: 14px;
  }
  .table-center {
    inset: 227px 23px 123px;
    gap: 9px;
    justify-content: start;
  }
  .compass {
    position: absolute;
    bottom: calc(100% + 23px);
    left: 50%;
    transform: translateX(-50%);
    gap: 9px;
  }
  .compass-wind {
    font-size: 28px;
  }
  .wall-count {
    padding-left: 9px;
  }
  .wall-count strong {
    font-size: 21px;
  }
  .wall-count small {
    font-size: 9px;
    white-space: nowrap;
  }
  .river-grid {
    gap: 9px 12px;
    min-height: 130px;
  }
  .river-label {
    font-size: 9px;
    margin-bottom: 4px;
  }
  .river-tiles {
    gap: 2px;
    min-height: 36px;
  }
  .tile.small {
    --tile-w: 20px;
    --tile-h: 28px;
  }
  .tile.small .number {
    font-size: 9px;
  }
  .tile.small .symbol {
    font-size: 12px;
  }
  .tile.small .honor {
    font-size: 17px;
  }
  .tile.small .honor-name {
    font-size: 4px;
  }
  .tile.small .corner {
    font-size: 5px;
  }
  .tile.small .pip {
    width: 3px;
    height: 3px;
  }
  .hand-zone {
    bottom: 17px;
    left: 7px;
    right: 7px;
  }
  .hand-topline {
    margin-bottom: 12px;
    gap: 8px;
    min-height: 20px;
  }
  .hand-topline .you-label {
    font-size: 12px;
  }
  .own-tiles {
    gap: 2px;
    min-height: 51px;
  }
  :root {
    --tile-w: calc((100vw - 66px) / 14);
    --tile-h: calc((100vw - 66px) / 14 * 1.5);
  }
  .tile {
    border-radius: 3px;
    padding: 1px;
    box-shadow:
      0 3px 0 #a1a795,
      0 4px 0 #d2d7bc,
      1px 5px 4px #00170f55;
  }
  .tile .number {
    font-size: clamp(12px, 3.3vw, 17px);
  }
  .tile .symbol {
    font-size: clamp(14px, 4vw, 21px);
  }
  .tile .honor {
    font-size: clamp(18px, 5.7vw, 29px);
  }
  .tile .honor-name {
    font-size: 5px;
  }
  .tile .corner {
    font-size: 6px;
    right: 1px;
    top: 1px;
  }
  .tile .bonus-glyph {
    font-size: 20px;
  }
  .tile .bonus-name {
    font-size: 5px;
  }
  .tile .dots-grid {
    gap: 1px;
  }
  .tile .pip {
    width: clamp(3px, 1.2vw, 6px);
    height: clamp(3px, 1.2vw, 6px);
    border-width: 1.5px;
  }
  .tile.drawn {
    margin-left: 5px;
  }
  .tile.selected {
    transform: translateY(-10px);
  }
  .own-melds {
    margin-left: 5px;
    gap: 4px;
  }
  .own-melds .tile {
    --tile-w: calc((100vw - 88px) / 17);
    --tile-h: calc((100vw - 88px) / 17 * 1.5);
  }
  .own-melds .tile .number {
    font-size: 9px;
  }
  .own-melds .tile .symbol {
    font-size: 11px;
  }
  .own-melds .tile .honor {
    font-size: 16px;
  }
  .own-melds .tile .honor-name {
    font-size: 4px;
  }
  .own-melds .tile .corner {
    font-size: 4px;
  }
  .own-melds .pip {
    width: 3px;
    height: 3px;
    border-width: 1px;
  }
  .turn-bar {
    padding: 15px 2px 6px;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 86px;
  }
  .turn-status {
    flex: 1;
    min-width: 150px;
  }
  .turn-status strong {
    font-size: 15px;
  }
  .turn-status p {
    font-size: 12px;
    margin-top: 4px;
  }
  .move-actions {
    gap: 6px;
    max-width: 100%;
  }
  .primary,
  .call-button,
  .ghost {
    font-size: 13px;
    padding: 11px 13px;
  }
  .sidebar {
    gap: 10px;
    padding-top: 15px;
  }
  .panel {
    padding: 15px 13px;
  }
  .panel-title {
    font-size: 10px;
    margin-bottom: 12px;
  }
  .score-row {
    font-size: 12px;
    gap: 6px;
    margin: 12px 0;
  }
  .score-player {
    gap: 6px;
  }
  .rule-line {
    font-size: 11px;
    margin: 10px 0;
  }
  .panel-note {
    font-size: 11px;
    padding-top: 10px;
    margin-top: 12px;
  }
  .rule-link {
    font-size: 12px;
  }
  .footer {
    font-size: 10px;
    gap: 8px;
  }
  .footer button {
    font-size: 11px;
  }
  .dialog-head {
    padding: 20px;
  }
  .dialog-content {
    padding: 20px;
  }
  .dialog-actions {
    padding: 15px 20px;
  }
  .settings-grid {
    gap: 13px;
  }
  .seat-input {
    grid-template-columns: 21px 1fr 112px;
    gap: 8px;
  }
  .seat-input input,
  .seat-input select {
    font-size: 13px;
    padding: 10px;
  }
  .field {
    font-size: 12px;
  }
  .field input,
  .field select {
    font-size: 13px;
  }
  .result-hand .tile {
    --tile-w: 25px;
    --tile-h: 37px;
  }
  .result-hand .tile .number {
    font-size: 12px;
  }
  .result-hand .tile .symbol {
    font-size: 15px;
  }
  .result-hand .tile .honor {
    font-size: 21px;
  }
  .bonus-row {
    gap: 2px;
  }
  .tile.tiny {
    --tile-w: 16px;
    --tile-h: 23px;
  }
  .tile.tiny .number {
    font-size: 8px;
  }
  .tile.tiny .symbol {
    font-size: 10px;
  }
  .tile.tiny .honor {
    font-size: 14px;
  }
  .tile.tiny .bonus-glyph {
    font-size: 12px;
  }
  .seat .melds {
    gap: 4px;
  }
  .seat .tile.tiny {
    --tile-w: 14px;
    --tile-h: 20px;
  }
  .seat .tile.tiny .number {
    font-size: 7px;
  }
  .seat .tile.tiny .symbol {
    font-size: 9px;
  }
  .seat .tile.tiny .honor {
    font-size: 12px;
  }
}
@media (max-width: 370px) {
  h1 {
    font-size: 16px;
  }
  .brand small {
    font-size: 9px;
  }
  .nav button {
    padding: 7px;
  }
  .table-center {
    left: 17px;
    right: 17px;
  }
  .river-tiles .tile.small {
    --tile-w: 18px;
    --tile-h: 26px;
  }
  .own-tiles {
    gap: 1px;
  }
  .nav {
    gap: 4px;
  }
  .board {
    min-height: 550px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.river-tiles {
  max-height: 111px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #5b8061 transparent;
}
@media (max-width: 640px) {
  .river-tiles {
    max-height: 88px;
  }
  .river-grid {
    min-height: 0;
  }
  .hand-zone .bonus-row {
    margin-top: 0;
  }
  .tile.small .honor-name,
  .tile.tiny .honor-name {
    display: none;
  }
}

/* Traditional faces scale with the tile, including all hand, river and meld sizes. */
.tile .tile-face {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
}
.tile:has(.tile-face) {
  padding: 0;
}
.tile {
  background: #fffcf2;
  border-color: #ddd2b9;
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 #b5b79c,
    0 4px 0 #3b775b,
    1px 6px 5px #001b1650;
}
.tile .bonus-glyph {
  font-family: KaiTi, STKaiti, 'Kaiti SC', 'Songti SC', serif;
  font-weight: 600;
  font-size: calc(var(--tile-h) * 0.62);
  line-height: 1;
}
.tile.bonus .corner {
  font-size: calc(var(--tile-h) * 0.19);
  font-weight: 700;
  color: #9b2b30;
  top: 3%;
  right: 7%;
}

/* Desktop opponents sit behind one continuous rack facing their own seat. */
.rack-line {
  display: contents;
}
@media (min-width: 951px) {
  .board {
    min-height: 650px;
  }
  .table-center {
    inset: 155px 165px 140px;
  }
  .river-tiles .tile.small {
    --tile-w: 30px;
    --tile-h: 41px;
  }
  .river-tiles {
    max-height: 136px;
    gap: 4px;
  }
  .seat .tile.tiny {
    --tile-w: 27px;
    --tile-h: 38px;
  }
  .seat .bonus-row .tile.tiny {
    --tile-w: 25px;
    --tile-h: 35px;
  }
  .seat .melds {
    gap: 8px;
    flex-wrap: nowrap;
  }
  .seat .back {
    width: 25px;
    height: 35px;
    border-radius: 4px;
  }
  .seat .back:after {
    margin: 5px;
    height: 23px;
  }
  .rack-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }
  .rack-line .backs,
  .rack-line .melds {
    margin: 0;
  }
  .opponent-rack {
    margin-top: 11px;
  }
  .seat-left,
  .seat-right {
    height: 470px;
    width: 125px;
    max-width: 125px;
    top: 44%;
  }
  .seat-left {
    left: 14px;
  }
  .seat-right {
    right: 14px;
  }
  .seat-left .player-badge,
  .seat-right .player-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }
  .seat-left .seat-score,
  .seat-right .seat-score {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    position: absolute;
    left: 50%;
    top: 50%;
    width: max-content;
    margin: 0;
    transform-origin: center;
  }
  .seat-left .opponent-rack {
    transform: translate(-50%, -50%) rotate(90deg);
  }
  .seat-right .opponent-rack {
    transform: translate(-50%, -50%) rotate(-90deg);
  }
  .seat-left .backs,
  .seat-right .backs {
    display: flex;
    max-width: none;
    gap: 3px;
    margin: 0;
    flex-wrap: nowrap;
  }
  .seat-left .back,
  .seat-right .back {
    width: 25px;
    height: 35px;
  }
  .seat-left .back:after,
  .seat-right .back:after {
    margin: 5px;
    height: 23px;
  }
  .seat-left .bonus-row,
  .seat-right .bonus-row {
    max-width: 400px;
  }
  .seat-top .opponent-rack {
    max-width: 100%;
  }
}
@media (min-width: 1400px) {
  .river-tiles .tile.small {
    --tile-w: 35px;
    --tile-h: 47px;
  }
  .river-tiles {
    max-height: 150px;
  }
  .table-center {
    left: 180px;
    right: 180px;
  }
  .seat .tile.tiny {
    --tile-w: 29px;
    --tile-h: 41px;
  }
  .seat-left,
  .seat-right {
    height: 475px;
    width: 140px;
    max-width: 140px;
  }
  .seat .bonus-row .tile.tiny {
    --tile-w: 27px;
    --tile-h: 38px;
  }
}

/* Discards stay on the felt in front of their owner. */
.board {
  min-height: 740px;
  max-height: 850px;
}
.table-center {
  inset: 165px 108px 155px;
  display: block;
}
.compass {
  position: absolute;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  gap: 10px;
  z-index: 1;
  pointer-events: none;
}
.discard-stage {
  position: absolute;
  inset: 0;
}
.discard-zone {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  --facing: 0deg;
  --discard-w: 29px;
  --discard-h: 40px;
}
.discard-top,
.discard-bottom {
  left: 24%;
  width: 52%;
  height: 29%;
  flex-direction: column;
}
.discard-top {
  top: 0;
  --facing: 180deg;
}
.discard-bottom {
  bottom: 0;
  flex-direction: column-reverse;
}
.discard-left,
.discard-right {
  top: 29%;
  width: 25%;
  height: 42%;
  flex-direction: column;
}
.discard-left {
  left: 0;
  --facing: 90deg;
}
.discard-right {
  right: 0;
  --facing: -90deg;
}
.discard-pile {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
}
.scattered-discard {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--discard-w);
  height: var(--discard-h);
  transform: translate(var(--dx), var(--dy)) rotate(var(--angle));
  padding: 0;
  background: none;
  min-height: 0;
  border: 0;
  line-height: 0;
  margin-bottom: -8px;
}
.scattered-discard:hover,
.scattered-discard:focus-visible {
  z-index: 200 !important;
  transform: rotate(0deg) scale(1.22);
}
.scattered-discard .tile.small {
  --tile-w: var(--discard-w);
  --tile-h: var(--discard-h);
  transform: rotate(var(--facing));
  box-shadow:
    0 2px 0 #909c84,
    1px 4px 5px #092c2177;
}
.discard-left .scattered-discard,
.discard-right .scattered-discard {
  width: var(--discard-h);
  height: var(--discard-w);
  margin-bottom: -5px;
}
.latest-discard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  z-index: 90;
  flex-shrink: 0;
}
.latest-discard button {
  padding: 0;
  background: none;
  min-height: 0;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.latest-discard .tile.featured {
  --tile-w: 43px;
  --tile-h: 59px;
  transform: rotate(var(--facing));
  box-shadow:
    0 3px 0 #969f81,
    0 0 0 2px #f3d27f,
    0 0 22px #e8c06944;
}
.latest-discard > span {
  font-size: 12px;
  line-height: 1;
  color: #f3d27f;
  background: #153d31e6;
  padding: 3px 6px;
  border-radius: 3px;
}
.discard-left .latest-discard button,
.discard-right .latest-discard button {
  width: 59px;
  height: 43px;
}
.discard-top.has-latest .discard-pile,
.discard-bottom.has-latest .discard-pile {
  max-width: calc(100% - 58px);
}
.discard-top.has-latest,
.discard-bottom.has-latest {
  flex-direction: row;
  gap: 14px;
}
.discard-top.has-latest .latest-discard,
.discard-bottom.has-latest .latest-discard {
  align-self: center;
}
.tile .engraved-face {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #182721;
  pointer-events: none;
}
.tile .characters-face {
  flex-direction: column;
  gap: 2%;
  font-size: calc(var(--tile-h) * 0.38);
}
.tile .characters-face span:last-child {
  color: #ac2827;
}
.tile .honor-face {
  font-size: calc(var(--tile-h) * 0.67);
}
.tile.dragon-red .honor-face {
  color: #b22627;
}
.tile.dragon-green .honor-face {
  color: #176335;
}
/* Public tai is legible at every seat; detail uses the same scoring rules. */
.tai-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #9fb69550;
  background: #10372de6;
  border-radius: 8px;
  padding: 7px 10px;
  min-height: 48px;
  color: #bed0b7;
  line-height: 1;
}
.tai-count {
  font-size: 14px;
  white-space: nowrap;
}
.tai-count b {
  font-size: 23px;
  color: #e9ead7;
  font-variant-numeric: tabular-nums;
}
.tai-count > span {
  font-size: 11px;
  margin-left: 3px;
}
.tai-badge.has-tai {
  border-color: #d6bb7866;
}
.tai-badge.has-tai .tai-count b {
  color: #f6d38a;
}
.tai-badge.at-cap {
  background: #665225;
  border-color: #ebc566;
}
.tai-badge.at-cap .tai-count > span {
  color: #ffe2a0;
  font-weight: 700;
}
.tai-meter {
  display: flex;
  gap: 4px;
}
.tai-meter i {
  height: 4px;
  width: 14px;
  border-radius: 2px;
  background: #77997844;
}
.tai-meter i.filled {
  background: #e9c775;
}
.tai-caption {
  font-size: 11px;
  color: #c0c9ae;
  white-space: nowrap;
}
.bonus-piece {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  min-height: 0;
  line-height: 1;
  margin-bottom: 7px;
  border-radius: 3px;
}
.bonus-piece.scores-tai .tile {
  box-shadow:
    0 2px 0 #8a967e,
    0 0 0 1px #e7c772;
}
.bonus-value {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: #e6c574;
  color: #253820;
  z-index: 1;
  border-radius: 3px;
  padding: 1px 3px;
  font-family: ui-sans-serif, sans-serif;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.bonus-row {
  align-items: center;
  gap: 5px;
}
.hand-topline {
  flex-wrap: wrap;
  gap: 10px;
  min-height: 53px;
}
.hand-topline .bonus-row {
  margin-top: 0;
}
.hand-topline .tai-badge {
  flex-direction: row;
  gap: 8px;
  padding: 6px 9px;
  min-height: 35px;
}
.hand-topline .tai-meter {
  display: none;
}
.hand-topline .tai-count b {
  font-size: 21px;
}
.hand-zone .bonus-row .tile.tiny {
  --tile-w: 29px;
  --tile-h: 40px;
}
.tai-summary {
  text-align: center;
  padding: 8px 0 20px;
}
.tai-summary > strong {
  font-size: 48px;
  color: #eed193;
}
.tai-summary small {
  font-size: 19px;
  font-weight: 400;
}
.tai-summary p {
  margin: 7px 0 0;
}
.cap-note {
  color: #efd18a;
}
.bonus-detail-list {
  margin: 16px 0;
}
.bonus-detail {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #ffffff12;
}
.bonus-detail > span:not(.tile) {
  flex: 1;
}
.bonus-detail strong {
  font-size: 15px;
}
.bonus-detail small {
  display: block;
  font-size: 13px;
  color: #aabcaa;
  margin-top: 4px;
}
.bonus-detail > b {
  white-space: nowrap;
  font-size: 14px;
}
.bonus-detail .tile.small {
  --tile-w: 38px;
  --tile-h: 52px;
}
@media (min-width: 951px) {
  .seat-left,
  .seat-right {
    height: 530px;
    top: 44%;
  }
  .seat-score {
    margin-top: 10px;
  }
  .seat-top .seat-score .tai-badge {
    flex-direction: row;
    min-height: 34px;
    padding: 5px 8px;
    gap: 8px;
  }
  .seat-top .tai-count b {
    font-size: 20px;
  }
  .seat-top .tai-caption {
    display: none;
  }
  .seat-top .tai-meter i {
    width: 9px;
  }
  .seat-top .bonus-row {
    margin-top: 8px;
  }
  .table-center {
    top: 190px;
  }
}
@media (min-width: 1400px) {
  .table-center {
    left: 130px;
    right: 130px;
  }
  .discard-zone {
    --discard-w: 33px;
    --discard-h: 45px;
  }
  .latest-discard .tile.featured {
    --tile-w: 49px;
    --tile-h: 67px;
  }
  .discard-left .latest-discard button,
  .discard-right .latest-discard button {
    width: 67px;
    height: 49px;
  }
}
@media (min-width: 951px) and (max-width: 1199px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 0;
  }
  .activity-panel {
    grid-column: 1/-1;
  }
  .board {
    min-height: 760px;
  }
}
@media (max-width: 950px) and (min-width: 641px) {
  .board {
    min-height: 720px;
  }
  .table-center {
    inset: 177px 113px 153px;
  }
  .seat-left,
  .seat-right {
    max-width: 100px;
    top: 46%;
  }
  .seat .bonus-row .tile.tiny {
    --tile-w: 24px;
    --tile-h: 34px;
  }
}
@media (max-width: 640px) {
  .board {
    min-height: 760px;
    max-height: none;
    height: auto;
  }
  .seat-top {
    top: 13px;
    max-width: 90%;
  }
  .seat-top .opponent-rack {
    margin-top: 4px;
  }
  .seat-top .seat-score {
    margin-top: 7px;
  }
  .seat-top .tai-badge {
    flex-direction: row;
    gap: 7px;
    min-height: 31px;
    padding: 4px 7px;
  }
  .seat-top .tai-meter,
  .seat-top .tai-caption {
    display: none;
  }
  .seat-left,
  .seat-right {
    top: 29%;
    max-width: 92px;
    transform: translateY(-50%);
  }
  .seat-left {
    left: 6px;
  }
  .seat-right {
    right: 6px;
  }
  .seat .bonus-row .tile.tiny {
    --tile-w: 22px;
    --tile-h: 31px;
  }
  .seat .bonus-row {
    gap: 4px;
  }
  .seat-score {
    margin-top: 9px;
  }
  .tai-badge {
    padding: 6px;
    gap: 5px;
    min-height: 43px;
  }
  .tai-count {
    font-size: 12px;
  }
  .tai-count b {
    font-size: 20px;
  }
  .tai-count > span {
    font-size: 10px;
    margin-left: 1px;
  }
  .tai-caption {
    font-size: 10px;
  }
  .tai-meter {
    gap: 3px;
  }
  .tai-meter i {
    width: 11px;
  }
  .table-center {
    inset: 173px 18px 145px;
  }
  .compass {
    top: 50%;
    gap: 6px;
    opacity: 0.8;
  }
  .compass-wind {
    font-size: 22px;
  }
  .wall-count {
    padding-left: 6px;
  }
  .wall-count strong {
    font-size: 19px;
  }
  .wall-count small {
    font-size: 9px;
    letter-spacing: 0;
  }
  .discard-zone {
    --discard-w: 23px;
    --discard-h: 32px;
    gap: 9px;
  }
  .discard-top,
  .discard-bottom {
    left: 14%;
    width: 72%;
    height: 25%;
  }
  .discard-left,
  .discard-right {
    top: 33%;
    width: 31%;
    height: 40%;
  }
  .discard-left {
    left: 0;
  }
  .discard-right {
    right: 0;
  }
  .discard-left .discard-pile,
  .discard-right .discard-pile {
    max-width: 100%;
  }
  .scattered-discard {
    margin-bottom: -9px;
    gap: 2px;
  }
  .discard-left .scattered-discard,
  .discard-right .scattered-discard {
    margin-bottom: -8px;
  }
  .latest-discard {
    gap: 5px;
  }
  .latest-discard .tile.featured {
    --tile-w: 32px;
    --tile-h: 44px;
  }
  .latest-discard > span {
    font-size: 10px;
    padding: 2px 4px;
  }
  .discard-left .latest-discard button,
  .discard-right .latest-discard button {
    width: 44px;
    height: 32px;
  }
  .discard-top.has-latest .discard-pile,
  .discard-bottom.has-latest .discard-pile {
    max-width: calc(100% - 44px);
  }
  .discard-top.has-latest,
  .discard-bottom.has-latest {
    gap: 10px;
  }
  .hand-topline {
    gap: 8px;
    min-height: 49px;
    margin-bottom: 11px;
  }
  .hand-zone .bonus-row .tile.tiny {
    --tile-w: 24px;
    --tile-h: 34px;
  }
  .hand-topline .tai-badge {
    min-height: 31px;
    gap: 5px;
    padding: 5px 6px;
  }
  .hand-topline .tai-caption {
    display: none;
  }
  .hand-topline .tai-count b {
    font-size: 19px;
  }
}

/* Fixed scatter positions keep long hands within their owner's area. */
.discard-zone {
  --cell-w: var(--discard-w);
  --cell-h: var(--discard-h);
}
.discard-left,
.discard-right {
  --cell-w: var(--discard-h);
  --cell-h: var(--discard-w);
}
.discard-pile {
  position: relative;
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.scattered-discard {
  position: absolute;
  left: calc(var(--x) * (100% - var(--cell-w)));
  top: calc(var(--y) * (100% - var(--cell-h)));
  margin: 0 !important;
}
.discard-top.has-latest .discard-pile,
.discard-bottom.has-latest .discard-pile {
  max-width: none;
}

/* Flowers and the tai count sit together on the table side of each rack. */
.opponent-rack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 9px;
}
.rack-front {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}
.rack-front .bonus-row {
  margin: 0;
  flex-wrap: nowrap;
  gap: 5px;
}
.tai-anchor {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rack-front .tai-badge {
  padding: 5px 8px;
  gap: 5px;
  min-height: 40px;
  border-radius: 5px;
  white-space: nowrap;
}
.rack-front .tai-count {
  font-size: 14px;
}
.rack-front .tai-count b {
  font-size: 23px;
}
.rack-front .tai-count > span {
  font-size: 11px;
}
.rack-front .tai-caption {
  display: none;
}
.rack-front .tai-meter {
  display: flex;
  gap: 3px;
}
.rack-front .tai-meter i {
  width: 10px;
}
.hand-topline .rack-front {
  min-width: 0;
  flex-wrap: wrap;
}
.hand-topline .tai-badge {
  flex-direction: column;
  min-height: 40px;
}
.hand-topline {
  margin-bottom: 15px;
  gap: 18px;
}
.seat-top .rack-line {
  order: 0;
}
.seat-top .rack-front {
  order: 0;
}
@media (min-width: 641px) {
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    flex-direction: column;
    gap: 10px;
  }
  .seat-left .rack-front,
  .seat-right .rack-front {
    max-width: 425px;
  }
  .seat-left .tai-anchor,
  .seat-right .tai-anchor {
    width: 43px;
    height: 84px;
  }
  .seat-left .tai-badge,
  .seat-right .tai-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 84px;
    height: 43px;
    padding: 4px;
    min-height: 0;
  }
  .seat-left .tai-badge {
    transform: translate(-50%, -50%) rotate(-90deg);
  }
  .seat-right .tai-badge {
    transform: translate(-50%, -50%) rotate(90deg);
  }
  .seat-left .tai-count > span,
  .seat-right .tai-count > span {
    display: none;
  }
  .seat-left .bonus-row,
  .seat-right .bonus-row {
    max-width: 390px;
    flex-wrap: wrap;
  }
  .seat-top .tai-badge {
    flex-direction: column;
    min-height: 40px;
  }
  .table-center {
    left: 155px;
    right: 155px;
  }
}
@media (min-width: 641px) and (max-width: 950px) {
  .seat-left,
  .seat-right {
    height: 430px;
    width: 110px;
    max-width: 110px;
    top: 43%;
  }
  .seat-left {
    left: 8px;
  }
  .seat-right {
    right: 8px;
  }
  .seat-left .player-badge,
  .seat-right .player-badge {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    position: absolute;
    left: 50%;
    top: 50%;
    width: max-content;
    margin: 0;
    transform-origin: center;
  }
  .seat-left .opponent-rack {
    transform: translate(-50%, -50%) rotate(90deg);
  }
  .seat-right .opponent-rack {
    transform: translate(-50%, -50%) rotate(-90deg);
  }
  .rack-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .seat-left .backs,
  .seat-right .backs {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    max-width: none;
    margin: 0;
  }
  .seat-left .back,
  .seat-right .back {
    width: 20px;
    height: 28px;
  }
  .seat-left .back:after,
  .seat-right .back:after {
    height: 19px;
    margin: 3px;
  }
  .seat .melds {
    flex-wrap: nowrap;
    margin: 0;
  }
  .seat .tile.tiny {
    --tile-w: 23px;
    --tile-h: 32px;
  }
  .table-center {
    left: 125px;
    right: 125px;
  }
}
@media (max-width: 640px) {
  .rack-front {
    gap: 6px;
    flex-wrap: wrap;
  }
  .rack-front .bonus-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  .seat-top .rack-front {
    flex-wrap: nowrap;
  }
  .seat-top .tai-badge {
    flex-direction: column;
    min-height: 38px;
  }
  .seat-top .tai-count b {
    font-size: 20px;
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    gap: 7px;
  }
  .seat-left .backs,
  .seat-right .backs {
    display: flex;
    gap: 1px;
    max-width: none;
    margin: 0;
    flex-wrap: nowrap;
  }
  .seat-left .back,
  .seat-right .back {
    width: 5px;
    height: 12px;
    border-radius: 1px;
  }
  .seat-left .back:after,
  .seat-right .back:after {
    display: none;
  }
  .seat-left .rack-front,
  .seat-right .rack-front {
    flex-direction: column;
    gap: 6px;
  }
  .rack-front .tai-badge {
    min-height: 37px;
    padding: 4px 6px;
  }
  .rack-front .tai-count {
    font-size: 13px;
  }
  .rack-front .tai-count b {
    font-size: 21px;
  }
  .rack-front .tai-count > span {
    font-size: 10px;
  }
  .rack-front .tai-meter i {
    width: 8px;
  }
  .hand-topline {
    gap: 8px;
  }
  .hand-topline .rack-front {
    gap: 6px;
  }
  .hand-topline .tai-badge {
    min-height: 37px;
  }
}

/* Names sit behind each rack and follow that player's orientation. */
.seat .opponent-rack .player-badge {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  flex-shrink: 0;
}
.seat-top .opponent-rack {
  margin-top: 0;
}
@media (min-width: 641px) {
  .seat-left .tai-anchor,
  .seat-right .tai-anchor {
    height: 70px;
  }
  .seat-left .tai-badge,
  .seat-right .tai-badge {
    width: 70px;
  }
  .seat-left .opponent-rack {
    left: calc(50% + 10px);
  }
  .seat-right .opponent-rack {
    left: calc(50% - 10px);
  }
  .seat .player-name strong {
    font-size: 15px;
  }
  .seat .player-name small {
    font-size: 12px;
  }
  .table-center {
    left: 174px;
    right: 174px;
  }
}
@media (min-width: 641px) and (max-width: 950px) {
  .table-center {
    left: 146px;
    right: 146px;
  }
  .seat-left .opponent-rack {
    left: calc(50% + 12px);
  }
  .seat-right .opponent-rack {
    left: calc(50% - 12px);
  }
}

/* Hand ordering is explicit, so moving a tile cannot discard it. */
.hand-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 14px;
  color: #acbda7;
  font-size: 13px;
}
.hand-controls button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}
.own-tiles .tile.group-start:not(:first-child) {
  margin-left: 0;
}
.arrange-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 14px;
}
.arrange-options button {
  padding: 9px 13px;
}
.arrange-explanation {
  min-height: 48px;
  font-size: 14px;
  color: #bccdb9;
  line-height: 1.6;
}
.arrange-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 28px 0;
  margin: 8px 0;
  min-height: 125px;
  user-select: none;
}
.arrange-piece {
  padding: 0;
  background: none;
  position: relative;
  min-height: 0;
  line-height: 0;
  touch-action: none;
  user-select: none;
  border-radius: 5px;
}
.arrange-piece .tile {
  --tile-w: 43px;
  --tile-h: 60px;
  pointer-events: none;
}
.arrange-piece.chosen .tile {
  box-shadow:
    0 0 0 3px #ebca79,
    0 4px 0 #929d86;
}
.arrange-piece.dragging {
  z-index: 100;
  transition: none;
  opacity: 0.8;
}
.arrange-piece.group-start {
  margin-left: 7px;
}
.arrange-move {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 20px;
}
.arrange-move > span {
  text-align: center;
  font-size: 14px;
  color: #e9d098;
}
.arrange-move button {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .own-tiles .tile.group-start:not(:first-child) {
    margin-left: 0;
  }
  .arrange-piece .tile {
    --tile-w: 34px;
    --tile-h: 48px;
  }
  .arrange-tiles {
    gap: 5px;
  }
  .arrange-move {
    flex-wrap: wrap;
    justify-content: center;
  }
  .arrange-move > span {
    order: -1;
    width: 100%;
  }
  .hand-controls {
    padding-top: 12px;
  }
  .arrange-options button {
    font-size: 13px;
  }
  .hand-controls + .turn-bar {
    padding-top: 12px;
  }
}
/* Compact side racks keep the same physical orientation on phones. */
@media (max-width: 640px) {
  .seat-left,
  .seat-right {
    top: 43%;
    height: 300px;
    width: 94px;
    max-width: 94px;
    transform: translateY(-50%);
  }
  .seat-left {
    left: 3px;
  }
  .seat-right {
    right: 3px;
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    position: absolute;
    left: 50%;
    top: 50%;
    width: max-content;
    max-width: none;
    margin: 0;
    flex-direction: column;
    gap: 5px;
    transform-origin: center;
  }
  .seat-left .opponent-rack {
    transform: translate(-50%, -50%) rotate(90deg);
  }
  .seat-right .opponent-rack {
    transform: translate(-50%, -50%) rotate(-90deg);
  }
  .seat-left .rack-line,
  .seat-right .rack-line {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .seat-left .backs,
  .seat-right .backs {
    gap: 2px;
  }
  .seat-left .back,
  .seat-right .back {
    width: 11px;
    height: 17px;
    border-radius: 2px;
  }
  .seat-left .melds,
  .seat-right .melds {
    flex-wrap: nowrap;
    margin: 0;
    gap: 4px;
  }
  .seat-left .rack-front,
  .seat-right .rack-front {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    max-width: none;
  }
  .seat-left .bonus-row,
  .seat-right .bonus-row {
    flex-wrap: nowrap;
    gap: 3px;
    max-width: none;
  }
  .seat-left .bonus-row .tile.tiny,
  .seat-right .bonus-row .tile.tiny {
    --tile-w: 20px;
    --tile-h: 28px;
  }
  .seat-left .tai-badge,
  .seat-right .tai-badge {
    width: 55px;
    min-height: 35px;
    padding: 3px;
  }
  .seat-left .tai-count > span,
  .seat-right .tai-count > span {
    display: none;
  }
  .seat-left .tai-meter i,
  .seat-right .tai-meter i {
    width: 6px;
  }
  .seat-left .avatar,
  .seat-right .avatar {
    width: 22px;
    height: 22px;
  }
  .seat-left .player-name strong,
  .seat-right .player-name strong {
    font-size: 12px;
  }
  .discard-left,
  .discard-right {
    width: 18%;
    top: 29%;
    height: 45%;
    --discard-w: 21px;
    --discard-h: 29px;
  }
  .discard-left {
    left: 28%;
  }
  .discard-right {
    right: 28%;
  }
  .discard-top {
    left: 27%;
    width: 46%;
  }
  .compass {
    flex-direction: column;
    gap: 3px;
    width: 30px;
  }
  .compass-wind {
    font-size: 20px;
  }
  .wall-count {
    border: 0;
    padding: 0;
    text-align: center;
  }
  .wall-count strong {
    font-size: 17px;
  }
  .wall-count small {
    font-size: 8px;
    letter-spacing: 0;
  }
}

/* The shrinking two-layer wall includes the fifteen reserved tiles. */
.wall-diagram {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 260px;
  margin: 0 auto;
  --wall-gap: 2px;
}
.wall-side {
  position: absolute;
  display: flex;
  gap: var(--wall-gap);
  justify-content: center;
}
.wall-top,
.wall-bottom {
  left: 10%;
  width: 80%;
  height: 12px;
}
.wall-top {
  top: 7%;
}
.wall-bottom {
  bottom: 7%;
  flex-direction: row-reverse;
}
.wall-left,
.wall-right {
  top: 11%;
  height: 78%;
  width: 12px;
  flex-direction: column;
}
.wall-left {
  left: 3%;
  flex-direction: column-reverse;
}
.wall-right {
  right: 3%;
}
.wall-stack {
  display: flex;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  gap: 1px;
  flex-direction: column;
}
.wall-left .wall-stack,
.wall-right .wall-stack {
  flex-direction: row;
}
.wall-piece {
  display: block;
  flex: 1;
  min-width: 0;
  min-height: 0;
  border-radius: 1px;
  background: #4f9a7d;
  border: 1px solid #92b59966;
  box-shadow: 0 1px 0 #0b281f;
}
.wall-piece.reserve {
  background: #d2ae59;
  border-color: #edcf86;
}
.wall-piece.empty {
  background: #11392e;
  border-color: #51735830;
  box-shadow: none;
}
.wall-middle {
  position: absolute;
  inset: 25%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.wall-middle strong {
  font-size: 36px;
  font-weight: 500;
  color: #eee2ba;
}
.wall-middle span {
  font-size: 13px;
  color: #cfdbc3;
}
.wall-middle small {
  font-size: 12px;
  color: #e0bd71;
  margin-top: 6px;
  white-space: nowrap;
}
.wall-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  color: #bdcbb5;
}
.wall-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.wall-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #4f9a7d;
}
.wall-legend .reserve {
  background: #d2ae59;
}
@media (max-width: 640px) {
  .wall-diagram {
    max-width: 230px;
    min-width: 120px;
  }
  .wall-middle strong {
    font-size: 29px;
  }
  .wall-legend {
    gap: 8px;
    font-size: 11px;
  }
}

/* Calls and discard controls are part of the table, immediately below the hand. */
.board {
  --action-room: 88px;
  min-height: 828px;
  max-height: 938px;
  height: calc(100vh - 190px);
}
.hand-zone {
  bottom: calc(20px + var(--action-room));
}
.table-center {
  bottom: calc(155px + var(--action-room));
}
.seat-left,
.seat-right {
  top: calc((100% - var(--action-room)) * 0.44);
}
.table-turn-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  min-height: var(--action-room);
  padding: 12px 22px;
  background: #103d32;
  border-top: 1px solid #c9b87538;
  gap: 12px;
  align-items: center;
}
.table-turn-bar .turn-status strong {
  font-size: 15px;
  line-height: 1.35;
}
.table-turn-bar .turn-status p {
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}
.table-turn-bar .move-actions {
  gap: 6px;
  max-width: 72%;
  flex-shrink: 1;
}
.table-turn-bar .primary,
.table-turn-bar .call-button,
.table-turn-bar .ghost {
  padding: 10px 14px;
  min-height: 42px;
  font-size: 14px;
}
@media (min-width: 951px) and (max-width: 1199px) {
  .board {
    min-height: 848px;
  }
}
@media (min-width: 641px) and (max-width: 950px) {
  .board {
    min-height: 808px;
  }
  .table-center {
    bottom: calc(153px + var(--action-room));
  }
  .seat-left,
  .seat-right {
    top: calc((100% - var(--action-room)) * 0.43);
  }
  .table-turn-bar {
    padding: 10px 14px;
  }
  .table-turn-bar .turn-status p {
    display: none;
  }
}
@media (max-width: 640px) {
  .board {
    --action-room: 124px;
    min-height: 884px;
    height: auto;
    max-height: none;
  }
  .hand-zone {
    bottom: calc(17px + var(--action-room));
  }
  .table-center {
    bottom: calc(145px + var(--action-room));
  }
  .seat-left,
  .seat-right {
    top: calc((100% - var(--action-room)) * 0.43);
  }
  .table-turn-bar {
    padding: 10px 9px;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .table-turn-bar .turn-status {
    flex: none;
    min-width: 0;
    text-align: center;
  }
  .table-turn-bar .turn-status strong {
    font-size: 14px;
  }
  .table-turn-bar .turn-status p {
    display: none;
  }
  .table-turn-bar .move-actions {
    max-width: 100%;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
  }
  .table-turn-bar .primary,
  .table-turn-bar .call-button,
  .table-turn-bar .ghost {
    padding: 9px 11px;
    min-height: 38px;
    font-size: 13px;
  }
}

/* All four discard areas meet in the centre, with one space per tile. */
.board {
  --discard-w: 29px;
  --discard-h: 40px;
  --pile-gap: 5px;
  --top-rows: var(--base-top);
  --bottom-rows: var(--base-bottom);
  --middle-rows: var(--base-middle);
  --top-block: calc(var(--top-rows) * (var(--discard-h) + var(--pile-gap)));
  --bottom-block: calc(var(--bottom-rows) * (var(--discard-h) + var(--pile-gap)));
  --middle-block: max(76px, calc(var(--middle-rows) * (var(--discard-w) + var(--pile-gap))));
  --discard-block: calc(var(--top-block) + var(--middle-block) + var(--bottom-block) + 36px);
  --rack-space: 194px;
  --hand-space: 155px;
  min-height: max(
    850px,
    calc(var(--rack-space) + var(--hand-space) + var(--action-room) + var(--discard-block) + 20px)
  );
  max-height: none;
}
.table-center {
  top: var(--rack-space);
  bottom: calc(var(--hand-space) + var(--action-room));
  left: 194px;
  right: 194px;
}
.discard-stage {
  display: grid;
  align-content: center;
  grid-template-columns: minmax(85px, 1fr) minmax(199px, 2fr) minmax(85px, 1fr);
  grid-template-rows: var(--top-block) var(--middle-block) var(--bottom-block);
  gap: 18px 8px;
}
.discard-zone {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  transform: none;
  --discard-w: inherit;
  --discard-h: inherit;
}
.discard-top {
  grid-area: 1/2;
  align-items: flex-end;
}
.discard-bottom {
  grid-area: 3/2;
  align-items: flex-start;
}
.discard-left {
  grid-area: 2/1;
  align-items: flex-end;
}
.discard-right {
  grid-area: 2/3;
  align-items: flex-start;
}
.discard-pile {
  display: grid;
  position: static;
  flex: none;
  grid-template-columns: repeat(6, var(--cell-w));
  grid-auto-rows: var(--cell-h);
  gap: var(--pile-gap);
  width: max-content;
  height: auto;
  min-height: 0;
  max-width: none !important;
  align-content: start;
  justify-content: center;
}
.discard-left .discard-pile,
.discard-right .discard-pile {
  grid-template-columns: repeat(2, var(--cell-w));
}
.discard-left {
  --side-rows: var(--base-left);
}
.discard-right {
  --side-rows: var(--base-right);
}
.discard-left .discard-pile,
.discard-right .discard-pile {
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--side-rows), var(--cell-h));
}
.discard-left .latest-discard,
.discard-right .latest-discard {
  grid-column: 1 / span 2;
  grid-row: -3 / -1;
}
.discard-right .discard-pile {
  transform: rotate(180deg);
}
.discard-right .scattered-discard,
.discard-right .scattered-discard:hover,
.discard-right .scattered-discard:focus-visible,
.discard-right .latest-discard {
  transform: rotate(180deg);
}
@media (min-width: 1400px) {
  .discard-left {
    --side-rows: var(--wide-left);
  }
  .discard-right {
    --side-rows: var(--wide-right);
  }
}
@media (max-width: 800px) {
  .discard-left {
    --side-rows: var(--phone-left);
  }
  .discard-right {
    --side-rows: var(--phone-right);
  }
}
.scattered-discard {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  margin: 0 !important;
  z-index: auto;
}
.scattered-discard:hover,
.scattered-discard:focus-visible {
  transform: none;
  z-index: 2 !important;
  outline: 2px solid #edcf7b;
  outline-offset: 1px;
}
.latest-discard {
  grid-column: span 2;
  grid-row: span 2;
  justify-content: center;
  align-self: stretch !important;
  gap: 3px;
  width: auto;
  min-height: 0;
  margin: 0;
  z-index: 2;
}
.latest-discard .tile.featured {
  --tile-w: 43px;
  --tile-h: 59px;
}
.latest-discard > span {
  font-size: 10px;
  line-height: 1;
  padding: 1px 3px;
}
.discard-left .latest-discard button,
.discard-right .latest-discard button {
  width: 59px;
  height: 43px;
}
.compass {
  top: calc(50% + (var(--top-block) - var(--bottom-block)) / 2);
  width: auto;
}
/* Larger face-up sets and substantial, evenly spaced concealed tile backs. */
.seat .rack-line {
  gap: 12px;
  padding: 7px 5px 9px;
  border-radius: 7px;
  max-width: 100%;
}
.seat.active .rack-line {
  background: #e7ca7615;
  box-shadow: 0 0 0 1px #e7ca7640;
}
.seat .rack-line .backs {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  margin: 0;
  max-width: none;
  flex-shrink: 0;
}
.seat .rack-line .backs .back {
  position: relative;
  flex: 0 0 auto;
  width: 31px;
  height: 37px;
  border-radius: 4px;
  background: linear-gradient(145deg, #438a70, #2a6c56);
  border: 1px solid #87b799;
  border-bottom: 5px solid #ddd9be;
  box-shadow:
    0 2px 0 #82947d,
    1px 3px 3px #08251d66;
}
.seat .rack-line .backs .back:after {
  display: block;
  position: absolute;
  inset: 4px;
  margin: 0;
  width: auto;
  height: auto;
  border: 1px solid #add0ae66;
  border-radius: 2px;
}
.seat .tile.tiny {
  --tile-w: 38px;
  --tile-h: 52px;
}
.seat .bonus-row .tile.tiny {
  --tile-w: 33px;
  --tile-h: 46px;
}
.seat .melds {
  gap: 11px;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
}
.seat .meld {
  gap: 2px;
}
.exposed-meld {
  display: block;
  padding: 0;
  background: none;
  min-height: 0;
  line-height: 0;
  border-radius: 4px;
  flex-shrink: 0;
}
.exposed-meld:hover {
  outline: 2px solid #e7ca7680;
  outline-offset: 3px;
}
.exposed-meld .concealed-label {
  line-height: 1;
  font-size: 9px;
  bottom: -11px;
}
.meld-inspection {
  display: flex;
  gap: 9px;
  justify-content: center;
  padding: 28px 0 24px;
}
.meld-inspection .tile {
  --tile-w: 66px;
  --tile-h: 90px;
}
.meld-description {
  text-align: center;
  line-height: 1.7;
}
@media (min-width: 1400px) {
  .board {
    --discard-w: 33px;
    --discard-h: 45px;
    --top-rows: var(--wide-top);
    --bottom-rows: var(--wide-bottom);
    --middle-rows: var(--wide-middle);
  }
  .discard-stage {
    grid-template-columns: minmax(145px, 1fr) minmax(223px, 2fr) minmax(145px, 1fr);
  }
  .discard-left .discard-pile,
  .discard-right .discard-pile {
    grid-template-columns: repeat(3, var(--cell-w));
  }
}
@media (min-width: 801px) and (max-width: 950px) {
  .board {
    --discard-w: 25px;
    --discard-h: 35px;
    --rack-space: 181px;
    --hand-space: 153px;
    min-height: max(
      828px,
      calc(var(--rack-space) + var(--hand-space) + var(--action-room) + var(--discard-block) + 20px)
    );
  }
  .table-center {
    left: 160px;
    right: 160px;
  }
  .discard-stage {
    grid-template-columns: minmax(75px, 1fr) minmax(175px, 2fr) minmax(75px, 1fr);
    column-gap: 6px;
  }
  .seat .tile.tiny {
    --tile-w: 31px;
    --tile-h: 43px;
  }
  .seat .bonus-row .tile.tiny {
    --tile-w: 28px;
    --tile-h: 39px;
  }
  .seat .rack-line .backs .back {
    width: 26px;
    height: 31px;
  }
  .seat .rack-line {
    gap: 9px;
  }
  .latest-discard .tile.featured {
    --tile-w: 37px;
    --tile-h: 51px;
  }
  .discard-left .latest-discard button,
  .discard-right .latest-discard button {
    width: 51px;
    height: 37px;
  }
}
@media (max-width: 800px) {
  .board {
    --discard-w: 23px;
    --discard-h: 32px;
    --pile-gap: 4px;
    --top-rows: var(--phone-top);
    --bottom-rows: var(--phone-bottom);
    --middle-rows: var(--phone-middle);
    --rack-space: calc(192px + var(--narrow-rack-span));
    --hand-space: 145px;
    min-height: max(
      884px,
      calc(var(--rack-space) + var(--hand-space) + var(--action-room) + var(--discard-block) + 20px)
    );
  }
  .seat-top {
    width: calc(100% - 28px);
    max-width: none;
  }
  .seat-top .opponent-rack {
    width: 100%;
  }
  .seat-top .rack-line {
    flex-wrap: wrap;
    gap: 8px;
  }
  .seat-top .melds {
    flex-wrap: wrap;
  }
  .seat-left,
  .seat-right {
    top: calc(176px + var(--narrow-rack-span) / 2);
    height: var(--narrow-rack-span);
    width: 100px;
    max-width: 100px;
    transform: translateY(-50%);
  }
  .seat-left {
    left: 3px;
  }
  .seat-right {
    right: 3px;
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    left: 50%;
    gap: 6px;
  }
  .seat .rack-line {
    gap: 8px;
    padding: 5px 3px 7px;
  }
  .seat .rack-line .backs {
    gap: 2px;
  }
  .seat .rack-line .backs .back {
    width: 19px;
    height: 24px;
    border-bottom-width: 4px;
    border-radius: 3px;
  }
  .seat .rack-line .backs .back:after {
    inset: 3px;
  }
  .seat .tile.tiny {
    --tile-w: 23px;
    --tile-h: 32px;
  }
  .seat .melds {
    gap: 8px;
  }
  .seat .bonus-row .tile.tiny {
    --tile-w: 24px;
    --tile-h: 33px;
  }
  .seat-left .bonus-row .tile.tiny,
  .seat-right .bonus-row .tile.tiny {
    --tile-w: 24px;
    --tile-h: 33px;
  }
  .seat-left .rack-front,
  .seat-right .rack-front {
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
    max-width: none;
  }
  .seat-left .bonus-row,
  .seat-right .bonus-row {
    flex-wrap: nowrap;
    max-width: none;
    gap: 3px;
  }
  .table-center {
    top: var(--rack-space);
    left: 14px;
    right: 14px;
  }
  .discard-stage {
    grid-template-columns: minmax(68px, 1fr) minmax(104px, 1.5fr) minmax(68px, 1fr);
    column-gap: 6px;
  }
  .discard-top .discard-pile,
  .discard-bottom .discard-pile {
    grid-template-columns: repeat(4, var(--cell-w));
  }
  .latest-discard .tile.featured {
    --tile-w: 32px;
    --tile-h: 44px;
  }
  .latest-discard > span {
    font-size: 9px;
  }
  .discard-left .latest-discard button,
  .discard-right .latest-discard button {
    width: 44px;
    height: 32px;
  }
  .compass {
    flex-direction: column;
    gap: 5px;
  }
  .compass-wind {
    font-size: 22px;
  }
  .wall-count {
    border: 0;
    padding: 0;
    text-align: center;
  }
  .wall-count small {
    font-size: 9px;
    letter-spacing: 0;
  }
  .meld-inspection {
    gap: 7px;
  }
  .meld-inspection .tile {
    --tile-w: 52px;
    --tile-h: 72px;
  }
}

.wall-roll {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}
.wall-roll > span {
  display: flex;
  gap: 4px;
}
.wall-roll i {
  font-style: normal;
  font-size: 29px;
  line-height: 1;
  color: #f0e5c6;
}
.wall-roll b {
  font-size: 16px;
  font-weight: 500;
  color: #e1c487;
  padding-left: 9px;
  border-left: 1px solid #dec48e40;
}
.wall-opening {
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: #c8d3ba;
  margin-top: 7px;
}
.wall-piece.next {
  position: relative;
  background: #f4f0dc;
  border-color: #fffbe3;
  box-shadow: 0 0 0 1px #e4eeb6;
  z-index: 2;
}
.wall-seat-label {
  position: absolute;
  font-size: 13px;
  line-height: 1;
  color: #d9ca9e;
  pointer-events: none;
}
.wall-top .wall-seat-label {
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
}
.wall-bottom .wall-seat-label {
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
}
.wall-left .wall-seat-label {
  right: calc(100% + 2px);
  top: 50%;
}
.wall-right .wall-seat-label {
  left: calc(100% + 2px);
  top: 50%;
}
.wall-left {
  left: 7%;
}
.wall-right {
  right: 7%;
}
.wall-top,
.wall-bottom {
  left: 14%;
  width: 72%;
}
.wall-stack.wall-break:before {
  content: '';
  position: absolute;
  background: #e2ad65;
  pointer-events: none;
}
.wall-top .wall-break:before,
.wall-bottom .wall-break:before {
  top: -4px;
  bottom: -4px;
  width: 2px;
}
.wall-top .wall-break:before {
  left: -2px;
}
.wall-bottom .wall-break:before {
  right: -2px;
}
.wall-left .wall-break:before,
.wall-right .wall-break:before {
  left: -4px;
  right: -4px;
  height: 2px;
}
.wall-left .wall-break:before {
  bottom: -2px;
}
.wall-right .wall-break:before {
  top: -2px;
}
.wall-legend {
  gap: 8px;
  flex-wrap: wrap;
}
.wall-legend .next {
  background: #f4f0dc;
}
.wall-legend .opening {
  width: 2px;
  background: #e2ad65;
}

/* Keep the four discard groups together and leave clear margins around racks. */
.discard-zone,
.discard-top.has-latest,
.discard-bottom.has-latest {
  flex-direction: column;
  gap: 0;
  align-items: center;
  justify-content: center;
}
.discard-top {
  justify-content: flex-end;
}
.discard-bottom {
  justify-content: flex-start;
}
.discard-left {
  align-items: flex-end;
}
.discard-right {
  align-items: flex-start;
}
@media (min-width: 951px) {
  .seat-left,
  .seat-right {
    width: 152px;
    max-width: 152px;
  }
  .seat-left {
    left: 28px;
  }
  .seat-right {
    right: 28px;
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    left: 50%;
  }
  .table-center {
    left: 214px;
    right: 214px;
  }
}
@media (min-width: 951px) and (max-width: 1439px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 0;
  }
  .activity-panel {
    grid-column: 1/-1;
  }
}
@media (min-width: 801px) and (max-width: 950px) {
  .table-center {
    left: 182px;
    right: 182px;
  }
  .seat-left,
  .seat-right {
    width: 158px;
    max-width: 158px;
  }
  .seat-left {
    left: 16px;
  }
  .seat-right {
    right: 16px;
  }
  .seat-left .opponent-rack,
  .seat-right .opponent-rack {
    left: 50%;
  }
  .seat-left .tai-anchor,
  .seat-right .tai-anchor {
    height: 56px;
  }
  .seat-left .tai-badge,
  .seat-right .tai-badge {
    width: 56px;
  }
}
@media (max-width: 800px) {
  .seat-left {
    left: 9px;
  }
  .seat-right {
    right: 9px;
  }
  .seat-left .tai-anchor,
  .seat-right .tai-anchor {
    width: 55px;
    height: 35px;
  }
  .seat-left .tai-badge,
  .seat-right .tai-badge {
    position: static;
    transform: none;
    width: 55px;
    height: 35px;
    min-height: 35px;
    padding: 3px;
  }
  .seat-left .avatar,
  .seat-right .avatar {
    width: 22px;
    height: 22px;
  }
  .seat-left .player-name strong,
  .seat-right .player-name strong {
    font-size: 12px;
  }
  .seat-left .player-name small,
  .seat-right .player-name small {
    font-size: 10px;
  }
}

/* Eight tiles along each owner's hand; the latest tile has its own clear space. */
.board {
  --river-height: 40px;
  --centre-gap: 64px;
  --stage-col-gap: 12px;
}
.table-center {
  container-type: inline-size;
}
.discard-stage {
  --discard-h: min(
    var(--river-height),
    calc(
      (
          100cqw - var(--centre-gap) - 2 * var(--stage-col-gap) - (var(--side-columns) - 2) *
            var(--pile-gap)
        ) /
        var(--side-columns)
    ),
    calc((100cqw - 7 * var(--pile-gap)) / 5.84)
  );
  --discard-w: calc(var(--discard-h) * 0.73);
  grid-template-columns: max-content minmax(var(--centre-gap), 1fr) max-content;
  column-gap: var(--stage-col-gap);
}
.discard-top {
  grid-area: 1 / 1 / 2 / -1;
}
.discard-bottom {
  grid-area: 3 / 1 / 4 / -1;
}
.discard-zone .discard-pile {
  grid-template-columns: repeat(var(--pile-columns), var(--cell-w));
  grid-template-rows: repeat(var(--pile-rows), var(--cell-h));
  grid-auto-flow: row;
}
.discard-stage .compass {
  grid-area: 2/2;
  position: static;
  inset: auto;
  transform: none;
  justify-self: center;
  align-self: center;
  flex-direction: column;
  gap: 8px;
  width: auto;
  max-width: 64px;
  opacity: 1;
  text-align: center;
}
.compass .compass-wind {
  font-size: 26px;
  color: #c4b48a;
}
.compass .wall-count {
  border: 0;
  padding: 0;
  text-align: center;
}
.compass .wall-count strong {
  font-size: 27px;
  font-weight: 600;
  color: #f0e6cb;
}
.compass .wall-count small {
  font-size: 9px;
  letter-spacing: 0.07em;
  color: #acc4b3;
  white-space: nowrap;
}
.discard-stage .latest-discard .tile.featured {
  --tile-w: calc(var(--discard-w) * 1.35);
  --tile-h: calc(var(--discard-h) * 1.35);
  box-shadow:
    0 3px 0 #9ca88d,
    0 0 0 2px #efd79b,
    0 5px 7px #09281d66;
}
.discard-left .latest-discard button,
.discard-right .latest-discard button {
  width: calc(var(--discard-h) * 1.35);
  height: calc(var(--discard-w) * 1.35);
}
.latest-discard > span {
  color: #f0d797;
  background: none;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 2px;
}
.scattered-discard .tile.small {
  box-shadow:
    0 2px 0 #a3ad91,
    0 3px 3px #082b2066;
}
@media (min-width: 1400px) {
  .board {
    --river-height: 45px;
  }
}
@media (min-width: 801px) and (max-width: 950px) {
  .board {
    --river-height: 35px;
    --centre-gap: 56px;
    --stage-col-gap: 8px;
  }
}
@media (max-width: 800px) {
  .board {
    --river-height: 32px;
    --centre-gap: 48px;
    --stage-col-gap: 8px;
  }
  .discard-stage .compass {
    gap: 5px;
    max-width: 48px;
  }
  .compass .compass-wind {
    font-size: 22px;
  }
  .compass .wall-count strong {
    font-size: 22px;
  }
  .compass .wall-count small {
    font-size: 8px;
    letter-spacing: 0;
  }
}

/* Warm ivory and enamel ink sit against quieter felt and walnut rails. */
:root {
  background: #0b211b;
  color: #ede8d9;
  --gold: #e1c994;
  --muted: #a8beae;
  --paper: #fffcf2;
}
body {
  background: radial-gradient(ellipse at 50% 0, #17392d 0, #0b211b 75%);
}
.app-shell {
  max-width: 1680px;
}
.topbar {
  border-bottom-color: #d4c39a20;
}
.brand small {
  letter-spacing: 0.15em;
  color: #a8beae;
}
.brand-mark {
  color: #efd9a5;
  background: #173e304d;
  border-color: #cfb77f4d;
  border-radius: 7px;
}
.nav button {
  border-color: #c8d2be28;
}
.nav .new-table {
  background: #e1c994;
  color: #18382a;
}
.board {
  border-color: #3c3228;
  border-radius: 23px;
  background: radial-gradient(ellipse at 50% 42%, #255c47 0, #1b503e 62%, #154433 100%);
  box-shadow:
    0 0 0 1px #806d494f,
    0 16px 40px #00140e66,
    inset 0 0 0 1px #c1b18330,
    inset 0 0 45px #072e2040;
}
.board:before {
  border-color: #dec99417;
  border-radius: 11px;
}
.round-pill {
  padding: 6px 9px;
  border: 1px solid #cbb67c2b;
  background: #102f25;
  border-radius: 6px;
  font-size: 13px;
}
.round-pill strong {
  color: #efdab0;
  font-weight: 600;
}
.table-toolbar {
  color: #a7bfad;
}
.table-actions .icon-btn {
  border: 1px solid #b6c6ad20;
  color: #bed0bf;
  padding: 5px 8px;
  min-height: 31px;
}
.table-actions .icon-btn:hover {
  background: #214a37;
}
.seat.active .rack-line {
  background: #edcd8712;
  box-shadow: 0 0 0 1px #ebd29766;
}
.player-name strong {
  font-weight: 600;
}
.player-name small {
  color: #aec3b2;
}
.seat .rack-line .backs .back {
  background: linear-gradient(145deg, #3b8465, #29684f);
  border-color: #97ba9270;
  border-bottom-color: #e8dfc4;
  box-shadow:
    0 2px 0 #84967b,
    0 3px 3px #07261b55;
}
.rack-front .tai-badge {
  background: #123d2e;
  border-color: #a8bb9552;
  color: #d4dfc9;
}
.tai-badge.has-tai {
  border-color: #dcc38a88;
}
.tai-badge.has-tai .tai-count b {
  color: #f5d89a;
}
.tai-badge.at-cap {
  background: #625229;
  border-color: #e4c580;
}
.table-turn-bar {
  background: linear-gradient(180deg, #153f31, #11392c);
  border-top-color: #d8c28d3b;
}
.table-turn-bar .turn-status strong {
  color: #f0e1bf;
  font-weight: 600;
}
.table-turn-bar .turn-status p {
  color: #afc6b2;
}
.table-turn-bar .primary {
  background: #e8d1a0;
  color: #183b2a;
  font-weight: 700;
}
.table-turn-bar .primary:hover {
  background: #f4dfb5;
}
.table-turn-bar .primary.win {
  background: #f1cd76;
  color: #382b13;
}
.table-turn-bar .call-button {
  background: #286047;
  border-color: #aec6a557;
}
.table-turn-bar .ghost {
  border-color: #b9c9ae38;
}
.panel {
  background: #102d23;
  border-color: #c7c6a521;
  border-radius: 10px;
  padding: 18px;
}
.panel-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #cabb97;
  font-weight: 600;
}
.panel-note {
  color: #9ab59e;
  border-top-color: #c7d0b718;
}
.score-row {
  padding: 7px 0;
  margin: 4px 0;
  gap: 12px;
}
.score-row + .score-row {
  border-top: 1px solid #bdd0b511;
}
.score-num {
  font-weight: 600;
}
.small-wind {
  color: #dbc69a;
}
.wall-panel {
  order: -1;
}
.wall-middle strong {
  font-weight: 600;
}
.wall-piece.empty {
  background: #0d2a21;
  border-color: #56725c2c;
}
.activity {
  max-height: 185px;
  gap: 11px;
}
.activity-entry {
  color: #a6bfa9;
}
.activity-entry:first-child {
  color: #eee0ba;
  border-color: #d2b979;
}
.sidebar .activity-panel {
  display: block;
}
.hand-controls > span {
  color: #a5bda7;
}
.hand-controls .ghost {
  border-color: #bec6ab30;
}
.footer {
  color: #8aa78d;
}
@media (min-width: 1440px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 20px;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .sidebar .panel {
    margin: 0;
  }
}
@media (max-width: 640px) {
  .round-pill {
    padding: 4px 6px;
    font-size: 11px;
    gap: 5px;
  }
  .table-actions {
    gap: 4px;
  }
  .table-actions .icon-btn {
    font-size: 11px;
    padding: 4px 5px;
  }
  .panel {
    padding: 14px;
  }
  .panel-title {
    margin-bottom: 13px;
  }
  .activity-panel {
    grid-column: 1/-1;
  }
  .activity {
    max-height: 120px;
  }
}

/* A win reveals the winning seat immediately and remains on the felt. */
.winning-concealed {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  min-height: 0;
  padding: 0;
  background: none;
  border-radius: 4px;
  line-height: 0;
}
.winning-tile {
  display: inline-flex;
  position: relative;
  margin-left: 7px;
}
.winning-tile .tile {
  box-shadow:
    0 3px 0 #aaa887,
    0 0 0 2px #f2d28a;
}
.seat.winner .rack-line {
  background: #ead29120;
  box-shadow: 0 0 0 1px #eed09599;
}
.seat.winner .avatar {
  background: #e8cf96;
  color: #213c2a;
  border-color: #f4dfa9;
}
.seat.winner .player-name strong,
.seat.winner .player-name small {
  color: #ffe4a6;
}
.win-label {
  color: #f4d58f;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.bonus-piece.winner-bonus .tile {
  box-shadow:
    0 2px 0 #8a967e,
    0 0 0 2px #efcf83;
}
.winning-concealed:hover {
  outline: 1px solid #efce8580;
  outline-offset: 5px;
}
@media (max-width: 800px) {
  .winning-concealed {
    gap: 2px;
  }
  .winning-tile {
    margin-left: 5px;
  }
  .seat-top.winner .winning-concealed {
    flex-wrap: wrap;
    max-width: 100%;
    justify-content: center;
  }
  .win-label {
    font-size: 11px;
  }
}

/* Advice sits beside the hand controls, leaving the whole table available. */
.hand-controls {
  flex-wrap: wrap;
}
.hand-controls .coach-toggle {
  font-size: 14px;
}
.coach-toggle[aria-pressed='true'] {
  border-color: #e1c994;
  background: #284534;
  color: #f6dfa9;
}
.coach-panel {
  margin-top: 16px;
  padding: 20px;
  background: #102e24;
  border: 1px solid #cbb9884d;
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.5;
  min-width: 0;
}
.coach-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.coach-heading h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}
.coach-heading button {
  font-size: 14px;
  padding: 7px 11px;
}
.coach-panel h3 {
  font-size: 15px;
  margin: 12px 0;
  color: #d5c5a0;
}
.coach-panel p {
  margin: 10px 0;
}
.coach-pick {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.coach-pick > span {
  font-size: 14px;
  color: #b7c8b6;
}
.coach-pick strong {
  color: #f2daa5;
}
.coach-verdict {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  border-left: 3px solid #d4b272;
  background: #d8bf8010;
  border-radius: 0 7px 7px 0;
}
.coach-verdict strong {
  color: #f3d591;
}
.coach-verdict.match {
  border-color: #9bc59d;
  background: #b7dcb00a;
}
.coach-verdict.match strong {
  color: #c8e6ba;
}
.coach-verdict.close {
  border-color: #b9c9ca;
}
.coach-verdict.close strong {
  color: #d8e5e1;
}
.coach-verdict span,
.coach-reason {
  color: #cad7c8;
  font-size: 15px;
}
.coach-comparison {
  overflow-x: auto;
  margin: 14px 0;
  max-width: 100%;
}
.coach-comparison table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.coach-comparison caption {
  text-align: left;
  padding: 0 0 8px;
  color: #a9c0ac;
  font-size: 13px;
}
.coach-comparison th,
.coach-comparison td {
  padding: 10px 9px;
  border-bottom: 1px solid #a7bea320;
  white-space: normal;
}
.coach-comparison thead th {
  font-weight: 500;
  color: #b7c8b6;
  line-height: 1.3;
}
.coach-comparison tbody th {
  font-weight: 500;
  color: #f1ebd9;
}
.coach-chosen {
  background: #eed38c0b;
}
.coach-chosen th {
  box-shadow: inset 3px 0 #e1c994;
}
.coach-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 128px;
}
.coach-tile .tile.small {
  --tile-w: 31px;
  --tile-h: 43px;
  flex-shrink: 0;
}
.coach-tile small {
  display: block;
  font-size: 12px;
  color: #d8bd81;
  font-weight: 600;
  margin-top: 2px;
}
.coach-comparison td {
  font-variant-numeric: tabular-nums;
}
.coach-panel .coach-note,
.coach-note {
  font-size: 13px;
  line-height: 1.6;
  color: #a9bfad;
  margin-top: 16px;
}
.coach-review {
  border-top: 1px solid #c1c9ab24;
  padding-top: 8px;
  margin-top: 18px;
}
.coach-review:first-of-type {
  border: 0;
}
.coach-review summary {
  font-size: 15px;
  color: #dcccaa;
  padding: 5px 0;
  cursor: pointer;
}
.coach-options {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}
.coach-options button {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 5px;
  padding: 16px;
  border: 1px solid #aec1a945;
  border-radius: 8px;
  background: #163a2c;
}
.coach-options strong {
  font-size: 16px;
}
.coach-options span {
  color: #b5c7b7;
  font-size: 14px;
  line-height: 1.5;
}
.coach-options button[aria-pressed='true'] {
  border-color: #e1c994;
  background: #314932;
}
.coach-options button[aria-pressed='true'] strong {
  color: #f6dca0;
}

/* The result remains in view while the winning hand stays on the felt. */
.win-announcement {
  position: sticky;
  top: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 16px;
  padding: 20px 22px;
  border: 1px solid #f0d9a2;
  border-radius: 13px;
  background: linear-gradient(115deg, #e7cc90, #f5e6bc);
  color: #183626;
  box-shadow: 0 9px 30px #001b2055;
  animation: win-arrive 0.3s ease-out;
}
.win-seal {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 58px;
  height: 66px;
  border: 1px solid #6d593c66;
  border-radius: 8px;
  background: #fff9e7;
  font-size: 42px;
  color: #9f3035;
  box-shadow: 0 3px 0 #b8a57d;
}
.win-announcement-copy {
  flex: 1;
  min-width: 0;
}
.win-announcement-copy > span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  color: #566344;
}
.win-announcement h2 {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  margin: 5px 0;
  overflow-wrap: anywhere;
}
.win-announcement p {
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}
.win-announcement-tai {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 1px;
}
.win-announcement-tai strong {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
}
.win-announcement-tai span {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.win-announcement-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.win-announcement button {
  font-size: 14px;
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}
.win-announcement .primary {
  background: #193e2b;
  color: #fff1c8;
}
.win-announcement .ghost {
  background: none;
  border-color: #5f67464d;
  color: #274531;
}
.seat.winner .rack-line {
  box-shadow: 0 0 0 2px #f0d18a;
  background: #ead2912c;
}
.winning-tile .tile {
  box-shadow:
    0 3px 0 #aaa887,
    0 0 0 3px #f2d28a;
}
.win-announcement .win-source {
  font-size: 15px;
  margin: 7px 0 4px;
}
.win-source strong {
  color: #8c2831;
  font-weight: 700;
}
@keyframes win-arrive {
  from {
    opacity: 0.2;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 640px) {
  .coach-panel {
    padding: 14px;
  }
  .coach-heading h2 {
    font-size: 18px;
  }
  .coach-comparison th,
  .coach-comparison td {
    padding: 9px 6px;
  }
  .coach-tile {
    gap: 6px;
    min-width: 104px;
  }
  .coach-tile .tile.small {
    --tile-w: 26px;
    --tile-h: 36px;
  }
  .coach-comparison table {
    min-width: 440px;
  }
  .hand-controls {
    gap: 7px;
  }
  .hand-controls .coach-toggle {
    flex-basis: 100%;
    max-width: 250px;
  }
  .win-announcement {
    gap: 12px;
    padding: 14px;
    flex-wrap: wrap;
    position: relative;
    top: auto;
  }
  .win-seal {
    width: 43px;
    height: 52px;
    font-size: 32px;
  }
  .win-announcement h2 {
    font-size: 23px;
  }
  .win-announcement-tai strong {
    font-size: 36px;
  }
  .win-announcement-actions {
    flex-direction: row;
    flex-basis: 100%;
    justify-content: flex-end;
  }
  .win-announcement-copy {
    flex-basis: 45%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .win-announcement {
    animation: none;
  }
}

/* Wind and dealer stay together beside the player's name. */
.seat-markers {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  vertical-align: middle;
}
.seat .avatar.seat-wind,
.you-label .wind-token.seat-wind,
.seat .avatar.dealer-marker,
.you-label .wind-token.dealer-marker,
.own-tiles > .rack-dealer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 38px;
  border: 2px solid #b5ad8c;
  border-radius: 6px;
  background: #fff5df;
  color: #214331;
  font-family: 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    0 2px 0 #aa9068,
    0 0 0 2px #ffedc91a;
}
.seat .avatar.dealer-marker,
.you-label .wind-token.dealer-marker,
.own-tiles > .rack-dealer {
  border-color: #cf5157;
  color: #b52331;
}
.own-tiles > .rack-dealer {
  display: none;
}
@media (max-width: 800px) {
  .seat .avatar.seat-wind,
  .you-label .wind-token.seat-wind,
  .seat .avatar.dealer-marker,
  .you-label .wind-token.dealer-marker {
    width: 29px;
    height: 33px;
    font-size: 23px;
  }
  .seat-markers {
    gap: 4px;
  }
}

/* A quiet recording state becomes a full-hand review after Hu or a draw. */
.hand-coach-recording {
  padding: 14px 18px;
}
.hand-coach-recording .coach-heading {
  margin-bottom: 4px;
}
.hand-coach-recording p {
  font-size: 14px;
  color: #b5c8b7;
}
.hand-coach-complete {
  border-color: #d6bd78;
}
.hand-coach-summary {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 12px 0 18px;
}
.hand-coach-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-shrink: 0;
  color: #f2d391;
  font-variant-numeric: tabular-nums;
}
.hand-coach-score strong {
  font-size: 64px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.05em;
}
.hand-coach-score > span {
  font-size: 18px;
  color: #aabbab;
}
.hand-coach-summary h3 {
  font-size: 19px;
  margin: 0 0 4px;
  color: #eee5cc;
}
.hand-coach-summary p {
  font-size: 15px;
  margin: 3px 0;
}
.hand-coach-summary .hand-coach-caption {
  font-size: 13px;
  color: #a9bfac;
  line-height: 1.5;
}
.hand-coach-counts {
  display: flex;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  font-size: 14px;
  color: #b6c9b6;
}
.hand-coach-counts b {
  font-size: 20px;
  font-weight: 600;
  color: #ecdbb1;
  margin-right: 4px;
}
.hand-coach-highlights {
  border-left: 2px solid #d0b576;
  padding-left: 14px;
  margin: 14px 0 24px;
}
.hand-coach-highlights p {
  margin: 12px 0;
  font-size: 14px;
}
.hand-coach-highlights strong,
.hand-coach-highlights span {
  display: block;
  line-height: 1.55;
}
.hand-coach-highlights span {
  color: #b0c5b1;
  margin-top: 3px;
}
.hand-coach-decision {
  border: 1px solid #b2c3a830;
  border-radius: 8px;
  margin: 10px 0;
  padding: 12px 14px;
}
.hand-coach-decision > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.5;
}
.hand-coach-decision > summary > span:before {
  content: '+';
  display: inline-block;
  width: 19px;
  color: #d8c58e;
}
.hand-coach-decision[open] > summary > span:before {
  content: '−';
}
.hand-coach-decision summary b {
  font-size: 14px;
  color: #edd297;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hand-coach-decision > p {
  margin: 12px 0;
  color: #bacdb8;
  font-size: 14px;
}
.hand-coach-tiles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin: 12px 0 18px;
}
.hand-coach-tiles .tile.small {
  --tile-w: 28px;
  --tile-h: 39px;
}
.hand-coach-tiles .meld {
  display: inline-flex;
  gap: 2px;
  margin-left: 8px;
}
.hand-coach-rubric {
  margin-top: 20px;
  border-top: 1px solid #b2c3a830;
  padding-top: 15px;
  font-size: 14px;
  line-height: 1.6;
}
.hand-coach-rubric summary {
  cursor: pointer;
  color: #e7cf9a;
}
.hand-coach-rubric p {
  margin: 12px 0;
  color: #b4c9b3;
}
.hand-coach-rubric ul {
  padding-left: 22px;
  margin: 12px 0;
  color: #c2d2be;
}
.hand-quality {
  margin: 14px 0 20px;
  padding: 14px 16px;
  border: 1px solid #b2c3a830;
  border-radius: 8px;
  background: #c6d0a808;
}
.hand-quality-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
}
.hand-quality-heading > span {
  color: #b6c9b6;
  font-size: 14px;
}
.hand-quality-heading > strong {
  color: #eddaa9;
  font-size: 18px;
  font-weight: 600;
}
.hand-quality > p {
  font-size: 14px;
  line-height: 1.6;
  color: #d0dcc8;
  margin: 10px 0 0;
}
.hand-quality > .coach-note {
  font-size: 13px;
  color: #a9bfad;
}
.hand-quality .hand-coach-tiles {
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .hand-coach-summary {
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .hand-coach-score strong {
    font-size: 52px;
  }
  .hand-coach-counts {
    gap: 10px 18px;
  }
  .hand-coach-decision {
    padding: 10px;
  }
  .hand-coach-tiles .tile.small {
    --tile-w: 24px;
    --tile-h: 34px;
  }
}

/* Lift only the concealed tiles needed by legal calls; the rack keeps its order. */
.own-tiles {
  --claim-rise: -8px;
  --claim-focus-rise: -11px;
}
.own-tiles > .tile.claimable {
  --claim-offset: var(--claim-rise);
  --claim-ring: #e5c984;
  transform: translateY(var(--claim-offset));
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 #b5b79c,
    0 4px 0 #3b775b,
    0 0 0 2px var(--claim-ring),
    1px 9px 7px #001b1650;
}
.board:has(.move-actions [data-claim-preview]:is(:hover, :focus-visible))
  .own-tiles
  > .tile.claimable {
  --claim-offset: 0px;
  --claim-ring: transparent;
}
.table-turn-bar [data-claim-preview]:is(:hover, :focus-visible) {
  border-color: #e8cf91;
  box-shadow: 0 0 0 1px #e8cf9155;
}
@media (max-width: 640px) {
  .own-tiles {
    --claim-rise: -6px;
    --claim-focus-rise: -8px;
  }
}

/* Keep game audio one tap away, including compact and 3D tables. */
button.sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  color: #f2dfac;
  background: #183d2d;
  border: 1px solid #d8be7d88;
  border-radius: 7px;
  touch-action: manipulation;
}
button.sound-toggle[data-sound-enabled='false'] {
  color: #cfddd2;
  border-color: #adc1a766;
  background: #20362d;
}
button.sound-toggle:focus-visible {
  outline: 2px solid #f2dfac;
  outline-offset: 2px;
}
.sound-toggle svg {
  flex: none;
  width: 24px;
  height: 24px;
  pointer-events: none;
}
.sound-toggle .sound-label {
  display: none;
}
.mobile-menu-grid .sound-toggle .sound-label {
  display: inline;
}
@media (max-width: 360px) {
  .topbar .mobile-header-actions > .score-button {
    display: none;
  }
}
