:root {
  color-scheme: dark;
  --page-bg: #120d0a;
  --page-bg-deep: #090705;
  --wood: #3d281d;
  --wood-deep: #20130d;
  --wood-glow: #6f4a2e;
  --felt: #1f5638;
  --felt-deep: #123926;
  --felt-shadow: rgba(5, 25, 16, 0.82);
  --line-soft: rgba(231, 213, 177, 0.18);
  --line-strong: rgba(214, 177, 93, 0.55);
  --gold: #d8b56d;
  --gold-bright: #f2d79c;
  --text: #f4ead8;
  --muted: #b6a78d;
  --paper: #f7f1e3;
  --paper-edge: #dfd4bd;
  --card-shadow: 0 20px 34px rgba(0, 0, 0, 0.28);
  --black-card: #1b1917;
  --red-card: #ba312d;
  --panel: rgba(18, 12, 8, 0.72);
  --button-dark: linear-gradient(180deg, #45362a 0%, #221812 100%);
  --button-green: linear-gradient(180deg, #5a8e4f 0%, #214928 100%);
  --button-gold: linear-gradient(180deg, #ddb96f 0%, #94672f 100%);
  --shadow-heavy: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 16%, rgba(126, 85, 40, 0.18), transparent 18rem),
    radial-gradient(circle at 82% 14%, rgba(126, 85, 40, 0.14), transparent 16rem),
    linear-gradient(180deg, rgba(30, 20, 12, 0.94), rgba(7, 5, 4, 0.98)),
    linear-gradient(135deg, var(--page-bg), var(--page-bg-deep));
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(225, 205, 162, 0.24);
  border-radius: 18px;
  padding: 0 16px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(25, 16, 11, 0.9), rgba(12, 9, 7, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

input::placeholder {
  color: rgba(227, 214, 188, 0.52);
}

.eyebrow,
.brand-mark__subtitle,
.turn-banner__eyebrow,
.meta-chip__label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(229, 204, 146, 0.86);
}

.subtle {
  margin: 0;
  color: rgba(235, 225, 205, 0.72);
  line-height: 1.75;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark h1 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "Palatino Linotype", serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  color: #f3ddaf;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.32);
}

.brand-mark__seal {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 2rem;
  color: #1e160f;
  background: linear-gradient(180deg, #f0dcab 0%, #bd8f46 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 10px 24px rgba(0, 0, 0, 0.22);
}

.brand-mark--compact h1 {
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.brand-mark--compact .brand-mark__seal {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  font-size: 1.4rem;
}

.lobby-page {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.lobby-shell {
  width: min(1260px, 100%);
}

.lobby-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(420px, 560px);
  gap: 32px;
  padding: 48px;
  border-radius: 42px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgba(221, 185, 111, 0.14), transparent 16rem),
    linear-gradient(180deg, rgba(51, 33, 22, 0.92), rgba(17, 12, 9, 0.98));
  box-shadow: var(--shadow-heavy);
  border: 1px solid rgba(220, 189, 126, 0.16);
}

.lobby-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 30px;
  border: 1px solid rgba(223, 187, 112, 0.12);
  pointer-events: none;
}

.lobby-stage__glow {
  position: absolute;
  inset: auto 14% -10rem auto;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(213, 173, 100, 0.16), transparent 72%);
  filter: blur(24px);
  pointer-events: none;
}

.lobby-stage__hero {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 18px;
  padding-right: 18px;
}

.lobby-forms {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
}

.lobby-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid rgba(225, 205, 162, 0.14);
  border-radius: 20px;
  background: rgba(14, 10, 7, 0.7);
}

.lobby-panel__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.lobby-panel__header h2 {
  margin: 0;
  color: #f4e4bd;
  font-size: 1.25rem;
}

.lobby-panel__empty {
  margin: 0;
  color: rgba(233, 220, 193, 0.68);
}

.room-list,
.match-history {
  display: grid;
  gap: 10px;
}

.room-list__item,
.match-history__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(225, 205, 162, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.room-list__code {
  display: block;
  color: #f8e5b8;
  letter-spacing: 0.08em;
}

.room-list__meta,
.match-history__item span {
  color: rgba(233, 220, 193, 0.72);
  font-size: 0.9rem;
}

.room-list__join {
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: #e5c47d;
  color: #1e160f;
  font-weight: 700;
  cursor: pointer;
}

.match-history__score {
  min-width: 44px;
  text-align: right;
  color: #f8e5b8;
  font-weight: 700;
}

.form-block {
  display: grid;
  gap: 10px;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(225, 205, 162, 0.16);
  background: linear-gradient(180deg, rgba(24, 17, 12, 0.84), rgba(12, 9, 7, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.form-block--primary {
  background:
    radial-gradient(circle at top, rgba(82, 110, 65, 0.2), transparent 12rem),
    linear-gradient(180deg, rgba(24, 17, 12, 0.84), rgba(12, 9, 7, 0.94));
}

.form-block__header {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
}

.form-block__header h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", "Palatino Linotype", serif;
  font-size: 1.7rem;
  color: #f4e4bd;
}

.form-block label {
  color: rgba(233, 220, 193, 0.82);
  font-size: 0.92rem;
}

.table-page {
  padding: 0 8px 24px;
}

.table-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.table-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(38, 24, 16, 0.78), rgba(14, 9, 7, 0.88));
  border: 1px solid rgba(215, 180, 104, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

.table-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid rgba(221, 183, 107, 0.2);
  background: rgba(9, 8, 6, 0.35);
}

.meta-chip__value {
  font-size: 1rem;
  color: #f5ead2;
}

.table-topbar__status {
  display: flex;
  justify-content: flex-end;
}

.status-pill {
  min-width: 104px;
  padding: 12px 16px;
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
  color: #1e160f;
  background: linear-gradient(180deg, #f0d18c 0%, #b98740 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.24);
}

.table-stage {
  position: relative;
  display: grid;
  gap: 14px;
}

.turn-banner {
  display: grid;
  place-items: center;
  gap: 10px;
  pointer-events: none;
}

.turn-banner__frame {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: min(360px, calc(100vw - 44px));
  padding: 12px 24px 14px;
  border-radius: 28px;
  border: 1px solid rgba(226, 190, 114, 0.28);
  background:
    linear-gradient(180deg, rgba(84, 57, 34, 0.94), rgba(28, 18, 12, 0.96));
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.26);
}

.turn-banner__title {
  text-align: center;
  font-family: "STSong", "Songti SC", "Palatino Linotype", serif;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  color: #f9edcb;
}

.table-notice {
  min-height: 1.6rem;
  text-align: center;
  color: rgba(235, 224, 200, 0.78);
}

.table-toast {
  position: fixed;
  left: 50%;
  top: 104px;
  z-index: 40;
  min-width: min(460px, calc(100vw - 32px));
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 18px;
  transform: translateX(-50%);
  border: 1px solid rgba(238, 207, 141, 0.34);
  background: linear-gradient(180deg, rgba(45, 31, 20, 0.96), rgba(19, 12, 9, 0.98));
  color: #f8eed7;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.34);
  text-align: center;
  pointer-events: none;
}

.table-toast--info {
  border-color: rgba(214, 187, 129, 0.38);
}

.table-toast--warning {
  border-color: rgba(226, 178, 92, 0.62);
  box-shadow:
    0 22px 40px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(226, 178, 92, 0.18);
}

.table-toast--error {
  border-color: rgba(216, 105, 82, 0.7);
  box-shadow:
    0 22px 40px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(216, 105, 82, 0.22);
}

.table-toast__text {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
}

.table-frame {
  position: relative;
  min-height: 760px;
  padding: 16px;
}

.table-wood {
  position: relative;
  min-height: 100%;
  padding: 28px;
  border-radius: 72px;
  background:
    linear-gradient(180deg, rgba(98, 67, 43, 0.36), rgba(43, 26, 17, 0.12)),
    radial-gradient(circle at 50% 12%, rgba(123, 81, 45, 0.28), transparent 18rem),
    linear-gradient(180deg, #56392a 0%, #2f1d14 48%, #21140e 100%);
  box-shadow:
    inset 0 0 0 2px rgba(70, 42, 27, 0.9),
    inset 0 0 0 6px rgba(108, 75, 45, 0.34),
    inset 0 28px 50px rgba(255, 255, 255, 0.06),
    0 26px 40px rgba(0, 0, 0, 0.34);
}

.table-felt {
  position: relative;
  min-height: 700px;
  border-radius: 56px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(55, 122, 81, 0.48), transparent 28rem),
    radial-gradient(circle at 50% 46%, rgba(18, 57, 38, 0.18), transparent 38rem),
    linear-gradient(180deg, #255c3d 0%, #18462f 58%, #103322 100%);
  box-shadow:
    inset 0 0 0 3px rgba(215, 178, 103, 0.8),
    inset 0 0 0 7px rgba(24, 52, 34, 0.76),
    inset 0 14px 34px rgba(255, 255, 255, 0.04),
    inset 0 -18px 30px rgba(0, 0, 0, 0.24);
}

.table-felt::before {
  content: "";
  position: absolute;
  inset: 30px 52px;
  border-radius: 44px;
  border: 1px solid rgba(222, 191, 120, 0.08);
  pointer-events: none;
}

.called-card-display {
  position: absolute;
  top: 40px;
  left: 50%;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 10px;
  border-radius: 22px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(35, 24, 16, 0.94), rgba(18, 12, 8, 0.98));
  border: 1px solid rgba(227, 194, 122, 0.28);
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.24);
}

.called-card-display__meta {
  display: grid;
  gap: 3px;
}

.called-card-display__title {
  color: #f7e7be;
  font-family: "STSong", "Songti SC", serif;
  font-size: 1rem;
  font-weight: 700;
}

.called-card-display__subtitle {
  color: rgba(242, 228, 198, 0.68);
  font-size: 0.78rem;
  white-space: nowrap;
}

.called-card-display__face .card {
  cursor: default;
}

.seat {
  position: absolute;
  z-index: 2;
  overflow: visible;
}

.seat-top {
  top: 24px;
  left: 50%;
  width: min(620px, calc(100% - 180px));
  height: 152px;
  transform: translateX(-50%);
}

.seat-left {
  top: 50%;
  left: 22px;
  width: 220px;
  height: 430px;
  transform: translateY(-50%);
}

.seat-right {
  top: 50%;
  right: 22px;
  width: 220px;
  height: 430px;
  transform: translateY(-50%);
}

.seat-self {
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
}

.seat-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(31, 21, 15, 0.96), rgba(15, 10, 7, 0.96));
  border: 1px solid rgba(223, 188, 114, 0.3);
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.22);
}

