:root {
  color-scheme: dark;
  --bg: #101313;
  --surface: #171b1a;
  --surface-strong: #1d2321;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f2e9;
  --muted: #a6aca8;
  --gold: #d8b960;
  --green: #62a98e;
  --red: #d56368;
  --yellow: #e0b75b;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body,
#display-root {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.board {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  min-height: 74px;
  padding: 0 36px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand,
.join-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold);
}

.suit {
  margin-right: 8px;
  color: var(--red);
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
}

.game-mode {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
}

.status-badge,
.buy-in-state {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-running {
  color: var(--green);
  border-color: rgba(98, 169, 142, 0.55);
}

.status-paused {
  color: var(--yellow);
  border-color: rgba(224, 183, 91, 0.55);
}

.status-terminal {
  color: var(--red);
  border-color: rgba(213, 99, 104, 0.55);
}

.connection-state {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.connection-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--yellow);
}

.connection-online .connection-dot {
  background: var(--green);
}

.connection-offline .connection-dot {
  background: var(--red);
}

.board-content {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(210px, 0.65fr) minmax(0, 3fr);
}

.rewards-panel {
  min-width: 0;
  padding: 30px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.rewards-panel h2 {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.rewards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reward-row {
  min-height: 60px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.reward-rank {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-strong);
  color: var(--gold);
  font-weight: 800;
}

.reward-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.35;
}

.empty-rewards {
  color: var(--muted);
  font-size: 0.95rem;
}

.primary-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
}

.level-label,
.blind-label,
.timer-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.current-level {
  margin: 7px 0 22px;
  color: var(--gold);
  font-size: 4.6rem;
  line-height: 1;
  font-weight: 800;
}

