:root {
  --bg: #0b1826;
  --surface: #12243a;
  --surface-2: #173050;
  --surface-3: #1f3b60;
  --border: #2a4a70;
  --text: #f3f4f8;
  --muted: #9fb3cc;
  --crimson: #ffb547;
  --crimson-soft: rgba(255, 181, 71, 0.18);
  --green: #28a745;
  --green-bright: #2ecc71;
  --green-dark: #1d7a32;
  --blue: #34b4ff;
  --purple: #913ef8;
  --pink: #c017b4;
  --amber: #f59e0b;
  --cyan: #06b6d4;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px 14px 14px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

/* Topbar */
.topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.02em;
  color: var(--crimson);
}

.brand-duel-badge {
  background: var(--crimson);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

.engine-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}

.engine-pill.online {
  color: var(--green-bright);
  border-color: rgba(46, 204, 113, 0.35);
}

.engine-pill.offline {
  color: var(--crimson);
  border-color: rgba(255, 181, 71, 0.4);
}

/* History Strip (pílulas de multiplicador) */
.history-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding: 2px 4px;
}
.history-strip::-webkit-scrollbar {
  display: none;
}

.mult-pill {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid transparent;
}
.mult-pill.low {
  color: var(--blue);
  border-color: rgba(52, 180, 255, 0.25);
}
.mult-pill.mid {
  color: #b47cff;
  border-color: rgba(145, 62, 248, 0.35);
  background: rgba(145, 62, 248, 0.1);
}
.mult-pill.high {
  color: #ff4fd8;
  border-color: rgba(192, 23, 180, 0.45);
  background: rgba(192, 23, 180, 0.14);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s, background 0.15s;
}
.icon-btn:hover {
  background: var(--surface-3);
  border-color: #424657;
}

.primary-sm-btn {
  background: linear-gradient(135deg, #ffb547, #ff8a1f);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.primary-sm-btn:hover {
  filter: brightness(1.1);
}
.primary-sm-btn:active {
  transform: scale(0.97);
}

/* Duel Scoreboard HUD */
.duel-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

.fighter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fighter-card.p1.leading {
  border-color: rgba(46, 204, 113, 0.5);
  box-shadow: inset 0 0 0 1px rgba(46, 204, 113, 0.18);
}

.fighter-card.p2.leading {
  border-color: rgba(168, 85, 247, 0.55);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.18);
}

.fighter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fighter-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.slot-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.p1-tag {
  background: rgba(46, 204, 113, 0.18);
  color: var(--green-bright);
  border: 1px solid rgba(46, 204, 113, 0.35);
}
.p2-tag {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.fighter-name {
  font-weight: 700;
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crown-badge {
  font-size: 0.9rem;
}

.fighter-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
}

.score-value {
  font-size: 1.45rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-unit {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.fighter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.status-pill.waiting {
  background: var(--surface-2);
  color: var(--muted);
}
.status-pill.flying {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}
.status-pill.cashed {
  background: rgba(46, 204, 113, 0.18);
  color: var(--green-bright);
}
.status-pill.crashed {
  background: rgba(255, 181, 71, 0.18);
  color: #ff5c7c;
}
.status-pill.disconnected {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.target-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.round-center-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-width: 195px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.round-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.round-badge {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text);
}

.overtime-badge {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 1px 7px;
  border-radius: 999px;
  animation: pulseGlow 1.2s infinite;
}

.round-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.round-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.round-dot.active {
  border-color: var(--crimson);
  color: #fff;
  background: var(--crimson-soft);
}
.round-dot.win-p1 {
  background: rgba(46, 204, 113, 0.22);
  border-color: var(--green-bright);
  color: var(--green-bright);
}
.round-dot.win-p2 {
  background: rgba(168, 85, 247, 0.22);
  border-color: #c084fc;
  color: #c084fc;
}
.round-dot.tie {
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--amber);
  color: var(--amber);
}

.room-code-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}
.room-code-bar strong {
  color: #fff;
  letter-spacing: 0.12em;
}

.copy-code-btn {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}
.copy-code-btn:hover {
  border-color: #555a6e;
}

/* Main Stage Canvas */
.stage-wrapper {
  position: relative;
  background: radial-gradient(circle at 50% 65%, #191a24 0%, #0d0e13 78%);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  min-height: 360px;
  height: clamp(360px, 49vh, 520px);
}

#aviator-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-seed-pill {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(14, 14, 17, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.68rem;
  color: var(--muted);
  z-index: 4;
}
.stage-seed-pill code {
  color: #cfd4e2;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  text-align: center;
  padding: 20px;
}

.overlay-waiting {
  pointer-events: auto;
  background: rgba(14, 14, 17, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 30px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.overlay-waiting h2 {
  font-size: 1.2rem;
}
.overlay-waiting p {
  font-size: 0.86rem;
  color: var(--muted);
}
.waiting-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--crimson);
  padding: 10px 18px;
  border-radius: 12px;
  margin-top: 4px;
}
.waiting-code-box span {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #fff;
}

.spinner-ring {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 181, 71, 0.2);
  border-top-color: var(--crimson);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.overlay-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(14, 14, 17, 0.58);
  padding: 18px 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
}
.countdown-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.countdown-timer {
  font-size: 3.1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #fff;
}
.countdown-bar-track {
  width: 240px;
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.countdown-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--crimson), #ffd27a);
  transition: width 0.08s linear;
}
.countdown-sub {
  font-size: 0.76rem;
  color: var(--muted);
}