.seat-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-family: "STSong", "Songti SC", serif;
  font-size: 1.1rem;
  color: #21170f;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.64), transparent 45%),
    linear-gradient(180deg, #f1d7a0 0%, #b28343 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    0 8px 16px rgba(0, 0, 0, 0.26);
}

.seat-copy {
  display: grid;
  gap: 4px;
}

.seat-name {
  max-width: 12ch;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 700;
  color: #fbf0d6;
}

.seat-meta {
  font-size: 0.88rem;
  color: rgba(239, 224, 194, 0.7);
}

.seat-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 3.2em;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 214, 122, 0.96), rgba(195, 130, 40, 0.96));
  color: #22160d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow:
    0 0 0 1px rgba(255, 236, 190, 0.45),
    0 8px 14px rgba(0, 0, 0, 0.22);
}

.seat-countdown.is-warning {
  background: linear-gradient(180deg, rgba(255, 180, 112, 0.98), rgba(176, 88, 30, 0.98));
  color: #fff4e4;
}

.seat.is-current .seat-badge {
  border-color: rgba(245, 214, 148, 0.68);
  box-shadow:
    0 0 0 1px rgba(245, 214, 148, 0.18),
    0 18px 32px rgba(0, 0, 0, 0.28);
}

.seat.is-ready .seat-meta {
  color: #d9c495;
}

.seat-status-pill {
  position: absolute;
  left: 50%;
  top: -12px;
  z-index: 3;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(77, 52, 31, 0.96), rgba(28, 18, 11, 0.96));
  border: 1px solid rgba(237, 202, 132, 0.36);
  color: #f7ead0;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
  white-space: nowrap;
  pointer-events: none;
}

.seat-cards {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seat-card-back {
  width: 46px;
  height: 68px;
  border: 1px solid #d4a854;
  border-radius: 5px;
  background-color: #0c1a3a;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(212, 168, 84, 0.55) 7px 8px),
    repeating-linear-gradient(-45deg, transparent 0 7px, rgba(212, 168, 84, 0.55) 7px 8px);
  box-shadow:
    inset 0 0 0 2px #0c1a3a,
    inset 0 0 0 3px #d4a854,
    inset 0 0 0 5px #0c1a3a,
    0 2px 5px rgba(0, 0, 0, 0.6);
  position: relative;
}

.seat-card-back::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px solid #d4a854;
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(212, 168, 84, 0.15) 0%, transparent 30%, transparent 70%, rgba(212, 168, 84, 0.15) 100%);
  pointer-events: none;
}

.seat-card-back::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 0.5px solid rgba(212, 168, 84, 0.6);
  border-radius: 2px;
  pointer-events: none;
}

.seat-top .seat-cards {
  position: absolute;
  left: 50%;
  top: 0;
  min-width: min(560px, 100%);
  margin-bottom: 0;
  transform: translateX(-50%);
}

.seat-top .seat-card-back + .seat-card-back {
  margin-left: -32px;
}

.seat-top .seat-badge {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

.seat-left .seat-cards,
.seat-right .seat-cards {
  position: absolute;
  flex-direction: column;
  min-height: 360px;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
}

.seat-left .seat-cards {
  left: 0;
}

.seat-right .seat-cards {
  right: 0;
}

.seat-left .seat-card-back + .seat-card-back,
.seat-right .seat-card-back + .seat-card-back {
  margin-top: -40px;
}

.seat-left .seat-badge,
.seat-right .seat-badge {
  position: absolute;
  top: 50%;
  margin-top: 0;
  transform: translateY(-50%);
}

.seat-left .seat-badge {
  left: 8px;
}

.seat-right .seat-badge {
  right: 8px;
}

.played-pile-shell {
  position: absolute;
  inset: 18% 18% 26%;
  z-index: 1;
  pointer-events: none;
}

.played-pile {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 440px;
  height: 240px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
}

.last-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}

.played-pile__stack {
  position: absolute;
  inset: 0;
}

.played-pile__card {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: var(--pile-card-opacity, 1);
  z-index: var(--pile-card-z, 1);
  transform:
    translate(-50%, -50%)
    translate(var(--pile-card-x, 0px), var(--pile-card-y, 0px))
    rotate(var(--pile-card-rotate, 0deg))
    scale(var(--pile-card-scale, 1));
  transform-origin: center center;
}

.played-pile .card.highlight,
.discard-cluster .card.highlight {
  z-index: 999;
  border-color: rgba(245, 208, 109, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.9),
    0 0 14px 4px rgba(245, 208, 109, 0.8),
    0 4px 10px rgba(0, 0, 0, 0.3);
}

.played-pile__label {
  position: absolute;
  left: calc(50% + 138px);
  top: calc(50% - 104px);
  transform: translate(-50%, -50%);
  padding: 7px 14px;
  border-radius: 999px;
  color: #fff2ca;
  background: rgba(73, 92, 43, 0.9);
  border: 1px solid rgba(241, 214, 143, 0.48);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.18);
  font-size: 0.84rem;
  white-space: nowrap;
}

.pile-group {
  position: absolute;
  left: 50%;
  top: 50%;
  transform:
    translate(-50%, -50%)
    translate(var(--pile-x, 0px), var(--pile-y, 0px))
    rotate(var(--pile-rotate, 0deg))
    scale(var(--pile-scale, 1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-right: 0;
  z-index: var(--pile-z, 1);
  opacity: var(--pile-opacity, 1);
}

.pile-group__cards {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pile-group__cards .card + .card {
  margin-left: -54px;
}

.pile-group__label {
  display: none;
}

.pile-group--latest {
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.22));
}

.pile-group--latest .card--pile {
  box-shadow:
    0 24px 34px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(243, 216, 157, 0.18);
}

.pile-group--latest .pile-group__label {
  display: inline-flex;
  position: absolute;
  left: calc(100% + 18px);
  top: 16px;
  transform: none;
  padding: 7px 14px;
  border-radius: 999px;
  color: #fff2ca;
  background: rgba(73, 92, 43, 0.9);
  border-color: rgba(241, 214, 143, 0.48);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(241, 214, 143, 0.48);
  font-size: 0.84rem;
  white-space: nowrap;
}

.hand-zone {
  position: relative;
  z-index: 4;
  display: grid;
  gap: 14px;
  margin-top: -84px;
}

.identity-actions,
.action-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hand-shelf {
  padding: 22px 28px 10px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(45, 29, 20, 0.58), rgba(17, 11, 8, 0.74));
  border: 1px solid rgba(224, 192, 121, 0.14);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.22);
}

.hand {
  min-height: 176px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 16px 32px 22px;
  overflow-x: auto;
  overflow-y: visible;
}

.hand::-webkit-scrollbar {
  height: 10px;
}

.hand::-webkit-scrollbar-thumb {
  background: rgba(221, 184, 107, 0.35);
  border-radius: 999px;
}

.hand .card {
  margin-left: calc(var(--fan-overlap, -28px));
  transform:
    translateY(var(--raise, 0px))
    rotate(var(--fan-rotate, 0deg));
  z-index: var(--fan-z, 1);
}

.hand .card:first-child {
  margin-left: 0;
}

.action-shelf {
  padding: 10px 0 2px;
}

.button {
  min-width: 142px;
  min-height: 64px;
  padding: 0 24px;
  border-radius: 22px;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: #f6ebd1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 14px 20px rgba(0, 0, 0, 0.22);
  transition: transform 0.08s ease, filter 0.08s ease;
}

.button:not(:disabled):active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.95);
}

.button--ghost {
  background: var(--button-dark);
  border: 1px solid rgba(225, 199, 148, 0.24);
}

.button--dark {
  background: var(--button-dark);
  border: 1px solid rgba(225, 199, 148, 0.24);
}

.button--primary {
  color: #28190d;
  background: var(--button-gold);
  border: 1px solid rgba(247, 224, 177, 0.52);
}

.button--hint,
.button--green {
  background: var(--button-green);
}

.card {
  position: relative;
  width: var(--card-width, 88px);
  height: var(--card-height, 128px);
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #fbf9f4 100%);
  color: var(--black-card);
  box-shadow:
    0 1.5px 3px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.06);
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  transform-origin: center bottom;
}

.card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.02);
  pointer-events: none;
}

.card::after {
  display: none;
}

.card.red {
  color: var(--red-card);
}

.card.card--image {
  overflow: hidden;
}

.card__face-image {
  width: 102%;
  height: 102%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
  pointer-events: none;
  user-select: none;
  transform: translate(-1%, -1%);
}

.card--pile {
  --card-width: 80px;
  --card-height: 116px;
}

.card.selected {
  --raise: -28px;
  border-color: rgba(245, 208, 109, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.9),
    0 0 12px 3px rgba(245, 208, 109, 0.75),
    0 12px 20px rgba(0, 0, 0, 0.25);
  filter: none;
}

.card--latest {
  border-color: rgba(245, 208, 109, 0.84);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.82),
    0 0 12px 3px rgba(245, 208, 109, 0.62),
    0 5px 12px rgba(0, 0, 0, 0.28);
}

.card--top {
  border-color: rgba(245, 208, 109, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.9),
    0 0 14px 4px rgba(245, 208, 109, 0.78),
    0 6px 14px rgba(0, 0, 0, 0.32);
}

.card__corner {
  position: absolute;
  left: 10px;
  top: 10px;
  display: grid;
  gap: 2px;
  justify-items: center;
  line-height: 1;
}

