/* ═══════════════════════════════════════════════
   NIGHT CITY META — Cyberpunk TCG Deck Builder
   nightcitymeta.com | Mana Riot Games
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
  /* ── Core palette ── */
  --bg:       #0a0a0c;
  --bg2:      #111114;
  --bg3:      #18181c;
  --surface:  #1a1a20;
  --surface2: #222228;
  --border:   #2a2a32;
  --border2:  #3a3a44;

  /* ── Night City neons ── */
  --neon-red:      #FF073A;
  --neon-yellow:   #FFD700;
  --neon-cyan:     #00F0FF;
  --chrome:        #C0C0D0;
  --chrome-dim:    #6E6E7E;

  /* ── Accent (primary = red) ── */
  --accent:     var(--neon-red);
  --accent-dim: rgba(255, 7, 58, 0.15);
  --accent-glow: rgba(255, 7, 58, 0.4);

  /* ── Text ── */
  --text1: #E8E8F0;
  --text2: #A0A0B0;
  --text3: #606070;

  /* ── Card colors (RAM colors) ── */
  --color-red:     #FF073A;
  --color-blue:    #00A0FF;
  --color-green:   #00E676;
  --color-yellow:  #FFD700;
  --color-neutral: #808090;

  /* ── Fonts ── */
  --display: 'Orbitron', sans-serif;
  --body: 'Rajdhani', sans-serif;
  --mono: 'Share Tech Mono', monospace;

  /* ── Spacing ── */
  --gap: 8px;
  --radius: 4px;
  --radius-lg: 8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text1);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Scanline overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-red); }

/* ═══════════════════
   HEADER
   ═══════════════════ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-red), var(--neon-yellow), var(--neon-red), transparent);
  opacity: 0.6;
}

.logo-wrap { display: flex; align-items: baseline; gap: 12px; }

.logo-primary {
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-red) 0%, var(--neon-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 8px rgba(255, 7, 58, 0.3));
}

.logo-secondary {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-right { display: flex; gap: 8px; align-items: center; }

.header-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  color: var(--text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-badge.live {
  border-color: var(--neon-red);
  color: var(--neon-red);
  text-shadow: 0 0 6px rgba(255, 7, 58, 0.5);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Nav tabs ── */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
}

.nav-tab {
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 14px;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.2s;
  position: relative;
}

.nav-tab:hover { color: var(--text2); }

.nav-tab.active {
  color: var(--neon-red);
  text-shadow: 0 0 6px rgba(255, 7, 58, 0.3);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--neon-red);
  box-shadow: 0 0 8px rgba(255, 7, 58, 0.5);
}

/* ── Auth controls ── */
.auth-controls { display: flex; align-items: center; gap: 8px; }

.auth-btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 14px;
  border: 1px solid var(--neon-red);
  background: rgba(255, 7, 58, 0.08);
  color: var(--neon-red);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.2s;
}

.auth-btn:hover {
  background: rgba(255, 7, 58, 0.2);
  box-shadow: 0 0 12px rgba(255, 7, 58, 0.3);
}

.auth-btn.google {
  border-color: var(--neon-yellow);
  background: rgba(255, 215, 0, 0.08);
  color: var(--neon-yellow);
}

.auth-btn.google:hover {
  background: rgba(255, 215, 0, 0.2);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.user-chip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-chip img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--neon-red);
}

/* ═══════════════════
   APP LAYOUT
   ═══════════════════ */
.app-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(400px, 1.5fr) 300px;
  gap: 1px;
  height: calc(100vh - 52px);
  background: var(--border);
}

/* ── Panels ── */
.panel {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text2);
}

.panel-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
}

/* ── Search ── */
.search-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text1);
  outline: none;
  transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--text3); }
.search-input:focus {
  border-color: var(--neon-red);
  box-shadow: 0 0 8px rgba(255, 7, 58, 0.15);
}

/* ── Filter bars ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chip {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
}

.chip:hover { border-color: var(--text3); color: var(--text2); }
.chip.active {
  border-color: var(--neon-red);
  color: var(--neon-red);
  background: rgba(255, 7, 58, 0.08);
  text-shadow: 0 0 4px rgba(255, 7, 58, 0.3);
}

/* Color-coded chips */
.chip[data-color="red"].active    { border-color: var(--color-red); color: var(--color-red); background: rgba(255,7,58,0.08); }
.chip[data-color="blue"].active   { border-color: var(--color-blue); color: var(--color-blue); background: rgba(0,160,255,0.08); }
.chip[data-color="green"].active  { border-color: var(--color-green); color: var(--color-green); background: rgba(0,230,118,0.08); }
.chip[data-color="yellow"].active { border-color: var(--color-yellow); color: var(--color-yellow); background: rgba(255,215,0,0.08); }
.chip[data-color="neutral"].active{ border-color: var(--color-neutral); color: var(--color-neutral); background: rgba(128,128,144,0.08); }

