:root {
  color-scheme: dark;
  --ink: #fff4d8;
  --muted: #ddc99b;
  --night: #10091d;
  --plum: #2b1446;
  --teal: #0b6f78;
  --jade: #66e0b2;
  --gold: #ffd36f;
  --ember: #d85655;
  --candy-pink: #ff8fb8;
  --sky-pop: #82ddff;
  --mint-pop: #75f3ca;
  --cream-pop: #fff2b8;
  --ivory: #fffaf0;
  --shadow: rgba(4, 2, 12, .55);
  --panel: rgba(25, 14, 43, .78);
  --panel-strong: rgba(44, 22, 68, .94);
  --border: rgba(255, 213, 119, .36);
  --rim-warm: #ffba75;
  --rim-rose: #d45c8d;
  --rim-cool: #61ead0;
  --glass-line: rgba(255, 239, 184, .16);
  --edge-gold: rgba(255, 222, 142, .72);
  --edge-gold-soft: rgba(255, 222, 142, .28);
  --edge-jade: rgba(117, 243, 202, .48);
  --edge-ink: rgba(9, 5, 20, .72);
  --edge-inner: rgba(255, 255, 255, .11);
  --table-felt: url("/assets/table-felt.svg");
  --tile-back-image: url("/assets/tile-back.svg");
  --table-border: rgba(255, 226, 163, .38);
  --table-glow: rgba(101, 224, 178, .18);
  --tile-w-base: 47px;
  --tile-h-base: 64px;
  --tile-w-own: 72px;
  --tile-h-own: 98px;
  --tile-w-small: 30px;
  --tile-h-small: 41px;
  --river-tile-w: clamp(30px, 2.55vw, 38px);
  --own-hand-clearance: 272px;
  --opponent-clearance-top: 142px;
  --discard-fly-duration: 2.1s;
  --call-smash-duration: 4.6s;
  --win-smash-duration: 6s;
  --tile-pop-duration: 1.2s;
  --tile-pop-discard-duration: 1.45s;
  --smash-shock-duration: 3.6s;
  --smash-tile-flip-duration: 3.2s;
  --smash-spark-duration: 3.4s;
  --own-hand-gap: 5px;
  --font-ui: "Microsoft JhengHei UI", "Microsoft JhengHei", "PingFang HK", "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  --font-display: "Microsoft JhengHei UI", "PingFang HK", "PingFang TC", "Noto Serif TC", "Songti TC", Georgia, serif;
  --font-number: "Segoe UI Variable", "SF Pro Rounded", "Microsoft JhengHei UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #303236;
  --muted: #62666c;
  --night: #f7eddc;
  --plum: #f2dfce;
  --teal: #247d78;
  --jade: #167f61;
  --gold: #8f6424;
  --ember: #b8443f;
  --candy-pink: #c44876;
  --sky-pop: #2a789a;
  --mint-pop: #238a68;
  --cream-pop: #fff1ae;
  --ivory: #fffaf0;
  --shadow: rgba(72, 50, 35, .24);
  --panel: rgba(255, 250, 240, .88);
  --panel-strong: rgba(255, 244, 224, .96);
  --border: rgba(126, 83, 34, .30);
  --rim-warm: #d18a34;
  --rim-rose: #c7687d;
  --rim-cool: #2ca884;
  --glass-line: rgba(75, 50, 28, .12);
  --edge-gold: rgba(151, 100, 35, .58);
  --edge-gold-soft: rgba(151, 100, 35, .24);
  --edge-jade: rgba(31, 135, 95, .34);
  --edge-ink: rgba(104, 73, 41, .28);
  --edge-inner: rgba(255, 255, 255, .72);
  --table-felt: url("/assets/table-felt-green.svg");
  --table-border: rgba(84, 115, 50, .50);
  --table-glow: rgba(32, 118, 69, .22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-rendering: geometricPrecision;
  background:
    linear-gradient(115deg, rgba(15, 8, 30, .98), rgba(7, 55, 65, .93) 58%, rgba(44, 19, 67, .96)),
    repeating-linear-gradient(135deg, rgba(255, 211, 111, .055) 0 1px, transparent 1px 22px),
    url("/assets/table-felt.svg");
  background-size: cover;
}

:root[data-theme="light"] body {
  background:
    linear-gradient(115deg, rgba(255, 248, 235, .96), rgba(217, 244, 231, .9) 58%, rgba(250, 225, 207, .92)),
    repeating-linear-gradient(135deg, rgba(126, 83, 34, .05) 0 1px, transparent 1px 22px),
    url("/assets/table-felt.svg");
  background-size: cover;
}

:root[data-table-skin="luxury"] body,
:root[data-theme="light"][data-table-skin="luxury"] body {
  background:
    linear-gradient(180deg, rgba(9, 6, 15, .34), rgba(9, 6, 15, .72)),
    url("/assets/gui/mahjong-parlor-backdrop.png") center/cover fixed no-repeat;
}

button,
input,
select {
  font: inherit;
  font-family: var(--font-ui);
}

button {
  min-height: 32px;
  border: 1px solid rgba(255, 239, 198, .34);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .10), transparent 46%, rgba(0, 0, 0, .18)) padding-box,
    linear-gradient(180deg, rgba(94, 49, 132, .96), rgba(34, 18, 58, .98)),
    linear-gradient(90deg, rgba(255, 211, 111, .10), rgba(97, 234, 208, .10));
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -2px rgba(0, 0, 0, .26), 0 0 0 1px rgba(0, 0, 0, .22), 0 10px 24px rgba(0, 0, 0, .22);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.08;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .22);
  transition: transform .16s cubic-bezier(.2, .82, .22, 1), border-color .16s ease, background .16s ease, box-shadow .16s ease, filter .16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(242, 200, 109, .7);
  filter: brightness(1.05) saturate(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

button.primary {
  color: #241324;
  border-color: rgba(255, 246, 191, .82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .36), transparent 42%, rgba(137, 67, 18, .16)) padding-box,
    linear-gradient(180deg, #fff1ad, #ffc95f 52%, #d98c37),
    linear-gradient(90deg, rgba(255, 255, 255, .22), transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, .68), inset 0 -2px rgba(122, 66, 18, .26), 0 0 0 1px rgba(74, 37, 12, .20), 0 12px 26px rgba(0, 0, 0, .28), 0 0 20px rgba(255, 211, 111, .16);
  font-weight: 900;
  text-shadow: 0 1px rgba(255, 255, 255, .34);
}

button.danger {
  background: linear-gradient(180deg, #ff7a6d, #9d314d 62%, #5a1835);
  border-color: rgba(255, 183, 164, .52);
}

:root[data-theme="light"] button {
  color: #303236;
  background: linear-gradient(180deg, #fffdf7, #f1ddb4);
  border-color: rgba(84, 115, 50, .42);
  box-shadow: inset 0 1px rgba(255, 255, 255, .9), 0 8px 18px rgba(82, 65, 38, .16);
}

:root[data-theme="light"] button.primary {
  color: #2f3033;
  background: linear-gradient(180deg, #fff0b5, #d99632);
  border-color: rgba(120, 78, 20, .48);
}

:root[data-theme="light"] button.danger {
  color: #fff8e7;
  background: linear-gradient(180deg, #c9514b, #80313b);
}

:root[data-theme="light"] button:disabled {
  opacity: .68;
}

.wide {
  width: 100%;
}

input,
select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--edge-gold-soft);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .10)) padding-box,
    rgba(12, 8, 26, .78);
  padding: 0 12px;
  outline: none;
  font-weight: 750;
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .18), 0 6px 14px rgba(0, 0, 0, .10);
}

:root[data-theme="light"] input,
:root[data-theme="light"] select {
  color: #303236;
  background: rgba(255, 253, 245, .96);
  border-color: rgba(96, 101, 107, .28);
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 200, 109, .18);
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  border: 1px solid var(--edge-gold-soft);
  border-radius: 8px;
  padding: 7px 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 45%, rgba(0, 0, 0, .22)) padding-box,
    linear-gradient(90deg, rgba(20, 10, 38, .94), rgba(11, 70, 78, .9) 47%, rgba(55, 22, 70, .94)),
    linear-gradient(135deg, var(--edge-gold), var(--edge-jade) 52%, rgba(255, 143, 184, .34)) border-box;
  box-shadow: 0 18px 42px var(--shadow), inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .34), 0 0 0 1px rgba(0, 0, 0, .22);
}

:root[data-theme="light"] .topbar {
  border-color: rgba(126, 83, 34, .32);
  background:
    linear-gradient(90deg, rgba(255, 248, 235, .96), rgba(218, 243, 231, .92) 48%, rgba(250, 229, 203, .95)),
    linear-gradient(180deg, rgba(255, 255, 255, .7), transparent);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 7px;
  pointer-events: none;
  background:
    linear-gradient(100deg, transparent 0 18%, rgba(255, 211, 111, .18) 30%, transparent 44% 100%),
    linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 44%);
  opacity: .85;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 5px;
  pointer-events: none;
  border: 1px solid rgba(255, 239, 184, .12);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .38)) drop-shadow(0 0 12px rgba(255, 211, 111, .22));
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.38rem;
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 950;
  color: #fff0b2;
  background: linear-gradient(180deg, #fff8c8 6%, #ffd36f 48%, #ff9f5d 88%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(61, 27, 38, .72)) drop-shadow(0 8px 15px rgba(0, 0, 0, .24));
}

.brand p,
.panel-title,
.field span,
.room-ribbon span {
  color: var(--muted);
}

.brand p {
  margin-top: 3px;
  color: color-mix(in srgb, var(--jade) 72%, var(--muted));
  font-size: .78rem;
  font-weight: 850;
  line-height: 1.18;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .26);
}

:root[data-theme="light"] h1 {
  color: #303236;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: #303236;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .82));
}

:root[data-theme="light"] .brand p {
  color: #5f646b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .82);
}

.room-ribbon {
  min-width: 94px;
  border: 1px solid var(--edge-gold);
  border-radius: 8px;
  padding: 6px 12px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent),
    rgba(12, 8, 27, .68);
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .20), 0 10px 20px rgba(0, 0, 0, .22);
}

:root[data-theme="light"] .room-ribbon {
  border-color: rgba(96, 101, 107, .26);
  background: rgba(255, 253, 245, .82);
}

:root[data-theme="light"] .room-ribbon span {
  color: #666a70;
}

:root[data-theme="light"] .room-ribbon strong {
  color: #303236;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .72);
}

.room-ribbon strong {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-family: var(--font-number);
  font-size: 1.12rem;
  letter-spacing: 0;
  font-weight: 950;
  text-shadow: 0 0 12px rgba(255, 211, 111, .34);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.theme-toggle,
.settings-toggle {
  min-width: 76px;
  flex: 0 0 auto;
  padding: 0 13px;
}

.settings-toggle {
  color: #241324;
  border-color: rgba(255, 236, 170, .72);
  background: linear-gradient(180deg, #d7ffe8, #71dca8 56%, #31a06f);
  font-weight: 900;
}

:root[data-theme="light"] .settings-toggle {
  color: #123026;
  background: linear-gradient(180deg, #e6fff0, #72c993);
}

.settings-toggle[hidden] {
  display: none;
}

.game-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 214px minmax(640px, 1fr) 226px;
  gap: 10px;
  overflow: hidden;
}

.settings-collapsed .game-layout {
  grid-template-columns: minmax(720px, 1fr) 226px;
}

.settings-collapsed .left-panel {
  display: none;
}

.settings-collapsed {
  --tile-w-own: 80px;
  --tile-h-own: 109px;
  --own-hand-clearance: 292px;
  --opponent-clearance-top: 136px;
}

.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.left-panel {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.left-panel .panel,
.left-panel .field,
.left-panel input,
.left-panel select,
.left-panel button {
  max-width: 100%;
}

.panel {
  position: relative;
  border: 1px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .075), transparent 34%, rgba(0, 0, 0, .12)) padding-box,
    linear-gradient(135deg, rgba(101, 224, 178, .08), rgba(255, 143, 184, .055)) padding-box,
    var(--panel) padding-box,
    linear-gradient(135deg, var(--edge-gold), var(--edge-jade) 42%, rgba(255, 143, 184, .30) 72%, var(--edge-gold-soft)) border-box;
  box-shadow: 0 18px 42px var(--shadow), inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .30), 0 0 0 1px rgba(0, 0, 0, .24);
  padding: 9px;
  min-height: 0;
  overflow: hidden;
  backdrop-filter: blur(10px) saturate(1.12);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 211, 111, .18), transparent 32%, rgba(97, 234, 208, .12)),
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 42%);
  opacity: .55;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 5px;
  pointer-events: none;
  border: 1px solid rgba(255, 239, 184, .10);
  background:
    linear-gradient(90deg, var(--edge-gold) 0 18px, transparent 18px calc(100% - 18px), var(--edge-gold) calc(100% - 18px)) top / 100% 1px no-repeat,
    linear-gradient(90deg, var(--edge-gold-soft) 0 14px, transparent 14px calc(100% - 14px), var(--edge-gold-soft) calc(100% - 14px)) bottom / 100% 1px no-repeat;
  opacity: .72;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16);
}

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