.card__corner--bottom {
  left: auto;
  top: auto;
  right: 10px;
  bottom: 10px;
  transform: rotate(180deg);
}

.card__rank {
  font-family: "Baskerville Old Face", "Palatino Linotype", serif;
  font-size: clamp(1.45rem, 1.9vw, 1.9rem);
  font-weight: 700;
}

.card__suit {
  font-size: 1rem;
}

.card__center {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 100%;
  height: 58%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.card__center-suit {
  position: absolute;
  inset: 50% auto auto 50%;
  font-size: clamp(2.4rem, 3.6vw, 3.4rem);
  line-height: 1;
  transform: translate(-50%, -50%);
}

.call-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.call-card-grid button {
  min-height: 52px;
  border-radius: 16px;
  color: #24170f;
  background: linear-gradient(180deg, #f6f0df 0%, #ddceb4 100%);
}

.hidden {
  display: none !important;
}

dialog {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid rgba(224, 189, 112, 0.22);
  border-radius: 28px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(51, 33, 22, 0.98), rgba(16, 11, 8, 0.98));
  box-shadow: 0 28px 40px rgba(0, 0, 0, 0.4);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

dialog h2 {
  margin: 0 0 12px;
  font-family: "STSong", "Songti SC", serif;
  color: #f4e3bd;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

@media (max-width: 1180px) {
  .table-frame {
    min-height: 680px;
  }

  .table-felt {
    min-height: 620px;
  }

  .called-card-display {
    top: 34px;
  }

  .seat-left,
  .seat-right {
    width: 188px;
    height: 360px;
  }

  .seat-top .seat-cards {
    min-width: 460px;
  }
}

@media (max-width: 900px) {
  .lobby-stage {
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }

  .table-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .table-topbar__status {
    justify-content: center;
  }

  .table-frame {
    min-height: 620px;
    padding: 10px;
  }

  .table-wood {
    padding: 18px;
    border-radius: 44px;
  }

  .table-felt {
    min-height: 560px;
    border-radius: 34px;
  }

  .called-card-display {
    top: 30px;
    gap: 10px;
    padding: 8px 10px 8px 8px;
  }

  .table-toast {
    top: 92px;
  }

  .seat-top {
    width: min(460px, calc(100% - 140px));
    height: 136px;
  }

  .seat-left,
  .seat-right {
    width: 164px;
    height: 300px;
  }

  .seat-top .seat-cards {
    min-width: 360px;
  }

  .seat-card-back {
    width: 38px;
    height: 58px;
  }

  .hand-zone {
    margin-top: -46px;
  }

  .hand {
    padding-inline: 12px;
  }

  .button {
    min-width: 122px;
    min-height: 58px;
  }
}

@media (max-width: 640px) {
  .table-page {
    padding-inline: 10px;
  }

  .lobby-stage {
    border-radius: 28px;
  }

  .brand-mark {
    gap: 12px;
  }

  .brand-mark__seal {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
  }

  .table-frame {
    min-height: 560px;
  }

  .table-wood {
    padding: 12px;
    border-radius: 28px;
  }

  .table-felt {
    min-height: 500px;
    border-radius: 24px;
  }

  .called-card-display {
    top: 22px;
    min-width: 0;
    max-width: calc(100% - 120px);
  }

  .table-toast {
    top: 78px;
    min-width: calc(100vw - 20px);
    padding: 12px 14px;
    border-radius: 14px;
  }

  .table-toast__text {
    font-size: 0.92rem;
  }

  .called-card-display__title {
    font-size: 0.9rem;
  }

  .called-card-display__subtitle {
    font-size: 0.72rem;
  }

  .table-felt::before {
    inset: 16px 20px;
    border-radius: 22px;
  }

  .seat-top {
    top: 12px;
    width: min(280px, calc(100% - 96px));
    height: 118px;
  }

  .seat-left {
    left: 10px;
    width: 132px;
    height: 226px;
  }

  .seat-right {
    right: 10px;
    width: 132px;
    height: 226px;
  }

  .seat-self {
    bottom: 12px;
  }

  .seat-badge {
    min-height: 56px;
    padding: 5px 10px 5px 6px;
  }

  .seat-avatar {
    width: 42px;
    height: 42px;
    font-size: 0.9rem;
  }

  .seat-name {
    font-size: 0.88rem;
    max-width: 8ch;
  }

  .seat-meta {
    font-size: 0.78rem;
  }

  .seat-top .seat-cards {
    min-width: 240px;
  }

  .seat-top .seat-card-back + .seat-card-back {
    margin-left: -26px;
  }

  .seat-left .seat-cards,
  .seat-right .seat-cards {
    min-height: 212px;
  }

  .seat-left .seat-card-back + .seat-card-back,
  .seat-right .seat-card-back + .seat-card-back {
    margin-top: -34px;
  }

  .played-pile-shell {
    inset: 22% 10% 30%;
  }

  .pile-group {
    padding-right: 0;
  }

  .pile-group__cards .card + .card {
    margin-left: -42px;
  }

  .card {
    --card-width: 68px;
    --card-height: 102px;
  }

  .card--pile {
    --card-width: 58px;
    --card-height: 86px;
  }

  .hand-zone {
    margin-top: -26px;
  }

  .hand-shelf {
    padding: 16px 10px 8px;
  }

  .hand {
    min-height: 144px;
    padding: 10px 6px 18px;
    justify-content: flex-start;
  }

  .hand .card {
    margin-left: calc(var(--fan-overlap, -22px));
  }

  .button {
    min-width: 112px;
    min-height: 52px;
    padding-inline: 18px;
    border-radius: 18px;
    font-size: 1.1rem;
  }
}

.match-summary {
  display: grid;
  gap: 10px;
  margin: 12px auto 18px;
  width: min(920px, 100%);
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(11, 31, 24, 0.78);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.match-summary__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.match-summary__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.7;
}

.match-summary__round {
  font-size: 1rem;
}

.match-scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.match-scoreboard__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.match-scoreboard__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-scoreboard__score {
  font-variant-numeric: tabular-nums;
}

.game-over-dialog menu {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.game-over-dialog h3 {
  margin: 14px 0 6px;
}

.game-over-dialog ol,
.game-over-dialog ul {
  margin: 0;
  padding-left: 20px;
}

@media (max-width: 720px) {
  .match-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.table-shell--reference {
  width: min(1520px, 100%);
  gap: 10px;
}

.table-shell--reference .table-topbar {
  grid-template-columns: auto auto 1fr auto;
  gap: 16px;
  min-height: 78px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid rgba(180, 138, 82, 0.24);
  border-radius: 0 0 24px 24px;
  background: linear-gradient(180deg, rgba(34, 22, 14, 0.88), rgba(17, 11, 8, 0.94));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.table-shell--reference .brand-mark {
  gap: 14px;
  min-width: 170px;
}

.table-shell--reference .brand-mark__seal {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.45rem;
}

.table-shell--reference .brand-mark h1 {
  font-size: clamp(1.8rem, 2vw, 2.4rem);
}

.table-shell--reference .brand-mark__subtitle {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
}

.table-shell--reference .table-meta {
  justify-content: flex-start;
  gap: 12px;
}

.table-shell--reference .meta-chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border-color: rgba(214, 176, 110, 0.26);
  background: rgba(15, 10, 8, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.table-shell--reference .meta-chip__label,
.table-shell--reference .meta-chip__value {
  color: rgba(245, 234, 210, 0.94);
  font-size: 0.98rem;
  letter-spacing: 0;
  text-transform: none;
}

.table-shell--reference .round-emblem {
  justify-self: center;
  position: relative;
  min-width: 258px;
  padding: 10px 26px 22px;
  text-align: center;
  font-family: "STSong", "Songti SC", serif;
  color: var(--gold-bright);
  isolation: isolate;
}

.table-shell--reference .round-emblem::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(101, 66, 35, 0.98), rgba(38, 24, 16, 0.98));
  border: 1px solid rgba(223, 190, 127, 0.24);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.26);
  clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
  pointer-events: none;
}

.table-shell--reference .round-emblem__index {
  display: block;
  position: relative;
  font-size: 1.18rem;
  line-height: 1.2;
}

.table-shell--reference .round-emblem__turn {
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  min-width: 124px;
  padding: 8px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #3f6537, #203a23);
  border: 1px solid rgba(243, 216, 157, 0.28);
  color: #f6e7b8;
  font-size: 1rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
  white-space: nowrap;
}

.table-shell--reference .table-topbar__status {
  justify-content: flex-end;
}

.table-shell--reference .status-panel {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 120px;
}

.table-shell--reference .status-panel__label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(229, 204, 146, 0.74);
}

.table-shell--reference .status-panel__value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  color: #1e160f;
  background: linear-gradient(180deg, #f0d18c 0%, #b98740 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.24);
}

.table-shell--reference .table-notice {
  min-height: 1.4rem;
  margin-top: 10px;
  text-align: center;
  color: rgba(235, 224, 200, 0.78);
}

.table-shell--reference .table-stage {
  position: relative;
  display: block;
}

.table-shell--reference .table-wrap {
  position: relative;
  width: 100%;
  height: 1028px;
  overflow: hidden;
}

.table-shell--reference .ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.table-shell--reference .lamp,
.table-shell--reference .teapot,
.table-shell--reference .cup,
.table-shell--reference .coin {
  position: absolute;
  border-radius: 50%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.3));
}

.table-shell--reference .lamp {
  left: 16px;
  top: 120px;
  width: 104px;
  height: 104px;
  background: radial-gradient(circle at 38% 38%, rgba(255, 227, 164, 0.96), rgba(212, 169, 83, 0.84) 36%, rgba(79, 49, 27, 0.86) 70%);
  box-shadow: 0 0 32px rgba(255, 223, 146, 0.18);
}

.table-shell--reference .teapot {
  right: 62px;
  top: 126px;
  width: 82px;
  height: 82px;
  background: radial-gradient(circle at 38% 32%, rgba(66, 62, 57, 0.96), rgba(24, 21, 18, 0.98) 70%);
}

.table-shell--reference .cup {
  width: 42px;
  height: 42px;
  background: radial-gradient(circle at 42% 38%, rgba(146, 104, 50, 0.92), rgba(63, 39, 21, 0.98) 74%);
}

.table-shell--reference .cup--top {
  right: 26px;
  top: 160px;
}

.table-shell--reference .cup--bottom {
  left: 0;
  bottom: 118px;
}

.table-shell--reference .coin {
  width: 34px;
  height: 34px;
  background: radial-gradient(circle at 34% 34%, rgba(255, 227, 160, 0.96), rgba(169, 118, 54, 0.98) 72%);
}

.table-shell--reference .coin--left {
  left: 54px;
  bottom: 128px;
}

.table-shell--reference .coin--right {
  right: 38px;
  bottom: 140px;
}

.table-shell--reference .table-frame {
  position: absolute;
  inset: 34px 8px 28px;
  border-radius: 122px;
  background: linear-gradient(145deg, #724b32 0%, #442c1d 24%, #2b1a12 72%, #603f2a 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 222, 164, 0.06),
    inset 0 26px 30px rgba(255, 214, 160, 0.06),
    inset 0 -24px 30px rgba(0, 0, 0, 0.28),
    0 28px 52px rgba(0, 0, 0, 0.36);
}

.table-shell--reference .table-felt {
  position: absolute;
  inset: 30px;
  border-radius: 98px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 215, 124, 0.08), transparent 56%),
    linear-gradient(180deg, #1d5e39, #14472d 72%, #103822);
  border: 4px solid rgba(209, 171, 93, 0.88);
  box-shadow:
    inset 0 0 0 6px rgba(255, 233, 173, 0.08),
    inset 0 0 0 22px rgba(13, 51, 31, 0.22);
}

.table-shell--reference .table-felt::before {
  content: "";
  position: absolute;
  inset: 34px 46px;
  border-radius: 78px;
  border: 1px solid rgba(222, 191, 120, 0.08);
  pointer-events: none;
}

.table-shell--reference .called-card-display {
  top: 24px;
  left: auto;
  right: 24px;
  gap: 16px;
  padding: 12px 16px 12px 12px;
  border-radius: 24px;
  transform: none;
  background: linear-gradient(180deg, rgba(35, 24, 16, 0.94), rgba(18, 12, 8, 0.98));
  border: 1px solid rgba(227, 194, 122, 0.28);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.24);
  z-index: 6;
}

