:root {
  --felt: #14382f;
  --felt-deep: #0a211e;
  --ink: #1e1912;
  --paper: #f8edd8;
  --paper-soft: #efe0c3;
  --gold: #d9a441;
  --gold-soft: #f1d58c;
  --cinnabar: #c94a33;
  --jade: #2f8f7b;
  --night: #0d1617;
  --muted: #9f927b;
  --line: rgba(255, 238, 200, 0.18);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --card-w: clamp(50px, 5vw, 76px);
  --card-h: clamp(72px, 7.1vw, 108px);
  --card-overlap: clamp(-32px, -2.3vw, -20px);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--paper);
  font-family: "LXGW WenKai", "STKaiti", "KaiTi", "Songti SC", Georgia, serif;
  background:
    linear-gradient(135deg, rgba(201, 74, 51, 0.16), transparent 32%),
    radial-gradient(circle at 72% 16%, rgba(217, 164, 65, 0.2), transparent 28%),
    radial-gradient(circle at 18% 90%, rgba(47, 143, 123, 0.18), transparent 30%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 8px),
    var(--felt-deep);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: clamp(8px, 1.2vw, 18px);
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 16px;
  max-width: 1540px;
  margin: 0 auto;
  width: 100%;
}

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

.seal {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(241, 213, 140, 0.6);
  border-radius: 50%;
  color: var(--gold-soft);
  background:
    linear-gradient(145deg, rgba(201, 74, 51, 0.78), rgba(87, 25, 19, 0.8)),
    var(--cinnabar);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  font-size: 22px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 42px);
  letter-spacing: 0;
  line-height: 1;
}

.brand p {
  margin: 4px 0 0;
  color: var(--gold-soft);
  font-size: 14px;
}

.round-strip {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid rgba(241, 213, 140, 0.32);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--paper);
  background: rgba(10, 33, 30, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.pill strong {
  color: var(--gold-soft);
  font-weight: 700;
}

.version-pill {
  color: rgba(248, 237, 216, 0.72);
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-button,
.primary-button,
.danger-button {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    opacity 160ms ease;
}

.sound-button {
  min-width: 78px;
}

.music-next-button {
  min-width: 86px;
}

.ghost-button {
  border: 1px solid rgba(241, 213, 140, 0.34);
  background: rgba(248, 237, 216, 0.08);
}

.primary-button {
  color: #20150e;
  background: linear-gradient(180deg, #f3d782, #d69d35);
  box-shadow: 0 12px 26px rgba(217, 164, 65, 0.24);
}

.danger-button {
  background: linear-gradient(180deg, #dc674e, #a93828);
}

.ghost-button:hover,
.primary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(220px, 290px) minmax(640px, 1fr) minmax(250px, 340px);
  gap: 16px;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
}

.side-rail,
.rule-rail {
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 35%),
    rgba(8, 26, 24, 0.72);
  box-shadow: var(--shadow);
  overflow: auto;
}

.rail-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.rail-section:last-child {
  border-bottom: 0;
}

.rail-section h2,
.rail-section h3 {
  margin: 0 0 10px;
  color: var(--gold-soft);
  font-size: 17px;
  font-weight: 700;
}

.score-number {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 2px 0 10px;
}

.score-number strong {
  color: var(--paper);
  font-size: 46px;
  line-height: 0.95;
}

.score-number span {
  color: var(--muted);
}

.meter {
  height: 12px;
  border: 1px solid rgba(241, 213, 140, 0.2);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  transition: width 260ms ease;
}

.small-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.team-list {
  display: grid;
  gap: 8px;
}

.team-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 238, 200, 0.1);
}

.team-row:last-child {
  border-bottom: 0;
}

.team-row b {
  color: var(--gold-soft);
}

