/* The debug panel (type debug() in the console), possess banner, spy mode. Kept from
   the previous UI verbatim; it reads the legacy token names, aliased here onto the
   new palette (they used to live in tokens.css). */
:root {
  --gold-dim: color-mix(in srgb, var(--gold) 70%, #000);
  --gold-light: var(--gold-hi);
  --gold-glow: color-mix(in srgb, var(--gold) 35%, transparent);
  --bg-deepest: #000;
  --border-subtle: var(--panel-rim);
  --text-primary: var(--text);
  --text-secondary: var(--text-dim);
  --radius-md: var(--radius);
  --radius-lg: calc(var(--radius) + 6px);
  --danger: var(--mult);
}

/* online: what this browser does not have, and why */
.debug-hidden-note { font-size: 0.7rem; color: var(--text-secondary); font-style: italic; }
.debug-log { font-family: 'IBM Plex Mono', Consolas, monospace; font-size: 0.66rem; line-height: 1.5; color: var(--text-secondary); }
.debug-log .in { color: var(--gold-light); }

.debug-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  max-height: 85vh;
  background: rgba(5, 13, 8, 0.98);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 40px var(--gold-glow);
}

.debug-panel.hidden { display: none; }

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1.2rem;
  background: linear-gradient(145deg, var(--gold), var(--gold-dim));
  color: var(--bg-deepest);
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 2px;
  cursor: grab;
  user-select: none;
}

.btn-debug-close {
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: var(--bg-deepest);
  font-weight: 900;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  transition: background 0.2s;
}

.btn-debug-close:hover { background: rgba(0, 0, 0, 0.35); }

.debug-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.3);
}

.debug-tab {
  flex: 1;
  padding: 0.55rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.debug-tab:hover { color: var(--text-secondary); }

.debug-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.debug-body {
  padding: 0.8rem;
  overflow-y: auto;
  font-size: 0.8rem;
  flex: 1;
}

.debug-body::-webkit-scrollbar { width: 5px; }
.debug-body::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }

.debug-section {
  margin-bottom: 0.9rem;
}

.debug-section-title {
  font-weight: 800;
  color: var(--gold);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-subtle);
}

.debug-card {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  margin: 2px;
  font-size: 0.75rem;
  font-family: 'IBM Plex Mono', Consolas, monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.debug-card:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--gold-dim);
}

.debug-card.removable { cursor: pointer; }

.debug-card.removable:hover {
  background: rgba(239, 83, 80, 0.3);
  border-color: var(--danger);
  color: var(--danger);
}

.debug-controls {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.debug-controls-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.debug-select {
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 0.4rem 0.55rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  outline: none;
  flex: 1;
}

.debug-select:focus { border-color: var(--gold-dim); }

.btn-debug {
  background: rgba(240, 192, 48, 0.1);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  border-radius: 7px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-debug:hover {
  background: rgba(240, 192, 48, 0.25);
  border-color: var(--gold);
}

.btn-debug.danger {
  background: rgba(239, 83, 80, 0.1);
  border-color: rgba(239, 83, 80, 0.4);
  color: var(--danger);
}

.btn-debug.danger:hover {
  background: rgba(239, 83, 80, 0.25);
  border-color: var(--danger);
}

.debug-player-hand {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.2);
}

.debug-player-label {
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.debug-turn-indicator {
  color: var(--gold);
  font-size: 0.82rem;
}

/* Debug restore pill (minimized state) */
.debug-restore-pill {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 2001;
  background: linear-gradient(145deg, var(--gold), var(--gold-dim));
  color: var(--bg-deepest);
  border: none;
  border-radius: 20px;
  padding: 0.45rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px var(--gold-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.debug-restore-pill:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 20px var(--gold-glow);
}

.debug-restore-pill.hidden { display: none; }

/* ============================= FREEZE BANNER ============================= */
.freeze-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  background: linear-gradient(135deg, rgba(100, 180, 255, 0.15), rgba(140, 200, 255, 0.1));
  border-bottom: 2px solid rgba(100, 180, 255, 0.5);
  color: #8ec8ff;
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  animation: freeze-pulse 2s ease-in-out infinite;
}

.freeze-icon-inline {
  font-size: 0.7rem;
  margin-right: 0.3rem;
  letter-spacing: 1px;
}

@keyframes freeze-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* ============================= POSSESS BANNER ============================= */
#possess-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.4rem 1rem;
  background: linear-gradient(135deg, rgba(240, 192, 48, 0.12), rgba(240, 192, 48, 0.06));
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-md);
  margin-bottom: 0.4rem;
}

.possess-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ============================= FROZEN TURN INDICATOR ============================= */
.frozen-turn {
  color: #8ec8ff;
  font-weight: 800;
  letter-spacing: 2px;
  animation: freeze-pulse 2s ease-in-out infinite;
}

/* ============================= SPY MODE ============================= */
.spy-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 0.3rem;
}

.spy-card {
  display: inline-block;
  background: rgba(240, 192, 48, 0.12);
  border: 1px solid var(--gold-dim);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--gold-light);
  font-family: 'IBM Plex Mono', Consolas, monospace;
}

/* ============================= CONTROLLED OPPONENT ============================= */
.opponent-card.controlled {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow), inset 0 0 6px var(--gold-glow);
}

.ctrl-badge {
  font-size: 0.55rem;
  font-weight: 900;
  color: var(--gold);
  background: rgba(240, 192, 48, 0.15);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  letter-spacing: 1px;
  vertical-align: middle;
}

/* ============================= RESPONSIVE ============================= */

/* Tablet & small desktop */