.panel-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lobby-panel,
.score-panel {
  flex: 0 0 auto;
}

.left-panel .panel {
  flex-shrink: 0;
}

.left-panel-section {
  flex: 0 0 auto;
}

.left-panel-section[open] {
  display: grid;
  grid-template-rows: auto auto;
}

.left-panel-section:not([open]) {
  padding-bottom: 7px;
}

.left-panel-section:not([open]) .panel-body {
  display: none;
}

.left-panel-section[open] .panel-body {
  overflow: hidden;
}

.seats-panel {
  flex: 0 0 auto;
  overflow: hidden;
}

.seat-list {
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  max-width: 100%;
  scrollbar-width: thin;
}

.audio-panel {
  flex: 0 0 auto;
}

.audio-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 7px;
}

.audio-switch {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--edge-jade) 72%, var(--edge-gold-soft));
  border-radius: 8px;
  padding: 0 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent 44%, rgba(0, 0, 0, .10)),
    rgba(255, 248, 231, .07);
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .18);
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}

.audio-switch input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  min-height: 14px;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--jade);
}

.audio-field {
  margin-bottom: 5px;
}

.audio-field:last-child {
  margin-bottom: 0;
}

input[type="range"] {
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--gold);
}

:root[data-theme="light"] .audio-switch {
  color: #303236;
  border-color: rgba(96, 101, 107, .22);
  background: rgba(255, 253, 245, .72);
}

.log-panel,
.chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-panel {
  flex: 0 0 auto;
}

.chat-panel {
  flex: 1 1 0;
  min-height: 260px;
}

.right-panel-section {
  flex: 0 0 auto;
}

.right-panel-section[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: .72 1 0;
}

.right-panel-section.chat-panel[open] {
  flex: 1.9 1 0;
  min-height: 330px;
}

.right-panel-section:not([open]) {
  padding-bottom: 7px;
}

.right-panel-section:not([open]) .panel-body {
  display: none;
}

.right-panel-section[open] .panel-body {
  overflow: hidden;
}

.left-panel-section > summary.panel-title,
.right-panel-section > summary.panel-title {
  margin: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.left-panel-section > summary.panel-title::-webkit-details-marker,
.right-panel-section > summary.panel-title::-webkit-details-marker {
  display: none;
}

.left-panel-section > summary.panel-title::after,
.right-panel-section > summary.panel-title::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: .72;
}

.left-panel-section[open] > summary.panel-title,
.right-panel-section[open] > summary.panel-title {
  margin-bottom: 8px;
}

.left-panel-section[open] > summary.panel-title::after,
.right-panel-section[open] > summary.panel-title::after {
  transform: rotate(225deg) translateY(-1px);
}

.chat-panel-body {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 8px;
  border-radius: 6px;
  padding: 3px 6px 3px 4px;
  color: color-mix(in srgb, var(--gold) 58%, var(--muted));
  background:
    linear-gradient(90deg, rgba(255, 211, 111, .16), rgba(101, 224, 178, .08), transparent 78%),
    rgba(255, 248, 231, .035);
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .16);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .28);
}

.panel-title h2 {
  color: #fff4cf;
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  background: linear-gradient(180deg, #fff7d2, #ffd36f 70%, #ffb15e);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .30));
}

.title-gem {
  width: 11px;
  height: 16px;
  background: linear-gradient(180deg, #fff2b8 0 14%, var(--jade) 42%, var(--teal));
  clip-path: polygon(50% 0, 100% 30%, 78% 100%, 22% 100%, 0 30%);
  box-shadow: 0 0 12px rgba(101, 213, 168, .42), 0 0 18px rgba(255, 211, 111, .18);
}

.field {
  display: grid;
  gap: 3px;
  margin-bottom: 6px;
}

.field span {
  color: color-mix(in srgb, var(--gold) 48%, var(--muted));
  font-size: .75rem;
  font-weight: 850;
  line-height: 1.12;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .24);
}

.auth-status {
  min-height: 28px;
  display: grid;
  align-items: center;
  margin-bottom: 6px;
  border: 1px solid color-mix(in srgb, var(--edge-jade) 70%, var(--edge-gold-soft));
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--jade);
  background: rgba(15, 111, 115, .20);
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .16);
  font-size: .8rem;
  font-weight: 900;
  line-height: 1.22;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .24);
}

.lobby-panel.signed-in .auth-only-control,
.lobby-panel.in-room .room-create-controls,
.lobby-panel.in-room .room-join-control,
.lobby-panel:not(.signed-in) #logoutBtn {
  display: none !important;
}

.lobby-panel.signed-in #logoutBtn {
  margin-bottom: 6px;
}

.auth-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(74px, 86px);
  gap: 6px;
  margin-bottom: 6px;
}

.seat-list,
.score-list,
.game-log {
  display: grid;
  gap: 5px;
}

.seat-row,
.score-row,
.log-entry {
  border: 1px solid var(--edge-gold-soft);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .065), transparent),
    rgba(12, 8, 26, .54);
  padding: 6px;
  box-shadow: inset 0 1px var(--edge-inner), inset 0 -1px rgba(0, 0, 0, .16);
}

:root[data-theme="light"] .panel-title h2 {
  color: #303236;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: #303236;
  filter: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .92);
}

:root[data-theme="light"] .field span,
:root[data-theme="light"] .panel-title {
  color: #565b61;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .86);
}

:root[data-theme="light"] .panel-title {
  border: 1px solid rgba(96, 101, 107, .22);
  background:
    linear-gradient(90deg, rgba(143, 100, 36, .16), rgba(48, 50, 54, .06), transparent 82%),
    rgba(255, 250, 240, .92);
  box-shadow: inset 0 1px rgba(255, 255, 255, .9), inset 0 -1px rgba(96, 101, 107, .10), 0 1px 0 rgba(96, 101, 107, .08);
}

:root[data-theme="light"] .left-panel-section > summary.panel-title::after,
:root[data-theme="light"] .right-panel-section > summary.panel-title::after {
  opacity: .95;
}

:root[data-theme="light"] .seat-row,
:root[data-theme="light"] .score-row,
:root[data-theme="light"] .log-entry {
  color: #303236;
  border-color: rgba(96, 101, 107, .22);
  background: rgba(255, 253, 243, .84);
}

.seat-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.seat-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 6px;
  overflow: hidden;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seat-name {
  grid-column: 1;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff5d5;
  font-weight: 900;
  font-size: .9rem;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .28);
}