.table-shell--reference .called-card-display__title {
  font-size: 1rem;
}

.table-shell--reference .called-card-display__subtitle {
  font-size: 0.8rem;
}

.table-shell--reference .called-card-display__face .card {
  --card-width: 84px;
  --card-height: 122px;
}

.table-shell--reference .seat {
  position: absolute;
  z-index: 4;
}

.table-shell--reference .seat--top {
  left: 50%;
  top: 84px;
  width: 760px;
  height: 182px;
  transform: translateX(-50%);
}

.table-shell--reference .seat--left {
  left: 4px;
  top: 236px;
  width: 216px;
  height: 452px;
}

.table-shell--reference .seat--right {
  right: 4px;
  top: 236px;
  width: 216px;
  height: 452px;
}

.table-shell--reference .seat--self {
  left: 50%;
  bottom: 92px;
  width: min(1280px, calc(100% - 120px));
  height: 318px;
  transform: translateX(-50%);
  z-index: 5;
}

.table-shell--reference .seat-cards {
  position: absolute;
  display: flex;
  align-items: flex-end;
}

.table-shell--reference .hand-fan--top {
  left: 50%;
  top: 0;
  width: 702px;
  justify-content: center;
  transform: translateX(-50%);
}

.table-shell--reference .hand-fan--left,
.table-shell--reference .hand-fan--right {
  top: 40px;
  flex-direction: column;
  height: 340px;
  justify-content: center;
}

.table-shell--reference .hand-fan--left {
  left: 32px;
}

.table-shell--reference .hand-fan--right {
  right: 32px;
}

.table-shell--reference .seat-card-back {
  width: 54px;
  height: 82px;
  border-radius: 10px;
  border: 1px solid rgba(216, 186, 132, 0.44);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 28%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #4f463f, #2f2a26);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.26);
}

.table-shell--reference .hand-fan--top .seat-card-back + .seat-card-back {
  margin-left: -22px;
}

.table-shell--reference .hand-fan--left .seat-card-back + .seat-card-back,
.table-shell--reference .hand-fan--right .seat-card-back + .seat-card-back {
  margin-top: -28px;
}

.table-shell--reference .seat-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 146px;
  min-height: 62px;
  padding: 8px 14px 8px 8px;
  border-radius: 18px;
  background: rgba(19, 12, 8, 0.88);
  border: 1px solid rgba(205, 164, 86, 0.28);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.table-shell--reference .seat-badge--top {
  left: 50%;
  top: 88px;
  transform: translateX(-50%);
}

.table-shell--reference .seat-badge--left {
  left: 6px;
  top: 180px;
}

.table-shell--reference .seat-badge--right {
  right: 6px;
  top: 180px;
}

.table-shell--reference .seat-badge--self {
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  min-width: 160px;
}

.table-shell--reference .seat-avatar {
  width: 58px;
  height: 58px;
  font-size: 1.1rem;
}

.table-shell--reference .seat-name {
  max-width: 12ch;
}

.table-shell--reference .seat-meta {
  color: rgba(247, 218, 150, 0.92);
}

.table-shell--reference .seat-status-pill {
  top: -10px;
  min-width: 62px;
  padding: 4px 11px;
  font-size: 0.76rem;
}

.table-shell--reference .discard-cluster {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 640px;
  height: 420px;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}

.table-shell--reference .played-pile,
.table-shell--reference .last-play,
.table-shell--reference .played-pile__stack {
  position: absolute;
  inset: 0;
}

.table-shell--reference .played-pile__card {
  transform:
    translate(-50%, -50%)
    translate(var(--pile-card-x, 0px), var(--pile-card-y, 0px))
    rotate(var(--pile-card-rotate, 0deg))
    scale(var(--pile-card-scale, 1));
}

.table-shell--reference .played-pile__label,
.table-shell--reference .pile-group__label {
  display: none !important;
}

.table-shell--reference .hand {
  min-height: 0;
  padding: 0;
}

.table-shell--reference .self-hand {
  position: absolute;
  left: 50%;
  bottom: 154px;
  width: min(1280px, 100%);
  height: 204px;
  overflow: visible;
  transform: translateX(-50%);
}

.table-shell--reference .self-hand .card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 96px;
  height: 152px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.2);
  transform:
    translate(-50%, -50%)
    translate(var(--hand-x, 0px), calc(var(--hand-y, 0px) + var(--hand-selected-lift, 0px)))
    rotate(var(--hand-rotate, 0deg));
  z-index: var(--hand-z, 1);
}

.table-shell--reference .self-hand .card.selected {
  border-color: rgba(245, 208, 109, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.9),
    0 0 12px 3px rgba(245, 208, 109, 0.75),
    0 12px 20px rgba(0, 0, 0, 0.25);
}

.table-shell--reference .action-row {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: min(1468px, calc(100% - 24px));
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  transform: translateX(-50%);
  z-index: 7;
}

.table-shell--reference .action-group {
  display: flex;
  gap: 14px;
  align-items: center;
}

.table-shell--reference .action-group--utility {
  position: absolute;
  left: 24px;
  bottom: 0;
}

.table-shell--reference .action-group--main {
  justify-content: center;
  flex: 0 0 auto;
}

.table-shell--reference .identity-actions {
  justify-content: center;
  gap: 12px;
}

.table-shell--reference .button {
  min-width: 212px;
  min-height: 82px;
  padding: 0 30px;
  border-radius: 18px;
  font-size: 1.22rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 14px 24px rgba(0, 0, 0, 0.22);
}

.table-shell--reference .button--utility {
  min-width: 156px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 0.96rem;
}

