:root {
  --felt-dark: #0c5a38;
  --felt-mid: #117346;
  --felt-light: #16905a;
  --wood-dark: #4d311d;
  --wood-light: #8f5f37;
  --paper: #f8f1df;
  --paper-strong: #efe4cc;
  --ink: #22201d;
  --ink-soft: #4f4b44;
  --gold: #d09c35;
  --danger: #b4382f;
  --success: #1a8f4e;
  --border: rgba(34, 32, 29, 0.2);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Nunito Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 240, 200, 0.12), transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(255, 222, 170, 0.08), transparent 36%),
    linear-gradient(165deg, #093d27 0%, #0f5d38 50%, #083520 100%);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.015) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.015) 50%, rgba(255, 255, 255, 0.015) 75%, transparent 75%, transparent);
  background-size: 22px 22px;
  opacity: 0.5;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 18px 16px 42px;
}

.title {
  margin: 0;
  font-family: "Rye", serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: 0.02em;
  color: #fff9e8;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.subtitle {
  margin: 8px 0 0;
  color: #dcefdc;
  font-size: 1rem;
}

.home-install-card {
  margin-top: 16px;
  display: grid;
  gap: 14px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 241, 210, 0.98), rgba(247, 230, 188, 0.92)),
    linear-gradient(180deg, var(--paper) 0%, #f6edda 100%);
  border-color: rgba(96, 71, 38, 0.22);
}

.home-install-copy {
  display: grid;
  gap: 6px;
}

.home-install-kicker {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #85623a;
}

.home-install-copy h2 {
  margin: 0;
}

.home-install-copy .muted {
  margin: 0;
}

.home-install-actions {
  display: flex;
  justify-content: flex-start;
}