.money-chip {
  flex: 0 0 auto;
  min-width: 58px;
  max-width: 100%;
  border: 1px solid rgba(255, 236, 170, .42);
  border-radius: 999px;
  padding: 2px 7px;
  color: #2a1825;
  background: linear-gradient(180deg, #fff3b0, #dca54a);
  box-shadow: inset 0 1px rgba(255, 255, 255, .58), 0 4px 10px rgba(0, 0, 0, .16);
  font-family: var(--font-number);
  font-size: .78rem;
  font-weight: 950;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.seat-head > .money-chip {
  grid-column: 1 / -1;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.money-chip.positive {
  color: #082c20;
  border-color: rgba(117, 243, 202, .62);
  background: linear-gradient(180deg, #e7fff1, #75f3ca 54%, #2da878);
}

.money-chip.negative {
  color: #fff7ef;
  border-color: rgba(255, 143, 184, .72);
  background: linear-gradient(180deg, #ff9dbb, #d85655 58%, #8b2635);
}

:root[data-theme="light"] .money-chip {
  color: #3c2914;
  border-color: rgba(126, 83, 34, .34);
  background: linear-gradient(180deg, #fff5c2, #e1b660);
  box-shadow: inset 0 1px rgba(255, 255, 255, .74), 0 4px 10px rgba(82, 65, 38, .12);
}

:root[data-theme="light"] .money-chip.positive {
  color: #0b3f2d;
  border-color: rgba(36, 125, 120, .35);
  background: linear-gradient(180deg, #eaffef, #93e2b4);
}

:root[data-theme="light"] .money-chip.negative {
  color: #6b1428;
  border-color: rgba(184, 68, 63, .36);
  background: linear-gradient(180deg, #ffe0e8, #f0a0ac);
}

.seat-badge {
  grid-column: 2;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 64px;
  border-radius: 999px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 3px 8px;
  color: #241324;
  background: linear-gradient(180deg, #fff1ad, var(--gold) 54%, #c48a35);
  font-size: .76rem;
  line-height: 1;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px rgba(255, 255, 255, .28);
  box-shadow: inset 0 1px rgba(255, 255, 255, .42), 0 6px 12px rgba(0, 0, 0, .22);
}

:root[data-theme="light"] .seat-name {
  color: #303236;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .76);
}

.seat-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.seat-controls button,
.seat-controls select {
  width: 100%;
  min-width: 0;
  padding-inline: 6px;
}

.seat-controls select {
  grid-column: 1 / -1;
}

.table-stage {
  min-width: 0;
  position: relative;
  display: grid;
  isolation: isolate;
}

.table-stage::before {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: -1;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--edge-gold), transparent 28%, var(--edge-jade) 68%, rgba(255, 143, 184, .26)),
    rgba(10, 6, 22, .52);
  box-shadow: 0 26px 64px rgba(0, 0, 0, .48), inset 0 0 0 1px rgba(255, 255, 255, .10);
}

.table-stage::after {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 1;
  border-radius: 8px;
  pointer-events: none;
  border: 1px solid rgba(255, 236, 170, .16);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
}

.table-aura {
  position: absolute;
  inset: 12px;
  border: 1px solid var(--edge-gold-soft);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 0 72px var(--table-glow), inset 0 0 0 6px rgba(255, 255, 255, .026), inset 0 0 0 1px rgba(0, 0, 0, .22), 0 18px 44px rgba(0, 0, 0, .26);
  z-index: 1;
}

.mahjong-table {
  height: 100%;
  min-height: 0;
  position: relative;
  border: 2px solid color-mix(in srgb, var(--table-border) 78%, var(--edge-gold));
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, rgba(120, 255, 213, .18), transparent 44%),
    linear-gradient(135deg, rgba(255, 143, 184, .16), transparent 28%, rgba(115, 240, 194, .13) 64%, rgba(130, 216, 255, .16)),
    var(--table-felt) center/cover;
  box-shadow: 0 24px 54px rgba(0, 0, 0, .42), inset 0 0 0 1px rgba(255, 255, 255, .10), inset 0 0 0 4px rgba(0, 0, 0, .10), inset 0 0 72px rgba(8, 4, 20, .28);
  isolation: isolate;
}

:root[data-table-skin="luxury"] .mahjong-table {
  border-color: rgba(255, 218, 129, .58);
  background:
    linear-gradient(180deg, rgba(255, 244, 205, .08), rgba(0, 0, 0, .10)),
    url("/assets/gui/mahjong-table-skin.png") center/100% 100% no-repeat;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .54), inset 0 0 0 1px rgba(255, 241, 188, .18);
}

.mahjong-table::before,
.mahjong-table::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 8px;
}

.mahjong-table::before {
  inset: 20px;
  z-index: 0;
  border: 1px solid rgba(255, 226, 163, .22);
  background:
    linear-gradient(135deg, rgba(255, 226, 163, .14), transparent 16% 84%, rgba(117, 243, 202, .10)),
    linear-gradient(90deg, transparent, rgba(255, 211, 111, .055), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 46%, rgba(0, 0, 0, .12));
}

.mahjong-table::after {
  inset: 0;
  z-index: 0;
  box-shadow: inset 0 0 0 7px rgba(255, 255, 255, .026), inset 0 0 0 10px rgba(0, 0, 0, .10), inset 0 0 34px rgba(255, 211, 111, .12);
}

:root[data-table-skin="luxury"] .mahjong-table::before {
  display: none;
}

:root[data-table-skin="luxury"] .mahjong-table::after {
  box-shadow: inset 0 0 0 8px rgba(255, 226, 163, .10), inset 0 0 52px rgba(0, 0, 0, .22);
}

.seat-zone {
  position: absolute;
  min-width: 0;
  z-index: 2;
  container-type: inline-size;
}

.seat-zone::before {
  content: "";
  position: absolute;
  display: none;
  z-index: 0;
  border: 0;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at var(--turn-light-origin, 50% 50%),
      rgba(255, 255, 236, .50) 0%,
      rgba(255, 244, 178, .28) 34%,
      rgba(255, 218, 104, .13) 58%,
      transparent 78%),
    linear-gradient(var(--turn-light-angle, 0deg),
      rgba(255, 255, 240, .44) 0%,
      rgba(255, 238, 148, .22) 42%,
      rgba(255, 213, 102, .08) 66%,
      transparent 94%);
  clip-path: var(--turn-light-shape, polygon(0 0, 100% 0, 100% 100%, 0 100%));
  box-shadow: 0 0 30px rgba(255, 238, 148, .12);
  mix-blend-mode: screen;
  filter: blur(6px) saturate(1.08);
  pointer-events: none;
  opacity: 0;
  transform: scale(.98);
  transition: opacity .26s ease, transform .26s ease;
}

.seat-top::before {
  inset: -4px 0 -34%;
  --turn-light-origin: 50% 0%;
  --turn-light-angle: 180deg;
  --turn-light-shape: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.seat-bottom::before {
  inset: -34% 0 -6px;
  --turn-light-origin: 50% 100%;
  --turn-light-angle: 0deg;
  --turn-light-shape: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}

.seat-left::before {
  inset: 0 -38% 0 -6px;
  --turn-light-origin: 0% 50%;
  --turn-light-angle: 90deg;
  --turn-light-shape: polygon(0 20%, 100% 0, 100% 100%, 0 80%);
}

.seat-right::before {
  inset: 0 -6px 0 -38%;
  --turn-light-origin: 100% 50%;
  --turn-light-angle: 270deg;
  --turn-light-shape: polygon(100% 20%, 0 0, 0 100%, 100% 80%);
}

.seat-zone:has(.player-mat.active)::before {
  opacity: .68;
  transform: scale(1.01);
  animation: activeSeatGlow 2.7s ease-in-out infinite;
}

:root[data-theme="light"] .seat-zone:has(.player-mat.active)::before {
  opacity: .50;
  mix-blend-mode: multiply;
  background:
    radial-gradient(ellipse at var(--turn-light-origin, 50% 50%),
      rgba(255, 250, 213, .42) 0%,
      rgba(246, 203, 83, .18) 42%,
      rgba(167, 114, 27, .07) 64%,
      transparent 78%),
    linear-gradient(var(--turn-light-angle, 0deg),
      rgba(255, 252, 224, .34) 0%,
      rgba(244, 196, 73, .13) 52%,
      transparent 94%);
}

.seat-top {
  top: 8px;
  left: 16%;
  right: 16%;
}

.seat-bottom {
  bottom: 10px;
  left: 2%;
  right: 2%;
  min-height: 196px;
  z-index: 4;
}

.seat-left {
  left: 8px;
  top: var(--opponent-clearance-top);
  bottom: var(--own-hand-clearance);
  width: min(23%, 226px);
}

.seat-right {
  right: 8px;
  top: var(--opponent-clearance-top);
  bottom: var(--own-hand-clearance);
  width: min(23%, 226px);
}

.discard-field {
  position: absolute;
  inset: calc(var(--opponent-clearance-top) + 44px) calc(min(23%, 226px) + 18px) calc(var(--own-hand-clearance) + 44px);
  z-index: 3;
  pointer-events: none;
  display: grid;
  grid-template-areas:
    "top top top"
    "left . right"
    "bottom bottom bottom";
  grid-template-columns: minmax(96px, .76fr) minmax(260px, 1.28fr) minmax(96px, .76fr);
  grid-template-rows: minmax(96px, auto) minmax(118px, 1fr) minmax(96px, auto);
  gap: 8px 12px;
}

.discard-river {
  --tile-w-small: var(--river-tile-w);
  --tile-h-small: calc(var(--river-tile-w) * 1.36);
  display: grid;
  align-content: center;
  justify-content: center;
  gap: 5px;
  width: max-content;
  height: max-content;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.discard-river:not(.density-tight):not(.density-compact):not(.density-ultra):has(.tile:nth-child(n+25)) {
  --tile-w-small: clamp(25px, 2.05vw, 31px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  gap: 4px;
}

.discard-river.density-tight {
  --tile-w-small: clamp(26px, 2.1vw, 32px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  gap: 4px;
}

.discard-river.density-compact {
  --tile-w-small: clamp(22px, 1.8vw, 28px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  gap: 3px;
}

.discard-river.density-ultra {
  --tile-w-small: clamp(16px, 1.28vw, 21px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  gap: 2px;
}

.discard-river-left:not(.density-tight):not(.density-compact):not(.density-ultra):has(.tile:nth-child(n+25)),
.discard-river-right:not(.density-tight):not(.density-compact):not(.density-ultra):has(.tile:nth-child(n+25)) {
  --tile-w-small: clamp(23px, 1.9vw, 29px);
}

.discard-river-left.density-compact,
.discard-river-right.density-compact {
  --tile-w-small: clamp(20px, 1.55vw, 25px);
}

.discard-river-left.density-ultra,
.discard-river-right.density-ultra {
  --tile-w-small: clamp(15px, 1.1vw, 19px);
}

.discard-river-top,
.discard-river-bottom {
  grid-template-columns: repeat(11, var(--tile-w-small));
}

.discard-river-top.density-tight,
.discard-river-bottom.density-tight {
  grid-template-columns: repeat(12, var(--tile-w-small));
}

.discard-river-top.density-compact,
.discard-river-bottom.density-compact {
  grid-template-columns: repeat(13, var(--tile-w-small));
}

.discard-river-top.density-ultra,
.discard-river-bottom.density-ultra {
  grid-template-columns: repeat(16, var(--tile-w-small));
}

.discard-river-bottom.density-wrap {
  --bottom-river-wrap-offset: clamp(32px, 4vh, 46px);
  transform: translateY(var(--bottom-river-wrap-offset));
}

.discard-river-bottom.density-wrap:not(.density-tight):not(.density-compact):not(.density-ultra) {
  --tile-w-small: clamp(24px, 1.9vw, 30px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  grid-template-columns: repeat(13, var(--tile-w-small));
  gap: 3px;
}

.discard-river-bottom.density-wrap.density-tight {
  --tile-w-small: clamp(22px, 1.72vw, 28px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  grid-template-columns: repeat(14, var(--tile-w-small));
  gap: 3px;
}

.discard-river-bottom.density-wrap.density-compact {
  --tile-w-small: clamp(19px, 1.45vw, 24px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  grid-template-columns: repeat(16, var(--tile-w-small));
  gap: 3px;
}

.discard-river-bottom.density-wrap.density-ultra {
  --tile-w-small: clamp(16px, 1.15vw, 20px);
  --tile-h-small: calc(var(--tile-w-small) * 1.36);
  grid-template-columns: repeat(18, var(--tile-w-small));
  gap: 2px;
}

.discard-river-left,
.discard-river-right {
  grid-template-columns: repeat(5, var(--tile-w-small));
}

.discard-river-left.density-tight,
.discard-river-right.density-tight {
  grid-template-columns: repeat(6, var(--tile-w-small));
}

.discard-river-left.density-compact,
.discard-river-right.density-compact,
.discard-river-left.density-ultra,
.discard-river-right.density-ultra {
  grid-template-columns: repeat(7, var(--tile-w-small));
}

.discard-river-top {
  grid-area: top;
  align-self: start;
  justify-self: center;
  transform: translateY(8px);
}

.discard-river-right {
  grid-area: right;
  align-self: center;
  justify-self: end;
  transform: translate(0, -32px);
}

.discard-river-bottom {
  grid-area: bottom;
  align-self: end;
  justify-self: center;
  transform: translateY(10px);
}

.discard-river-left {
  grid-area: left;
  align-self: center;
  justify-self: start;
  transform: translate(0, -32px);
}

.discard-river .tile.small {
  width: var(--tile-w-small);
  height: auto;
  aspect-ratio: 44 / 60;
  position: relative;
  z-index: 1;
  filter: saturate(1.04);
  box-shadow: inset -1px -2px 0 rgba(119, 88, 47, .13), inset 1px 1px 0 rgba(255, 255, 255, .78), 0 8px 13px rgba(0, 0, 0, .28);
}

.discard-pending-slot {
  visibility: hidden;
  pointer-events: none;
}

.player-mat {
  --turn-spotlight-active: 0;
  position: relative;
  height: 100%;
  z-index: 1;
  isolation: isolate;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  padding: 4px;
  overflow: visible;
}

.player-mat::before,
.player-mat::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  transition: opacity .22s ease, transform .22s ease;
}

.player-mat::before {
  border-radius: 18px;
  background:
    radial-gradient(ellipse at center,
      rgba(255, 252, 214, .42) 0%,
      rgba(255, 221, 110, .20) 46%,
      rgba(117, 243, 202, .10) 68%,
      transparent 76%);
  filter: blur(8px) saturate(1.08);
  transform: scale(.96);
}

.player-mat::after {
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(255, 247, 189, .30) 18%,
      rgba(255, 214, 84, .88) 50%,
      rgba(117, 243, 202, .42) 74%,
      transparent 100%);
  box-shadow:
    0 0 14px rgba(255, 214, 84, .34),
    0 0 28px rgba(117, 243, 202, .16);
  transform: translate3d(0, 0, 0);
}

.player-mat > * {
  position: relative;
  z-index: 1;
}

.seat-bottom .player-mat::before {
  left: 3%;
  right: 3%;
  bottom: 18px;
  height: 72px;
}

.seat-top .player-mat::before {
  left: 8%;
  right: 8%;
  top: 14px;
  height: 60px;
}

.seat-left .player-mat::before {
  top: 7%;
  bottom: 7%;
  left: 0;
  width: 62px;
}

.seat-right .player-mat::before {
  top: 7%;
  right: 0;
  bottom: 7%;
  width: 62px;
}

.seat-top .player-mat::after,
.seat-bottom .player-mat::after {
  left: clamp(24px, 8%, 72px);
  right: clamp(24px, 8%, 72px);
  height: 5px;
  background-size: 220% 100%;
}

.seat-top .player-mat::after {
  top: -1px;
}

.seat-bottom .player-mat::after {
  bottom: -1px;
}

.seat-left .player-mat::after,
.seat-right .player-mat::after {
  top: clamp(22px, 8%, 60px);
  bottom: clamp(22px, 8%, 60px);
  width: 5px;
  background:
    linear-gradient(180deg,
      transparent 0%,
      rgba(255, 247, 189, .30) 18%,
      rgba(255, 214, 84, .88) 50%,
      rgba(117, 243, 202, .42) 74%,
      transparent 100%);
  background-size: 100% 220%;
}

.seat-left .player-mat::after {
  left: -1px;
}

.seat-right .player-mat::after {
  right: -1px;
}

:root[data-theme="light"] .player-mat::before {
  background:
    radial-gradient(ellipse at center,
      rgba(255, 250, 213, .50) 0%,
      rgba(246, 203, 83, .22) 46%,
      rgba(67, 147, 128, .08) 68%,
      transparent 76%);
  filter: blur(8px) saturate(1.02);
}

:root[data-theme="light"] .player-mat::after {
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(255, 250, 213, .58) 16%,
      rgba(190, 96, 16, .96) 48%,
      rgba(29, 129, 100, .52) 74%,
      transparent 100%);
  background-size: 220% 100%;
  box-shadow:
    0 0 14px rgba(190, 96, 16, .32),
    0 0 24px rgba(29, 129, 100, .16);
}

:root[data-theme="light"] .seat-left .player-mat::after,
:root[data-theme="light"] .seat-right .player-mat::after {
  background:
    linear-gradient(180deg,
      transparent 0%,
      rgba(255, 250, 213, .58) 16%,
      rgba(190, 96, 16, .96) 48%,
      rgba(29, 129, 100, .52) 74%,
      transparent 100%);
  background-size: 100% 220%;
}

.seat-top .player-mat,
.seat-bottom .player-mat {
  display: flex;
  flex-direction: column;
}

.seat-left .player-mat,
.seat-right .player-mat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.player-mat.active {
  --turn-spotlight-active: 1;
  filter: none;
  box-shadow: none;
}

.player-mat.active::before {
  opacity: .78;
  transform: scale(1);
  animation: activeLocalGlow 2.6s ease-in-out infinite;
}

.player-mat.active::after {
  opacity: 1;
  animation: activeRailSweep 2.1s linear infinite;
}

:root[data-theme="light"] .player-mat.active::after {
  opacity: 1;
  filter: saturate(1.16) brightness(1.02);
}

.seat-left .player-mat.active::after,
.seat-right .player-mat.active::after {
  animation-name: activeRailSweepVertical;
}

:root[data-theme="light"] .player-mat.active {
  filter: none;
  box-shadow: none;
}

.player-line {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 211, 111, .22);
  border-radius: 999px;
  padding: 3px 5px 3px 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent),
    rgba(12, 8, 26, .56);
  box-shadow: 0 8px 16px rgba(0, 0, 0, .18), inset 0 1px rgba(255, 255, 255, .10);
}

.seat-top .player-line,
.seat-bottom .player-line {
  margin-inline: auto;
}

.seat-left .player-line {
  margin-right: auto;
}

.seat-right .player-line {
  margin-left: auto;
}

.seat-bottom .player-line,
.seat-bottom .player-mat.active .player-line {
  order: 5;
  align-self: flex-start;
  position: static;
  left: auto;
  bottom: auto;
  z-index: 5;
  max-width: clamp(156px, 22cqw, 250px);
  margin: 3px 0 0 clamp(4px, 1.4cqw, 16px);
}

.player-mat.active .player-line {
  border-color: rgba(255, 218, 104, .72);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 236, .34), transparent 28%),
    linear-gradient(180deg, rgba(255, 226, 126, .34), rgba(106, 62, 20, .54)),
    linear-gradient(90deg, rgba(117, 243, 202, .16), transparent 56%),
    rgba(54, 33, 16, .82);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .18),
    0 0 0 2px rgba(255, 218, 104, .14),
    0 10px 22px rgba(0, 0, 0, .24),
    0 0 26px rgba(255, 218, 104, .26),
    0 0 22px rgba(117, 243, 202, .14);
  animation: activeNameGlow 2.6s ease-in-out infinite;
}

:root[data-theme="light"] .player-line {
  border-color: rgba(96, 101, 107, .20);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .84), rgba(246, 231, 203, .68)),
    rgba(255, 250, 240, .78);
  box-shadow: 0 8px 16px rgba(82, 65, 38, .12), inset 0 1px rgba(255, 255, 255, .92);
}

:root[data-theme="light"] .player-mat.active .player-line {
  border-color: rgba(166, 102, 20, .42);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, .86), transparent 28%),
    linear-gradient(180deg, rgba(255, 244, 189, .98), rgba(236, 190, 89, .90)),
    rgba(255, 248, 220, .94);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .82),
    0 0 0 2px rgba(166, 102, 20, .11),
    0 10px 20px rgba(82, 65, 38, .12),
    0 0 22px rgba(176, 118, 28, .18);
}

