:root {
  color-scheme: dark;
  --bg: #081512;
  --bg-soft: #10241e;
  --panel: rgba(18, 40, 33, 0.86);
  --panel-solid: #142b24;
  --line: rgba(182, 219, 200, 0.16);
  --line-strong: rgba(205, 235, 220, 0.3);
  --ink: #eef7f1;
  --muted: #9ab4a8;
  --muted-2: #789186;
  --gold: #e8c46f;
  --gold-soft: rgba(232, 196, 111, 0.16);
  --green: #30a46c;
  --red: #e05d63;
  --felt: #0e5a40;
  --felt-deep: #073a2a;
  --card-bg: #fbf8ef;
  --card-ink: #18201c;
  --card-red: #bd2f39;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(38, 111, 82, 0.22), transparent 32rem),
    radial-gradient(circle at 85% 90%, rgba(110, 77, 31, 0.18), transparent 30rem),
    linear-gradient(160deg, #07120f, #0a1c16 52%, #07110e);
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

h1,
p {
  margin: 0;
}

code {
  font-family: "Cascadia Code", "Consolas", monospace;
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
}

.connection-pill {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 60;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 21, 18, 0.82);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
}

.connection-pill.ok {
  color: #84d7a9;
  border-color: rgba(80, 190, 126, 0.32);
}

.connection-pill.warn {
  color: var(--gold);
  border-color: rgba(232, 196, 111, 0.34);
}

.connection-pill.off {
  color: var(--red);
  border-color: rgba(224, 93, 99, 0.34);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 100;
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(13, 31, 25, 0.96);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 13px;
  text-align: center;
  backdrop-filter: blur(16px);
}

.toast.error {
  border-color: rgba(224, 93, 99, 0.5);
}

.toast.success {
  border-color: rgba(48, 164, 108, 0.5);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(21, 47, 39, 0.92), rgba(12, 30, 24, 0.9));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.panel-title {
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.primary,
.secondary,
.danger,
.ghost,
.text-btn,
.icon-btn {
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.primary {
  padding: 11px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e8c46f, #d0a94c);
  color: #201a0e;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(208, 169, 76, 0.22);
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #f0d184, #dcb558);
}

.secondary {
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(230, 248, 239, 0.07);
  color: var(--ink);
  font-weight: 700;
}

.secondary:hover:not(:disabled) {
  background: rgba(230, 248, 239, 0.12);
}

.danger {
  padding: 11px 16px;
  border: 1px solid rgba(224, 93, 99, 0.35);
  border-radius: 10px;
  background: rgba(224, 93, 99, 0.1);
  color: #ffb8bb;
  font-weight: 700;
}

.danger:hover:not(:disabled) {
  background: rgba(224, 93, 99, 0.18);
}

.ghost {
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.ghost:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.small {
  padding: 7px 12px;
  font-size: 12px;
}

.text-btn {
  padding: 4px 6px;
  background: transparent;
  color: var(--gold);
  font-size: 12px;
}

.text-btn:hover {
  color: #f4d88f;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 18px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.primary:disabled,
.secondary:disabled,
.danger:disabled {
  opacity: 0.38;
  box-shadow: none;
  transform: none;
}

.lobby-view {
  display: grid;
  place-items: center;
  padding: 54px 20px;
}

.lobby-wrap {
  width: min(1040px, 100%);
}

.lobby-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid rgba(232, 196, 111, 0.34);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(232, 196, 111, 0.16), rgba(14, 90, 64, 0.2));
  color: var(--gold);
  font-size: 40px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 40px rgba(0, 0, 0, 0.25);
}

.lobby-brand h1 {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.lobby-brand p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.entry-panel,
.rooms-panel {
  padding: 26px;
}

.entry-panel label {
  display: block;
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.entry-panel input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: rgba(4, 15, 11, 0.5);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.04em;
}

.entry-panel input:focus {
  border-color: rgba(232, 196, 111, 0.55);
  box-shadow: 0 0 0 3px rgba(232, 196, 111, 0.09);
}

.entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.hint {
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.7;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 318px;
  margin-top: 16px;
  overflow-y: auto;
}

.room-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.room-item:hover {
  border-color: rgba(232, 196, 111, 0.3);
  background: rgba(232, 196, 111, 0.045);
}

.room-item-code {
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(232, 196, 111, 0.1);
  color: var(--gold);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.room-item-main {
  min-width: 0;
}

.room-item-title {
  font-size: 13px;
  font-weight: 700;
}

.room-item-sub {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 11px;
}

.room-item .text-btn {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state {
  padding: 42px 12px;
  color: var(--muted-2);
  font-size: 13px;
  text-align: center;
}

.rules-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.rules-strip span {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.room-view {
  display: flex;
  flex-direction: column;
}

.room-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 18, 14, 0.84);
  backdrop-filter: blur(18px);
}

.room-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.room-label {
  color: var(--muted-2);
  font-size: 12px;
}

#room-code {
  color: var(--gold);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.room-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.room-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 16px 20px 36px;
}

.table-column {
  min-width: 0;
}

.bridge-table {
  position: relative;
  width: min(100%, 880px);
  min-height: 430px;
  margin: 0 auto;
  aspect-ratio: 1.6 / 1;
  border: 12px solid #4a2f1e;
  border-radius: 48% / 42%;
  background:
    radial-gradient(ellipse at center, rgba(28, 126, 88, 0.95), rgba(10, 75, 52, 0.98) 56%, rgba(5, 48, 34, 1)),
    #0e5a40;
  box-shadow:
    inset 0 0 0 2px rgba(247, 220, 160, 0.2),
    inset 0 0 70px rgba(0, 0, 0, 0.36),
    0 24px 55px rgba(0, 0, 0, 0.3);
}

.bridge-table::after {
  content: "";
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(245, 224, 170, 0.17);
  border-radius: inherit;
  pointer-events: none;
}

.seat {
  position: absolute;
  z-index: 3;
  width: 156px;
  min-height: 66px;
  padding: 9px 11px;
  border: 1px solid rgba(185, 222, 201, 0.16);
  border-radius: 12px;
  background: rgba(4, 29, 20, 0.58);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

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

.seat-w {
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
}

.seat-e {
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
}

.seat.active-turn {
  border-color: rgba(232, 196, 111, 0.75);
  background: rgba(75, 63, 30, 0.58);
  box-shadow: 0 0 0 3px rgba(232, 196, 111, 0.12), 0 8px 26px rgba(0, 0, 0, 0.22);
}

.seat.disconnected {
  opacity: 0.62;
  border-style: dashed;
}

.seat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.seat-role {
  color: var(--gold);
  font-weight: 700;
}

.seat-name {
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-name b {
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  vertical-align: 1px;
}

.seat-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.seat-sub .role {
  color: #8fd3b0;
}

.seat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 46px;
  color: var(--muted-2);
  font-size: 11px;
}

.seat-join {
  padding: 5px 12px;
  border: 1px solid rgba(232, 196, 111, 0.34);
  border-radius: 8px;
  background: rgba(232, 196, 111, 0.08);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

.seat-join:hover {
  background: rgba(232, 196, 111, 0.15);
}

.table-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50%;
  min-height: 148px;
  transform: translate(-50%, -50%);
  text-align: center;
}

.board-info {
  color: rgba(228, 244, 234, 0.66);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.trick-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 110px;
  margin: 6px 0;
}

.trick-placeholder {
  color: rgba(239, 226, 188, 0.2);
  font-size: 34px;
  letter-spacing: 0.35em;
  line-height: 1;
}

.trick-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.trick-label {
  color: rgba(230, 244, 235, 0.54);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.trick-caption {
  width: 100%;
  margin-bottom: -3px;
  color: rgba(230, 244, 235, 0.45);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.table-status {
  min-height: 20px;
  color: #d9ecdf;
  font-size: 12px;
  line-height: 1.4;
}

.table-status strong {
  color: var(--gold);
}

.hand-panel {
  width: min(100%, 880px);
  margin: 14px auto 0;
  padding: 11px 14px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(150deg, rgba(17, 41, 33, 0.9), rgba(10, 27, 21, 0.9));
}

.hand-title {
  margin-bottom: 9px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.hand-title span {
  color: var(--gold);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.suit-group {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 4px 8px;
  border: 1px solid rgba(210, 233, 219, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.suit-symbol {
  width: 20px;
  flex: 0 0 20px;
  color: var(--ink);
  font-size: 16px;
  text-align: center;
}

.suit-symbol.red {
  color: #ff9197;
}

.suit-cards {
  display: flex;
}

.suit-cards .card + .card {
  margin-left: -9px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 49px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--card-ink);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.24);
  user-select: none;
}

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

.card .rank {
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.card .suit {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1;
}

button.card:disabled {
  opacity: 1;
}

button.card:not(:disabled) {
  cursor: pointer;
}

.card.playable {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  transform: translateY(-4px);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(232, 196, 111, 0.12);
}

.card.playable:hover {
  transform: translateY(-8px);
}

.card.tiny {
  width: 28px;
  height: 39px;
}

.card.tiny .rank {
  font-size: 11px;
}

.card.tiny .suit {
  font-size: 10px;
}

.action-panel {
  width: min(100%, 880px);
  min-height: 96px;
  margin: 14px auto 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.action-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.action-title strong {
  color: var(--ink);
  font-size: 14px;
}

.action-title .subtle {
  color: var(--muted-2);
  font-size: 11px;
}

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

.bid-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.bid-btn {
  min-height: 34px;
  padding: 5px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.bid-btn:hover:not(:disabled) {
  border-color: rgba(232, 196, 111, 0.45);
  background: rgba(232, 196, 111, 0.09);
}

.bid-btn.pass {
  color: #a8c9b8;
}

.bid-btn.double {
  color: #ffc0c2;
}

.bid-btn.redouble {
  color: var(--gold);
}

.bid-btn:disabled {
  color: rgba(220, 239, 228, 0.2);
  background: rgba(255, 255, 255, 0.012);
}

.bid-btn.enabled {
  border-color: rgba(232, 196, 111, 0.22);
}

.waiting-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

.waiting-box p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.waiting-box strong {
  color: var(--ink);
}

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.result-contract {
  color: var(--gold);
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 900;
  letter-spacing: -0.03em;
}

.result-text {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.result-points {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 24px;
  font-weight: 900;
}

.result-points.positive {
  color: #7fe0a9;
}

.result-points.negative {
  color: #ff8d93;
}

.result-points small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.reveal-grid {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reveal-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
}

.reveal-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reveal-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  font-family: "Cascadia Code", "Consolas", monospace;
  letter-spacing: 0.04em;
}

.reveal-suit {
  color: var(--ink);
}

.reveal-suit.red {
  color: #ff969b;
}

.side-column {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
  max-height: calc(100vh - 92px);
}

.side-panel {
  padding: 15px;
}

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

.auction-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
}

.auction-head {
  padding: 4px 2px;
  color: var(--muted-2);
  font-size: 10px;
  text-align: center;
}

.auction-head.active {
  border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold);
}

.auction-cell {
  display: grid;
  place-items: center;
  min-height: 25px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.auction-cell.filled {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.auction-cell.double {
  color: #ffafb2;
}

.auction-cell.redouble {
  color: var(--gold);
}

.auction-cell.pass {
  color: var(--muted-2);
  font-weight: 500;
}

.contract-summary {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.contract-summary strong {
  color: var(--gold);
  font-size: 15px;
}

.contract-summary .tricks {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  color: var(--muted-2);
}

.chat-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 260px;
  overflow: hidden;
}

.spectator-count {
  color: var(--muted-2);
  font-size: 10px;
}

.chat-list {
  flex: 1 1 auto;
  min-height: 120px;
  margin: 11px -4px 10px 0;
  padding-right: 4px;
  overflow-y: auto;
}

.chat-msg {
  margin-bottom: 9px;
  font-size: 12px;
  line-height: 1.5;
}

.chat-meta {
  color: var(--muted-2);
  font-size: 9px;
}

.chat-text {
  margin-top: 1px;
  color: #d8ebe0;
  word-break: break-word;
}

.chat-msg.system .chat-meta {
  display: none;
}

.chat-msg.system .chat-text {
  color: var(--muted-2);
  font-size: 10px;
  font-style: italic;
}

.chat-form {
  display: flex;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(4, 15, 11, 0.45);
  color: var(--ink);
  font-size: 12px;
}

.chat-form input:focus {
  border-color: rgba(232, 196, 111, 0.4);
}

@media (max-width: 1100px) {
  .room-main {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .seat {
    width: 136px;
  }

  .seat-w {
    left: 12px;
  }

  .seat-e {
    right: 12px;
  }
}

@media (max-width: 960px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .room-head {
    grid-template-columns: 1fr auto;
  }

  .room-meta {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .room-main {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .side-column {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    max-height: none;
  }

  .chat-list {
    height: 220px;
  }

  .bridge-table {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .connection-pill {
    display: none;
  }

  .lobby-view {
    padding: 30px 14px;
  }

  .lobby-brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 17px;
    font-size: 31px;
  }

  .entry-panel,
  .rooms-panel {
    padding: 20px;
  }

  .room-head {
    padding: 9px 10px;
    gap: 8px;
  }

  .room-label,
  #copy-btn {
    display: none;
  }

  #room-code {
    font-size: 13px;
  }

  .room-head-actions {
    gap: 3px;
  }

  .room-head-actions .small {
    padding: 6px 8px;
    font-size: 10px;
  }

  .room-main {
    padding: 8px 7px 24px;
  }

  .bridge-table {
    min-height: 370px;
    aspect-ratio: auto;
    border-width: 8px;
    border-radius: 32% / 24%;
  }

  .seat {
    width: 106px;
    min-height: 55px;
    padding: 6px 7px;
  }

  .seat-n {
    top: 9px;
  }

  .seat-s {
    bottom: 9px;
  }

  .seat-w {
    top: 47%;
    left: 7px;
  }

  .seat-e {
    top: 47%;
    right: 7px;
  }

  .seat-name {
    font-size: 12px;
  }

  .seat-sub {
    font-size: 9px;
  }

  .table-center {
    width: 47%;
  }

  .trick-area {
    gap: 5px;
    min-height: 86px;
  }

  .trick-placeholder {
    font-size: 25px;
  }

  .card.tiny {
    width: 23px;
    height: 32px;
  }

  .hand-panel {
    padding: 9px 8px 11px;
  }

  .hand {
    gap: 6px;
  }

  .suit-group {
    min-height: 43px;
    padding: 3px 5px;
  }

  .suit-symbol {
    width: 16px;
    flex-basis: 16px;
    font-size: 13px;
  }

  .card {
    width: 31px;
    height: 44px;
  }

  .suit-cards .card + .card {
    margin-left: -12px;
  }

  .action-panel {
    padding: 12px;
  }

  .bid-grid,
  .bid-special {
    gap: 4px;
  }

  .bid-btn {
    min-height: 31px;
    font-size: 11px;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .reveal-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 7px;
  }

  .waiting-box {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

.result-player-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.result-player {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.result-player-name {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-player-score {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
}

.result-player-score.positive,
.reveal-score.positive {
  color: #7fe0a9;
}

.result-player-score.negative,
.reveal-score.negative {
  color: #ff8d93;
}

.reveal-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

@media (max-width: 700px) {
  .result-player-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.reveal-row {
  grid-template-columns: 92px 74px minmax(0, 1fr);
}

.mode-badge {
  position: fixed;
  left: 50%;
  top: calc(8px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 2000;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.mode-badge.offline {
  color: #ffe6a3;
  background: rgba(120, 72, 8, 0.92);
}

.mode-badge.online {
  color: #bff7d0;
  background: rgba(12, 92, 48, 0.92);
}

@media (max-width: 700px) {
  .reveal-row {
    grid-template-columns: 74px 58px minmax(0, 1fr);
  }
}
