:root {
  --bg-dark: #f1f5f9;
  --bg-panel: #ffffff;
  --bg-elevated: #f8fafc;
  --border: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --team-a: #0d9488;
  --team-a-bg: rgba(13, 148, 136, 0.08);
  --team-b: #4f46e5;
  --team-b-bg: rgba(79, 70, 229, 0.08);
  --success: #15803d;
  --danger: #b91c1c;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* TOP BAR */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #1e293b;
  color: #f8fafc;
  border-bottom: 1px solid #0f172a;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: #f8fafc;
}

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

/* MOBILE PANE NAV (Hidden on desktop; visible on mobile <= 960px) */
.mobile-pane-nav {
  display: none;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  padding: 4px 8px;
  gap: 4px;
  position: sticky;
  top: 48px;
  z-index: 89;
}

.pane-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 4px;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pane-tab .pane-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #475569;
  transition: all 0.15s ease;
}

.pane-tab.active {
  background: #1e293b;
  color: #f8fafc;
  border-color: #38bdf8;
}

.pane-tab.active .pane-dot {
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}

/* MOBILE STICKY BOTTOM BAR (Hidden on desktop; visible on mobile <= 960px) */
.mobile-sticky-bottom-bar {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid #334155;
  padding: 6px 12px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
  z-index: 95;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.25);
}