/* ── Card list ── */
.card-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.card-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(42, 42, 50, 0.4);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}

.card-row:hover { background: var(--surface); }

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.color-dot.red    { background: var(--color-red); box-shadow: 0 0 4px rgba(255,7,58,0.5); }
.color-dot.blue   { background: var(--color-blue); box-shadow: 0 0 4px rgba(0,160,255,0.5); }
.color-dot.green  { background: var(--color-green); box-shadow: 0 0 4px rgba(0,230,118,0.5); }
.color-dot.yellow { background: var(--color-yellow); box-shadow: 0 0 4px rgba(255,215,0,0.5); }
.color-dot.neutral{ background: var(--color-neutral); }

.card-name {
  font-family: var(--body);
  font-weight: 600;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-name .subtitle {
  font-weight: 400;
  color: var(--text3);
  font-size: 11px;
  margin-left: 6px;
}

.card-type {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-cost {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-yellow);
  min-width: 20px;
  text-align: center;
}

.card-power {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-red);
  min-width: 20px;
  text-align: center;
}

.add-btn {
  font-family: var(--mono);
  font-size: 14px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.add-btn:hover {
  border-color: var(--neon-red);
  color: var(--neon-red);
  background: rgba(255, 7, 58, 0.1);
}

/* ── Empty state ── */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  padding: 40px;
  text-align: center;
}

/* ═══════════════════
   DECK PANEL (Col 2)
   ═══════════════════ */
.deck-name-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.deck-name-input {
  width: 100%;
  padding: 6px 10px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--neon-yellow);
  letter-spacing: 0.08em;
  outline: none;
}

.deck-name-input:focus { border-color: var(--neon-yellow); }

/* ── Legend slots ── */
.legend-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.legend-slot {
  padding: 8px;
  border: 1px dashed var(--border2);
  text-align: center;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}

.legend-slot.filled {
  border-style: solid;
  background: var(--surface);
}

.legend-slot .slot-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.legend-slot .slot-name {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text1);
  margin-top: 2px;
}

.legend-slot .slot-ram {
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 2px;
}

.legend-slot .remove-legend {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 12px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.legend-slot:hover .remove-legend { opacity: 1; }
.legend-slot .remove-legend:hover { color: var(--neon-red); }

/* ── Deck list ── */
.deck-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.deck-section-header {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 8px 12px 4px;
  display: flex;
  justify-content: space-between;
}

.deck-card-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.deck-card-row:hover { background: var(--surface); }

.card-qty {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-yellow);
  text-align: center;
}

.qty-controls {
  display: flex;
  gap: 2px;
}

.qty-btn {
  font-family: var(--mono);
  font-size: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.1s;
}

.qty-btn:hover { border-color: var(--neon-red); color: var(--neon-red); }
.qty-btn.minus:hover { border-color: var(--neon-yellow); color: var(--neon-yellow); }

/* ── Deck toolbar ── */
.deck-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-btn {
  flex: 1;
  font-family: var(--mono);
  font-size: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  border-color: var(--neon-red);
  color: var(--neon-red);
  background: rgba(255, 7, 58, 0.05);
}

.toolbar-btn.primary {
  border-color: var(--neon-red);
  color: var(--neon-red);
  background: rgba(255, 7, 58, 0.08);
}

.toolbar-btn.primary:hover {
  background: rgba(255, 7, 58, 0.2);
  box-shadow: 0 0 10px rgba(255, 7, 58, 0.2);
}

/* ═══════════════════
   STATS PANEL (Col 3)
   ═══════════════════ */
.stats-scroll {
  flex: 1;
  overflow-y: auto;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(42, 42, 50, 0.3);
}

.stat-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-val {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text1);
}

/* ── Validation ── */
.validation-section { padding: 12px 16px; }

.validation-title {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.v-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}

.v-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
}

.v-item.pass .v-dot { background: var(--color-green); box-shadow: 0 0 4px rgba(0,230,118,0.5); }
.v-item.pass { color: var(--color-green); }
.v-item.fail .v-dot { background: var(--neon-red); box-shadow: 0 0 4px rgba(255,7,58,0.5); }
.v-item.fail { color: var(--neon-red); }

/* ── Eddie Curve ── */
.curve-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.curve-title {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.curve-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 80px;
  gap: 4px;
}

.curve-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.curve-count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text2);
  height: 12px;
}

.curve-bar {
  width: 100%;
  max-width: 24px;
  background: linear-gradient(180deg, var(--neon-red), rgba(255,7,58,0.3));
  border-radius: 2px 2px 0 0;
  min-height: 1px;
  transition: height 0.3s ease;
  box-shadow: 0 0 6px rgba(255, 7, 58, 0.2);
}