.team-row span {
  text-align: right;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(241, 213, 140, 0.18);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.segment-button {
  min-height: 32px;
  border-radius: 6px;
  color: rgba(248, 237, 216, 0.78);
  background: transparent;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.segment-button:hover {
  color: var(--paper);
  background: rgba(248, 237, 216, 0.08);
}

.segment-button.active {
  color: #20150e;
  background: linear-gradient(180deg, #f4d883, #d9a441);
  box-shadow: 0 8px 18px rgba(217, 164, 65, 0.2);
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.log-entry {
  color: rgba(248, 237, 216, 0.86);
  font-size: 13px;
  line-height: 1.45;
}

.table-shell {
  position: relative;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(241, 213, 140, 0.34);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.035), transparent 58%),
    linear-gradient(180deg, rgba(5, 18, 17, 0.02), rgba(5, 18, 17, 0.18)),
    url("./assets/images/dunhuang-ornate-table.png");
  background-size: 100% 100%, 100% 100%, 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow:
    inset 0 0 0 10px rgba(241, 213, 140, 0.035),
    var(--shadow);
  overflow: hidden;
}

.table-shell::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(241, 213, 140, 0.07);
  border-radius: 16px;
  pointer-events: none;
}

.seat {
  position: absolute;
  z-index: 2;
  min-width: 150px;
  color: var(--paper);
}

.seat-north {
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
}

.seat-west {
  top: 36%;
  left: 18px;
}

.seat-east {
  top: 36%;
  right: 18px;
}

.seat-south {
  left: 22px;
  right: 22px;
  bottom: 12px;
}

.seat-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--gold-soft);
  font-size: 14px;
}

.turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.seat.is-turn .turn-dot {
  background: var(--cinnabar);
  box-shadow: 0 0 0 5px rgba(201, 74, 51, 0.18);
}

.seat-role {
  padding: 2px 7px;
  border-radius: 999px;
  color: #26170b;
  background: var(--gold-soft);
  font-size: 12px;
}

.hidden-hand {
  display: flex;
  justify-content: center;
  min-height: 38px;
}

.seat-west .hidden-hand,
.seat-east .hidden-hand {
  width: 150px;
  flex-wrap: wrap;
}

.card-back {
  width: 26px;
  height: 38px;
  margin-left: -13px;
  border: 1px solid rgba(241, 213, 140, 0.34);
  border-radius: 5px;
  background:
    linear-gradient(135deg, transparent 42%, rgba(241, 213, 140, 0.24) 42% 58%, transparent 58%),
    linear-gradient(45deg, transparent 42%, rgba(241, 213, 140, 0.18) 42% 58%, transparent 58%),
    #8f2d24;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

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

.center-stage {
  position: absolute;
  inset: 112px 178px 230px;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  align-items: center;
}

.message-board {
  align-self: start;
  border: 1px solid rgba(241, 213, 140, 0.28);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: rgba(3, 17, 16, 0.5);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.03);
}

.message-board h2 {
  margin: 0 0 4px;
  color: var(--gold-soft);
  font-size: 19px;
}

.message-board p {
  margin: 0;
  color: rgba(248, 237, 216, 0.84);
  line-height: 1.5;
}

.trick-mat {
  position: relative;
  min-height: 260px;
}

.trick-pile {
  position: absolute;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 132px;
  min-height: 94px;
  align-content: center;
}

.trick-pile .pile-name {
  color: rgba(248, 237, 216, 0.72);
  font-size: 12px;
}

.trick-pile.has-play .pile-name {
  display: none;
}

.pile-cards {
  display: flex;
  justify-content: center;
  min-height: 76px;
}