.table-shell--reference .button--ghost,
.table-shell--reference .button--dark {
  background: linear-gradient(180deg, #45362b, #221814);
  border: 1px solid rgba(224, 190, 118, 0.24);
  color: #f6ead3;
}

.table-shell--reference .button--primary {
  background: linear-gradient(180deg, #ddb96f, #9c6d30);
  border: 1px solid rgba(244, 220, 170, 0.52);
  color: #24170d;
}

.table-shell--reference .button--green,
.table-shell--reference .button--hint {
  background: linear-gradient(180deg, #5c8f4c, #244829);
  border: 1px solid rgba(224, 190, 118, 0.24);
  color: #fbf0ce;
}

.table-shell--reference .card {
  width: 110px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #fbf9f4 100%);
  box-shadow:
    0 1.5px 3px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.06);
  transform-origin: center center;
}

.table-shell--reference .card::before {
  inset: 3px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.table-shell--reference .card__corner {
  left: 10px;
  top: 10px;
}

.table-shell--reference .card__corner--bottom {
  right: 10px;
  bottom: 10px;
}

.table-shell--reference .card__rank {
  font-size: 2rem;
}

.table-shell--reference .card__suit {
  font-size: 1.18rem;
}

.table-shell--reference .card__center-suit {
  font-size: 2.2rem;
}

.table-shell--reference .card--pile {
  width: 110px;
  height: 160px;
}

.table-shell--reference .card--latest {
  border-color: rgba(245, 208, 109, 0.84);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.82),
    0 0 12px 3px rgba(245, 208, 109, 0.62),
    0 5px 12px rgba(0, 0, 0, 0.28);
}

.table-shell--reference .card--top {
  border-color: rgba(245, 208, 109, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.9),
    0 0 14px 4px rgba(245, 208, 109, 0.78),
    0 6px 14px rgba(0, 0, 0, 0.32);
}

.table-shell--reference .match-summary {
  width: min(1080px, calc(100% - 40px));
  margin: 2px auto 0;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(11, 31, 24, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.16);
}

.table-shell--reference .match-scoreboard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.table-shell--reference .match-scoreboard__row {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 1360px) {
  .table-shell--reference .table-wrap {
    height: 980px;
  }

  .table-shell--reference .seat--self {
    width: min(1180px, calc(100% - 120px));
    bottom: 92px;
  }

  .table-shell--reference .self-hand {
    width: min(1180px, 100%);
    bottom: 148px;
  }

  .table-shell--reference .action-row {
    width: min(1320px, calc(100% - 24px));
  }
}

@media (max-width: 1100px) {
  .table-shell--reference .table-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 14px 18px 18px;
  }

  .table-shell--reference .table-meta,
  .table-shell--reference .table-topbar__status {
    justify-content: center;
  }

  .table-shell--reference .table-wrap {
    height: 900px;
  }

  .table-shell--reference .table-frame {
    inset: 34px 0 52px;
  }

  .table-shell--reference .table-felt {
    inset: 24px;
    border-radius: 72px;
  }

  .table-shell--reference .seat--top {
    width: min(620px, calc(100% - 140px));
  }

  .table-shell--reference .seat--left,
  .table-shell--reference .seat--right {
    top: 258px;
    width: 180px;
    height: 360px;
  }

  .table-shell--reference .discard-cluster {
    width: 520px;
    height: 340px;
  }

  .table-shell--reference .self-hand {
    width: min(960px, calc(100% - 40px));
    bottom: 148px;
  }

  .table-shell--reference .action-row {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    bottom: 18px;
  }

  .table-shell--reference .action-group--utility {
    position: static;
  }

  .table-shell--reference .action-group--main {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .table-shell--reference .table-wrap {
    height: 780px;
  }

  .table-shell--reference .table-frame {
    inset: 26px 0 110px;
    border-radius: 72px;
  }

  .table-shell--reference .table-felt {
    inset: 18px;
    border-radius: 48px;
  }

  .table-shell--reference .called-card-display {
    top: 188px;
    max-width: calc(100% - 48px);
  }

  .table-shell--reference .seat--top {
    top: 70px;
    width: min(360px, calc(100% - 90px));
    height: 150px;
  }

  .table-shell--reference .seat--left,
  .table-shell--reference .seat--right {
    top: 250px;
    width: 132px;
    height: 250px;
  }

  .table-shell--reference .hand-fan--top {
    width: 340px;
  }

  .table-shell--reference .hand-fan--left,
  .table-shell--reference .hand-fan--right {
    height: 220px;
  }

  .table-shell--reference .seat-card-back {
    width: 38px;
    height: 58px;
  }

  .table-shell--reference .discard-cluster {
    width: 360px;
    height: 260px;
    top: 48%;
  }

  .table-shell--reference .card,
  .table-shell--reference .card--pile {
    width: 74px;
    height: 108px;
    border-radius: 12px;
  }

  .table-shell--reference .card__rank {
    font-size: 1.55rem;
  }

  .table-shell--reference .card__suit {
    font-size: 0.96rem;
  }

  .table-shell--reference .card__center-suit {
    font-size: 1.7rem;
  }

  .table-shell--reference .seat--self {
    width: calc(100% - 28px);
    height: 248px;
    bottom: 36px;
  }

  .table-shell--reference .self-hand {
    width: calc(100% - 12px);
    height: 144px;
    bottom: 112px;
  }

  .table-shell--reference .self-hand .card {
    width: 70px;
    height: 112px;
  }

  .table-shell--reference .button {
    min-width: 132px;
    min-height: 56px;
    font-size: 1.06rem;
  }

  .table-shell--reference .button--utility {
    min-width: 112px;
    min-height: 44px;
    font-size: 0.86rem;
  }

  .table-shell--reference .match-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Reference table layout v2: align the live room with the approved visual direction. */
.table-page {
  background:
    radial-gradient(circle at 10% 12%, rgba(137, 91, 48, 0.18), transparent 14rem),
    radial-gradient(circle at 88% 10%, rgba(137, 91, 48, 0.14), transparent 16rem),
    linear-gradient(180deg, #1f140d 0%, #090605 100%);
}

.table-shell--reference {
  width: min(1540px, 100%);
  padding: 0 0 18px;
}

.table-shell--reference .table-topbar {
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 92px;
  padding: 10px 18px 8px;
  border: 0;
  border-bottom: 1px solid rgba(164, 122, 67, 0.24);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(33, 22, 14, 0.94), rgba(17, 11, 8, 0.96));
  box-shadow:
    inset 0 -1px 0 rgba(255, 224, 165, 0.05),
    0 18px 28px rgba(0, 0, 0, 0.28);
}

.table-shell--reference .brand-mark--hero {
  display: grid;
  gap: 2px;
  justify-items: start;
  min-width: 230px;
}

.table-shell--reference .brand-mark__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.table-shell--reference .brand-mark__cn {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(2.5rem, 2.9vw, 3.35rem);
  line-height: 1;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fde9a8 0%, #d4a838 50%, #8a6018 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
}

.table-shell--reference .brand-mark__stamp {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 0.92rem;
  line-height: 1;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 68px;
  padding: 7px 5px;
  margin-bottom: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ae3f1b 0%, #7d1e0f 52%, #511108 100%);
  border: 1px solid rgba(254, 215, 132, 0.88);
  color: #f5df9d;
  text-shadow:
    0 1px 0 rgba(84, 27, 10, 0.72),
    0 0 6px rgba(0, 0, 0, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 231, 182, 0.26),
    0 8px 16px rgba(0, 0, 0, 0.24);
}

.table-shell--reference .brand-mark__subtitle {
  margin: 0;
  color: rgba(239, 213, 154, 0.86);
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.table-shell--reference .table-meta--hero {
  gap: 14px;
}

.table-shell--reference .meta-chip {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  background: rgba(22, 14, 10, 0.84);
  border: 1px solid rgba(213, 173, 106, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 18px rgba(0, 0, 0, 0.16);
}

.table-shell--reference .meta-chip__label,
.table-shell--reference .meta-chip__value {
  color: rgba(250, 238, 214, 0.96);
  font-size: 1rem;
}

.table-shell--reference .round-emblem {
  min-width: 290px;
  padding: 10px 34px 18px;
  font-size: 1.22rem;
  letter-spacing: 0;
}

.table-shell--reference .round-emblem::before {
  background:
    linear-gradient(180deg, rgba(112, 74, 40, 0.98), rgba(47, 28, 17, 0.98));
  border-color: rgba(223, 190, 127, 0.32);
}

.table-shell--reference .round-emblem__index {
  font-size: 1.6rem;
}

.table-shell--reference .round-emblem__turn {
  bottom: -22px;
  min-width: 144px;
  padding: 10px 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #4c7a40, #234125);
  font-size: 1.12rem;
}

.table-shell--reference .table-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.table-shell--reference .table-tool {
  display: grid;
  gap: 6px;
  justify-items: center;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: rgba(245, 230, 192, 0.96);
  font: inherit;
  font-size: 0.94rem;
  cursor: default;
  padding: 0;
}

.table-shell--reference .table-tool__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(230, 197, 125, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 1.1rem;
}

.table-shell--reference .status-panel--inline {
  gap: 6px;
  min-width: 94px;
  margin-left: 8px;
}

.table-shell--reference .status-panel--inline .status-panel__label {
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.78rem;
}

.table-shell--reference .status-panel--inline .status-panel__value {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 0.96rem;
}

.table-shell--reference .table-notice {
  min-height: 24px;
  margin: 10px 0 0;
  color: rgba(236, 222, 195, 0.82);
  font-size: 0.98rem;
}

.table-shell--reference .rules-panel,
.table-shell--reference .settings-panel {
  position: absolute;
  top: 92px;
  right: max(18px, calc((100vw - min(1500px, 100%)) / 2 + 18px));
  z-index: 45;
  width: min(430px, calc(100vw - 28px));
  padding: 20px 22px 22px;
  border-radius: 24px;
  border: 1px solid rgba(238, 201, 121, 0.36);
  background:
    radial-gradient(circle at 18% 10%, rgba(213, 168, 84, 0.18), transparent 9rem),
    linear-gradient(180deg, rgba(47, 29, 17, 0.98), rgba(15, 10, 8, 0.98));
  box-shadow:
    0 24px 50px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.table-shell--reference .settings-panel {
  width: min(390px, calc(100vw - 28px));
}

.table-shell--reference .rules-panel::before,
.table-shell--reference .settings-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(238, 207, 141, 0.13);
  pointer-events: none;
}

.table-shell--reference .rules-panel__header,
.table-shell--reference .settings-panel__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.table-shell--reference .rules-panel__eyebrow,
.table-shell--reference .settings-panel__eyebrow {
  margin: 0 0 4px;
  color: rgba(238, 204, 138, 0.78);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.table-shell--reference .rules-panel h2,
.table-shell--reference .settings-panel h2 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 1.72rem;
  color: #f9e6ae;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.34);
}

.table-shell--reference .rules-panel__close,
.table-shell--reference .settings-panel__close,
.table-shell--reference .chat-popover__close,
.table-shell--reference .emoji-popover__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(229, 190, 112, 0.3);
  background: rgba(18, 11, 8, 0.68);
  color: #f8e6bd;
  font-size: 1.2rem;
}

.table-shell--reference .rules-panel__list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.35rem;
  color: rgba(250, 239, 214, 0.9);
  line-height: 1.62;
  font-size: 0.95rem;
}

.table-shell--reference .rules-panel__list li::marker {
  color: #e4bd65;
  font-weight: 800;
}

.table-shell--reference .settings-panel__list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.table-shell--reference .settings-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(229, 190, 112, 0.18);
  background: rgba(12, 8, 6, 0.36);
}

.table-shell--reference .settings-option input {
  width: 20px;
  min-height: 20px;
  accent-color: #d4a854;
}

.table-shell--reference .settings-option strong,
.table-shell--reference .settings-option small {
  display: block;
}

.table-shell--reference .settings-option strong {
  color: #f8e7bd;
  font-size: 0.98rem;
}

.table-shell--reference .settings-option small {
  margin-top: 3px;
  color: rgba(246, 231, 199, 0.66);
  line-height: 1.45;
}

.table-shell--reference .table-wrap {
  height: min(980px, calc(100vh - 132px));
  min-height: 820px;
  padding-top: 6px;
}

.table-shell--reference .shadow {
  position: absolute;
  pointer-events: none;
  filter: blur(12px);
  opacity: 0.7;
}

.table-shell--reference .shadow--left {
  left: -26px;
  top: 116px;
  width: 190px;
  height: 188px;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.38), transparent 72%);
}