.curve-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
}

/* ── Color breakdown ── */
.breakdown-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.breakdown-title {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.color-bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 30px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.color-bar-name {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
}

.color-bar-track {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.color-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.color-bar-pct {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-align: right;
}

/* ── RAM budget ── */
.ram-budget-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.ram-budget-title {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.ram-row {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.ram-color-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.ram-bar-track {
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.ram-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.ram-bar-fill.over { animation: pulse-red 1s ease infinite; }

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.ram-values {
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

.ram-values.over { color: var(--neon-red); }

/* ── Card preview tooltip ── */
.card-preview {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.6));
}

.card-preview img {
  width: 200px;
  border-radius: 8px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 20px;
  background: var(--neon-red);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 2000;
  letter-spacing: 0.04em;
  box-shadow: 0 0 20px rgba(255, 7, 58, 0.4);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Oracle modal ── */
.oracle-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}

.oracle-overlay.open { display: flex; }

.oracle-modal {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--bg2);
  border: 1px solid var(--neon-red);
  box-shadow: 0 0 40px rgba(255, 7, 58, 0.2), 0 0 80px rgba(255, 7, 58, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.oracle-title {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-red), var(--neon-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.oracle-close {
  font-size: 18px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
}

.oracle-close:hover { color: var(--neon-red); }

.oracle-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.oracle-prompt-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.oracle-prompt-row { display: flex; gap: 8px; }

.oracle-input {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text1);
  outline: none;
}

.oracle-input:focus { border-color: var(--neon-red); }

.oracle-send {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 16px;
  border: 1px solid var(--neon-red);
  background: rgba(255, 7, 58, 0.15);
  color: var(--neon-red);
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.oracle-send:hover { background: rgba(255, 7, 58, 0.3); }

.oracle-msg {
  padding: 8px 0;
  font-family: var(--body);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

.oracle-msg.user { color: var(--neon-yellow); }
.oracle-msg.ai { color: var(--text1); }

.oracle-loading {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--neon-red);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Disclaimer ── */
.disclaimer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.disclaimer p {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text3);
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.disclaimer a {
  color: var(--neon-red);
  text-decoration: none;
}

/* ═══════════════════
   COMMUNITY PAGE
   ═══════════════════ */
.community-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.community-header {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-red), var(--neon-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.community-deck-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.community-deck-card:hover {
  border-color: var(--neon-red);
  box-shadow: 0 0 16px rgba(255, 7, 58, 0.1);
}

.cdc-name {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text1);
  letter-spacing: 0.06em;
}

.cdc-author {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

.cdc-legends {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.cdc-legend-chip {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  color: var(--text2);
}

.cdc-stats {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
}

/* ═══════════════════
   VIEW TOGGLE
   ═══════════════════ */
.view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.view-toggle-btn {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.15s;
}

.view-toggle-btn:hover { border-color: var(--text3); color: var(--text2); }
.view-toggle-btn.active {
  border-color: var(--neon-red);
  color: var(--neon-red);
  background: rgba(255, 7, 58, 0.08);
}

/* ═══════════════════
   LEGEND SLOTS — GRID MODE (card art)
   ═══════════════════ */
.legend-slot.grid-mode {
  min-height: 120px;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.legend-slot.grid-mode .legend-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.legend-slot.grid-mode .legend-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

.legend-slot.grid-mode .slot-name {
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.legend-slot.grid-mode .slot-ram {
  font-size: 9px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.legend-slot.grid-mode .remove-legend {
  z-index: 3;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  width: 18px;
  height: 18px;
}

/* ═══════════════════
   DECK GRID VIEW
   ═══════════════════ */
.deck-grid-view {
  padding: 4px;
  overflow: hidden;
  min-width: 0;
}

.deck-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px 8px 8px;
}

.deck-grid-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.grid-card-img-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 5 / 7;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.grid-card-img-wrap:hover {
  box-shadow: 0 0 12px rgba(255, 7, 58, 0.2);
}

.grid-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  padding: 8px;
}

.grid-qty-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--neon-yellow);
  padding: 1px 6px;
  border-radius: 2px;
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
  z-index: 2;
}

.grid-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 2px;
}

.grid-card-name {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.grid-card-info .qty-controls {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════ */

/* ── Mobile tab bar (hidden on desktop) ── */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 768px) {

  /* ── Body scroll ── */
  html, body {
    overflow: auto;
    height: auto;
  }

  /* ── Header: compact ── */
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }

  .logo-primary { font-size: 15px; letter-spacing: 0.1em; }
  .logo-secondary { display: none; }

  .nav-tabs {
    margin-left: 0;
    order: 3;
    width: 100%;
    justify-content: center;
    display: none;
  }

  .header-right {
    margin-left: auto;
  }

  .header-right .header-badge:not(.live) { display: none; }

  .auth-btn { font-size: 10px; padding: 4px 10px; }

  /* ── App layout: single column, full height panels ── */
  .app-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 96px);
    gap: 0;
    background: var(--bg);
  }

  /* ── Panels: show/hide via mobile tabs ── */
  .panel {
    display: none;
    flex-direction: column;
    min-height: calc(100vh - 96px);
    overflow-y: auto;
  }

  .panel.mobile-active {
    display: flex;
  }

  /* On first load before JS runs, show cards panel by default */
  #panel-cards { display: flex; }

  /* ── Mobile tab bar: fixed bottom nav ── */
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 200;
  }

  .mobile-tab-bar::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon-red), var(--neon-yellow), var(--neon-red), transparent);
    opacity: 0.4;
  }

  .mobile-tab {
    flex: 1;
    font-family: var(--display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text3);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
  }

  .mobile-tab.active {
    color: var(--neon-red);
    text-shadow: 0 0 6px rgba(255, 7, 58, 0.3);
  }

  .mobile-tab.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--neon-red);
    box-shadow: 0 0 8px rgba(255, 7, 58, 0.5);
  }

  /* ── Bottom padding for fixed tab bar ── */
  .panel { padding-bottom: 48px; }
  .deck-toolbar { margin-bottom: 48px; }

  /* ── Card list: tighter rows ── */
  .card-row {
    grid-template-columns: 12px 1fr auto auto;
    padding: 8px 10px;
    gap: 6px;
    font-size: 13px;
  }

  .card-name { font-size: 13px; }
  .card-name .subtitle { display: none; }
  .card-type { display: none; }

  /* ── Search & filters: compact ── */
  .search-wrap { padding: 6px 10px; }
  .search-input { padding: 8px 10px; font-size: 13px; }

  .filter-bar {
    padding: 6px 10px;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .chip {
    font-size: 10px;
    padding: 4px 10px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── Deck panel ── */
  .deck-name-wrap { padding: 6px 10px; }
  .deck-name-input { font-size: 12px; padding: 6px 10px; }

  .legend-slots { gap: 4px; padding: 6px 10px; }
  .legend-slot { min-height: 50px; padding: 6px; }
  .legend-slot.grid-mode { min-height: 90px; }

  .deck-section-header { padding: 6px 10px 3px; }

  .deck-card-row {
    padding: 6px 10px;
    font-size: 13px;
  }

  /* Grid view mobile: 3 across still works */
  .deck-card-grid {
    gap: 4px;
    padding: 4px 6px 6px;
  }

  .grid-card-name { font-size: 10px; }
  .grid-qty-badge { font-size: 9px; padding: 1px 4px; }

  .qty-btn { width: 28px; height: 28px; font-size: 16px; }

  /* ── Toolbar: compact ── */
  .deck-toolbar {
    gap: 3px;
    padding: 6px 10px;
  }

  .toolbar-btn { font-size: 10px; padding: 8px 6px; }

  /* ── Stats panel ── */
  .stats-scroll { padding-bottom: 48px; }

  .stat-row { padding: 8px 14px; }
  .stat-label { font-size: 12px; }
  .stat-val { font-size: 13px; }

  .validation-section { padding: 10px 14px; }
  .v-item { font-size: 12px; padding: 4px 0; }

  .curve-section { padding: 10px 14px; }
  .curve-bars { height: 70px; }

  .breakdown-section { padding: 10px 14px; }
  .ram-budget-section { padding: 10px 14px; }

  /* ── View toggle ── */
  .view-toggle-btn { padding: 4px 10px; font-size: 10px; }

  /* ── Panel header ── */
  .panel-header { padding: 8px 12px; }
  .panel-title { font-size: 10px; }

  /* ── Card preview: disable on mobile (touch doesn't hover) ── */
  .card-preview { display: none !important; }

  /* ── Oracle modal: full screen on mobile ── */
  .oracle-modal {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .oracle-input { font-size: 14px; padding: 10px 12px; }
  .oracle-send { padding: 10px 16px; }

  /* ── Scanline: lighter on mobile for perf ── */
  body::before { display: none; }

  /* ── Community page ── */
  .community-layout { padding: 16px; }
  .deck-grid { grid-template-columns: 1fr; }

  /* ── Toast: above tab bar ── */
  .toast { bottom: 56px; }
}

/* ── Tablet tweaks (768-1024) ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .app-layout {
    grid-template-columns: minmax(240px, 0.8fr) minmax(340px, 1.2fr) 220px;
  }

  .card-name .subtitle { display: none; }
}