.pile-north {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.pile-south {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.pile-west {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.pile-east {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 42px;
}

.hand-wrap {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.human-toolbar {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 18px;
  color: rgba(248, 237, 216, 0.78);
  font-size: 13px;
}

.human-hand {
  display: flex;
  justify-content: center;
  align-items: end;
  min-height: calc(var(--card-h) + 20px);
  padding: 0 8px 4px;
}

.playing-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: var(--card-w);
  height: var(--card-h);
  aspect-ratio: 5 / 7;
  flex: 0 0 var(--card-w);
  margin-left: var(--card-overlap);
  border: 1px solid rgba(30, 25, 18, 0.22);
  border-radius: 8px;
  padding: 7px;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 28%, rgba(217, 164, 65, 0.12), transparent 34%),
    linear-gradient(180deg, #fff9ed, var(--paper-soft));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.64);
  cursor: default;
  transform-origin: bottom center;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease;
}

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

.human-hand .playing-card {
  cursor: pointer;
}

.human-hand .playing-card:hover {
  transform: translateY(-10px);
}

.playing-card.selected {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(217, 164, 65, 0.28),
    0 18px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-18px);
}

.playing-card.trump {
  background:
    linear-gradient(180deg, rgba(255, 249, 237, 0.95), rgba(241, 213, 140, 0.78)),
    var(--paper);
}

.playing-card.banned {
  border-color: var(--cinnabar);
  box-shadow:
    0 0 0 3px rgba(201, 74, 51, 0.24),
    0 10px 28px rgba(0, 0, 0, 0.3);
}

.playing-card.red {
  color: #b72e22;
}

.playing-card.joker {
  color: #1c1915;
  background:
    radial-gradient(circle at center, rgba(201, 74, 51, 0.16), transparent 45%),
    linear-gradient(180deg, #fff9ed, #e9d7b5);
}

.card-rank {
  align-self: start;
  font-size: clamp(16px, 2vw, 23px);
  font-weight: 800;
  line-height: 1;
}

.card-suit {
  place-self: center;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
}

.card-foot {
  align-self: end;
  display: flex;
  justify-content: space-between;
  align-items: end;
  min-height: 16px;
  color: rgba(30, 25, 18, 0.76);
  font-size: 11px;
}

.card-badge {
  border-radius: 999px;
  padding: 1px 5px;
  color: #fff8df;
  background: var(--cinnabar);
}

.mini-card {
  --card-w: 42px;
  --card-h: 60px;
  margin-left: -16px;
}

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

.table-card {
  --card-w: clamp(46px, 4vw, 58px);
  --card-h: clamp(65px, 5.7vw, 82px);
  margin-left: -18px;
  padding: 6px;
  border-radius: 7px;
}

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

.table-card .card-rank {
  font-size: clamp(18px, 2vw, 24px);
}

.table-card .card-suit {
  font-size: clamp(24px, 2.8vw, 32px);
}

.table-card .card-foot {
  min-height: 14px;
  font-size: 10px;
}

.bury-preview {
  display: flex;
  min-height: 66px;
  align-items: center;
}

.rule-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-list li {
  padding-left: 14px;
  border-left: 2px solid rgba(217, 164, 65, 0.58);
  color: rgba(248, 237, 216, 0.86);
  font-size: 14px;
  line-height: 1.45;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 238, 200, 0.1);
  color: rgba(248, 237, 216, 0.82);
  font-size: 13px;
}

.last-trick {
  display: grid;
  gap: 10px;
}

.last-trick-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(248, 237, 216, 0.82);
  font-size: 13px;
}

.last-trick-head strong {
  color: var(--gold-soft);
}

.last-trick-grid {
  display: grid;
  gap: 8px;
}

.last-play {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 6px;
  border: 1px solid rgba(241, 213, 140, 0.12);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.13);
}

.last-play.winner {
  border-color: rgba(217, 164, 65, 0.48);
  background: rgba(217, 164, 65, 0.1);
}

.last-play b {
  color: var(--gold-soft);
  font-size: 13px;
}

.last-play-cards {
  display: flex;
  min-height: 44px;
  align-items: center;
  overflow: hidden;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.score-fly {
  position: fixed;
  z-index: 30;
  top: 48%;
  left: 50%;
  display: grid;
  justify-items: center;
  min-width: 94px;
  padding: 8px 12px;
  border: 1px solid rgba(241, 213, 140, 0.56);
  border-radius: 999px;
  color: #20150e;
  background: linear-gradient(180deg, #fff2b1, #d9a441);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  pointer-events: none;
  animation: scoreFly 980ms cubic-bezier(0.2, 0.72, 0.18, 1) forwards;
}

.score-fly span {
  font-size: 11px;
  line-height: 1;
}

.score-fly strong {
  font-size: 24px;
  line-height: 1;
}

.summary-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at center, rgba(217, 164, 65, 0.14), transparent 38%),
    rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(5px);
}