.player-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff6d6;
  font-family: var(--font-display);
  font-weight: 950;
  font-size: 1rem;
  line-height: 1.18;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .30), 0 0 14px rgba(255, 211, 111, .14);
}

:root[data-theme="light"] .player-title {
  color: #303236;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .84);
}

.player-mat.active .player-title {
  color: #fffbe8;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, .34),
    0 0 12px rgba(255, 218, 104, .34),
    0 0 22px rgba(117, 243, 202, .14);
}

:root[data-theme="light"] .player-mat.active .player-title {
  color: #2a281f;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .92),
    0 0 12px rgba(176, 118, 28, .16);
}

.wind-chip {
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  min-width: 36px;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  padding: 4px 10px;
  color: #241324;
  background:
    linear-gradient(180deg, #fff4bb, #ffd36f 54%, #ba7d2f),
    linear-gradient(90deg, rgba(255, 255, 255, .28), transparent);
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1;
  font-weight: 950;
  text-shadow: 0 1px rgba(255, 255, 255, .34);
  box-shadow: inset 0 1px rgba(255, 255, 255, .54), inset 0 -2px rgba(92, 51, 16, .18), 0 7px 13px rgba(0, 0, 0, .24);
}

.player-mat.active .wind-chip {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .66),
    inset 0 -2px rgba(92, 51, 16, .18),
    0 7px 13px rgba(0, 0, 0, .24),
    0 0 18px rgba(255, 218, 104, .36);
}

.player-mat.active .wind-chip::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #75f3ca;
  box-shadow: 0 0 0 2px rgba(18, 40, 34, .22), 0 0 12px rgba(117, 243, 202, .72);
  animation: activeTurnDotPulse 1.45s ease-in-out infinite;
}

.hand-row,
.meld-row,
.flower-row,
.discard-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  overflow: hidden;
  scrollbar-width: thin;
}

.player-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0 0 7px;
  overflow: visible;
  scrollbar-width: thin;
}

.seat-bottom .player-status-row {
  width: min(100%, calc(100% - clamp(128px, 24cqw, 300px)));
  align-self: center;
  justify-content: center;
  margin-bottom: 4px;
}

.seat-bottom .player-status-row .flower-row,
.seat-bottom .player-status-row .meld-row {
  justify-content: center;
  flex-wrap: wrap;
  overflow: visible;
}

.own-hand-layout {
  --drawn-tile-gap: clamp(12px, 1.45cqw, 24px);
  --own-fit-tile-w: clamp(30px, calc((100cqw - 132px - var(--drawn-tile-gap)) / 14), var(--tile-w-own));
  --own-hand-gap: clamp(3px, .45cqw, 6px);
  display: grid;
  grid-template-columns: max-content max-content;
  grid-template-areas:
    "actions actions"
    "main drawn"
    "melds melds";
  align-items: flex-end;
  justify-content: center;
  gap: 6px var(--drawn-tile-gap);
  min-width: 0;
}

.own-hand-layout:has(.drawn-tile-pocket:empty) {
  grid-template-columns: max-content;
  grid-template-areas:
    "actions"
    "main"
    "melds";
}

.own-main-hand {
  grid-area: main;
  min-width: 0;
  max-width: none;
  justify-content: flex-start;
  padding: 4px 2px 7px;
  gap: var(--own-hand-gap);
  overflow: visible;
}

.drawn-tile-pocket {
  grid-area: drawn;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  min-width: var(--own-fit-tile-w);
  padding: 4px 0 7px;
}

.drawn-tile-pocket:not(:empty)::before {
  content: "";
  position: absolute;
  left: calc(var(--drawn-tile-gap) * -.5);
  bottom: 15px;
  width: 2px;
  height: min(58px, 72%);
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(255, 211, 111, .62), rgba(117, 243, 202, .48), transparent);
  box-shadow: 0 0 14px rgba(255, 211, 111, .34);
  pointer-events: none;
}

.drawn-tile-pocket .tile:not(.selected) {
  transform: translateY(-5px);
  border-color: rgba(255, 230, 111, .92);
  box-shadow: inset -2px -4px 0 rgba(93, 78, 54, .10), inset 2px 2px 0 rgba(255, 255, 255, .90), 0 0 0 2px rgba(255, 211, 111, .28), 0 16px 24px rgba(0, 0, 0, .36), 0 0 22px rgba(117, 243, 202, .20);
  animation: drawnTileGlow 2.4s ease-in-out infinite;
}

:root[data-theme="light"] .drawn-tile-pocket .tile:not(.selected) {
  box-shadow: inset -2px -4px 0 rgba(93, 78, 54, .08), inset 2px 2px 0 rgba(255, 255, 255, .94), 0 0 0 2px rgba(166, 106, 32, .22), 0 13px 22px rgba(82, 65, 38, .22), 0 0 18px rgba(26, 122, 72, .16);
}

.drawn-tile-pocket:empty {
  display: none;
}

.own-action-slot {
  grid-area: actions;
  position: relative;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  min-width: 0;
  min-height: 0;
}

.own-action-slot.empty {
  display: none;
}

.own-meld-shelf {
  --own-meld-tile-w: clamp(32px, 3.2cqw, 44px);
  grid-area: melds;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  width: min(100%, calc(100% - clamp(128px, 24cqw, 300px)));
  align-self: center;
  gap: 5px;
  min-height: 0;
  padding: 0 2px 2px;
  overflow: visible;
}

.own-meld-shelf.density-tight {
  --own-meld-tile-w: clamp(28px, 2.9cqw, 38px);
  gap: 4px;
}

.own-meld-shelf.density-compact {
  --own-meld-tile-w: clamp(25px, 2.55cqw, 34px);
  gap: 3px;
}

.own-meld-shelf.density-ultra {
  --own-meld-tile-w: clamp(22px, 2.25cqw, 30px);
  gap: 2px;
}

.own-meld-shelf .meld-group {
  gap: 3px;
}

.own-meld-shelf .own-flower-group {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  min-height: 0;
  overflow: visible;
}

.own-meld-shelf .tile.small {
  --tile-w: var(--own-meld-tile-w);
  height: auto;
  aspect-ratio: 44 / 60;
}

.seat-left .hand-row,
.seat-right .hand-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-content: start;
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.seat-left .hand-row:has(.tile.hidden),
.seat-right .hand-row:has(.tile.hidden) {
  --side-rack-gap: 3px;
  display: grid;
  grid-template-columns: minmax(40px, min-content);
  grid-template-rows: repeat(13, minmax(0, 1fr));
  grid-auto-flow: row;
  align-content: stretch;
  align-items: stretch;
  gap: var(--side-rack-gap);
  padding: 2px 0;
  overflow: visible;
}

.seat-left .player-status-row,
.seat-right .player-status-row {
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 6px;
  gap: 5px;
}

.seat-left .player-status-row {
  align-items: flex-start;
}

.seat-right .player-status-row {
  align-items: flex-end;
}

.seat-left .hand-row:has(.tile.hidden) {
  justify-content: start;
  justify-items: start;
}

.seat-right .hand-row:has(.tile.hidden) {
  justify-content: end;
  justify-items: end;
}

.player-status-row .meld-row,
.player-status-row .flower-row {
  --status-meld-tile-w: clamp(22px, 2.15cqw, 30px);
  flex: 0 1 auto;
  min-height: 0;
  margin-top: 0;
  flex-wrap: nowrap;
  overflow: visible;
}

.player-status-row .meld-row.density-tight,
.player-status-row .flower-row.density-tight {
  --status-meld-tile-w: clamp(20px, 1.9cqw, 27px);
}

.player-status-row .meld-row.density-compact,
.player-status-row .flower-row.density-compact {
  --status-meld-tile-w: clamp(18px, 1.7cqw, 24px);
}

.player-status-row .meld-row.density-ultra,
.player-status-row .flower-row.density-ultra {
  --status-meld-tile-w: clamp(16px, 1.45cqw, 21px);
}

.player-status-row .tile.small {
  --tile-w: var(--status-meld-tile-w);
  height: auto;
  aspect-ratio: 44 / 60;
}

.seat-left .player-status-row .meld-row,
.seat-right .player-status-row .meld-row {
  --status-meld-tile-w: clamp(22px, 10cqw, 30px);
  flex-direction: column;
  align-items: inherit;
  gap: 5px;
}

.seat-left .player-status-row .flower-row,
.seat-right .player-status-row .flower-row {
  --status-meld-tile-w: clamp(20px, 8.8cqw, 27px);
  flex-direction: row;
  align-items: center;
  gap: 3px;
}

.seat-left .player-status-row .meld-row.density-tight,
.seat-right .player-status-row .meld-row.density-tight {
  --status-meld-tile-w: clamp(21px, 9.2cqw, 28px);
}

.seat-left .player-status-row .meld-row.density-compact,
.seat-left .player-status-row .meld-row.density-ultra,
.seat-right .player-status-row .meld-row.density-compact,
.seat-right .player-status-row .meld-row.density-ultra {
  --status-meld-tile-w: clamp(19px, 8.2cqw, 25px);
}

.player-status-row .log-entry {
  display: inline-grid;
  min-height: 28px;
  align-items: center;
  white-space: nowrap;
  padding: 5px 11px;
  font-size: .9rem;
  line-height: 1.15;
  color: #dfffee;
  font-weight: 900;
  font-family: var(--font-display);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .28);
  border-color: rgba(117, 243, 202, .26);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 211, 111, .12), rgba(117, 243, 202, .18)),
    rgba(12, 8, 26, .58);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 6px 12px rgba(0, 0, 0, .16);
}

.meld-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(255, 211, 111, .24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent),
    rgba(255, 248, 231, .07);
  box-shadow: 0 8px 15px rgba(0, 0, 0, .18), inset 0 1px rgba(255, 255, 255, .08);
}

.seat-bottom .own-hand-layout .tile:not(.small) {
  --tile-w: var(--own-fit-tile-w);
  --tile-h: var(--tile-h-own);
  height: auto;
  aspect-ratio: 44 / 60;
  border-radius: 7px;
}

.seat-top .hand-row .tile:not(.small) {
  --tile-w: clamp(31px, calc((100cqw - 70px) / 13), var(--tile-w-base));
  height: auto;
  aspect-ratio: 44 / 60;
}