.btn-ptt-sticky {
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  gap: 10px !important;
  padding: 8px 14px !important;
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.btn-ptt-sticky:hover {
  background: #0369a1 !important;
}

.btn-ptt-sticky.listening {
  background: #b91c1c !important;
  border-color: #f87171 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3) !important;
}

.ptt-sticky-texts {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}

.btn-ptt-sticky .ptt-main-text {
  color: #ffffff !important;
  font-size: 0.88rem !important;
}

.btn-ptt-sticky .ptt-sub-text {
  color: #e0f2fe !important;
  font-size: 0.68rem !important;
}

.top-bar .btn {
  background: #334155;
  color: #f8fafc;
  border-color: #475569;
}

.top-bar .btn:hover:not(:disabled) {
  background: #475569;
}

.top-bar .btn-danger {
  background: #991b1b;
  color: #fef2f2;
  border-color: #b91c1c;
}

/* MAIN 3-COLUMN TABLETOP GRID */
.tabletop-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 420px 1fr;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

/* TEAM PANELS */
.team-panel {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 12px;
  min-height: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.team-panel.active-turn.team-a {
  border-color: var(--team-a);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.team-panel.active-turn.team-b {
  border-color: var(--team-b);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.team-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.team-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-info-right {
  text-align: right;
  align-items: flex-end;
}

.team-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-badges-right {
  justify-content: flex-end;
}

.team-side-tag {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
}

.team-role-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.team-panel.active-turn.team-a .team-role-badge {
  background: var(--team-a);
  color: #fff;
  border-color: var(--team-a);
}

.team-panel.active-turn.team-b .team-role-badge {
  background: var(--team-b);
  color: #fff;
  border-color: var(--team-b);
}

.team-name {
  font-size: 1.45rem;
  font-weight: 800;
  outline: none;
  border-bottom: 2px dashed transparent;
  color: var(--text-main);
}

.team-name:focus {
  border-bottom-color: var(--accent);
}

.team-disp {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vp-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  min-width: 132px;
}

.vp-total {
  font-size: 2.35rem;
  font-weight: 900;
  line-height: 1;
}

.team-a .vp-total {
  color: var(--team-a);
}

.team-b .vp-total {
  color: var(--team-b);
}

.vp-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.vp-cap-note {
  font-weight: 600;
  opacity: 0.8;
}

.vp-split {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.vp-split small {
  font-size: 0.65rem;
  opacity: 0.75;
}

.vp-capped {
  color: var(--success);
  font-weight: 800;
}

/* MISSION SECTIONS */
.mission-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mission-section.flex-grow {
  flex: 1;
  min-height: 0;
}

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

.section-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.primary-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.primary-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.primary-summary {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  max-height: 68px;
  overflow-y: auto;
}

.quick-vp-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.quick-vp-lbl {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

/* SECONDARY HAND */
.draw-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.card-select {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 0.78rem;
  max-width: 175px;
}

.hand-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.empty-hand {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  background: var(--bg-elevated);
}

.sec-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sec-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sec-card-name {
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-main);
}

.sec-card-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.sec-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sec-card-text {
  font-size: 0.76rem;
  color: #334155;
  line-height: 1.35;
}

.sec-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.sec-vp-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* HISTORY PILLS */
.history-mini-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.team-history-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 62px;
  overflow-y: auto;
}

.hist-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.hist-pill.scored {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.hist-pill.discarded {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* CENTER CONSOLE */
.center-console {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.turn-tracker-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* 1ST TURN ROLL-OFF TOGGLE */
.first-player-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
}

.first-player-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.first-player-toggle {
  display: flex;
  gap: 4px;
}

.first-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.first-btn:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

#btn-first-a.active {
  background: var(--team-a);
  border-color: var(--team-a);
  color: #ffffff;
}

#btn-first-b.active {
  background: var(--team-b);
  border-color: var(--team-b);
  color: #ffffff;
}

.round-turn-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.round-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: left;
}

.round-number {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text-main);
  text-align: left;
}

.round-max {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

.round-pips {
  display: flex;
  gap: 5px;
}

.pip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
}

.pip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.turn-indicator {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.turn-team-label {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
}

.turn-sub-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.nav-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.btn-nav {
  padding: 8px 10px;
  font-size: 0.88rem;
  font-weight: 800;
}

.btn-nav-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-nav-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.undo-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-undo,
.btn-complete {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.73rem;
}

.btn-complete.completed {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.active-game-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 99px;
  background: #0284c7;
  color: #fff;
}

.active-game-badge.completed {
  background: #15803d;
  color: #fff;
}

.modal-box-wide {
  max-width: 880px;
}

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

.games-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.games-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.games-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.games-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.games-table tr.current-game-row {
  background: #f0f9ff;
}

.game-status-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: #e0f2fe;
  color: #0369a1;
}

.game-status-pill.completed {
  background: #dcfce7;
  color: #166534;
}

/* ROUND BY ROUND SCORE SHEET */
.scoresheet-wrap {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.scoresheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.scoresheet-table th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 2px 6px;
  border-bottom: 1px solid var(--border);
}

.scoresheet-table td {
  padding: 2px 6px;
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.scoresheet-table tr.active-round-row {
  background: #e0f2fe;
  font-weight: 800;
}

.ss-left {
  text-align: left;
  color: var(--team-a);
}

.ss-center {
  text-align: center;
  font-weight: 800;
  color: var(--text-muted);
}

.ss-right {
  text-align: right;
  color: var(--team-b);
}

/* AI & PUSH TO TALK CONSOLE */
.ai-console-card {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-mode-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
}

.ptt-container {
  display: flex;
}

.btn-ptt {
  width: 100%;
  background: #f8fafc;
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 10px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-ptt:hover {
  background: #e0f2fe;
}

.btn-ptt.listening {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

.ptt-mic-icon {
  font-size: 1.35rem;
}

.ptt-main-text {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.ptt-sub-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ai-input-row {
  display: flex;
  gap: 6px;
}

.ai-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 0.8rem;
}

.ai-input:focus {
  outline: none;
  border-color: var(--accent);
}

.ai-log {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
}

.ai-msg {
  padding: 6px 9px;
  border-radius: 6px;
  line-height: 1.38;
}

.ai-msg.user {
  background: #e0f2fe;
  border-left: 3px solid var(--accent);
  color: #0c4a6e;
}

.ai-msg.assistant {
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 3px solid #334155;
  color: var(--text-main);
}

.ai-msg.system {
  background: #dcfce7;
  border-left: 3px solid var(--success);
  color: #14532d;
  font-size: 0.74rem;
}

/* GENERAL BUTTONS */
.btn {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #e2e8f0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.76rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.72rem;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-success {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.btn-success:hover:not(:disabled) {
  background: #bbf7d0;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: #fecaca;
}

.btn-vp {
  padding: 3px 8px;
  font-size: 0.74rem;
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.btn-vp-minus {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.setup-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-col label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-input,
.form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 0.88rem;
  width: 100%;
}

.rule-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-when {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent);
}

.rule-trigger {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.rule-tier {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.rule-vp {
  font-weight: 800;
  color: var(--success);
  white-space: nowrap;
}

.fan-disclaimer {
  font-size: 0.64rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
}

.fan-disclaimer:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.16);
}

.modal-box-terrain {
  max-width: 1120px;
  max-height: 92vh;
}

.terrain-modal-body {
  gap: 10px;
}

.terrain-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.terrain-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terrain-control-group label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.terrain-select {
  width: auto;
  min-width: 240px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.terrain-layout-tabs {
  display: flex;
  gap: 6px;
}

.terrain-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.terrain-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.terrain-workspace {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 14px;
  align-items: start;
  min-height: 480px;
}

.terrain-svg-wrap {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  overflow: auto;
}

.terrain-svg-wrap svg {
  width: 100%;
  max-height: 68vh;
  height: auto;
  display: block;
}

.terrain-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.terrain-summary-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-main);
}

.terrain-legend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.76rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.35);
}

.swatch-attacker {
  background: rgba(220, 38, 38, 0.65);
}

.swatch-defender {
  background: rgba(2, 132, 199, 0.65);
}

.swatch-home {
  background: #f8fafc;
  border: 3px solid #dc2626;
  border-radius: 50%;
}

.swatch-central {
  background: #10b981;
  border-radius: 50%;
}

.swatch-expansion {
  background: #059669;
  transform: rotate(45deg);
}

.swatch-dense {
  background: #047857;
}

.swatch-light {
  background: #d97706;
}

.footprint-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fp-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  padding-top: 3px;
  border-top: 1px solid var(--border);
}

@media (max-width: 960px) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    position: relative;
  }

  /* Fixed compact top bar with horizontal scrollable actions */
  .top-bar {
    padding: 6px 10px;
    gap: 8px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .fan-disclaimer {
    display: none;
  }

  .top-actions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .top-actions::-webkit-scrollbar {
    display: none;
  }

  .top-actions .btn {
    padding: 4px 8px;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* Show Pane navigation & sticky bottom speak bar */
  .mobile-pane-nav {
    display: flex;
  }

  .mobile-sticky-bottom-bar {
    display: block;
  }

  /* Hide redundant desktop PTT button inside console */
  .desktop-only-ptt {
    display: none !important;
  }

  /* 3-PANE HORIZONTAL SWIPE CAROUSEL (Left Player - Center - Right Player) */
  .tabletop-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding: 0;
    margin: 0;
    width: 100vw;
    height: calc(100dvh - 94px - 62px); /* Viewport minus top-bar, pane-nav, and sticky-bottom */
    scrollbar-width: none;
  }

  .tabletop-grid::-webkit-scrollbar {
    display: none;
  }

  /* Each pane occupies exactly 100vw and snaps cleanly (no halfway stops) */
  .team-panel,
  .center-console {
    flex: 0 0 100vw;
    width: 100vw;
    max-width: 100vw;
    min-width: 100vw;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 10px 12px;
    padding-bottom: 24px;
    box-sizing: border-box;
  }

  .team-panel {
    border-top: none;
  }

  .center-console {
    border-top: none;
  }

  .terrain-workspace {
    grid-template-columns: 1fr;
  }
}