.summary-panel {
  width: min(560px, 94vw);
  border: 1px solid rgba(241, 213, 140, 0.42);
  border-radius: 14px;
  padding: 24px;
  color: var(--paper);
  background:
    linear-gradient(180deg, rgba(20, 56, 47, 0.96), rgba(7, 24, 23, 0.98)),
    var(--felt);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.52);
  animation: panelIn 240ms ease-out both;
}

.summary-kicker {
  color: var(--gold-soft);
  font-size: 14px;
}

.summary-panel h2 {
  margin: 6px 0 6px;
  color: var(--gold-soft);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.summary-panel p {
  margin: 0 0 18px;
  color: rgba(248, 237, 216, 0.82);
}

.summary-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
}

.summary-score span {
  color: var(--muted);
}

.summary-score strong {
  color: var(--gold-soft);
  font-size: 54px;
  line-height: 0.85;
}

.summary-score em {
  color: rgba(248, 237, 216, 0.68);
  font-style: normal;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.summary-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(241, 213, 140, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.summary-grid b {
  color: var(--gold-soft);
  font-size: 13px;
}

.summary-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--gold-soft);
}

.summary-bottom div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.rotate-hint {
  display: none;
}

.rotate-card {
  width: min(360px, 86vw);
  padding: 26px;
  border: 1px solid rgba(241, 213, 140, 0.42);
  border-radius: 14px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(20, 56, 47, 0.98), rgba(8, 30, 27, 0.98)),
    var(--felt);
  box-shadow: var(--shadow);
}

.rotate-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  color: #20150e;
  background: linear-gradient(180deg, #f3d782, #d69d35);
  font-size: 34px;
}

.rotate-card h2 {
  margin: 0 0 8px;
  color: var(--gold-soft);
}

.rotate-card p {
  margin: 0;
  color: rgba(248, 237, 216, 0.82);
  line-height: 1.5;
}

.play-pop {
  animation: playPop 210ms cubic-bezier(0.18, 0.84, 0.22, 1.16) both;
}

@keyframes playPop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.86) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes scoreFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.82);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -34%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50vw + 132px), -210px) scale(0.72);
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .topbar,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .round-strip {
    justify-content: flex-start;
  }

  .side-rail,
  .rule-rail {
    height: auto;
    min-height: auto;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-shell {
    height: auto;
    min-height: 780px;
  }
}