.blind-card {
  min-width: min(520px, 80%);
  margin-bottom: 22px;
  padding: 16px 30px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.blinds {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 4rem;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.blind-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.blind-value strong {
  font: inherit;
}

.blind-value span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.blind-divider {
  color: rgba(255, 255, 255, 0.22);
  font-weight: 400;
}

.blind-note {
  margin-top: 10px;
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 700;
}

.timer {
  margin: 5px 0 22px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 8.5rem;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-urgent {
  color: var(--red);
}

.next-section {
  width: min(560px, 86%);
  margin-bottom: 18px;
  padding: 12px 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.next-section h2 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.next-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.next-level {
  color: var(--gold);
  font-size: 1.7rem;
  font-weight: 800;
}

.next-blinds {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.next-divider {
  color: rgba(255, 255, 255, 0.22);
}

.buy-in-state {
  color: var(--green);
  border-color: rgba(98, 169, 142, 0.55);
}

.buy-in-closed {
  color: var(--red);
  border-color: rgba(213, 99, 104, 0.55);
}

.stats-grid {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-width: 0;
  padding: 13px 16px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-card strong {
  color: var(--text);
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
}

.footer-band {
  min-height: 44px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
}

.loading-view,
.join-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.loading-view {
  gap: 14px;
  color: var(--muted);
}

.loading-mark {
  color: var(--red);
  font-size: 3.4rem;
}

.join-view {
  padding: 30px;
}

.join-view h1 {
  margin: 28px 0 38px;
  font-size: 3.4rem;
}

.join-form {
  width: min(520px, 100%);
}

.join-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.join-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}

.join-controls input,
.join-controls button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.join-controls input {
  min-width: 0;
  padding: 0 18px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.join-controls input:focus {
  border-color: var(--gold);
}

.join-controls button {
  background: var(--gold);
  color: #151817;
  font-weight: 800;
}

.form-error {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 0.85rem;
}

.fullscreen-button {
  position: fixed;
  right: 18px;
  bottom: 56px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(23, 27, 26, 0.86);
  color: var(--muted);
  font-size: 1.35rem;
}

.fullscreen-button:hover,
.fullscreen-button:focus-visible {
  color: var(--text);
  border-color: var(--gold);
}

@media (max-height: 800px) {
  .topbar {
    min-height: 60px;
  }

  .rewards-panel {
    padding: 20px;
  }

  .current-level {
    margin-bottom: 14px;
    font-size: 3.5rem;
  }

  .blind-card {
    margin-bottom: 14px;
    padding: 10px 24px;
  }

  .blinds {
    margin-top: 7px;
    font-size: 3rem;
  }

  .timer {
    margin-bottom: 14px;
    font-size: 5.7rem;
  }

  .next-section {
    margin-bottom: 12px;
    padding: 9px 16px;
  }

  .stat-card {
    padding: 9px 12px;
  }
}

@media (max-width: 1100px) and (orientation: landscape) {
  .board-content {
    grid-template-columns: minmax(170px, 0.6fr) minmax(0, 3fr);
  }

  .rewards-panel {
    padding: 16px;
  }

  .topbar {
    padding: 0 20px;
  }
}

@media (max-height: 650px) and (orientation: landscape) {
  .topbar {
    min-height: 52px;
  }

  .footer-band {
    min-height: 32px;
  }

  .rewards-panel {
    padding: 12px 16px;
  }

  .rewards-panel h2 {
    margin-bottom: 9px;
  }

  .rewards-list {
    gap: 6px;
  }

  .reward-row {
    min-height: 44px;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    padding: 4px 0;
  }

  .reward-rank {
    width: 32px;
    height: 32px;
    font-size: 0.78rem;
  }

  .primary-panel {
    padding: 10px 18px;
  }

  .current-level {
    margin: 3px 0 9px;
    font-size: 2.7rem;
  }

  .blind-card {
    margin-bottom: 9px;
    padding: 7px 20px;
  }

  .blinds {
    margin-top: 5px;
    gap: 16px;
    font-size: 2.4rem;
  }

  .blind-value {
    gap: 3px;
  }

  .blind-note {
    margin-top: 5px;
  }

  .timer {
    margin: 3px 0 9px;
    font-size: 4.3rem;
  }

  .next-section {
    margin-bottom: 9px;
    padding: 6px 14px;
  }

  .next-section h2 {
    margin-bottom: 3px;
  }

  .next-level,
  .next-blinds {
    font-size: 1.2rem;
  }

  .stat-card {
    padding: 6px 10px;
  }

  .stat-card strong {
    font-size: 1.45rem;
  }

  .fullscreen-button {
    bottom: 39px;
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 980px) and (orientation: portrait) {
  html,
  body,
  #display-root {
    min-height: 100%;
    height: auto;
    overflow: auto;
  }

  .board {
    min-height: 100vh;
  }

  .topbar {
    padding: 0 18px;
    grid-template-columns: 1fr auto;
  }

  .game-meta {
    justify-self: end;
  }

  .connection-state {
    display: none;
  }

  .board-content {
    grid-template-columns: 1fr;
  }

  .primary-panel {
    min-height: 520px;
    order: 1;
  }

  .rewards-panel {
    order: 2;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .timer {
    font-size: 6.5rem;
  }
}

@media (max-height: 420px) and (orientation: landscape) {
  .topbar {
    min-height: 44px;
  }

  .brand {
    font-size: 1rem;
  }

  .game-meta {
    font-size: 1rem;
  }

  .status-badge,
  .buy-in-state {
    padding: 4px 7px;
    font-size: 0.7rem;
  }

  .footer-band {
    min-height: 26px;
  }

  .primary-panel {
    padding: 4px 12px;
  }

  .level-label,
  .blind-label,
  .timer-label {
    font-size: 0.7rem;
  }

  .current-level {
    margin: 2px 0 6px;
    font-size: 2.1rem;
  }

  .blind-card {
    margin-bottom: 6px;
    padding: 4px 16px;
  }

  .blinds {
    margin-top: 3px;
    gap: 12px;
    font-size: 1.9rem;
  }

  .blind-value {
    gap: 2px;
  }

  .blind-value span,
  .blind-note {
    font-size: 0.65rem;
  }

  .blind-note {
    margin-top: 3px;
  }

  .timer {
    margin: 2px 0 6px;
    font-size: 3.2rem;
  }

  .next-section {
    margin-bottom: 6px;
    padding: 4px 12px;
  }

  .next-section h2 {
    margin-bottom: 2px;
    font-size: 0.65rem;
  }

  .next-level,
  .next-blinds {
    font-size: 1rem;
  }

  .stat-card {
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  .stat-card strong {
    font-size: 1.2rem;
  }

  .fullscreen-button {
    right: 10px;
    bottom: 31px;
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 600px) and (orientation: portrait) {
  .brand {
    font-size: 1rem;
  }

  .game-meta {
    gap: 8px;
    font-size: 0.9rem;
  }

  .status-badge {
    padding: 5px 7px;
  }

  .buy-in-state {
    display: none;
  }

  .primary-panel {
    min-height: 430px;
    padding: 20px 12px;
  }

  .current-level {
    font-size: 3rem;
  }

  .blinds {
    gap: 12px;
    font-size: 2.4rem;
  }

  .blind-card,
  .next-section {
    min-width: 0;
    width: 100%;
  }

  .timer {
    font-size: 4.2rem;
  }

  .footer-band {
    padding: 0 18px;
  }
}