.seat-left .hand-row .tile:not(.small):not(.hidden),
.seat-right .hand-row .tile:not(.small):not(.hidden) {
  --tile-w: clamp(31px, calc((100cqw - 24px) / 5), var(--tile-w-base));
  height: auto;
  aspect-ratio: 44 / 60;
}

.seat-left .hand-row:has(.tile.hidden) .tile.hidden,
.seat-right .hand-row:has(.tile.hidden) .tile.hidden {
  width: clamp(40px, 21.5cqw, 56px);
  height: 100%;
  min-height: 0;
  flex: none;
  border-color: transparent;
  border-radius: 5px;
  background-size: 100% 100%;
  box-shadow: inset -2px -2px 0 rgba(119, 88, 47, .20), 0 4px 8px rgba(0, 0, 0, .22);
}

:root[data-theme="light"] .meld-group {
  border-color: rgba(96, 101, 107, .20);
  background: rgba(255, 253, 243, .7);
}

:root[data-theme="light"] .player-status-row .log-entry {
  color: #303236;
  border-color: rgba(96, 101, 107, .20);
  background:
    linear-gradient(180deg, rgba(255, 244, 184, .62), rgba(246, 241, 230, .78)),
    rgba(255, 253, 243, .86);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .86);
  box-shadow: inset 0 1px rgba(255, 255, 255, .84), 0 6px 12px rgba(82, 65, 38, .10);
}

.tile {
  --tile-w: var(--tile-w-base);
  --tile-h: var(--tile-h-base);
  width: var(--tile-w);
  height: var(--tile-h);
  flex: 0 0 var(--tile-w);
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid #cdbb87;
  border-radius: 7px;
  appearance: none;
  color: #241324;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .99), rgba(252, 247, 229, .99) 58%, rgba(224, 214, 191, .98)),
    linear-gradient(180deg, rgba(255, 255, 255, .62), transparent 34%);
  box-shadow: inset -2px -4px 0 rgba(93, 78, 54, .15), inset 2px 2px 0 rgba(255, 255, 255, .82), 0 2px 0 rgba(111, 91, 60, .40), 0 8px 14px rgba(0, 0, 0, .26);
  min-height: 0;
  padding: 0;
  user-select: none;
  transform-origin: center bottom;
  transition: transform .22s cubic-bezier(.2, .86, .28, 1.28), border-color .18s ease, box-shadow .18s ease, filter .18s ease;
  isolation: isolate;
}

.tile:not(.hidden)::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  z-index: 0;
  pointer-events: none;
}

.tile:not(.hidden)::before {
  top: 2px;
  height: 6px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .82) 22%, rgba(255, 255, 255, .34) 70%, transparent);
  box-shadow: none;
}

.tile.small {
  --tile-w: var(--tile-w-small);
  --tile-h: var(--tile-h-small);
  border-radius: 5px;
}

.tile.hidden {
  background: var(--tile-back-image) center/cover;
  border-color: rgba(255, 226, 163, .64);
  box-shadow: inset -2px -3px 0 rgba(56, 40, 30, .22), inset 1px 1px 0 rgba(255, 255, 255, .58), 0 2px 0 rgba(68, 48, 30, .44), 0 7px 13px rgba(0, 0, 0, .26);
}

.seat-top .tile.hidden,
.seat-left .tile.hidden,
.seat-right .tile.hidden {
  border-color: transparent;
  box-shadow: inset -2px -3px 0 rgba(56, 40, 30, .24), 0 2px 0 rgba(68, 48, 30, .32), 0 7px 13px rgba(0, 0, 0, .24);
}

.tile.clickable {
  cursor: pointer;
  min-height: 0;
  padding: 0;
}

.tile.clickable:hover {
  border-color: var(--gold);
  transform: translateY(-5px);
  box-shadow: inset -2px -4px 0 rgba(93, 78, 54, .12), inset 2px 2px 0 rgba(255, 255, 255, .86), 0 0 0 2px rgba(255, 211, 111, .28), 0 16px 21px rgba(0, 0, 0, .34);
}

.tile.selected {
  z-index: 12;
  transform: translateY(-26px) scale(1.12) rotate(-1.2deg);
  border-color: #ffe66f;
  filter: saturate(1.16) brightness(1.06);
  box-shadow: inset -2px -4px 0 rgba(93, 78, 54, .10), inset 2px 2px 0 rgba(255, 255, 255, .90), 0 0 0 3px rgba(255, 230, 111, .56), 0 0 0 8px rgba(117, 243, 202, .20), 0 24px 34px rgba(0, 0, 0, .42);
  animation: selectedTilePulse 1.25s ease-in-out infinite;
}

.tile.selected::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(255, 230, 111, .78);
  border-radius: 10px;
  z-index: -1;
  pointer-events: none;
  animation: selectedTileHalo 1.25s ease-in-out infinite;
}

.tile.selected .tile-face {
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .7));
}

.tile-face {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.discard-fly-tile {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--from-x), var(--from-y), 0) translate(-50%, -50%) scale(.76);
  transform-origin: center;
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, .42));
  will-change: transform, opacity;
}

.discard-fly-tile.animate {
  animation: discardFlyStraight var(--discard-fly-duration) cubic-bezier(.2, .78, .18, 1) forwards;
}

.discard-fly-tile .tile {
  --tile-w: var(--tile-w-base);
  --tile-h: var(--tile-h-base);
}

.discard-fly-sparkles {
  position: absolute;
  inset: -22px;
  z-index: -1;
  pointer-events: none;
}

.discard-fly-sparkles span {
  --angle: calc(var(--pop-i) * 51.4deg);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cream-pop), var(--candy-pink));
  transform: rotate(var(--angle)) translateY(-18px) scale(.35);
  opacity: 0;
  animation: discardTrailSpark var(--discard-fly-duration) ease-out forwards;
  animation-delay: calc(var(--pop-i) * 120ms);
}

.tile-pop-fx {
  --pop-main: var(--cream-pop);
  --pop-accent: var(--mint-pop);
  position: fixed;
  z-index: 95;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .24));
}

.tile-pop-ring,
.tile-pop-bubble,
.tile-pop-stars {
  position: absolute;
  inset: 0;
}

.tile-pop-ring {
  width: 84px;
  height: 84px;
  border: 3px solid var(--pop-main);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(.18);
  animation: tilePopRing var(--tile-pop-duration) cubic-bezier(.12, .84, .2, 1) both;
}

.tile-pop-bubble {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--pop-accent) 52%, transparent);
  transform: translate(-50%, -50%) rotate(45deg) scale(.2);
  animation: tilePopBubble var(--tile-pop-duration) ease-out both;
}

.tile-pop-stars span {
  --angle: calc(var(--pop-i) * 36deg);
  position: absolute;
  left: -4px;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--pop-main), var(--pop-accent));
  transform: rotate(var(--angle)) translateY(0) scale(.35);
  opacity: 0;
  animation: tilePopStar var(--tile-pop-duration) cubic-bezier(.16, .84, .2, 1) both;
  animation-delay: calc(var(--pop-i) * 38ms);
}

.meld-smash-highlight,
.win-smash-highlight {
  position: relative;
  animation: meldSmashPulse var(--call-smash-duration) cubic-bezier(.16, .88, .2, 1);
}

.win-smash-highlight {
  animation-name: winSmashPulse;
  animation-duration: var(--win-smash-duration);
}

.claim-smash-fx {
  --fx-main: #f2c86d;
  --fx-hot: #ffef9d;
  position: fixed;
  z-index: 80;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 22px 22px rgba(0, 0, 0, .34));
}

.claim-smash-fx.chow {
  --fx-main: #65d5a8;
  --fx-hot: #d7ffe8;
}

.claim-smash-fx.pong {
  --fx-main: #f2c86d;
  --fx-hot: #fff0a8;
}

.claim-smash-fx.kong {
  --fx-main: #62c7ff;
  --fx-hot: #e1f6ff;
}

.claim-smash-fx.win {
  --fx-main: #ff4d6d;
  --fx-hot: #fff1b7;
}

.claim-smash-fx.selfDraw {
  --fx-main: #b66dff;
  --fx-hot: #fff1b7;
}

.claim-smash-shock {
  position: absolute;
  width: 260px;
  height: 260px;
  border: 3px solid var(--fx-main);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--fx-hot) 28%, transparent), transparent 58%);
  animation: smashShock var(--smash-shock-duration) cubic-bezier(.08, .82, .14, 1) both;
}

.claim-smash-fx.win .claim-smash-shock {
  width: 340px;
  height: 340px;
  border-width: 4px;
}

.claim-smash-word {
  position: absolute;
  z-index: 2;
  width: 240px;
  height: 128px;
  display: grid;
  place-items: center;
  white-space: nowrap;
  color: #ffb724;
  background: linear-gradient(180deg, #fff7a8 0%, #ffd04d 42%, #ff951e 72%, #bd4a13 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.6px rgba(92, 35, 8, .94);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.95rem;
  font-weight: 1000;
  line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(104, 45, 12, .82)) drop-shadow(0 16px 22px rgba(0, 0, 0, .44));
  text-shadow: 0 0 18px rgba(255, 218, 94, .52), 0 0 34px rgba(255, 143, 31, .34);
  animation: smashWord var(--call-smash-duration) cubic-bezier(.14, .9, .2, 1) both;
}

.claim-smash-fx.win .claim-smash-word {
  width: 390px;
  height: 156px;
  font-size: 5.85rem;
  color: #ffe36d;
  background: linear-gradient(180deg, #fff9c4 0%, #ffe15d 28%, #ff8f2d 56%, #ff3d5f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2.2px rgba(90, 10, 26, .96);
  filter: drop-shadow(0 5px 0 rgba(89, 15, 26, .9)) drop-shadow(0 22px 28px rgba(0, 0, 0, .5));
  text-shadow: 0 0 22px rgba(255, 238, 133, .78), 0 0 42px rgba(255, 84, 96, .54), 0 0 70px rgba(255, 177, 51, .32);
}

.claim-effect-art {
  position: relative;
  z-index: 2;
  display: block;
  pointer-events: none;
}

.claim-effect-art img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.claim-effect-art.smash-art {
  width: clamp(174px, 21vw, 252px);
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .34));
  animation: callImageBreath var(--call-smash-duration) cubic-bezier(.18, .9, .2, 1) both;
}

.claim-smash-fx.win .claim-effect-art.smash-art {
  width: clamp(286px, 35vw, 430px);
  animation-duration: var(--win-smash-duration);
}

.claim-effect-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.claim-smash-detail {
  position: absolute;
  z-index: 2;
  top: 82px;
  min-width: 86px;
  border: 1px solid rgba(255, 236, 170, .76);
  border-radius: 999px;
  padding: 4px 12px;
  color: #241324;
  background: linear-gradient(180deg, #ffeaa6, #d29b42);
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  animation: smashDetail var(--call-smash-duration) ease both;
}

.claim-smash-fx.win .claim-smash-detail {
  top: 114px;
}

.claim-smash-tiles {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  transform-origin: center;
  animation: smashTiles var(--call-smash-duration) cubic-bezier(.1, .9, .22, 1) both;
}

.claim-smash-tiles .tile {
  --tile-w: 46px;
  --tile-h: 62px;
  animation: smashTileFlip var(--smash-tile-flip-duration) cubic-bezier(.14, .9, .24, 1) both;
}

.claim-smash-fx.win .claim-smash-shock,
.claim-smash-fx.win .claim-smash-word,
.claim-smash-fx.win .claim-smash-detail,
.claim-smash-fx.win .claim-smash-tiles {
  animation-duration: var(--win-smash-duration);
}

.claim-smash-fx.win .claim-smash-tiles .tile {
  --tile-w: 60px;
  --tile-h: 82px;
  animation-duration: var(--smash-shock-duration);
}

.claim-smash-sparks {
  position: absolute;
  inset: -1px;
}

.claim-smash-sparks span {
  --angle: calc(var(--spark-i) * 25.714deg);
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--fx-hot), var(--fx-main));
  transform: rotate(var(--angle)) translateY(-18px) scale(.3);
  transform-origin: 4px 80px;
  opacity: 0;
  animation: smashSpark var(--smash-spark-duration) cubic-bezier(.12, .86, .2, 1) both;
  animation-delay: calc(var(--spark-i) * 28ms);
}

