:root {
  color-scheme: light;
  --bg: #e9edf0;
  --surface: #fbfbf8;
  --panel: #ffffff;
  --ink: #17211d;
  --muted: #66736b;
  --line: #d8ded7;
  --green: #176b4c;
  --green-2: #0d4934;
  --felt: #1f7656;
  --felt-dark: #14533e;
  --gold: #bf8126;
  --red: #b7443e;
  --blue: #4267b2;
  --shadow: 0 18px 45px rgba(32, 48, 38, 0.16);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 76, 0.12), transparent 38%),
    linear-gradient(180deg, #f6f8f7 0%, var(--bg) 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: #aab7ae;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

button.danger {
  border-color: rgba(183, 68, 62, 0.35);
  color: var(--red);
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 76, 0.12);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  width: min(1440px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
}

.table-panel,
.side-panel > section {
  border: 1px solid rgba(216, 222, 215, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.94);
  box-shadow: var(--shadow);
}

.table-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 36px);
  padding: 18px;
}

.topbar,
.room-header,
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.label {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.connection,
.room-state {
  min-width: 82px;
  border-radius: 999px;
  padding: 7px 12px;
  background: #edf5f0;
  color: var(--green-2);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.connection.offline {
  background: #faecea;
  color: var(--red);
}

.join-panel,
.room-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.actions,
.room-actions,
.chat-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.room-header {
  flex-wrap: wrap;
}

.room-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  font-size: 18px;
  font-weight: 900;
}

.room-code {
  min-width: 128px;
  border-color: rgba(191, 129, 38, 0.55);
  background: #fff8e9;
  color: #74490d;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.score-strip {
  display: flex;
  flex: 1;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.score-strip span,
.rank-board span {
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef3ef;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 800;
}

.game-table {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(380px, 1fr) 220px;
  grid-template-rows: 132px minmax(280px, 1fr) 132px;
  min-height: 640px;
  overflow: hidden;
  border: 12px solid #684325;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.18), transparent 34%),
    radial-gradient(ellipse at center, rgba(8, 42, 30, 0.2), transparent 62%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #248160 0%, #13533f 100%);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.12),
    inset 0 0 70px rgba(0, 0, 0, 0.2);
}

.opponent {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.opponent.top {
  grid-column: 2;
  grid-row: 1;
}

.opponent.left {
  grid-column: 1;
  grid-row: 2;
}

.opponent.right {
  grid-column: 3;
  grid-row: 2;
}

.opponent.bottom {
  grid-column: 2;
  grid-row: 3;
}

.table-center {
  position: relative;
  display: grid;
  grid-column: 2;
  grid-row: 2;
  min-height: 100%;
  place-items: center;
}

.mini-card {
  width: 54px;
  height: 76px;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.25);
}

.level-card-mini {
  box-shadow:
    0 0 0 2px rgba(255, 211, 80, 0.9),
    0 5px 12px rgba(0, 0, 0, 0.25);
}

.wild-card-mini {
  box-shadow:
    0 0 0 2px rgba(255, 211, 80, 1),
    0 0 18px rgba(255, 211, 80, 0.75),
    0 5px 12px rgba(0, 0, 0, 0.25);
}

.rank-board {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.table-action-zone {
  position: absolute;
  display: flex;
  min-width: 170px;
  min-height: 96px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.action-top {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.action-bottom {
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
}

.action-left {
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.action-right {
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.turn-pointer {
  position: absolute;
  z-index: 2;
  border-radius: 999px;
  padding: 8px 13px;
  background: #ffe08a;
  color: #5b3d00;
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 0 20px rgba(255, 224, 138, 0.72);
}

.turn-pointer.top {
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
}

.turn-pointer.bottom {
  bottom: 118px;
  left: 50%;
  transform: translateX(-50%);
}

.turn-pointer.left {
  left: 170px;
  top: 50%;
  transform: translateY(-50%);
}

.turn-pointer.right {
  right: 170px;
  top: 50%;
  transform: translateY(-50%);
}

.seat-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 9px;
  width: min(100%, 360px);
  min-height: 94px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  padding: 10px 10px 42px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 248, 244, 0.92));
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.seat-card.current {
  border-color: #ffe08a;
  box-shadow:
    0 0 0 3px rgba(255, 224, 138, 0.34),
    0 10px 25px rgba(0, 0, 0, 0.14);
}

.seat-card.self {
  border-color: #d8f1e6;
}

.seat-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f7fff9, #cfe9dc);
  color: var(--green-2);
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(23, 107, 76, 0.12);
}

.seat-main {
  min-width: 0;
}

.seat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 850;
}

.seat-tags {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  margin-top: 6px;
  overflow: hidden;
}

.seat-tags span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 6px;
  background: #eef1ee;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.seat-tags .team-tag {
  background: #e6f4ed;
  color: var(--green-2);
}

.card-count {
  display: grid;
  place-items: center;
  width: 34px;
  height: 46px;
  border-radius: 5px;
  background: linear-gradient(135deg, #fff, #f1f5f2);
  color: var(--green-2);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--line);
}

.card-count.hidden-count::before {
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  content: "";
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.seat-tools {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.seat-tool {
  flex: 1 1 0;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.table-action {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(13, 73, 52, 0.88);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.table-action-label {
  line-height: 1;
}

.table-action-cards {
  display: flex;
  max-width: 260px;
  overflow: hidden;
}

.wildcard-choice-panel {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(94%, 560px);
  max-height: min(74vh, 390px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(250, 252, 249, 0.96);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.wildcard-choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--green-2);
  font-size: 15px;
}

.wildcard-choice-close {
  display: grid;
  width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.wildcard-choice-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.wildcard-option {
  display: grid;
  grid-template-columns: minmax(64px, 86px) 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  border-color: #cddbd2;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.wildcard-option:hover {
  border-color: var(--green);
  box-shadow: 0 8px 18px rgba(18, 72, 54, 0.12);
}

.wildcard-option.blocked {
  opacity: 0.58;
}

.wildcard-option-label {
  color: var(--green-2);
  font-size: 13px;
  font-weight: 900;
}

.wildcard-option-cards {
  display: flex;
  min-width: 0;
  overflow: hidden;
}

.wildcard-option-card {
  width: 42px;
  height: 59px;
  margin-left: -14px;
}

.wildcard-option-card:first-child {
  margin-left: 0;
}

.wildcard-option-state {
  border-radius: 999px;
  padding: 5px 8px;
  background: #f3e7e5;
  color: #9b3b35;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.table-play-card {
  width: 58px;
  height: 82px;
  margin-left: -20px;
}

.table-play-card:first-child {
  margin-left: 0;
}

.pass-chip {
  border-radius: 999px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 22px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--line);
}

.hand-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f7faf8;
  touch-action: none;
  user-select: none;
}

.hand-info {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.hand {
  position: relative;
  display: flex;
  min-height: 150px;
  flex-wrap: wrap;
  overflow: visible;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px 8px;
}

.playing-card {
  position: relative;
  flex: 0 0 74px;
  width: 74px;
  height: 106px;
  min-height: 106px;
  margin-left: 0;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transform: translateY(0) scale(1);
  transition:
    transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 140ms ease;
  will-change: transform;
}

.playing-card img {
  display: block;
  width: 74px;
  height: 106px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 16px rgba(24, 34, 29, 0.18);
  pointer-events: none;
  user-select: none;
  transition:
    box-shadow 180ms ease,
    filter 180ms ease;
}

.playing-card:hover {
  z-index: 3;
  transform: translateY(-10px) scale(1.015);
}

.playing-card.selectable:hover img {
  box-shadow:
    0 0 0 3px rgba(66, 103, 178, 0.6),
    0 12px 20px rgba(24, 34, 29, 0.24);
}

.playing-card.selected {
  z-index: 4;
  transform: translateY(-18px) scale(1.025);
}

.playing-card.selected img {
  box-shadow:
    0 0 0 4px rgba(47, 132, 93, 0.92),
    0 0 24px rgba(47, 132, 93, 0.48),
    0 12px 20px rgba(24, 34, 29, 0.24);
}

.playing-card.selectable.wild img {
  box-shadow:
    0 0 0 4px rgba(191, 129, 38, 0.75),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.level img {
  box-shadow:
    0 0 0 3px rgba(255, 216, 77, 0.72),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.joker img {
  box-shadow:
    0 0 0 3px rgba(183, 68, 62, 0.72),
    0 0 18px rgba(183, 68, 62, 0.34),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.dragging {
  z-index: 8;
  cursor: grabbing;
  opacity: 0.72;
  transform: translateY(-24px) scale(1.06) rotate(-2deg);
}

.playing-card.box-target img {
  box-shadow:
    0 0 0 4px rgba(66, 103, 178, 0.95),
    0 0 26px rgba(66, 103, 178, 0.52),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.box-selected-target img {
  box-shadow:
    0 0 0 4px rgba(205, 70, 70, 0.95),
    0 0 26px rgba(205, 70, 70, 0.5),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.insert-before::before,
.playing-card.insert-after::after {
  position: absolute;
  top: -8px;
  bottom: -8px;
  z-index: 9;
  width: 4px;
  border-radius: 999px;
  background: #ffe08a;
  content: "";
  box-shadow: 0 0 14px rgba(255, 224, 138, 0.9);
}

.playing-card.insert-before::before {
  left: -5px;
}

.playing-card.insert-after::after {
  right: -5px;
}

.playing-card.dealing {
  animation: dealCard 520ms cubic-bezier(0.16, 0.84, 0.28, 1) both;
  animation-delay: calc(var(--i) * 22ms);
}

.hand.sorting .playing-card {
  animation: sortPulse 460ms ease both;
}

.playing-card.wild {
  animation: levelPulse 1.2s ease-in-out infinite;
}

.playing-card.tribute-choice img {
  box-shadow:
    0 0 0 4px rgba(255, 216, 77, 0.95),
    0 0 24px rgba(255, 216, 77, 0.7),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.tribute-choice::after {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 2px 7px;
  background: #ffd84d;
  color: #5c3900;
  content: "贡";
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.playing-card.return-choice img {
  box-shadow:
    0 0 0 4px rgba(66, 103, 178, 0.8),
    0 0 22px rgba(66, 103, 178, 0.42),
    0 8px 16px rgba(24, 34, 29, 0.18);
}

.playing-card.return-choice::after {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 2px 7px;
  background: #4267b2;
  color: #fff;
  content: "还";
  font-size: 12px;
  font-weight: 900;
}

@keyframes levelPulse {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 216, 77, 0));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(255, 216, 77, 0.9));
  }
}

@keyframes dragLift {
  from {
    transform: translateY(-8px) scale(1);
  }
  to {
    transform: translateY(-24px) scale(1.06) rotate(-2deg);
  }
}

@keyframes dealCard {
  from {
    opacity: 0;
    transform: translateY(-90px) scale(0.55) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes sortPulse {
  0% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-16px);
  }
  100% {
    transform: translateY(0);
  }
}

.selection-box {
  position: fixed;
  z-index: 2100;
  border: 2px solid rgba(66, 103, 178, 0.95);
  border-radius: 8px;
  background: rgba(66, 103, 178, 0.14);
  pointer-events: none;
  box-shadow: 0 0 24px rgba(66, 103, 178, 0.28);
}

.drag-ghost {
  position: fixed;
  z-index: 2150;
  width: 74px;
  height: 106px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.28));
}

.drag-ghost img {
  position: absolute;
  width: 74px;
  height: 106px;
  border-radius: 6px;
  animation: gatherToCursor 220ms cubic-bezier(0.16, 0.84, 0.28, 1) both;
  transform: translate(var(--stack-x), var(--stack-y)) rotate(var(--rot));
}

.drag-ghost.stack img {
  box-shadow: 0 8px 16px rgba(24, 34, 29, 0.24);
}

.drag-ghost.over-table img {
  box-shadow:
    0 0 0 4px rgba(47, 132, 93, 0.86),
    0 0 26px rgba(47, 132, 93, 0.42),
    0 8px 16px rgba(24, 34, 29, 0.24);
}

.drag-ghost.returning img {
  animation: ghostReturn 240ms ease both;
}

body.drag-over-table .game-table {
  box-shadow:
    inset 0 0 0 4px rgba(47, 132, 93, 0.42),
    0 20px 60px rgba(10, 34, 23, 0.2);
}

@keyframes gatherToCursor {
  from {
    opacity: 0.72;
    transform: translate(var(--from-x), var(--from-y)) scale(0.92) rotate(var(--rot));
  }
  to {
    opacity: 1;
    transform: translate(var(--stack-x), var(--stack-y)) scale(1) rotate(var(--rot));
  }
}

@keyframes ghostReturn {
  to {
    opacity: 0;
    transform: translate(var(--from-x), var(--from-y)) scale(0.86) rotate(var(--rot));
  }
}

.playing-card.locked {
  opacity: 0.6;
}

.room-actions {
  align-items: center;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.status-card,
.chat-panel {
  padding: 16px;
}

.status-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.status-list div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid #edf0ec;
  padding-bottom: 9px;
  color: var(--muted);
  line-height: 1.45;
}

.status-list .tribute-log-row {
  grid-template-columns: 56px minmax(0, 1fr);
}

.tribute-log {
  display: grid;
  gap: 7px;
}

.tribute-log-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 5px 7px;
  background: #f4f7f5;
}

.tribute-type {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff3d5;
  color: #82530f;
  font-weight: 900;
}

.tribute-log-item.return .tribute-type {
  background: #e7eefc;
  color: #2d4b8b;
}

.tribute-log-card {
  width: 31px;
  height: 43px;
}

.muted-text {
  color: var(--muted);
}

.flying-card {
  position: fixed;
  z-index: 2050;
  width: 58px;
  height: 82px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: flyCard 700ms cubic-bezier(0.16, 0.84, 0.28, 1) forwards;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.28));
}

.exchange-card {
  z-index: 2080;
  width: 64px;
  height: 90px;
  animation: exchangeCard 1700ms cubic-bezier(0.18, 0.78, 0.22, 1) forwards;
}

.special-effect-layer {
  position: fixed;
  inset: 0;
  z-index: 2070;
  pointer-events: none;
}

.special-effect-layer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.low-hand-alert {
  position: fixed;
  z-index: 2090;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 224, 138, 0.95);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(183, 68, 62, 0.94);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  pointer-events: none;
  animation: lowHandAlert 1800ms ease-out forwards;
  box-shadow:
    0 0 0 0 rgba(255, 224, 138, 0.65),
    0 16px 34px rgba(80, 18, 18, 0.28);
}

@keyframes flyCard {
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.72) rotate(5deg);
    opacity: 0.2;
  }
}

@keyframes exchangeCard {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72) rotate(0deg);
  }
  24% {
    opacity: 1;
    transform: translate(calc(-50% + var(--mx)), calc(-50% + var(--my))) scale(0.92) rotate(var(--r1));
  }
  52% {
    opacity: 1;
    transform: translate(calc(-50% + var(--mx) - 8px), calc(-50% + var(--my) + 6px)) scale(0.96) rotate(var(--r2));
  }
  100% {
    opacity: 0.18;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.66) rotate(6deg);
  }
}