@media (min-width: 1181px) and (max-height: 820px) {
  :root {
    --card-w: clamp(44px, 4.6vw, 66px);
    --card-h: clamp(63px, 6.5vw, 94px);
    --card-overlap: clamp(-29px, -2.1vw, -18px);
  }

  .app-shell {
    gap: 8px;
    padding: 8px 14px;
  }

  .seal {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .brand h1 {
    font-size: clamp(25px, 2.2vw, 34px);
  }

  .brand p {
    font-size: 12px;
  }

  .pill {
    padding: 6px 10px;
  }

  .ghost-button,
  .primary-button,
  .danger-button {
    min-height: 36px;
    padding: 7px 12px;
  }

  .rail-section {
    padding: 12px 14px;
  }

  .rule-list {
    gap: 7px;
  }

  .rule-list li {
    font-size: 13px;
    line-height: 1.35;
  }

  .log-list {
    max-height: 190px;
  }

  .center-stage {
    inset: 92px 158px 204px;
  }

  .message-board {
    padding: 10px 12px;
  }

  .message-board h2 {
    font-size: 17px;
  }

  .message-board p {
    font-size: 14px;
  }

  .trick-mat {
    min-height: 210px;
  }

  .seat-north {
    top: 10px;
  }

  .seat-west,
  .seat-east {
    top: 35%;
  }

  .seat-south {
    bottom: 8px;
  }

  .table-card {
    --card-w: clamp(42px, 3.7vw, 54px);
    --card-h: clamp(60px, 5.2vw, 76px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .brand h1 {
    font-size: 28px;
  }

  .table-shell {
    min-height: 720px;
    border-radius: 12px;
  }

  .center-stage {
    inset: 98px 20px 220px;
  }

  .seat-west,
  .seat-east {
    top: 44%;
  }

  .seat-west {
    left: 8px;
  }

  .seat-east {
    right: 8px;
  }

  .seat-south {
    left: 8px;
    right: 8px;
  }

  .human-hand {
    justify-content: flex-start;
    overflow-x: auto;
    padding-left: 24px;
  }

  .playing-card {
    margin-left: -24px;
  }

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

@media (max-width: 1180px) and (orientation: landscape) {
  :root {
    --card-w: clamp(40px, 5.4vw, 58px);
    --card-h: clamp(57px, 7.6vw, 82px);
    --card-overlap: clamp(-24px, -2.8vw, -16px);
  }

  html,
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
    padding: 6px 8px;
    overflow: hidden;
  }

  .topbar {
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 8px;
  }

  .brand {
    gap: 7px;
  }

  .seal {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .brand h1 {
    font-size: 22px;
  }

  .brand p {
    display: none;
  }

  .round-strip {
    gap: 5px;
  }

  .pill {
    padding: 5px 8px;
    font-size: 12px;
  }

  .top-actions {
    gap: 5px;
  }

  .ghost-button,
  .primary-button,
  .danger-button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .sound-button,
  .music-next-button {
    min-width: auto;
  }

  .game-grid {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .side-rail,
  .rule-rail {
    display: none;
  }

  .table-shell {
    height: 100%;
    min-height: 0;
    border-radius: 12px;
  }

  .table-shell::before {
    inset: 12px;
  }

  .seat-label {
    gap: 5px;
    margin-bottom: 4px;
    font-size: 12px;
  }

  .seat-role {
    padding: 1px 5px;
    font-size: 10px;
  }

  .seat-north {
    top: 7px;
  }

  .seat-west {
    top: 34%;
    left: 8px;
  }

  .seat-east {
    top: 34%;
    right: 8px;
  }

  .seat-south {
    left: 8px;
    right: 8px;
    bottom: 4px;
  }

  .center-stage {
    inset: 66px 112px 142px;
    gap: 6px;
  }

  .message-board {
    justify-self: center;
    width: min(460px, 100%);
    padding: 8px 10px;
  }

  .message-board h2 {
    font-size: 15px;
  }

  .message-board p {
    font-size: 12px;
    line-height: 1.3;
  }

  .trick-mat {
    min-height: 118px;
  }

  .trick-pile {
    min-width: 88px;
    min-height: 68px;
    gap: 3px;
  }

  .trick-pile .pile-name {
    display: none;
  }

  .pile-cards {
    min-height: 56px;
  }

  .table-card {
    --card-w: clamp(34px, 4.6vw, 46px);
    --card-h: clamp(48px, 6.5vw, 65px);
    margin-left: -13px;
    padding: 4px;
  }

  .table-card .card-rank {
    font-size: 16px;
  }

  .table-card .card-suit {
    font-size: 20px;
  }

  .human-toolbar {
    min-height: 14px;
    gap: 8px;
    font-size: 11px;
  }

  .action-bar {
    min-height: 32px;
    gap: 6px;
  }

  .human-hand {
    justify-content: center;
    min-height: calc(var(--card-h) + 10px);
    padding: 0 4px 2px;
    overflow-x: auto;
  }

  .hidden-hand {
    min-height: 30px;
  }

  .card-back {
    width: 22px;
    height: 32px;
    margin-left: -12px;
  }

  .score-fly {
    top: 48%;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  html,
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .rotate-hint {
    position: fixed;
    z-index: 80;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
      radial-gradient(circle at 50% 26%, rgba(217, 164, 65, 0.18), transparent 34%),
      rgba(5, 18, 17, 0.92);
    backdrop-filter: blur(4px);
  }
}