@media (prefers-reduced-motion: reduce) {
  .discard-fly-tile,
  .claim-smash-fx,
  .tile-pop-fx,
  .deal-start-fx {
    display: none;
  }

  .meld-smash-highlight,
  .win-smash-highlight,
  .tile.selected,
  .turn-pointer,
  .round-stone::before,
  .center-callout,
  .seat-zone:has(.player-mat.active)::before,
  .player-mat.active::before,
  .player-mat.active::after,
  .player-mat.active .player-line,
  .player-mat.active .wind-chip::after,
  .action-bar button.claim-choice,
  .action-bar button.claim-choice::before,
  .action-bar button.claim-choice::after,
  .action-bar button[data-action="discardSelected"] {
    animation: none;
  }

  .center-callout.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.deal-start-fx {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}

.deal-fx-pile {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 62px;
  transform: translate(-50%, -50%);
  opacity: .96;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .32));
  animation: dealPileFade 2.15s ease both;
}

.deal-pile-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  transform: translate(calc(-50% + var(--pile-x)), calc(-50% + var(--pile-y))) rotate(var(--pile-r));
  animation: dealPileShuffle 860ms ease-in-out both;
}

.deal-pile-card .tile.hidden {
  width: 36px;
  height: 49px;
}

.deal-fx-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  opacity: 0;
  will-change: transform, opacity;
  animation: dealCardFly 1.46s cubic-bezier(.2, .82, .18, 1) both;
  animation-delay: var(--delay);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .26));
}

.deal-fx-card .tile.hidden {
  width: 34px;
  height: 46px;
}

@keyframes dealPileShuffle {
  0%, 100% {
    transform: translate(calc(-50% + var(--pile-x)), calc(-50% + var(--pile-y))) rotate(var(--pile-r));
  }
  30% {
    transform: translate(calc(-50% + var(--pile-x) - 9px), calc(-50% + var(--pile-y) + 2px)) rotate(calc(var(--pile-r) - 8deg));
  }
  62% {
    transform: translate(calc(-50% + var(--pile-x) + 11px), calc(-50% + var(--pile-y) - 3px)) rotate(calc(var(--pile-r) + 7deg));
  }
}

@keyframes dealPileFade {
  0%, 58% {
    opacity: .96;
  }
  100% {
    opacity: 0;
  }
}

@keyframes dealCardFly {
  0% {
    opacity: 0;
    transform: translate(var(--from-x), var(--from-y)) translate(-50%, -50%) scale(.72) rotate(var(--rot-start));
  }
  16% {
    opacity: 1;
  }
  48% {
    opacity: 1;
    transform: translate(var(--arc-x), var(--arc-y)) translate(-50%, -50%) scale(1.04) rotate(var(--rot-mid));
  }
  86% {
    opacity: .98;
    transform: translate(var(--to-x), var(--to-y)) translate(-50%, -50%) scale(.9) rotate(var(--rot-end));
  }
  100% {
    opacity: 0;
    transform: translate(var(--to-x), var(--to-y)) translate(-50%, -50%) scale(.86) rotate(var(--rot-end));
  }
}

.center-altar {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  display: block;
  z-index: 5;
  pointer-events: none;
}

.turn-pointer {
  display: none !important;
}

.turn-pointer[hidden] {
  display: none !important;
}

.center-action-home {
  position: absolute;
  left: 50%;
  top: calc(50% + clamp(108px, 10vw, 130px));
  width: min(620px, calc(100% - 32px));
  min-height: 36px;
  display: flex;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.center-action-home:empty {
  min-height: 0;
}

.round-stone {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(158px, 14.5vw, 218px);
  min-height: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 0;
  color: #fff4ca;
  background: transparent;
  padding: 0;
  text-align: center;
  font-family: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", "Microsoft JhengHei UI", serif;
  letter-spacing: 0;
  text-shadow:
    0 1px 0 rgba(60, 30, 7, .82),
    0 0 10px rgba(255, 236, 165, .32),
    0 0 24px rgba(255, 191, 74, .16);
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .18));
}

.round-stone::before {
  display: none;
}

.round-stone::after {
  display: none;
}

.round-stone > * {
  position: relative;
  z-index: 1;
}

:root[data-theme="light"] .round-stone {
  color: #1a2026;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .98),
    0 -1px 0 rgba(255, 255, 255, .76),
    1px 0 0 rgba(255, 255, 255, .70),
    -1px 0 0 rgba(255, 255, 255, .70),
    0 2px 5px rgba(75, 48, 18, .30);
  filter: drop-shadow(0 8px 12px rgba(90, 64, 32, .18));
}

:root[data-theme="light"] .wall-count span {
  color: #4d3611;
  font-weight: 950;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .96),
    0 -1px 0 rgba(255, 255, 255, .72),
    0 2px 4px rgba(98, 67, 28, .24);
}

.wall-count {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  line-height: 1;
}

.wall-count span {
  display: inline;
  color: rgba(255, 229, 159, .92);
  font-size: clamp(.66rem, .72vw, .78rem);
  font-family: var(--font-ui);
  font-weight: 850;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(44, 23, 7, .56), 0 0 8px rgba(255, 221, 124, .22);
}

.wall-count strong {
  display: inline;
  color: #fff4bb;
  font-family: var(--font-number);
  font-size: clamp(1.16rem, 1.65vw, 1.48rem);
  font-weight: 950;
  line-height: 1.05;
  background: linear-gradient(180deg, #fffbe5 0%, #ffe08a 42%, #f3b947 70%, #c98020 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(74, 36, 8, .54), 0 0 12px rgba(255, 214, 104, .30);
}

:root[data-theme="light"] .wall-count strong {
  color: #151a20;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: currentColor;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .98),
    0 -1px 0 rgba(255, 255, 255, .72),
    1px 0 0 rgba(255, 255, 255, .62),
    -1px 0 0 rgba(255, 255, 255, .62),
    0 2px 5px rgba(82, 54, 20, .28);
}

.turn-orb {
  min-height: 38px;
  display: grid;
  place-items: center;
  margin: 5px 0;
  border: 1px solid rgba(117, 243, 202, .34);
  border-radius: 8px;
  color: var(--jade);
  background:
    linear-gradient(180deg, rgba(117, 243, 202, .16), rgba(9, 49, 58, .22)),
    rgba(15, 111, 115, .18);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .30), 0 0 13px rgba(117, 243, 202, .18);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 0 18px rgba(117, 243, 202, .10);
}

.table-turn-orb {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  max-height: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 0;
  background: transparent;
  font-family: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", "Microsoft JhengHei UI", serif;
  font-size: clamp(.88rem, 1.14vw, 1.08rem);
  font-weight: 950;
  line-height: 1.05;
  box-shadow: none;
  text-shadow: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.hub-turn-name,
.hub-turn-action {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-turn-name {
  color: #fffaf0;
  font-size: clamp(1rem, 1.28vw, 1.2rem);
  font-weight: 950;
  line-height: 1.05;
  text-shadow:
    0 1px 0 rgba(50, 22, 5, .82),
    0 0 10px rgba(255, 233, 165, .28);
}

.hub-turn-action {
  color: #86f0c9;
  font-family: var(--font-ui);
  font-size: clamp(.76rem, .94vw, .9rem);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 1px 0 rgba(8, 39, 35, .72), 0 0 10px rgba(117, 243, 202, .30);
}

:root[data-theme="light"] .hub-turn-action {
  color: #075447;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .96),
    0 -1px 0 rgba(255, 255, 255, .76),
    1px 0 0 rgba(255, 255, 255, .68),
    -1px 0 0 rgba(255, 255, 255, .68),
    0 2px 5px rgba(24, 90, 77, .26);
}

:root[data-theme="light"] .hub-turn-name {
  color: #151a20;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .98),
    0 -1px 0 rgba(255, 255, 255, .76),
    1px 0 0 rgba(255, 255, 255, .68),
    -1px 0 0 rgba(255, 255, 255, .68),
    0 2px 5px rgba(77, 54, 28, .28);
}

:root[data-theme="light"] .auth-status,
:root[data-theme="light"] .turn-orb {
  color: #303236;
  border-color: rgba(96, 101, 107, .24);
  background: rgba(248, 250, 246, .86);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .78);
}

:root[data-theme="light"] .round-stone .table-turn-orb,
.round-stone .table-turn-orb {
  color: #fffdf2;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  text-shadow: inherit;
}

:root[data-theme="light"] .round-stone .table-turn-orb {
  color: #151a20;
}

.center-callout {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  min-width: 62px;
  border: 2px solid rgba(255, 244, 187, .86);
  border-radius: 999px;
  padding: 3px 10px 4px;
  color: #2a1825;
  background:
    radial-gradient(circle at 34% 18%, rgba(255, 255, 255, .76), transparent 28%),
    linear-gradient(180deg, #fff6ba, #ffd36f 56%, #e59638);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .54),
    inset 0 -3px rgba(126, 83, 34, .22),
    0 8px 18px rgba(82, 43, 10, .24),
    0 0 26px rgba(255, 211, 111, .30);
  font-family: var(--font-display);
  font-size: clamp(1.16rem, 1.45vw, 1.48rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .52);
  transform: translate(-50%, -50%) scale(.86);
  opacity: 0;
  pointer-events: none;
}

.center-callout[hidden] {
  display: none !important;
}

.center-callout.show {
  animation: centerCalloutPop 2.8s cubic-bezier(.14, .9, .22, 1) both;
}

.center-callout[data-type="win"],
.center-callout[data-type="selfDraw"] {
  color: #fff7e5;
  border-color: rgba(255, 238, 180, .94);
  background:
    radial-gradient(circle at 34% 18%, rgba(255, 255, 255, .72), transparent 28%),
    linear-gradient(180deg, #ffbcce, #ff7aa2 48%, #b83e63);
  text-shadow: 0 2px 0 rgba(90, 21, 42, .46);
}

.last-discard {
  min-height: 20px;
  display: grid;
  place-items: center;
}

.last-discard .tile {
  transform: scale(.58);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .28));
}

.last-discard .log-entry {
  font-size: clamp(.74rem, .88vw, .88rem);
  line-height: 1.15;
  text-align: center;
}

.round-stone .last-discard .log-entry {
  border: 0;
  padding: 0;
  color: rgba(255, 232, 166, .92);
  background: transparent;
  box-shadow: none;
  font-family: var(--font-ui);
  font-weight: 850;
  text-shadow: 0 1px 0 rgba(46, 23, 5, .62), 0 0 8px rgba(255, 211, 111, .18);
}

:root[data-theme="light"] .round-stone .last-discard .log-entry {
  color: #20262c;
  font-weight: 900;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .96),
    0 -1px 0 rgba(255, 255, 255, .72),
    0 2px 4px rgba(77, 54, 28, .22);
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.action-bar button {
  min-width: 84px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 1px rgba(255, 255, 255, .24);
}

.action-bar button.claim-choice {
  --claim-main: var(--gold);
  --claim-deep: #8d4a32;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-width: 206px;
  min-height: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: #241324;
  border-color: color-mix(in srgb, var(--claim-main) 76%, white);
  background:
    radial-gradient(120% 160% at 50% -52%, rgba(255, 255, 255, .72), transparent 35%),
    linear-gradient(180deg, color-mix(in srgb, var(--claim-main) 48%, white), var(--claim-main) 54%, var(--claim-deep)),
    linear-gradient(90deg, rgba(255, 255, 255, .30), transparent);
  box-shadow: inset 0 2px rgba(255, 255, 255, .72), inset 0 -3px rgba(0, 0, 0, .22), 0 16px 30px rgba(0, 0, 0, .34), 0 0 28px color-mix(in srgb, var(--claim-main) 34%, transparent);
  animation: actionButtonPulse 2.2s ease-in-out infinite;
}

.action-bar button.claim-choice::before,
.action-bar button.claim-choice::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.action-bar button.claim-choice::before {
  inset: -42px -34px;
  background:
    conic-gradient(from 24deg, transparent 0deg 16deg, rgba(255, 255, 255, .36) 17deg 22deg, transparent 23deg 44deg),
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--claim-main) 34%, transparent), transparent 58%);
  opacity: .7;
  animation: actionButtonStarburst 7s linear infinite;
}

.action-bar button.claim-choice::after {
  inset: 2px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .48);
  background:
    linear-gradient(110deg, transparent 0 28%, rgba(255, 255, 255, .52) 42%, transparent 56% 100%),
    linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 48%);
  opacity: .64;
  mix-blend-mode: screen;
  transform: translateX(-120%);
  animation: actionButtonShine 3.2s ease-in-out infinite;
}

.action-bar button.claim-choice[data-claim="chow"] {
  --claim-main: #73f0c2;
  --claim-deep: #1d8c70;
}

.action-bar button.claim-choice[data-claim="pong"] {
  --claim-main: #ffd36f;
  --claim-deep: #b27030;
}

.action-bar button.claim-choice[data-claim="kong"],
.action-bar button.claim-choice[data-action="kong"] {
  --claim-main: #82ddff;
  --claim-deep: #2e7da8;
}