@keyframes lowHandAlert {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -72%) scale(1.08);
    box-shadow:
      0 0 0 18px rgba(255, 224, 138, 0.18),
      0 16px 34px rgba(80, 18, 18, 0.28);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -112%) scale(0.9);
    box-shadow:
      0 0 0 34px rgba(255, 224, 138, 0),
      0 16px 34px rgba(80, 18, 18, 0);
  }
}

.status-list strong {
  color: var(--ink);
}

.chat-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
}

.messages {
  display: flex;
  flex: 1;
  min-height: 320px;
  max-height: calc(100vh - 430px);
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.message {
  border-radius: 8px;
  padding: 10px 12px;
  background: #f5f7f5;
  line-height: 1.45;
}

.message.system {
  color: var(--muted);
  font-size: 13px;
}

.message-name {
  margin-bottom: 4px;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 850;
}

.chat-form {
  flex-wrap: nowrap;
}

.chat-form input {
  min-width: 0;
}

.hidden {
  display: none !important;
}

body.table-fullscreen {
  --fullscreen-hand-height: clamp(300px, 40vh, 380px);
  --fullscreen-hand-gap: 28px;
  overflow: hidden;
  background: #10251d;
}

body.table-fullscreen .app-shell {
  display: block;
  width: 100vw;
  min-height: 100vh;
  padding: 0;
}

body.table-fullscreen .table-panel {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #10251d;
  box-shadow: none;
}

body.table-fullscreen .topbar,
body.table-fullscreen .side-panel {
  display: none;
}

body.table-fullscreen .room-header {
  display: block;
  position: fixed;
  inset: 0 0 auto;
  z-index: 26;
  pointer-events: none;
}

body.table-fullscreen .room-header > :not(.room-header-actions),
body.table-fullscreen .room-header-actions .room-state {
  display: none;
}

body.table-fullscreen .room-header-actions {
  display: block;
}

body.table-fullscreen .room-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  overflow: hidden;
  background: #10251d;
}