.overlay-flying {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.live-multiplier {
  font-size: clamp(3.2rem, 7vw, 5.4rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.65);
  line-height: 1;
}
.live-multiplier.tier-mid {
  color: #e9d5ff;
  text-shadow: 0 0 32px rgba(145, 62, 248, 0.55);
}
.live-multiplier.tier-high {
  color: #ffd6f5;
  text-shadow: 0 0 36px rgba(255, 181, 71, 0.75);
}

.live-sub-pill {
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid rgba(46, 204, 113, 0.45);
  color: var(--green-bright);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

.overlay-crashed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.crashed-banner {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: uppercase;
}
.crashed-multiplier {
  font-size: clamp(3.1rem, 6.5vw, 5rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--crimson);
  text-shadow: 0 0 30px rgba(255, 181, 71, 0.55);
  line-height: 1;
}
.crashed-seed-tag {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(24, 25, 31, 0.85);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Cockpit Controls */
.cockpit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.control-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.p1-dot {
  background: var(--green-bright);
  box-shadow: 0 0 8px var(--green-bright);
}
.p2-dot {
  background: #c084fc;
  box-shadow: 0 0 8px #c084fc;
}

.shortcut-badge {
  font-size: 0.7rem;
  color: var(--muted);
}
kbd {
  background: var(--surface-3);
  border: 1px solid #3f4354;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
}

.control-body {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 10px;
  align-items: stretch;
}

/* Botão de ação */
.action-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: transform 0.08s, filter 0.15s, background 0.15s;
  min-height: 80px;
  color: #fff;
}
.action-btn:active:not(:disabled) {
  transform: translateY(2px);
}
.action-btn:disabled {
  cursor: not-allowed;
}

.action-btn.cashout-idle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.action-btn.cashout-live {
  background: linear-gradient(180deg, #32d275 0%, #249b46 100%);
  box-shadow: 0 4px 0 #17692d, 0 8px 24px rgba(46, 204, 113, 0.32);
  color: #fff;
}
.action-btn.cashout-live:hover {
  filter: brightness(1.06);
}

.action-btn.p2-btn-theme.cashout-live {
  background: linear-gradient(180deg, #b86bff 0%, #8631dc 100%);
  box-shadow: 0 4px 0 #5b1fa0, 0 8px 24px rgba(168, 85, 247, 0.34);
}

.action-btn.cashout-locked {
  background: rgba(46, 204, 113, 0.16);
  border: 1px solid rgba(46, 204, 113, 0.45);
  color: var(--green-bright);
}

.action-btn.cashout-crashed {
  background: rgba(255, 181, 71, 0.14);
  border: 1px solid rgba(255, 181, 71, 0.4);
  color: #ff6b8b;
}

.btn-main-text {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.btn-sub-text {
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

/* Auto-Cashout Box */
.auto-cashout-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.auto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.switch-label input {
  display: none;
}
.switch-slider {
  width: 32px;
  height: 18px;
  background: #363946;
  border-radius: 999px;
  position: relative;
  transition: background 0.15s;
}
.switch-slider::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.15s;
}
.switch-label input:checked + .switch-slider {
  background: var(--green);
}
.switch-label input:checked + .switch-slider::after {
  transform: translateX(14px);
}

.mult-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 7px;
  gap: 3px;
}
.mult-input-wrap input {
  width: 56px;
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.mult-input-wrap span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.preset-btn {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 0;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.preset-btn:hover {
  border-color: #555b70;
  background: #313442;
}

/* Telemetry Card */
.mode-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #c084fc;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.telemetry-live-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.tele-status-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tele-headline {
  font-size: 0.9rem;
  font-weight: 800;
}
.tele-subline {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.duel-mini-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 70px;
  overflow-y: auto;
}
.mini-hist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  background: var(--surface-2);
  padding: 4px 9px;
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
}
.mini-hist-empty {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 8px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 12, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 580px;
  padding: 20px 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
}
.modal-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

.close-modal-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.95rem;
}
.close-modal-btn:hover {
  color: #fff;
}

.lobby-config-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-group label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}
.field-group input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
}
.field-group input:focus {
  border-color: var(--crimson);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 7px 4px;
  border-radius: 7px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--surface-3);
  color: #fff;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.mode-tab {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 11px;
  padding: 9px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.mode-tab.active {
  background: var(--crimson-soft);
  border-color: var(--crimson);
  color: #fff;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.diff-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.diff-card.active {
  border-color: var(--green-bright);
  background: rgba(46, 204, 113, 0.1);
}
.diff-emoji {
  font-size: 1.35rem;
}
.diff-card strong {
  font-size: 0.85rem;
}
.diff-card small {
  font-size: 0.7rem;
  color: var(--muted);
}

.online-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.online-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.online-box h4 {
  font-size: 0.88rem;
}
.online-box p {
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1;
}

.join-code-row {
  display: flex;
  gap: 6px;
}
.join-code-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.queue-status {
  background: rgba(52, 180, 255, 0.1);
  border: 1px solid rgba(52, 180, 255, 0.35);
  border-radius: 11px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(52, 180, 255, 0.25);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.cancel-queue-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 0.74rem;
  cursor: pointer;
}

.local-keys-info {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.cta-btn {
  width: 100%;
  background: linear-gradient(135deg, #28c76f, #1e9e52);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s;
}
.cta-btn:hover {
  filter: brightness(1.08);
}

.cta-secondary-btn {
  width: 100%;
  background: var(--surface-3);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.cta-secondary-btn:hover {
  border-color: #54596f;
}

.cta-sm-btn {
  background: var(--crimson);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.lobby-rules-footer {
  font-size: 0.74rem;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px 11px;
  line-height: 1.45;
}
.lobby-rules-footer code {
  color: #fff;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Provably Fair Modal */
.fair-current-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fair-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fair-label {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 700;
}
.fair-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  background: var(--bg);
  padding: 7px 9px;
  border-radius: 8px;
  word-break: break-all;
  color: #93c5fd;
}
.fair-seed-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.seed-input-flex {
  display: flex;
  gap: 6px;
}
.seed-input-flex input {
  flex: 1;
  min-width: 0;
}

.fair-hist-title {
  font-size: 0.86rem;
}
.fair-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.fair-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fair-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fair-verify-btn {
  background: var(--surface-3);
  border: 1px solid #454a5c;
  color: #fff;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.fair-verify-result {
  font-size: 0.72rem;
  font-weight: 700;
}
.fair-verify-result.ok {
  color: var(--green-bright);
}
.fair-verify-result.fail {
  color: var(--crimson);
}

/* Match Over Podium */
.podium-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.podium-trophy {
  font-size: 2.6rem;
}
.podium-scores {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.podium-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 10px;
}
.podium-player.winner {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.45);
}
.podium-pts {
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.podium-vs {
  font-weight: 900;
  color: var(--muted);
}

.podium-table-wrap {
  max-height: 185px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
}
.podium-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.podium-table th, .podium-table td {
  padding: 7px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.podium-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
}

.podium-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rematch-wait-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--amber);
  font-weight: 700;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--crimson);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  animation: fadeSlide 0.2s ease-out;
}
.toast.success {
  border-left-color: var(--green-bright);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .duel-hud {
    grid-template-columns: 1fr 1fr;
  }
  .round-center-card {
    grid-column: 1 / -1;
    order: -1;
  }
  .cockpit-grid {
    grid-template-columns: 1fr;
  }
  .lobby-config-row,
  .online-actions-grid,
  .fair-seed-edit-row {
    grid-template-columns: 1fr;
  }
  .hide-sm {
    display: none;
  }
}

@media (max-width: 520px) {
  .control-body {
    grid-template-columns: 1fr;
  }
  .difficulty-grid {
    grid-template-columns: 1fr;
  }
}