.action-bar button.claim-choice[data-claim="win"],
.action-bar button.claim-choice[data-claim="selfDraw"],
.action-bar button[data-action="selfWin"] {
  --claim-main: #ff8fb8;
  --claim-deep: #a43d5d;
}

.action-bar button.claim-choice[data-claim="selfDraw"] {
  --claim-main: #d5a4ff;
  --claim-deep: #7443b5;
}

.action-bar button[data-action="discardSelected"] {
  color: #1b2430;
  border-color: rgba(224, 255, 235, .78);
  background:
    linear-gradient(180deg, #e0ffeb, #74e2ac 58%, #2fa06e),
    linear-gradient(90deg, rgba(255, 255, 255, .30), transparent);
  box-shadow: inset 0 1px rgba(255, 255, 255, .62), inset 0 -2px rgba(20, 92, 58, .18), 0 14px 30px rgba(0, 0, 0, .30), 0 0 22px rgba(117, 243, 202, .22);
  animation: actionButtonPulse 2.2s ease-in-out infinite;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 950;
}

.action-bar.effects-locked button:disabled {
  cursor: not-allowed;
  opacity: .52;
  filter: grayscale(.18) saturate(.72) brightness(.82);
  transform: none;
  animation: none;
  box-shadow: inset 0 1px rgba(255, 255, 255, .38), inset 0 -2px rgba(0, 0, 0, .16), 0 8px 16px rgba(0, 0, 0, .20);
}

.action-bar.effects-locked button:disabled::before,
.action-bar.effects-locked button:disabled::after {
  animation: none;
  opacity: .18;
}

.claim-label {
  flex: 0 0 auto;
  font-size: 1.55rem;
  line-height: 1;
  font-family: var(--font-display);
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 0 2px rgba(255, 255, 255, .34);
}

.claim-button-face {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 78px;
}

.claim-effect-art.button-art {
  width: 104px;
  margin: -16px -14px -14px;
  filter: drop-shadow(0 5px 0 rgba(80, 25, 7, .62)) drop-shadow(0 9px 10px rgba(0, 0, 0, .24));
}

.action-bar button.claim-choice[data-claim="win"] .claim-effect-art.button-art,
.action-bar button.claim-choice[data-claim="selfDraw"] .claim-effect-art.button-art {
  width: 146px;
  margin-inline: -18px;
}

.claim-tile-strip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  pointer-events: none;
}

.claim-tile-strip .tile.small {
  --tile-w: 40px;
  --tile-h: 54px;
  box-shadow: inset -1px -3px 0 rgba(119, 88, 47, .18), inset 1px 1px 0 rgba(255, 255, 255, .78), 0 4px 8px rgba(0, 0, 0, .2);
}

.own-action-slot .action-bar {
  position: relative;
  z-index: 41;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: end;
  gap: 8px;
}

.own-action-slot .action-bar button {
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
}

.own-action-slot .action-bar button.claim-choice {
  min-width: 198px;
  min-height: 78px;
  padding: 8px 12px;
}

.score-values {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.score-row strong {
  color: var(--gold);
  font-family: var(--font-number);
  font-weight: 950;
  text-shadow: 0 0 12px rgba(255, 211, 111, .20);
}

.game-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.log-entry {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.38;
  font-weight: 750;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 5px;
  padding-right: 2px;
}

.chat-message {
  border: 1px solid rgba(101, 224, 178, .24);
  border-radius: 7px;
  padding: 7px 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .065), transparent),
    rgba(255, 248, 231, .07);
  box-shadow: inset 0 1px rgba(255, 255, 255, .07), 0 6px 12px rgba(0, 0, 0, .10);
}

.chat-message.mine {
  border-color: rgba(242, 200, 109, .34);
  background:
    linear-gradient(180deg, rgba(255, 211, 111, .12), rgba(255, 211, 111, .04)),
    rgba(242, 200, 109, .10);
}

:root[data-theme="light"] .chat-message {
  color: #303236;
  border-color: rgba(96, 101, 107, .20);
  background: rgba(255, 253, 243, .82);
}

:root[data-theme="light"] .chat-message.mine {
  color: #303236;
  border-color: rgba(143, 100, 36, .26);
  background: rgba(255, 239, 190, .42);
}

:root[data-theme="light"] .chat-meta {
  color: #4f545a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .78);
}

:root[data-theme="light"] .chat-meta time {
  color: #6c7076;
}

:root[data-theme="light"] .chat-text {
  color: #303236;
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--gold);
  font-size: .7rem;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .24);
}

.chat-meta time {
  color: var(--muted);
  white-space: nowrap;
}

.chat-text {
  margin-top: 4px;
  color: var(--ink);
  font-size: .82rem;
  line-height: 1.36;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.emoji-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22px, 1fr));
  gap: 4px;
  margin-top: 6px;
  overflow: visible;
  padding: 2px;
}

.emoji-button {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: .98rem;
  line-height: 1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(34, 18, 58, .88)),
    rgba(73, 39, 104, .82);
}

.quick-banter-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
  max-height: 76px;
  overflow-y: auto;
  padding: 2px 1px 1px;
}

.quick-banter-button {
  flex: 1 1 auto;
  min-width: 68px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 9px;
  color: #22132a;
  border-color: rgba(255, 236, 170, .52);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .52), rgba(255, 211, 111, .14) 34%, transparent 58%),
    linear-gradient(180deg, #fff1ad, #ffd36f 54%, #e09a43);
  box-shadow: inset 0 1px rgba(255, 255, 255, .58), inset 0 -2px rgba(112, 69, 26, .18), 0 6px 12px rgba(0, 0, 0, .18);
  font-family: var(--font-display);
  font-size: .76rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px rgba(255, 255, 255, .34);
}

.quick-banter-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06) saturate(1.08);
}

.quick-banter-button:disabled {
  cursor: not-allowed;
  opacity: .48;
  filter: grayscale(.25) saturate(.72);
}

:root[data-theme="light"] .quick-banter-button {
  color: #303236;
  border-color: rgba(126, 83, 34, .32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 233, 168, .38) 38%, transparent 58%),
    linear-gradient(180deg, #fff6c6, #efc568 58%, #d68b35);
  box-shadow: inset 0 1px rgba(255, 255, 255, .82), 0 5px 10px rgba(82, 65, 38, .12);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 5px;
  margin-top: 6px;
}

.chat-form input {
  min-width: 0;
  padding: 0 8px;
}

.chat-form button {
  padding: 0 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 10;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(242, 200, 109, .44);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(31, 15, 46, .96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .36);
  font-weight: 900;
  line-height: 1.25;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .24);
}

:root[data-theme="light"] .toast {
  color: #303236;
  border-color: rgba(96, 101, 107, .24);
  background: rgba(255, 253, 245, .96);
  box-shadow: 0 14px 34px rgba(74, 82, 45, .16);
}

.hand-result {
  position: fixed;
  inset: auto 20px 20px auto;
  z-index: 9;
  width: min(420px, calc(100vw - 40px));
  border: 1px solid rgba(242, 200, 109, .55);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(58, 28, 78, .97), rgba(15, 45, 55, .97));
  box-shadow: 0 20px 54px rgba(0, 0, 0, .42);
  font-weight: 750;
}

:root[data-theme="light"] .hand-result {
  color: #303236;
  border-color: rgba(96, 101, 107, .24);
  background: linear-gradient(180deg, rgba(255, 253, 245, .98), rgba(241, 238, 230, .96));
  box-shadow: 0 18px 42px rgba(74, 82, 45, .16);
}

.hand-result h3 {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.26rem;
  font-weight: 950;
  line-height: 1.12;
  text-shadow: 0 0 16px rgba(255, 211, 111, .26), 0 1px 0 rgba(0, 0, 0, .32);
}

.hand-result h4 {
  margin: 10px 0 4px;
  color: var(--jade);
  font-size: .92rem;
  font-weight: 900;
}

.hand-result ul {
  margin: 8px 0 12px;
  padding-left: 20px;
}

.hand-result li {
  margin: 4px 0;
  line-height: 1.3;
}

.money-payment-list {
  color: var(--cream-pop);
  font-weight: 800;
}

:root[data-theme="light"] .money-payment-list {
  color: #303236;
}

@keyframes selectedTilePulse {
  0%, 100% {
    transform: translateY(-26px) scale(1.12) rotate(-1.2deg);
  }
  50% {
    transform: translateY(-31px) scale(1.145) rotate(1deg);
  }
}

@keyframes activeNameGlow {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.14);
  }
}

@keyframes activeSeatGlow {
  0%, 100% {
    opacity: .48;
    filter: blur(6px) saturate(1.02) brightness(1);
  }
  50% {
    opacity: .72;
    filter: blur(5px) saturate(1.08) brightness(1.08);
  }
}

@keyframes activeLocalGlow {
  0%, 100% {
    opacity: .68;
    filter: blur(8px) saturate(1.02) brightness(1);
  }
  50% {
    opacity: .88;
    filter: blur(7px) saturate(1.12) brightness(1.08);
  }
}

@keyframes activeRailSweep {
  0% {
    background-position: 120% 50%;
  }
  100% {
    background-position: -120% 50%;
  }
}

@keyframes activeRailSweepVertical {
  0% {
    background-position: 50% 120%;
  }
  100% {
    background-position: 50% -120%;
  }
}

@keyframes activeTurnDotPulse {
  0%, 100% {
    opacity: .72;
    transform: scale(.84);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

@keyframes turnSpotlightPulse {
  0%, 100% {
    opacity: .78;
    filter: saturate(1) brightness(1);
  }
  50% {
    opacity: 1;
    filter: saturate(1.08) brightness(1.06);
  }
}

@keyframes centerHubRingSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(1turn);
  }
}

@keyframes centerCalloutPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.76);
  }
  14%, 76% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.92);
  }
}

@keyframes actionButtonPulse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes actionButtonStarburst {
  to {
    transform: rotate(1turn);
  }
}

@keyframes actionButtonShine {
  0%, 44% {
    transform: translateX(-120%);
  }
  68%, 100% {
    transform: translateX(120%);
  }
}

@keyframes callImageBreath {
  0% {
    opacity: 0;
    transform: scale(.32) rotate(-8deg);
    filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0)) brightness(1.25) saturate(1.22);
  }
  16% {
    opacity: 1;
    transform: scale(1.28) rotate(3deg);
    filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .38)) brightness(1.18) saturate(1.2);
  }
  30% {
    transform: scale(.98) rotate(-1deg);
  }
  54% {
    transform: scale(1.07) rotate(.8deg);
  }
  82% {
    opacity: 1;
    transform: scale(1.02) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.18) rotate(0deg);
    filter: drop-shadow(0 20px 24px rgba(0, 0, 0, .30)) brightness(1.08) saturate(1.06);
  }
}

@keyframes drawnTileGlow {
  0%, 100% {
    filter: brightness(1) saturate(1.04);
  }
  50% {
    filter: brightness(1.08) saturate(1.14);
  }
}

@keyframes selectedTileHalo {
  0%, 100% {
    opacity: .72;
    transform: scale(.96) rotate(-2deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.04) rotate(2deg);
  }
}

@keyframes discardTrailSpark {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(-12px) scale(.2);
  }
  24% {
    opacity: .95;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(-48px) scale(1);
  }
}

@keyframes tilePopRing {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.16);
  }
  24% {
    opacity: .95;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.12);
  }
}

@keyframes tilePopBubble {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(.2);
  }
  38% {
    opacity: .8;
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.45);
  }
}

@keyframes tilePopStar {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(0) scale(.25);
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(-48px) scale(1.05);
  }
}

@keyframes discardFlyStraight {
  0% {
    opacity: 0;
    transform: translate3d(var(--from-x), var(--from-y), 0) translate(-50%, -50%) scale(.74);
  }
  8% {
    opacity: 1;
  }
  72% {
    opacity: 1;
    transform: translate3d(var(--near-x), var(--near-y), 0) translate(-50%, -50%) scale(1.04);
  }
  84% {
    opacity: 1;
    transform: translate3d(var(--to-x), var(--to-y), 0) translate(-50%, -50%) scale(1.08);
    filter: drop-shadow(0 18px 20px rgba(0, 0, 0, .42));
  }
  92% {
    opacity: 1;
    transform: translate3d(var(--to-x), var(--to-y), 0) translate(-50%, -50%) scale(.96, .9);
    filter: drop-shadow(0 7px 8px rgba(0, 0, 0, .30));
  }
  100% {
    opacity: 1;
    transform: translate3d(var(--to-x), var(--to-y), 0) translate(-50%, -50%) scale(1);
    filter: drop-shadow(0 6px 7px rgba(0, 0, 0, .24));
  }
}