body.table-fullscreen .game-table {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  grid-template-columns: minmax(180px, 18vw) minmax(0, 1fr) minmax(180px, 18vw);
  grid-template-rows: minmax(104px, 14vh) minmax(0, 1fr) minmax(180px, 24vh);
  border-width: 10px;
  border-radius: 0;
  padding-bottom: clamp(340px, 44vh, 430px);
}

body.table-fullscreen .opponent {
  padding: 8px;
}

body.table-fullscreen .opponent.bottom {
  position: fixed;
  left: 20px;
  bottom: calc(var(--fullscreen-hand-height) + var(--fullscreen-hand-gap));
  z-index: 24;
  width: min(310px, calc(100vw - 40px));
  padding: 0;
}

body.table-fullscreen .opponent.bottom .seat-card {
  width: 100%;
}

body.table-fullscreen .table-center {
  grid-column: 2;
  grid-row: 2;
}

body.table-fullscreen .action-bottom {
  position: fixed;
  z-index: 24;
  left: 50%;
  bottom: calc(var(--fullscreen-hand-height) + 130px);
  transform: translateX(-50%);
}

body.table-fullscreen .turn-pointer.bottom {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: calc(var(--fullscreen-hand-height) + 74px);
  transform: translateX(-50%);
}

body.table-fullscreen .hand-panel {
  position: fixed;
  right: 18px;
  bottom: 16px;
  left: 18px;
  z-index: 23;
  height: var(--fullscreen-hand-height);
  overflow: visible;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(247, 250, 248, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body.table-fullscreen .hand {
  min-height: calc(var(--fullscreen-hand-height) - 54px);
  overflow: visible;
  align-content: flex-start;
  padding-top: 34px;
}

body.table-fullscreen .room-actions {
  position: fixed;
  right: 0;
  bottom: calc(var(--fullscreen-hand-height) - 48px);
  left: 0;
  z-index: 25;
  justify-content: center;
  pointer-events: none;
}

body.table-fullscreen .room-actions button {
  flex: 0 0 auto;
  pointer-events: auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

body.table-fullscreen #leaveButton {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 26;
}

body.table-fullscreen #fullscreenButton {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 26;
  width: auto;
  min-width: 72px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.94);
  pointer-events: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: min(460px, calc(100% - 32px));
  transform: translateX(-50%);
  border: 1px solid rgba(24, 34, 29, 0.1);
  border-radius: 8px;
  padding: 12px 16px;
  background: rgba(24, 34, 29, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
}

body.table-fullscreen .toast {
  z-index: 2200;
  bottom: 28px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .table-panel {
    min-height: auto;
  }

  .messages {
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 1440px);
    padding: 8px 0;
  }

  .table-panel,
  .status-card,
  .chat-panel {
    padding: 12px;
  }

  .topbar,
  .room-header {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 24px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .game-table {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    min-height: auto;
    gap: 8px;
    padding: 8px;
  }

  .opponent.top,
  .opponent.left,
  .opponent.right,
  .opponent.bottom,
  .table-center {
    grid-column: 1;
    grid-row: auto;
  }

  .table-center {
    min-height: 200px;
  }

  .table-action-zone {
    min-width: 120px;
    min-height: 72px;
  }

  .table-play-card {
    width: 40px;
    height: 56px;
    margin-left: -14px;
  }

  .wildcard-choice-panel {
    width: min(96%, 420px);
    max-height: 330px;
  }

  .wildcard-option {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .turn-pointer.left {
    left: 8px;
  }

  .turn-pointer.right {
    right: 8px;
  }

  .seat-card {
    width: 100%;
  }

  .mini-card {
    width: 42px;
    height: 59px;
  }

  .playing-card,
  .playing-card img {
    width: 58px;
    height: 82px;
  }

  .playing-card {
    flex-basis: 58px;
    min-height: 82px;
    margin-left: 0;
  }

  .room-actions button,
  .actions button {
    flex: 1 1 120px;
  }

  body.table-fullscreen {
    --fullscreen-hand-height: 180px;
    --fullscreen-hand-gap: 16px;
  }

  body.table-fullscreen .game-table {
    grid-template-columns: minmax(78px, 24vw) minmax(0, 1fr) minmax(78px, 24vw);
    grid-template-rows: 92px minmax(0, 1fr) 168px;
    min-height: 100vh;
    gap: 0;
    padding: 0 0 204px;
  }

  body.table-fullscreen .opponent.top {
    grid-column: 2;
    grid-row: 1;
  }

  body.table-fullscreen .opponent.left {
    grid-column: 1;
    grid-row: 2;
  }

  body.table-fullscreen .opponent.right {
    grid-column: 3;
    grid-row: 2;
  }

  body.table-fullscreen .table-center {
    grid-column: 2;
    grid-row: 2;
    min-height: 100%;
  }

  body.table-fullscreen .opponent.bottom {
    left: 10px;
    bottom: calc(var(--fullscreen-hand-height) + var(--fullscreen-hand-gap));
    width: min(238px, calc(100vw - 20px));
  }

  body.table-fullscreen .action-bottom {
    position: fixed;
    z-index: 24;
    left: 50%;
    bottom: calc(var(--fullscreen-hand-height) + 108px);
    transform: translateX(-50%);
  }

  body.table-fullscreen .turn-pointer.bottom {
    position: fixed;
    z-index: 25;
    left: 50%;
    bottom: calc(var(--fullscreen-hand-height) + 56px);
    transform: translateX(-50%);
  }

  body.table-fullscreen .seat-card {
    min-height: 76px;
    padding: 8px;
  }

  body.table-fullscreen .seat-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  body.table-fullscreen .seat-name {
    font-size: 13px;
  }

  body.table-fullscreen .seat-tags {
    flex-wrap: wrap;
  }

  body.table-fullscreen .card-count {
    width: 30px;
    height: 40px;
  }

  body.table-fullscreen .hand-panel {
    right: 8px;
    bottom: 8px;
    left: 8px;
    height: 180px;
    padding: 7px;
  }

  body.table-fullscreen .hand-info {
    margin-bottom: 4px;
    font-size: 12px;
  }

  body.table-fullscreen .hand {
    min-height: 132px;
    overflow: visible;
    gap: 4px;
    padding: 22px 4px 2px;
  }

  body.table-fullscreen .room-actions {
    right: 0;
    bottom: calc(var(--fullscreen-hand-height) - 42px);
    left: 0;
    width: auto;
  }

  body.table-fullscreen .room-actions button {
    flex: 0 1 auto;
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  body.table-fullscreen #fullscreenButton {
    top: 10px;
    right: 10px;
    min-width: 58px;
    height: 34px;
    min-height: 34px;
    font-size: 13px;
  }

  body.table-fullscreen #leaveButton {
    top: 52px;
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flying-card {
    animation-duration: 180ms;
  }

  .special-effect-layer {
    display: none;
  }
}