.table-shell--reference .shadow--right {
  right: -22px;
  top: 116px;
  width: 204px;
  height: 176px;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.34), transparent 72%);
}

.table-shell--reference .lamp {
  left: 0;
  top: 168px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 40%, rgba(255, 228, 166, 0.98), rgba(212, 165, 80, 0.88) 34%, rgba(82, 51, 29, 0.92) 72%);
  box-shadow:
    0 0 40px rgba(255, 223, 146, 0.14),
    0 16px 26px rgba(0, 0, 0, 0.34);
}

.table-shell--reference .teapot {
  right: 54px;
  top: 176px;
  width: 94px;
  height: 94px;
}

.table-shell--reference .cup--top {
  right: 10px;
  top: 212px;
}

.table-shell--reference .cup--bottom {
  left: -2px;
  bottom: 194px;
}

.table-shell--reference .coin--left {
  left: 122px;
  bottom: 82px;
}

.table-shell--reference .coin--right {
  right: 44px;
  bottom: 92px;
}

.table-shell--reference .table-frame {
  inset: 22px 0 40px;
  border-radius: 142px;
  background:
    linear-gradient(145deg, #775035 0%, #452b1c 23%, #24150f 74%, #67462f 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 231, 182, 0.06),
    inset 0 28px 40px rgba(255, 214, 160, 0.05),
    inset 0 -28px 38px rgba(0, 0, 0, 0.3),
    0 30px 60px rgba(0, 0, 0, 0.42);
}

.table-shell--reference .table-felt {
  inset: 28px;
  border-radius: 112px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 214, 128, 0.1), transparent 54%),
    radial-gradient(circle at 50% 50%, rgba(38, 121, 77, 0.28), transparent 60%),
    linear-gradient(180deg, #1c5f3c 0%, #12452d 72%, #103822 100%);
  border: 4px solid rgba(209, 171, 93, 0.92);
  box-shadow:
    inset 0 0 0 2px rgba(255, 236, 181, 0.34),
    inset 0 0 0 10px rgba(14, 56, 33, 0.26),
    inset 0 0 0 26px rgba(10, 46, 29, 0.12);
}

.table-shell--reference .table-felt::before {
  inset: 24px 34px;
  border-radius: 92px;
  border-color: rgba(228, 196, 124, 0.1);
}

.table-shell--reference .called-card-display {
  top: 24px;
  padding: 10px 14px 10px 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(33, 23, 16, 0.95), rgba(18, 12, 9, 0.98));
}

.table-shell--reference .called-card-display__face .card {
  --card-width: 82px;
  --card-height: 120px;
}

.table-shell--reference .seat--top {
  top: 8px;
  width: 780px;
  height: 188px;
}

.table-shell--reference .seat--left {
  left: 8px;
  top: 212px;
  width: 218px;
  height: 428px;
}

.table-shell--reference .seat--right {
  right: 8px;
  top: 212px;
  width: 218px;
  height: 428px;
}

.table-shell--reference .seat--self {
  bottom: 40px;
  width: min(1360px, calc(100% - 70px));
  height: 304px;
}

.table-shell--reference .hand-fan--top {
  width: 760px;
  top: 0;
}

.table-shell--reference .hand-fan--left,
.table-shell--reference .hand-fan--right {
  top: 36px;
  height: 324px;
}

.table-shell--reference .hand-fan--left {
  left: 66px;
}

.table-shell--reference .hand-fan--right {
  right: 66px;
}

.table-shell--reference .seat-card-back {
  width: 60px;
  height: 92px;
  border-radius: 6px;
}

.table-shell--reference .hand-fan--top .seat-card-back + .seat-card-back {
  margin-left: -24px;
}

.table-shell--reference .hand-fan--left .seat-card-back + .seat-card-back,
.table-shell--reference .hand-fan--right .seat-card-back + .seat-card-back {
  margin-top: -30px;
}

.table-shell--reference .seat-badge {
  gap: 12px;
  min-width: 154px;
  min-height: 64px;
  padding: 8px 14px 8px 8px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(35, 26, 20, 0.94), rgba(14, 10, 8, 0.96));
  border: 1px solid rgba(212, 171, 95, 0.32);
}

.table-shell--reference .seat-badge--top {
  top: 52px;
}

.table-shell--reference .seat-badge--left {
  left: 18px;
  top: 160px;
}

.table-shell--reference .seat-badge--right {
  right: 18px;
  top: 160px;
}

.table-shell--reference .seat-badge--self {
  bottom: 4px;
  min-width: 170px;
}

.table-shell--reference .seat-avatar {
  width: 68px;
  height: 68px;
  border: 2px solid rgba(239, 214, 150, 0.86);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 241, 215, 0.82), rgba(132, 114, 112, 0.38) 30%, rgba(41, 45, 54, 0.96) 76%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    0 12px 18px rgba(0, 0, 0, 0.28);
  color: #f7ebcf;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.45rem;
}

.table-shell--reference .seat-copy {
  gap: 4px;
}

.table-shell--reference .seat-name {
  font-size: 0.98rem;
  color: #fff3d8;
}

.table-shell--reference .seat-meta {
  font-size: 0.92rem;
}

.table-shell--reference .seat-countdown {
  font-size: 0.82rem;
}

.table-shell--reference .discard-cluster {
  top: 38%;
  width: 440px;
  height: 240px;
  z-index: 6;
}

.table-shell--reference .played-pile {
  position: absolute;
  left: 50%;
  top: 38%;
  inset: auto;
  width: 440px;
  height: 240px;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
}

.table-shell--reference .last-play {
  position: absolute;
  left: 50%;
  top: 50%;
  inset: auto;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}

.table-shell--reference .played-pile__stack {
  position: absolute;
  inset: 0;
}

.table-shell--reference .discard-cluster::before {
  content: none;
}

.table-shell--reference .played-pile__card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: var(--pile-card-z, 1);
  opacity: var(--pile-card-opacity, 1);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
}

.table-shell--reference .card {
  width: 116px;
  height: 168px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #fbf9f4 100%);
  box-shadow:
    0 1.5px 3px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.06);
}

.table-shell--reference .card::before {
  inset: 3px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.table-shell--reference .card__rank {
  font-family: "Baskerville Old Face", "Palatino Linotype", serif;
  font-size: 2.12rem;
  font-weight: 700;
}

.table-shell--reference .card__suit {
  font-size: 1.2rem;
}

.table-shell--reference .card__center-suit {
  font-size: 2.32rem;
}

.table-shell--reference .card--pile {
  width: 62px;
  height: 88px;
  border-radius: 6px;
}

.table-shell--reference .card--pile .card__rank {
  font-size: 1rem;
}

.table-shell--reference .card--pile .card__suit {
  font-size: 0.7rem;
}

.table-shell--reference .card--pile .card__center-suit {
  font-size: 1rem;
}

.table-shell--reference .card--latest {
  border-color: rgba(245, 208, 109, 0.84);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.82),
    0 0 12px 3px rgba(245, 208, 109, 0.62),
    0 5px 12px rgba(0, 0, 0, 0.28);
}