@keyframes meldSmashPulse {
  0% {
    transform: scale(.96) rotate(-1deg);
    box-shadow: 0 0 0 0 rgba(242, 200, 109, .0);
    filter: brightness(1);
  }
  24% {
    transform: scale(1.12) rotate(1.4deg);
    box-shadow: 0 0 0 4px rgba(242, 200, 109, .72), 0 0 28px rgba(101, 213, 168, .55);
    filter: brightness(1.35) saturate(1.35);
  }
  56% {
    transform: scale(.98) rotate(-.7deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: none;
    filter: brightness(1);
  }
}

@keyframes winSmashPulse {
  0% {
    transform: scale(.98);
    box-shadow: 0 0 0 0 rgba(255, 77, 109, 0);
  }
  22% {
    transform: scale(1.025);
    box-shadow: 0 0 0 4px rgba(255, 77, 109, .68), 0 0 44px rgba(242, 200, 109, .56);
    filter: brightness(1.28) saturate(1.35);
  }
  52% {
    transform: scale(.995);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
    filter: brightness(1);
  }
}

@keyframes smashShock {
  0% {
    opacity: 0;
    transform: scale(.08);
  }
  18% {
    opacity: .95;
  }
  100% {
    opacity: 0;
    transform: scale(1.26);
  }
}

@keyframes smashWord {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(.38) rotate(-10deg);
  }
  18% {
    opacity: 1;
    transform: translateY(-18px) scale(1.2) rotate(3deg);
  }
  54% {
    opacity: 1;
    transform: translateY(-30px) scale(1) rotate(-1deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-72px) scale(.82) rotate(0deg);
  }
}

@keyframes smashDetail {
  0%, 22% {
    opacity: 0;
    transform: translateY(10px) scale(.75);
  }
  42%, 78% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px) scale(.86);
  }
}

@keyframes smashTiles {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(.72);
  }
  16% {
    opacity: 1;
    transform: translateY(54px) scale(1.16);
  }
  58% {
    opacity: 1;
    transform: translateY(66px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(86px) scale(.82);
  }
}

@keyframes smashTileFlip {
  0% {
    transform: translateY(34px) rotateX(68deg) rotateZ(-9deg);
  }
  34% {
    transform: translateY(-8px) rotateX(0deg) rotateZ(4deg);
  }
  58% {
    transform: translateY(0) rotateX(0deg) rotateZ(0deg);
  }
  100% {
    transform: translateY(8px) rotateX(0deg) rotateZ(0deg);
  }
}

@keyframes smashSpark {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(-18px) scale(.25);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(-128px) scale(1);
  }
}

@media (max-width: 1120px) {
  :root {
    --tile-w-own: 66px;
    --tile-h-own: 90px;
    --own-hand-clearance: 252px;
    --opponent-clearance-top: 130px;
    --river-tile-w: clamp(26px, 2.85vw, 34px);
  }

  .settings-collapsed {
    --tile-w-own: 72px;
    --tile-h-own: 98px;
    --own-hand-clearance: 270px;
    --opponent-clearance-top: 124px;
  }

  .game-layout {
    grid-template-columns: 230px minmax(500px, 1fr);
  }

  .right-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(180px, .72fr) minmax(0, 1fr) minmax(0, 1fr);
  }

  .log-panel,
  .chat-panel {
    min-height: 150px;
  }

  .discard-field {
    inset: calc(var(--opponent-clearance-top) + 28px) calc(min(23%, 214px) + 14px) calc(var(--own-hand-clearance) - 18px);
    grid-template-columns: minmax(82px, .78fr) minmax(218px, 1.18fr) minmax(82px, .78fr);
    grid-template-rows: minmax(92px, auto) minmax(120px, 1fr) minmax(92px, auto);
    gap: 6px 10px;
  }

  .discard-river-top,
  .discard-river-bottom {
    grid-template-columns: repeat(10, var(--tile-w-small));
  }

  .discard-river-top.density-tight,
  .discard-river-bottom.density-tight {
    grid-template-columns: repeat(11, var(--tile-w-small));
  }

  .discard-river-top.density-compact,
  .discard-river-bottom.density-compact {
    grid-template-columns: repeat(12, var(--tile-w-small));
  }

  .discard-river-top.density-ultra,
  .discard-river-bottom.density-ultra {
    grid-template-columns: repeat(14, var(--tile-w-small));
  }

  .discard-river-bottom.density-wrap:not(.density-tight):not(.density-compact):not(.density-ultra) {
    --tile-w-small: clamp(22px, 2.2vw, 28px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(12, var(--tile-w-small));
    gap: 3px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap.density-tight {
    --tile-w-small: clamp(20px, 2vw, 26px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(13, var(--tile-w-small));
    gap: 3px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap.density-compact {
    --tile-w-small: clamp(18px, 1.75vw, 23px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(14, var(--tile-w-small));
    gap: 2px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap.density-ultra {
    --tile-w-small: clamp(15px, 1.45vw, 19px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(16, var(--tile-w-small));
    gap: 2px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap {
    --bottom-river-wrap-offset: clamp(24px, 3.5vh, 36px);
  }

  .discard-river-left,
  .discard-river-right {
    grid-template-columns: repeat(4, var(--tile-w-small));
  }

  .discard-river-left.density-tight,
  .discard-river-right.density-tight {
    grid-template-columns: repeat(5, var(--tile-w-small));
  }

  .discard-river-left.density-compact,
  .discard-river-right.density-compact,
  .discard-river-left.density-ultra,
  .discard-river-right.density-ultra {
    grid-template-columns: repeat(5, var(--tile-w-small));
  }

  .round-stone {
    top: 50%;
    left: 50%;
    width: clamp(150px, 16vw, 204px);
    min-height: 0;
  }
}

@media (max-width: 820px) {
  :root {
    --tile-w-base: 40px;
    --tile-h-base: 55px;
    --tile-w-own: 52px;
    --tile-h-own: 71px;
    --tile-w-small: 27px;
    --tile-h-small: 37px;
    --river-tile-w: 24px;
    --own-hand-clearance: 0px;
    --opponent-clearance-top: 0px;
  }

  .settings-collapsed {
    --tile-w-own: 52px;
    --tile-h-own: 71px;
  }

  .own-hand-layout {
    --drawn-tile-gap: clamp(9px, 2cqw, 15px);
    --own-fit-tile-w: clamp(23px, calc((100cqw - 88px - var(--drawn-tile-gap)) / 14), var(--tile-w-own));
    --own-hand-gap: 2px;
  }

  .app-shell {
    padding: 10px;
    overflow-y: auto;
    gap: 8px;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
    padding: 7px 9px;
  }

  .brand {
    flex: 1 1 220px;
    gap: 7px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .room-ribbon {
    width: auto;
    flex: 0 1 132px;
    padding: 4px 8px;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .game-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .settings-collapsed .game-layout {
    grid-template-columns: 1fr;
  }

  .right-panel {
    grid-template-columns: 1fr;
  }

  .mahjong-table {
    min-height: 760px;
  }

  .seat-top,
  .seat-bottom {
    left: 8px;
    right: 8px;
  }

  .seat-bottom {
    min-height: 168px;
  }

  .seat-bottom .player-line,
  .seat-bottom .player-mat.active .player-line {
    max-width: clamp(116px, 30vw, 164px);
    margin-left: 4px;
  }

  .seat-left,
  .seat-right {
    width: clamp(106px, 25%, 122px);
    top: 255px;
    bottom: auto;
    height: 270px;
  }

  .seat-left {
    left: 8px;
  }

  .seat-right {
    right: 8px;
  }

  .seat-left .hand-row:has(.tile.hidden),
  .seat-right .hand-row:has(.tile.hidden) {
    --side-rack-gap: 3px;
    --side-rack-tile-h: clamp(18px, calc((100% - 18px) / 7), 29px);
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, var(--side-rack-tile-h));
    grid-auto-columns: minmax(34px, auto);
    align-content: start;
    gap: var(--side-rack-gap);
  }

  .seat-left .hand-row:has(.tile.hidden) {
    justify-content: start;
  }

  .seat-right .hand-row:has(.tile.hidden) {
    justify-content: end;
  }

  .seat-left .hand-row:has(.tile.hidden) .tile.hidden,
  .seat-right .hand-row:has(.tile.hidden) .tile.hidden {
    width: clamp(34px, 18cqw, 46px);
  }

  .discard-field {
    inset: 255px 12px 252px;
    grid-template-columns: minmax(72px, 1fr) minmax(142px, 1.3fr) minmax(72px, 1fr);
    grid-template-rows: 64px minmax(112px, 1fr) 64px;
    gap: 4px;
  }

  .discard-river {
    gap: 3px;
  }

  .discard-river-top,
  .discard-river-bottom {
    grid-template-columns: repeat(7, var(--river-tile-w));
  }

  .discard-river-top.density-tight,
  .discard-river-bottom.density-tight {
    grid-template-columns: repeat(8, var(--tile-w-small));
  }

  .discard-river-top.density-compact,
  .discard-river-bottom.density-compact,
  .discard-river-top.density-ultra,
  .discard-river-bottom.density-ultra {
    grid-template-columns: repeat(10, var(--tile-w-small));
  }

  .discard-river-bottom.density-wrap:not(.density-tight):not(.density-compact):not(.density-ultra) {
    --tile-w-small: clamp(20px, 4.8vw, 25px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(9, var(--tile-w-small));
    gap: 2px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap.density-tight {
    --tile-w-small: clamp(16px, 3.45vw, 19px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(12, var(--tile-w-small));
    gap: 2px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap.density-compact,
  .discard-river-bottom.density-wrap.density-ultra {
    --tile-w-small: clamp(15px, 3.25vw, 19px);
    --tile-h-small: calc(var(--tile-w-small) * 1.36);
    grid-template-columns: repeat(12, var(--tile-w-small));
    gap: 2px;
    transform: translateY(var(--bottom-river-wrap-offset));
  }

  .discard-river-bottom.density-wrap {
    --bottom-river-wrap-offset: clamp(18px, 3vh, 28px);
  }

  .discard-river-left,
  .discard-river-right {
    grid-template-columns: repeat(3, var(--river-tile-w));
  }

  .discard-river-left.density-tight,
  .discard-river-right.density-tight,
  .discard-river-left.density-compact,
  .discard-river-right.density-compact,
  .discard-river-left.density-ultra,
  .discard-river-right.density-ultra {
    grid-template-columns: repeat(3, var(--tile-w-small));
  }

  .discard-river-bottom {
    transform: translateY(8px);
  }

  .discard-river-left {
    transform: translate(calc(var(--river-tile-w) * 4), -20px);
  }

  .discard-river-right {
    transform: translate(calc(var(--river-tile-w) * -4), -20px);
  }

  .action-bar {
    gap: 7px;
  }

  .action-bar button.claim-choice,
  .own-action-slot .action-bar button.claim-choice {
    min-width: 168px;
    min-height: 68px;
    padding: 7px 10px;
  }

  .claim-effect-art.button-art {
    width: 88px;
    margin: -13px -12px -12px;
  }

  .action-bar button.claim-choice[data-claim="win"] .claim-effect-art.button-art,
  .action-bar button.claim-choice[data-claim="selfDraw"] .claim-effect-art.button-art {
    width: 120px;
    margin-inline: -15px;
  }

  .claim-label {
    font-size: 1.24rem;
  }

  .claim-tile-strip .tile.small {
    --tile-w: 32px;
    --tile-h: 44px;
  }

  .center-altar {
    inset: 0;
    width: auto;
    min-width: 0;
    min-height: 0;
    transform: none;
  }

  .center-altar .round-stone {
    top: 50%;
    left: 50%;
    width: clamp(132px, 31vw, 174px);
    min-height: 0;
    padding: 0;
    transform: translate(-50%, -50%);
  }

  .center-altar .wall-count span {
    font-size: .58rem;
  }

  .center-altar .wall-count strong {
    font-size: .98rem;
  }

  .center-action-home {
    top: calc(50% + clamp(88px, 24vw, 108px));
    width: min(440px, calc(100% - 20px));
  }

  .table-turn-orb {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    min-height: 30px;
    max-height: none;
    padding: 0;
    font-size: .72rem;
  }

  .center-altar .hub-turn-name {
    font-size: .82rem;
  }

  .center-altar .hub-turn-action {
    font-size: .64rem;
  }

  .center-altar .last-discard {
    min-height: 26px;
  }

  .center-altar .last-discard .tile {
    transform: scale(.46);
  }

  .player-line {
    padding: 2px 4px 2px 7px;
    gap: 6px;
  }

  .player-title {
    font-size: .9rem;
  }

  .wind-chip {
    min-width: 30px;
    min-height: 27px;
    padding: 3px 8px;
    font-size: .84rem;
  }
}