.home-install-actions .btn-ghost[disabled] {
  opacity: 0.72;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.card {
  background: linear-gradient(180deg, var(--paper) 0%, #f6edda 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-family: "Rye", serif;
  font-size: 1.2rem;
  color: #2c251c;
}

.field-grid {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(70, 54, 34, 0.26);
  border-radius: 12px;
  padding: 12px;
  background: #fffdf7;
  color: var(--ink);
}

.figure-select {
  border-color: var(--seat-border-color, rgba(70, 54, 34, 0.26));
  background: linear-gradient(180deg, var(--seat-bg-top, #fffdf7), var(--seat-bg-bottom, #f7f1e4));
}

.figure-tone-preview {
  --seat-accent: #8f6b3a;
  border: 1px solid var(--seat-border-color, rgba(70, 54, 34, 0.26));
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--seat-bg-top, #fffdf7), var(--seat-bg-bottom, #f7f1e4));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
  display: grid;
  gap: 6px;
}

.figure-tone-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--seat-accent);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 0 0 1px rgba(40, 28, 17, 0.12);
  flex: none;
}

.money-input-wrap {
  position: relative;
}

.money-input-wrap input {
  padding-right: 36px;
}

.money-input-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: #75573a;
  pointer-events: none;
}

input:focus,
select:focus {
  outline: 2px solid rgba(208, 156, 53, 0.5);
  outline-offset: 1px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.18s ease;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

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

.btn-primary {
  background: linear-gradient(180deg, #1ea55f 0%, #157944 100%);
  color: #f9fff8;
}

.btn-secondary {
  background: linear-gradient(180deg, #4d3724 0%, #2f2115 100%);
  color: #fff6dc;
}

.btn-ghost {
  background: rgba(59, 38, 22, 0.08);
  color: #3d2e1f;
}

.btn-danger {
  background: linear-gradient(180deg, #cf4b3f 0%, #9f2f27 100%);
  color: #fff2ef;
}

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

.room-item {
  border: 1px solid rgba(56, 40, 24, 0.15);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.9);
  padding: 12px;
}

.room-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.room-name {
  font-weight: 800;
  color: #302518;
}

.room-code {
  font-size: 0.86rem;
  color: #765637;
  letter-spacing: 0.06em;
}

.room-meta {
  margin: 0;
  color: #5a4a38;
  font-size: 0.9rem;
}

.room-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  margin: 0;
  color: #6e665e;
}

.room-layout {
  display: grid;
  gap: 14px;
}

.top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: linear-gradient(180deg, #f7efdc 0%, #efe2c6 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.top-meta {
  min-width: 0;
}

.room-title {
  margin: 0;
  font-family: "Rye", serif;
  font-size: 1.15rem;
  color: #322517;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-subtitle {
  margin: 2px 0 0;
  color: #6a5338;
  font-size: 0.88rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(60, 44, 28, 0.18);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #4f3b25;
  background: rgba(255, 251, 242, 0.95);
}

.sound-toggle input {
  width: auto;
  margin: 0;
}

.status-banner {
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.status-info {
  background: linear-gradient(180deg, #fff8df 0%, #f7e8bd 100%);
  border: 1px solid rgba(115, 84, 37, 0.28);
  color: #624618;
}

.status-success {
  background: linear-gradient(180deg, #e4f8e8 0%, #ccebd2 100%);
  border: 1px solid rgba(34, 120, 66, 0.3);
  color: #1f6d3d;
}

.status-danger {
  background: linear-gradient(180deg, #ffe8e5 0%, #ffd3cd 100%);
  border: 1px solid rgba(143, 44, 35, 0.28);
  color: #8a2f29;
}

.table-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.table-toolbar {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.seat-sort-btn {
  justify-self: center;
  min-width: 154px;
  padding: 10px 14px;
  border-color: rgba(83, 60, 35, 0.22);
  background: rgba(255, 250, 239, 0.88);
  box-shadow: 0 4px 10px rgba(49, 34, 19, 0.08);
}

.seat-sort-btn.active {
  border-color: rgba(30, 165, 95, 0.38);
  background: rgba(232, 248, 238, 0.96);
  color: #164f31;
}

.seat-sort-hint {
  margin: 0;
  font-size: 0.84rem;
  color: #6c5a43;
}

.poker-table {
  position: relative;
  min-height: 380px;
  border-radius: 46% / 40%;
  border: 14px solid var(--wood-dark);
  background:
    radial-gradient(circle at 40% 18%, rgba(255, 255, 255, 0.2), transparent 35%),
    radial-gradient(circle at 50% 62%, var(--felt-light), var(--felt-mid) 48%, var(--felt-dark) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 235, 200, 0.18),
    inset 0 0 28px rgba(0, 0, 0, 0.34),
    0 10px 24px rgba(0, 0, 0, 0.36);
}

.table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(250px, 70%);
  border-radius: 16px;
  background: rgba(255, 248, 229, 0.93);
  border: 1px solid rgba(75, 52, 28, 0.25);
  text-align: center;
  padding: 12px;
}

.bank-center {
  width: min(170px, 48%);
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.bank-label {
  font-size: 1.45rem;
  font-weight: 800;
  color: #2f261c;
}

.bank-pot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(88, 65, 34, 0.12);
  color: #584122;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.bank-pot-chip-empty {
  opacity: 0.72;
}

.bank-pot-text {
  text-transform: uppercase;
}

.bank-pot-value {
  color: #2f261c;
}

.bank-center:hover {
  transform: translate(-50%, -50%) scale(1.02);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.bank-center:active {
  transform: translate(-50%, -50%) scale(0.99);
}

.bank-center:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.table-center p {
  margin: 4px 0;
  color: #5b4a34;
}

.table-center .center-balance {
  margin: 6px 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #2f261c;
}

.seat {
  --seat-bg-top: rgba(255, 251, 241, 0.98);
  --seat-bg-bottom: rgba(247, 242, 232, 0.96);
  --seat-border-color: rgba(57, 41, 25, 0.28);
  --seat-accent: #8f6b3a;
  --seat-balance-color: #2f2519;
  position: absolute;
  width: min(132px, 34vw);
  transform: translate(-50%, -50%);
  border-radius: 14px;
  border: 1px solid var(--seat-border-color);
  padding: 8px;
  background: linear-gradient(180deg, var(--seat-bg-top), var(--seat-bg-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 8px 16px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.seat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--seat-accent), rgba(255, 255, 255, 0.55));
  pointer-events: none;
}

.seat.me {
  border: 2px solid var(--gold);
}

.seat-tone-default {
  --seat-bg-top: rgba(255, 251, 241, 0.98);
  --seat-bg-bottom: rgba(247, 242, 232, 0.96);
  --seat-border-color: rgba(57, 41, 25, 0.28);
  --seat-accent: #8f6b3a;
  --seat-balance-color: #2f2519;
}

.seat-tone-hatt {
  --seat-bg-top: rgba(247, 230, 196, 0.98);
  --seat-bg-bottom: rgba(235, 208, 159, 0.96);
  --seat-border-color: rgba(141, 93, 28, 0.44);
  --seat-accent: #996019;
  --seat-balance-color: #6f4300;
}

.seat-tone-bil {
  --seat-bg-top: rgba(213, 234, 255, 0.98);
  --seat-bg-bottom: rgba(182, 214, 249, 0.96);
  --seat-border-color: rgba(24, 93, 173, 0.42);
  --seat-accent: #1664bf;
  --seat-balance-color: #0e4787;
}

.seat-tone-hund {
  --seat-bg-top: rgba(220, 244, 212, 0.98);
  --seat-bg-bottom: rgba(187, 226, 171, 0.96);
  --seat-border-color: rgba(48, 128, 56, 0.42);
  --seat-accent: #2f933d;
  --seat-balance-color: #23642d;
}

.seat-tone-skepp {
  --seat-bg-top: rgba(211, 245, 244, 0.98);
  --seat-bg-bottom: rgba(174, 227, 224, 0.96);
  --seat-border-color: rgba(18, 140, 149, 0.42);
  --seat-accent: #12919b;
  --seat-balance-color: #0f646b;
}

.seat-tone-katt {
  --seat-bg-top: rgba(255, 229, 205, 0.98);
  --seat-bg-bottom: rgba(249, 199, 157, 0.96);
  --seat-border-color: rgba(198, 107, 33, 0.42);
  --seat-accent: #d06c1d;
  --seat-balance-color: #8b4709;
}

.seat-tone-trex {
  --seat-bg-top: rgba(251, 223, 230, 0.98);
  --seat-bg-bottom: rgba(240, 181, 194, 0.96);
  --seat-border-color: rgba(190, 62, 98, 0.42);
  --seat-accent: #c24163;
  --seat-balance-color: #892042;
}

.seat-tone-pingvin {
  --seat-bg-top: rgba(231, 230, 252, 0.98);
  --seat-bg-bottom: rgba(203, 199, 245, 0.96);
  --seat-border-color: rgba(94, 92, 182, 0.42);
  --seat-accent: #6357c8;
  --seat-balance-color: #41319f;
}

.seat-tone-gummianka {
  --seat-bg-top: rgba(255, 245, 166, 0.98);
  --seat-bg-bottom: rgba(245, 224, 105, 0.96);
  --seat-border-color: rgba(178, 145, 11, 0.42);
  --seat-accent: #d1a400;
  --seat-balance-color: #825f00;
}

.seat.clickable {
  cursor: pointer;
}

.seat.clickable:hover {
  border-color: rgba(207, 155, 59, 0.8);
  transform: translate(-50%, -50%) scale(1.03);
}

.seat-sortable {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.seat-sortable:active {
  cursor: grabbing;
}

.seat-selected {
  border-color: rgba(207, 155, 59, 0.92);
  box-shadow: 0 0 0 2px rgba(207, 155, 59, 0.3), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.seat-drop-target {
  border-color: rgba(30, 165, 95, 0.92);
  box-shadow: 0 0 0 2px rgba(30, 165, 95, 0.25), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.seat-dragging {
  opacity: 0.35;
}

.seat-name {
  margin: 0;
  font-weight: 800;
  color: #2f2519;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-balance {
  margin: 4px 0 2px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--seat-balance-color);
}

.seat-delta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.delta-positive {
  color: var(--success);
}

.delta-negative {
  color: var(--danger);
}

.delta-neutral {
  color: #615747;
}

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

.identity-grid {
  align-items: start;
}

.panel-title {
  margin: 0 0 10px;
  font-family: "Rye", serif;
  font-size: 1.05rem;
}

.quick-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.quick-btn {
  padding: 10px 4px;
  background: linear-gradient(180deg, #fffbef 0%, #f1e4c4 100%);
  color: #4e3a23;
  border: 1px solid rgba(83, 60, 35, 0.24);
}

.action-card {
  background: linear-gradient(180deg, #fff4d9 0%, #f6e7c2 100%);
}

.bank-pot-summary,
.bank-claim-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 252, 245, 0.8);
  border: 1px solid rgba(88, 65, 34, 0.16);
}

.bank-pot-summary-label {
  color: #68553a;
  font-weight: 700;
}

.bank-pot-summary-value,
.bank-claim-card strong {
  font-size: 1rem;
  color: #2f261c;
}

.bank-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.bank-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid rgba(88, 65, 34, 0.18);
  background: rgba(255, 251, 243, 0.92);
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  color: #4d3d28;
}

.bank-mode-option.active {
  border-color: rgba(15, 93, 56, 0.42);
  background: rgba(232, 248, 238, 0.96);
  box-shadow: inset 0 0 0 1px rgba(15, 93, 56, 0.12);
}

.bank-mode-option input {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #0f5d38;
}

.bank-mode-help {
  margin: 0;
}

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

.history-item {
  border: 1px solid rgba(56, 40, 24, 0.16);
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(255, 252, 245, 0.92);
}

.history-main {
  margin: 0;
  color: #33291d;
  font-weight: 700;
}

.history-time {
  margin: 2px 0 0;
  font-size: 0.79rem;
  color: #756955;
}

.participants {
  display: grid;
  gap: 8px;
}

.participant {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(62, 45, 28, 0.18);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 251, 243, 0.9);
}

.chip-active {
  font-size: 0.79rem;
  font-weight: 800;
  color: #1f7240;
}

.chip-bankrupt {
  font-size: 0.79rem;
  font-weight: 800;
  color: #8f2f28;
}

.flash {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}

.flash.error {
  background: rgba(212, 76, 65, 0.9);
  color: #fff6f5;
}

.flash.success {
  background: rgba(34, 142, 80, 0.9);
  color: #f2fff7;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.muted {
  color: #6e655b;
}

input[type="password"] {
  letter-spacing: 0.18em;
}

@media (min-width: 780px) {
  .home-install-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .home-install-actions {
    justify-content: flex-end;
  }

  .home-grid {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }

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

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

  .home-install-card {
    gap: 10px;
  }

  .top-bar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: space-between;
  }

  .poker-table {
    min-height: 460px;
    border-width: 11px;
  }

  .table-stage .poker-table {
    min-height: clamp(470px, calc(100dvh - 136px), 680px);
  }

  .bank-center {
    width: min(108px, 34%);
    min-height: 64px;
    padding: 8px 6px;
  }

  .bank-label {
    font-size: 1rem;
  }

  .bank-pot-chip {
    padding: 3px 7px;
    font-size: 0.63rem;
    gap: 4px;
  }

  .seat {
    width: min(86px, 26vw);
    padding: 5px;
    border-radius: 11px;
  }

  .seat.seat-left {
    transform: translate(calc(-50% - 5px), -50%);
  }

  .seat.seat-right {
    transform: translate(calc(-50% + 5px), -50%);
  }

  .seat.clickable.seat-left:hover {
    transform: translate(calc(-50% - 5px), -50%) scale(1.03);
  }

  .seat.clickable.seat-right:hover {
    transform: translate(calc(-50% + 5px), -50%) scale(1.03);
  }

  .seat-name {
    font-size: 0.72rem;
  }

  .seat-balance {
    margin: 3px 0 1px;
    font-size: 0.82rem;
  }

  .seat-delta {
    font-size: 0.66rem;
  }

  .quick-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Layout overrides for app-like fullscreen room view */
html,
body {
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

#app {
  min-height: 100%;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100dvh;
  height: auto;
  margin: 0 auto;
  padding: 10px 10px 14px;
  overflow: visible;
}

.room-layout-full {
  display: grid;
  gap: 8px;
  min-height: calc(100dvh - 24px);
  align-content: start;
}

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

.tab-btn {
  min-width: 0;
  border-radius: 10px;
  padding: 9px 6px;
  background: rgba(255, 246, 222, 0.82);
  border: 1px solid rgba(72, 52, 31, 0.18);
  color: #4d3822;
  font-weight: 800;
  font-size: 0.84rem;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.tab-btn.active {
  background: linear-gradient(180deg, #1ea55f 0%, #157944 100%);
  color: #f9fff8;
  border-color: transparent;
}

.tab-view {
  min-height: auto;
  overflow: visible;
  display: grid;
  gap: 10px;
  padding-bottom: 4px;
}

.table-stage {
  margin: 0;
  --table-available-height: calc(100dvh - 170px);
}

.table-stage .poker-table,
.archive-panel {
  margin: 0;
}

.table-stage .poker-table {
  min-height: clamp(520px, var(--table-available-height), 760px);
}

@media (max-width: 900px) and (orientation: landscape) {
  .app-shell {
    min-height: 100svh;
  }

  .room-layout-full {
    min-height: calc(100svh - 20px);
  }

  .table-stage {
    --table-available-height: calc(100svh - 210px);
  }

  .table-stage .poker-table {
    min-height: clamp(180px, var(--table-available-height), 250px);
    border-width: 8px;
  }
}

.history-expanded,
.history-full {
  margin-top: 8px;
  max-height: 30vh;
  overflow: auto;
  padding-right: 2px;
}

.settings-grid {
  display: grid;
  gap: 6px;
}

.settings-grid p {
  margin: 0;
}

.seat.self-click {
  border-color: rgba(199, 75, 67, 0.42);
}

.action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 18, 12, 0.56);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 14px;
}

.action-modal {
  width: min(520px, 100%);
  max-height: 86dvh;
  overflow: auto;
}

@media (max-width: 780px) {
  .action-overlay {
    padding: 8px;
  }

  .action-modal {
    max-height: 94dvh;
  }

  .action-card {
    padding: 12px;
  }

  .action-card .panel-title {
    margin-bottom: 6px;
    font-size: 0.96rem;
  }

  .action-card .field-grid {
    gap: 8px;
  }

  .action-card label {
    gap: 4px;
    font-size: 0.85rem;
  }

  .action-card .quick-row {
    margin-top: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .action-card .quick-btn {
    padding: 8px 2px;
    font-size: 0.72rem;
  }

  .bank-pot-summary,
  .bank-claim-card {
    padding: 8px 10px;
    gap: 8px;
  }

  .bank-pot-summary-label,
  .bank-claim-card span {
    font-size: 0.82rem;
  }

  .bank-pot-summary-value,
  .bank-claim-card strong {
    font-size: 0.92rem;
  }

  .bank-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .bank-mode-option {
    gap: 6px;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .bank-mode-help {
    font-size: 0.82rem;
  }

  .tab-view {
    gap: 8px;
  }

  .table-stage .poker-table {
    min-height: clamp(500px, calc(100dvh - 150px), 720px);
    border-width: 10px;
  }

  .bank-center {
    width: min(124px, 36%);
    min-height: 74px;
    padding: 10px 8px;
  }

  .bank-label {
    font-size: 1.15rem;
  }

  .bank-pot-chip {
    padding: 3px 8px;
    font-size: 0.68rem;
  }

  .seat {
    width: min(96px, 27vw);
    padding: 6px;
    border-radius: 12px;
  }

  .seat.seat-left {
    transform: translate(calc(-50% - 5px), -50%);
  }

  .seat.seat-right {
    transform: translate(calc(-50% + 5px), -50%);
  }

  .seat.clickable.seat-left:hover {
    transform: translate(calc(-50% - 5px), -50%) scale(1.03);
  }

  .seat.clickable.seat-right:hover {
    transform: translate(calc(-50% + 5px), -50%) scale(1.03);
  }

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

  .seat-balance {
    margin: 3px 0 1px;
    font-size: 0.88rem;
  }

  .seat-delta {
    font-size: 0.72rem;
  }
}

@media (max-width: 580px) {
  .action-overlay {
    padding: 6px;
  }

  .action-card {
    padding: 10px;
  }

  .action-card .quick-btn {
    font-size: 0.68rem;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .app-shell {
    min-height: 100svh;
  }

  .room-layout-full {
    min-height: calc(100svh - 12px);
  }

  .table-stage {
    --table-available-height: calc(100svh - 150px);
  }

  .table-stage .poker-table {
    min-height: clamp(250px, var(--table-available-height), 368px);
    border-width: 8px;
  }
}