.table-shell--reference .card--top,
.table-shell--reference .self-hand .card.selected {
  border-color: rgba(245, 208, 109, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(245, 208, 109, 0.9),
    0 0 14px 4px rgba(245, 208, 109, 0.78),
    0 8px 18px rgba(0, 0, 0, 0.32);
}

.table-shell--reference .self-hand {
  bottom: 86px;
  width: min(1320px, calc(100% - 20px));
  height: 190px;
}

.table-shell--reference .self-hand .card {
  width: 102px;
  height: 158px;
  transform:
    translate(-50%, -50%)
    translate(var(--hand-x, 0px), calc(var(--hand-y, 0px) + var(--hand-selected-lift, 0px)))
    rotate(var(--hand-rotate, 0deg));
}

.table-shell--reference .action-row {
  bottom: 8px;
  width: min(1508px, calc(100% - 22px));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 20px;
}

.table-shell--reference .action-side {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 70px;
}

.table-shell--reference .action-side--left {
  justify-content: flex-start;
  padding-left: 14px;
}

.table-shell--reference .action-side--right {
  justify-content: flex-end;
  padding-right: 14px;
}

.table-shell--reference .action-main {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.table-shell--reference .action-group {
  align-items: center;
}

.table-shell--reference .action-group--utility {
  gap: 12px;
}

.table-shell--reference .action-group--main {
  gap: 14px;
}

.table-shell--reference .identity-actions {
  gap: 12px;
}

.table-shell--reference .mini-chip {
  min-height: 56px;
  padding: 0 22px;
  border-radius: 16px;
  border: 1px solid rgba(213, 174, 104, 0.24);
  background: rgba(22, 15, 11, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 20px rgba(0, 0, 0, 0.22);
  color: #ead8aa;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  white-space: nowrap;
}

.table-shell--reference .mini-chip__icon {
  font-size: 1.2rem;
  line-height: 1;
}

.table-shell--reference .chat-popover {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 14px);
  z-index: 48;
  width: min(360px, calc(100vw - 28px));
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(238, 201, 121, 0.38);
  background:
    radial-gradient(circle at 18% 0%, rgba(80, 126, 72, 0.18), transparent 8rem),
    linear-gradient(180deg, rgba(42, 27, 18, 0.98), rgba(14, 10, 8, 0.98));
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.table-shell--reference .chat-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #f8e7bd;
  font-family: "STSong", "Songti SC", serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.table-shell--reference .chat-log {
  display: grid;
  align-content: start;
  gap: 8px;
  height: 190px;
  overflow: auto;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(229, 190, 112, 0.16);
  background: rgba(10, 7, 5, 0.48);
}

.table-shell--reference .chat-log__empty {
  margin: auto;
  color: rgba(246, 231, 199, 0.56);
  text-align: center;
  line-height: 1.55;
}

.table-shell--reference .chat-message {
  display: grid;
  gap: 3px;
  justify-items: start;
}

.table-shell--reference .chat-message--self {
  justify-items: end;
}

.table-shell--reference .chat-message--pending .chat-message__body {
  opacity: 0.74;
}

.table-shell--reference .chat-message__name {
  color: rgba(246, 231, 199, 0.58);
  font-size: 0.76rem;
}

.table-shell--reference .chat-message__body {
  max-width: 88%;
  padding: 8px 11px;
  border-radius: 14px;
  color: #fff5da;
  background: linear-gradient(180deg, rgba(85, 121, 61, 0.72), rgba(39, 70, 35, 0.86));
  border: 1px solid rgba(218, 190, 115, 0.24);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.table-shell--reference .chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 10px;
}

.table-shell--reference .chat-form input {
  min-height: 42px;
  border-radius: 14px;
  padding-inline: 12px;
}

.table-shell--reference .chat-form button {
  min-width: 64px;
  border-radius: 14px;
  border: 1px solid rgba(229, 190, 112, 0.3);
  background: linear-gradient(180deg, #ddb96f 0%, #94672f 100%);
  color: #211408;
  font-weight: 800;
}

.table-shell--reference .chat-form .chat-voice-button {
  min-width: 72px;
  background: linear-gradient(180deg, #45362b 0%, #221814 100%);
  color: #f6ead3;
}

.table-shell--reference .chat-form .chat-voice-button.is-active {
  border-color: rgba(246, 217, 151, 0.7);
  background: linear-gradient(180deg, #5c8f4c 0%, #244829 100%);
  color: #fff1c8;
  box-shadow:
    0 0 0 1px rgba(246, 217, 151, 0.16),
    0 0 16px rgba(93, 143, 76, 0.28);
}

.table-shell--reference .emoji-popover {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 14px);
  z-index: 48;
  width: min(360px, calc(100vw - 28px));
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(238, 201, 121, 0.38);
  background:
    radial-gradient(circle at 18% 0%, rgba(212, 168, 84, 0.18), transparent 8rem),
    linear-gradient(180deg, rgba(42, 27, 18, 0.98), rgba(14, 10, 8, 0.98));
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.table-shell--reference .emoji-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #f8e7bd;
  font-family: "STSong", "Songti SC", serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.table-shell--reference .emoji-picker {
  width: 100%;
  height: 330px;
  --background: #17100c;
  --border-color: rgba(229, 190, 112, 0.2);
  --button-hover-background: rgba(212, 168, 84, 0.18);
  --button-active-background: rgba(212, 168, 84, 0.28);
  --category-emoji-padding: 0.35rem;
  --emoji-size: 1.32rem;
  --indicator-color: #d4a854;
  --input-border-color: rgba(229, 190, 112, 0.26);
  --input-font-color: #f8ecd0;
  --input-placeholder-color: rgba(248, 236, 208, 0.48);
  --num-columns: 8;
  --outline-color: #f4d184;
  --text-color: #f8ecd0;
}

.table-shell--reference .emoji-fallback {
  display: none;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.table-shell--reference .emoji-popover--fallback .emoji-picker {
  display: none;
}

.table-shell--reference .emoji-popover--fallback .emoji-fallback {
  display: grid;
}

.table-shell--reference .emoji-fallback button {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(229, 190, 112, 0.22);
  background: rgba(12, 8, 6, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 1.3rem;
}

.table-shell--reference .action-row.is-my-turn {
  filter: drop-shadow(0 0 18px rgba(255, 220, 120, 0.34));
}

.table-shell--reference .seat-emoji-burst {
  position: absolute;
  left: 50%;
  bottom: 104px;
  z-index: 12;
  display: grid;
  place-items: center;
  min-width: 76px;
  min-height: 76px;
  padding: 10px 14px;
  border-radius: 28px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 230, 150, 0.74);
  background:
    radial-gradient(circle at 50% 25%, rgba(255, 248, 208, 0.36), transparent 3.2rem),
    linear-gradient(180deg, rgba(57, 34, 18, 0.95), rgba(17, 10, 7, 0.95));
  box-shadow:
    0 0 0 2px rgba(255, 248, 208, 0.18),
    0 0 30px rgba(255, 213, 100, 0.46),
    0 18px 32px rgba(0, 0, 0, 0.42);
  font-size: 2.5rem;
  pointer-events: none;
}

.table-shell--reference .seat-emoji-burst--pop {
  animation: emoji-burst-pop 1.8s cubic-bezier(.18, .9, .22, 1) both;
}

.is-reduce-motion .table-shell--reference *,
.is-reduce-motion .table-shell--reference *::before,
.is-reduce-motion .table-shell--reference *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
}

@keyframes emoji-burst-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.68) rotate(-8deg);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.12) rotate(3deg);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -16px) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scale(0.9) rotate(6deg);
  }
}

.table-shell--reference .mini-chip--info {
  justify-content: center;
  min-width: 176px;
  background:
    linear-gradient(180deg, rgba(22, 16, 12, 0.96), rgba(16, 11, 8, 0.96));
}

.table-shell--reference .button {
  min-width: 210px;
  min-height: 74px;
  padding: 0 30px;
  border-radius: 20px;
  font-family: "STSong", "Songti SC", serif;
  font-size: 1.26rem;
  letter-spacing: 0;
}

.table-shell--reference .button--utility {
  min-width: 148px;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 0.98rem;
}

.table-shell--reference .button--ghost,
.table-shell--reference .button--dark {
  background: linear-gradient(180deg, #474037 0%, #1f1814 100%);
  color: #f8ebcc;
}

.table-shell--reference .button--hint {
  background: linear-gradient(180deg, #5a8f4e 0%, #214224 100%);
  border-color: rgba(233, 204, 144, 0.24);
  color: #fbefca;
}

.table-shell--reference .button--primary {
  background: linear-gradient(180deg, #ddb96f 0%, #9a6c31 100%);
  color: #26180e;
}

.table-shell--reference .button:disabled {
  opacity: 0.44;
  filter: saturate(0.7);
}

.table-shell--reference .action-row--waiting .action-main {
  display: none;
}

.table-shell--reference .action-row--waiting .action-side--right {
  opacity: 0.72;
}

.table-shell--reference .seat--self.is-empty-hand {
  height: 220px;
}

.table-shell--reference .seat--self.is-empty-hand .seat-badge--self {
  bottom: 20px;
}

.table-shell--reference .seat--self.is-empty-hand .self-hand {
  display: none;
}

.table-shell--reference .match-summary {
  display: none;
}

.seat-score {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(212, 168, 84, 0.18), rgba(70, 44, 18, 0.42));
  border: 1px solid rgba(212, 168, 84, 0.42);
  color: #f5d27a;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.seat-score.is-positive { color: #ffe699; }
.seat-score.is-negative { color: #ff9c8b; border-color: rgba(255, 156, 139, 0.42); }

.table-shell--reference .hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .table-shell--reference .table-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .table-shell--reference .table-wrap {
    height: 1020px;
  }

  .table-shell--reference .table-frame {
    inset: 34px 0 94px;
  }

  .table-shell--reference .seat--top {
    width: min(760px, calc(100% - 160px));
  }

  .table-shell--reference .seat--self {
    width: calc(100% - 44px);
  }

  .table-shell--reference .self-hand {
    width: calc(100% - 60px);
  }

  .table-shell--reference .action-row {
    width: calc(100% - 24px);
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 14px;
  }

  .table-shell--reference .rules-panel {
    top: 154px;
    right: 12px;
  }

  .table-shell--reference .settings-panel {
    top: 154px;
    right: 12px;
  }

  .table-shell--reference .action-side--left,
  .table-shell--reference .action-side--right {
    justify-content: center;
    padding: 0;
  }

  .table-shell--reference .chat-popover,
  .table-shell--reference .emoji-popover {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 820px) {
  .table-shell--reference .table-wrap {
    height: 840px;
  }

  .table-shell--reference .table-frame {
    inset: 34px 0 134px;
    border-radius: 88px;
  }

  .table-shell--reference .table-felt {
    inset: 20px;
    border-radius: 66px;
  }

  .table-shell--reference .seat--top {
    top: 74px;
    width: min(420px, calc(100% - 100px));
    height: 156px;
  }

  .table-shell--reference .seat--left,
  .table-shell--reference .seat--right {
    top: 250px;
    width: 150px;
    height: 286px;
  }

  .table-shell--reference .discard-cluster {
    width: 420px;
    height: 240px;
  }

  .table-shell--reference .played-pile {
    width: 420px;
    height: 240px;
  }

  .table-shell--reference .card,
  .table-shell--reference .card--pile {
    width: 76px;
    height: 112px;
  }

  .table-shell--reference .self-hand {
    bottom: 112px;
    height: 158px;
  }

  .table-shell--reference .self-hand .card {
    width: 72px;
    height: 116px;
  }

  .table-shell--reference .button {
    min-width: 146px;
    min-height: 58px;
    font-size: 1.05rem;
  }

  .table-shell--reference .mini-chip {
    min-height: 46px;
    padding: 0 16px;
    font-size: 0.9rem;
  }

  .table-shell--reference .match-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-height: 780px) and (min-width: 960px) {
  .table-shell--reference .table-topbar {
    min-height: 78px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .table-shell--reference .brand-mark__cn {
    font-size: 2.35rem;
  }

  .table-shell--reference .brand-mark__stamp {
    min-height: 58px;
    font-size: 0.82rem;
  }

  .table-shell--reference .round-emblem {
    min-width: 250px;
    padding: 8px 28px 14px;
  }

  .table-shell--reference .round-emblem__index {
    font-size: 1.36rem;
  }

  .table-shell--reference .round-emblem__turn {
    min-width: 128px;
    padding: 8px 16px;
    font-size: 1rem;
  }

  .table-shell--reference .table-notice {
    margin-top: 6px;
  }

  .table-shell--reference .table-wrap {
    height: 650px;
    min-height: 650px;
  }

  .table-shell--reference .table-frame {
    inset: 10px 0 16px;
    border-radius: 108px;
  }

  .table-shell--reference .table-felt {
    inset: 18px;
    border-radius: 84px;
  }

  .table-shell--reference .table-felt::before {
    inset: 18px 28px;
    border-radius: 68px;
  }

  .table-shell--reference .lamp {
    top: 104px;
    width: 96px;
    height: 96px;
  }

  .table-shell--reference .teapot {
    top: 112px;
    width: 78px;
    height: 78px;
  }

  .table-shell--reference .cup--top {
    top: 138px;
  }

  .table-shell--reference .cup--bottom {
    bottom: 118px;
  }

  .table-shell--reference .seat--top {
    top: 18px;
    width: 640px;
    height: 132px;
  }

  .table-shell--reference .seat--left,
  .table-shell--reference .seat--right {
    top: 146px;
    width: 154px;
    height: 276px;
  }

  .table-shell--reference .seat--self {
    bottom: 18px;
    height: 208px;
  }

  .table-shell--reference .hand-fan--top {
    width: 610px;
  }

  .table-shell--reference .hand-fan--left,
  .table-shell--reference .hand-fan--right {
    top: 24px;
    height: 214px;
  }

  .table-shell--reference .hand-fan--left {
    left: 44px;
  }

  .table-shell--reference .hand-fan--right {
    right: 44px;
  }

  .table-shell--reference .seat-card-back {
    width: 44px;
    height: 68px;
    border-radius: 5px;
  }

  .table-shell--reference .hand-fan--top .seat-card-back + .seat-card-back {
    margin-left: -18px;
  }

  .table-shell--reference .hand-fan--left .seat-card-back + .seat-card-back,
  .table-shell--reference .hand-fan--right .seat-card-back + .seat-card-back {
    margin-top: -22px;
  }

  .table-shell--reference .seat-badge {
    min-width: 138px;
    min-height: 56px;
    gap: 10px;
    padding: 6px 12px 6px 6px;
  }

  .table-shell--reference .seat-badge--top {
    top: 62px;
  }

  .table-shell--reference .seat-badge--left,
  .table-shell--reference .seat-badge--right {
    top: 118px;
  }

  .table-shell--reference .seat-badge--self {
    bottom: 0;
  }

  .table-shell--reference .seat-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .table-shell--reference .seat-name {
    font-size: 0.9rem;
  }

  .table-shell--reference .seat-meta {
    font-size: 0.82rem;
  }

  .table-shell--reference .discard-cluster {
    top: 40%;
    width: 440px;
    height: 240px;
  }

  .table-shell--reference .played-pile {
    top: 40%;
    width: 440px;
    height: 240px;
  }

  .table-shell--reference .discard-cluster::before {
    content: none;
  }

  .table-shell--reference .card,
  .table-shell--reference .card--pile {
    width: 84px;
    height: 122px;
    border-radius: 8px;
  }

  .table-shell--reference .card::before {
    inset: 3px;
    border-radius: 5px;
  }

  .table-shell--reference .card__corner {
    left: 8px;
    top: 8px;
  }

  .table-shell--reference .card__corner--bottom {
    right: 8px;
    bottom: 8px;
  }

  .table-shell--reference .card__rank {
    font-size: 1.72rem;
  }

  .table-shell--reference .card__suit {
    font-size: 1rem;
  }

  .table-shell--reference .card__center-suit {
    font-size: 1.8rem;
  }

  .table-shell--reference .self-hand {
    bottom: 56px;
    height: 128px;
    width: min(1120px, calc(100% - 40px));
  }

  .table-shell--reference .self-hand .card {
    width: 78px;
    height: 118px;
  }

  .table-shell--reference .action-row {
    bottom: -2px;
    gap: 12px;
  }

  .table-shell--reference .rules-panel {
    top: 168px;
    max-height: calc(100vh - 190px);
    overflow: auto;
  }

  .table-shell--reference .settings-panel {
    top: 168px;
    max-height: calc(100vh - 190px);
    overflow: auto;
  }

  .table-shell--reference .chat-popover,
  .table-shell--reference .emoji-popover {
    width: min(330px, calc(100vw - 24px));
  }

  .table-shell--reference .chat-log {
    height: 150px;
  }

  .table-shell--reference .emoji-picker {
    height: 280px;
    --num-columns: 7;
  }

  .table-shell--reference .action-side {
    min-height: 54px;
    gap: 10px;
  }

  .table-shell--reference .mini-chip {
    min-height: 42px;
    padding: 0 16px;
    font-size: 0.9rem;
  }

  .table-shell--reference .button {
    min-width: 152px;
    min-height: 56px;
    padding: 0 20px;
    font-size: 1rem;
    border-radius: 16px;
  }

  .table-shell--reference .button--utility {
    min-width: 124px;
    min-height: 42px;
    font-size: 0.88rem;
  }

  .table-shell--reference .seat--self.is-empty-hand {
    height: 164px;
  }

  .table-shell--reference .seat--self.is-empty-hand .seat-badge--self {
    bottom: 8px;
  }

  .table-shell--reference .match-summary {
    width: min(1040px, calc(100% - 32px));
    padding: 10px 14px;
  }
}

#played-pile.played-pile.discard-cluster {
  position: absolute;
  inset: auto;
  left: 50%;
  top: 38%;
  right: auto;
  bottom: auto;
  width: 440px;
  height: 240px;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
}

#last-play.last-play {
  position: absolute;
  inset: auto;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}

@media (max-width: 820px) {
  #played-pile.played-pile.discard-cluster {
    width: 420px;
    height: 240px;
  }
}

@media (max-height: 780px) and (min-width: 960px) {
  #played-pile.played-pile.discard-cluster {
    top: 40%;
  }
}

.seat-card-back,
.table-shell--reference .seat-card-back {
  background-color: #0c1a3a;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(212, 168, 84, 0.55) 7px 8px),
    repeating-linear-gradient(-45deg, transparent 0 7px, rgba(212, 168, 84, 0.55) 7px 8px);
  border: 1px solid #d4a854;
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 2px #0c1a3a,
    inset 0 0 0 3px #d4a854,
    inset 0 0 0 5px #0c1a3a,
    0 2px 5px rgba(0, 0, 0, 0.6);
  position: relative;
}

.seat-card-back::before,
.table-shell--reference .seat-card-back::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px solid #d4a854;
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(212, 168, 84, 0.15) 0%, transparent 30%, transparent 70%, rgba(212, 168, 84, 0.15) 100%);
  pointer-events: none;
}

.seat-card-back::after,
.table-shell--reference .seat-card-back::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 0.5px solid rgba(212, 168, 84, 0.6);
  border-radius: 2px;
  pointer-events: none;
}

/* ---------- auth pages (login / register) ---------- */
.auth-stage {
  grid-template-columns: 1fr;
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 36px;
}

.auth-stage .lobby-stage__hero {
  padding-right: 0;
  text-align: center;
  justify-items: center;
}

.auth-stage .brand-mark {
  justify-content: center;
}

.auth-stage .form-block {
  padding: 26px 24px;
}

.form-error {
  color: #f5b7b1;
  background: rgba(186, 49, 45, 0.18);
  border: 1px solid rgba(186, 49, 45, 0.38);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.form-help {
  color: rgba(232, 220, 192, 0.6);
  font-size: 0.82rem;
  margin: -2px 0 4px;
}

.form-help[data-tone="success"] {
  color: #cde7aa;
}

.form-help[data-tone="warning"],
.form-help--warning {
  color: #f2c078;
}

.verify-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.verify-row__button {
  min-width: 128px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.form-block button[type="submit"] {
  margin-top: 10px;
  padding: 13px 18px;
  border: none;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #1e160f;
  cursor: pointer;
  background: linear-gradient(180deg, #f0d18c 0%, #b98740 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 8px 18px rgba(0, 0, 0, 0.25);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.form-block button[type="submit"]:hover {
  filter: brightness(1.05);
}

.form-block button[type="submit"]:active {
  transform: translateY(1px);
}

.form-block input[type="text"],
.form-block input[type="email"],
.form-block input[type="password"] {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(225, 205, 162, 0.22);
  background: rgba(12, 9, 7, 0.7);
  color: #f4e4bd;
  font-size: 0.96rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-block input[type="text"]:focus,
.form-block input[type="email"]:focus,
.form-block input[type="password"]:focus {
  border-color: rgba(241, 215, 156, 0.55);
  box-shadow: 0 0 0 3px rgba(241, 215, 156, 0.12);
}

@media (max-width: 640px) {
  .verify-row {
    grid-template-columns: 1fr;
  }

  .verify-row__button {
    width: 100%;
  }
}

.auth-footer-link {
  margin-top: 4px;
  text-align: center;
  font-size: 0.92rem;
  color: rgba(232, 220, 192, 0.7);
}

.auth-footer-link a {
  color: #f1d79c;
  text-decoration: none;
  border-bottom: 1px dashed rgba(241, 215, 156, 0.5);
  padding-bottom: 1px;
}

.auth-footer-link a:hover {
  color: #f6e3b4;
  border-bottom-style: solid;
}

/* ---------- lobby user bar (greeting + logout) ---------- */
.lobby-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(12, 9, 7, 0.55);
  border: 1px solid rgba(225, 205, 162, 0.14);
}

.lobby-user-bar__greet {
  color: rgba(232, 220, 192, 0.85);
  font-size: 0.92rem;
}

.lobby-user-bar__greet strong {
  color: #f4e4bd;
  font-weight: 600;
}

.lobby-user-bar__form {
  margin: 0;
}

.lobby-user-bar__logout {
  border: 1px solid rgba(225, 205, 162, 0.22);
  background: transparent;
  color: rgba(232, 220, 192, 0.78);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lobby-user-bar__logout:hover {
  background: rgba(225, 205, 162, 0.1);
  color: #f4e4bd;
}

/* logout form wrapping the exit button on the room page */
.table-tool-form {
  margin: 0;
  padding: 0;
  display: contents;
}
