/* ═══════════════════════════════════════════════════
   AeroPedia SPA — styles.css
   Military-Tech / HUD Aesthetic
   Mobile-first, CSS custom properties, no external libs
═══════════════════════════════════════════════════ */

/* ── CUSTOM PROPERTIES ────────────────────────────── */
:root {
  --bg-base:       #f8fafc;
  --bg-surface:    #ffffff;
  --bg-surface2:   #f1f5f9;
  --bg-surface3:   #e2e8f0;
  --border:        rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --text-1:        #0f172a;
  --text-2:        #334155;
  --text-3:        #64748b;
  --text-4:        #94a3b8;
  --primary:       #2563eb;
  --primary-glow:  rgba(37,99,235,0.12);
  --accent:        #0891b2;
  --warning:       #d97706;
  --danger:        #dc2626;
  --success:       #16a34a;
  --header-bg:     #ffffff;
  --header-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,0.04);
  --font-sans:     'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', 'Cascadia Code', monospace;
  --font-head:     'Orbitron', var(--font-sans);
  --radius:        8px;
  --radius-lg:     14px;
  --radius-xl:     20px;
  --t-fast:        120ms ease;
  --t-mid:         220ms ease;
  --t-slow:        400ms ease;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.06);
  --color-amber:   #f59e0b;
  --color-amber-bg: rgba(245,158,11,0.12);
  --color-violet:  #8b5cf6;
  --color-violet-bg: rgba(139,92,246,0.12);
  --color-cyan:    #06b6d4;
  --color-cyan-bg: rgba(6,182,212,0.12);
  --color-green:   #10b981;
  --color-green-bg: rgba(16,185,129,0.12);
  --color-rose:    #f43f5e;
  --color-rose-bg: rgba(244,63,94,0.12);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
}

[data-theme="dark"], .dark {
  --bg-base:       #090d1a;
  --bg-surface:    #0f1729;
  --bg-surface2:   #141e35;
  --bg-surface3:   #1a2744;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.14);
  --text-1:        #f1f5f9;
  --text-2:        #cbd5e1;
  --text-3:        #64748b;
  --text-4:        #475569;
  --primary:       #3b82f6;
  --primary-glow:  rgba(59,130,246,0.13);
  --accent:        #22d3ee;
  --warning:       #fbbf24;
  --danger:        #f87171;
  --success:       #34d399;
  --header-bg:     #0c1323;
  --header-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}

/* ── RESET ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-1);
  line-height: 1.6;
  transition: background var(--t-mid), color var(--t-mid);
  min-height: 100vh;
}
.dark-preload * { transition: none !important; }
img { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select { font-family: inherit; }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.hidden-sm { display: none; }
.hidden-md { display: none; }
@media (min-width: 640px) { .hidden-sm { display: table-cell; } }
@media (min-width: 960px) { .hidden-md { display: table-cell; } }

/* ── SKIP LINK ────────────────────────────────────── */
.skip-link {
  position: fixed; top: -100%; left: 1rem; z-index: 9999;
  background: var(--primary); color: #fff;
  padding: .5rem 1rem; border-radius: var(--radius);
  font-size: .85rem; font-weight: 600;
  transition: top var(--t-fast);
}
.skip-link:focus { top: .75rem; }

/* ── HEADER ───────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: var(--header-bg);
  box-shadow: var(--header-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: visible;
}
.header-inner { max-width: 1440px; margin: 0 auto; padding: 0 1rem; }
.header-row {
  display: flex; align-items: center; gap: .6rem;
  height: 56px;
}

.logo {
  display: flex; align-items: center; gap: .45rem;
  text-decoration: none; color: var(--text-1); flex-shrink: 0;
}
.logo-icon {
  width: 30px; height: 30px;
  background: var(--primary-glow);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: 6px; display: grid; place-items: center;
  color: var(--primary);
}
.logo-text {
  font-family: var(--font-head);
  font-size: .82rem; font-weight: 900;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-1);
}
.logo-text span { color: var(--primary); }

.main-nav { display: none; align-items: center; gap: .2rem; flex: 1; }
@media (min-width: 768px) { .main-nav { display: flex; } }

.nav-link {
  cursor: pointer;
  display: flex; align-items: center; gap: .3rem;
  padding: .32rem .6rem;
  font-size: .75rem; font-weight: 500; color: var(--text-3);
  border-radius: var(--radius); border: 1px solid transparent;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.nav-link:hover, .nav-link:focus-visible {
  color: var(--text-1); background: var(--bg-surface2); outline: none;
}
.nav-link.active {
  color: var(--primary); background: var(--primary-glow);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.header-controls { display: flex; align-items: center; gap: .4rem; margin-left: auto; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: .6rem; color: var(--text-3); pointer-events: none; flex-shrink: 0; }
.search-input {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .36rem .5rem .36rem 2rem;
  font-size: .78rem; color: var(--text-1); width: 180px; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), width var(--t-mid);
}
.search-input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); width: 230px;
}
.search-input::placeholder { color: var(--text-4); }
.search-kbd {
  position: absolute; right: .45rem;
  font-family: var(--font-mono); font-size: .62rem; color: var(--text-4);
  background: var(--bg-surface3); border: 1px solid var(--border);
  border-radius: 3px; padding: 0 .28rem; pointer-events: none;
}
.search-input:focus ~ .search-kbd { opacity: 0; }

.cat-select {
  cursor: pointer;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .36rem .45rem;
  font-size: .75rem; color: var(--text-2); outline: none; cursor: pointer;
  transition: border-color var(--t-fast);
}
.cat-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.header-btn {
  display: flex; align-items: center; gap: .3rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .36rem .48rem;
  font-size: .75rem; color: var(--text-2);
  transition: all var(--t-fast);
}
.header-btn:hover, .header-btn:focus-visible {
  color: var(--text-1); border-color: var(--border-strong);
  background: var(--bg-surface3); outline: none;
}
.header-btn.active, .header-btn[aria-pressed="true"] {
  color: var(--primary); background: var(--primary-glow);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}
.icon-btn { width: 32px; height: 32px; padding: 0; justify-content: center; position: relative; }

.view-toggle { display: flex; }
.view-btn {
  cursor: pointer;
  background: var(--bg-surface2); border: 1px solid var(--border);
  color: var(--text-3); padding: .36rem .52rem; transition: all var(--t-fast);
}
.view-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-btn:last-child  { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.view-btn.active  { color: var(--primary); background: var(--primary-glow); }
.view-btn:hover   { color: var(--text-1); background: var(--bg-surface3); }

.compare-nav-btn.has-items {
  color: #f59e0b; border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.08);
}
.compare-badge {
  position: absolute; top: -5px; right: -5px;
  background: #f59e0b; color: #000;
  font-size: .58rem; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; line-height: 1;
}

.theme-icon-sun  { display: inline; font-size: .9rem; }
.theme-icon-moon { display: none;   font-size: .85rem; }
[data-theme="dark"] .theme-icon-sun  { display: none; }
[data-theme="dark"] .theme-icon-moon { display: inline; }

/* ── MAIN OUTLET ──────────────────────────────────── */
#app-outlet {
  max-width: 1440px; margin: 0 auto;
  padding: 1rem;
  min-height: calc(100vh - 56px); outline: none;
}

/* ── INIT LOADING ─────────────────────────────────── */
.init-loading {
  display: flex; align-items: center; justify-content: center; min-height: 60vh;
}
.init-loading-inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.init-spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.init-loading-text { color: var(--text-3); font-size: .78rem; font-family: var(--font-mono); letter-spacing: .05em; }
.route-loading { opacity: .5; pointer-events: none; transition: opacity var(--t-mid); }

/* ── LOAD ERROR ───────────────────────────────────── */
.load-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center; min-height: 60vh; padding: 2rem; color: var(--text-3);
}
.load-error-title { font-family: var(--font-head); font-size: .9rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; }
.load-error-msg { font-size: .85rem; max-width: 32rem; }
.load-error-hint { font-size: .75rem; }
.load-error-hint code {
  background: var(--bg-surface2); padding: 2px 6px;
  border-radius: 4px; font-family: var(--font-mono); color: var(--primary);
}

/* ── HOME VIEW ────────────────────────────────────── */
.home-view { display: flex; flex-direction: column; gap: 1rem; }

.result-bar {
  display: flex; align-items: center; gap: .45rem;
  font-size: .73rem; color: var(--text-3); padding: .4rem 0;
}
.result-count {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--primary);
}
.result-divider { width: 1px; height: 14px; background: var(--border); margin: 0 .2rem; }
.result-filter { color: var(--text-2); font-weight: 500; font-size: .7rem; letter-spacing: .04em; }

/* ── GALLERY GRID ─────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); gap: 1.2rem; }
}

/* ── CARD ─────────────────────────────────────────── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; position: relative;
  transition: transform var(--t-mid), box-shadow var(--t-mid), border-color var(--t-mid);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card.selected-for-compare {
  border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.18);
}
.card-selected-bar { height: 2px; background: #f59e0b; position: absolute; top: 0; left: 0; right: 0; }

.card-img-wrap {
  position: relative; aspect-ratio: 16/9;
  background: var(--bg-surface2); overflow: hidden; flex-shrink: 0;
}
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow); }
.card:hover .card-img-wrap img { transform: scale(1.05); }
.card-badge-type {
  position: absolute; bottom: .45rem; left: .45rem;
  background: rgba(0,0,0,.68); color: #e2e8f0;
  font-size: .6rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  padding: .14rem .4rem; border-radius: 4px; backdrop-filter: blur(4px);
}

.card-body { padding: .8rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.card-name { font-family: var(--font-head); font-size: .88rem; font-weight: 700; color: var(--text-1); line-height: 1.2; }

.card-tags { display: flex; flex-wrap: wrap; gap: .28rem; }
.card-tag {
  font-size: .6rem; font-weight: 500; letter-spacing: .04em;
  padding: .13rem .4rem; border-radius: 4px; text-transform: uppercase;
}
.tag-country { background: var(--bg-surface2); color: var(--text-3); border: 1px solid var(--border); }
.tag-year { color: var(--text-4); font-family: var(--font-mono); }
.tag-status { border: 1px solid; }
.tag-status.active  { background: rgba(22,163,74,.1);  color: #16a34a; border-color: rgba(22,163,74,.28); }
.tag-status.retired { background: var(--bg-surface2);  color: var(--text-3); border-color: var(--border); }
.tag-status.proto   { background: rgba(139,92,246,.1); color: #8b5cf6; border-color: rgba(139,92,246,.28); }
.tag-status.limited { background: rgba(245,158,11,.1); color: #f59e0b; border-color: rgba(245,158,11,.28); }

/* Generation badges */
.gen-badge {
  font-family: var(--font-mono); font-size: .58rem; font-weight: 600;
  padding: .13rem .38rem; border-radius: 4px; border: 1px solid; letter-spacing: .04em;
}
.gen-1  { background: rgba(100,116,139,.1); color: #64748b; border-color: rgba(100,116,139,.2); }
.gen-2  { background: rgba(14,165,233,.1);  color: #0ea5e9; border-color: rgba(14,165,233,.2); }
.gen-3  { background: rgba(16,185,129,.1);  color: #10b981; border-color: rgba(16,185,129,.2); }
.gen-4  { background: rgba(99,102,241,.1);  color: #6366f1; border-color: rgba(99,102,241,.2); }
.gen-45 { background: rgba(139,92,246,.1);  color: #8b5cf6; border-color: rgba(139,92,246,.2); }
.gen-5  { background: rgba(244,114,182,.12);color: #f472b6; border-color: rgba(244,114,182,.3); }
.gen-6  { background: rgba(251,191,36,.12); color: #fbbf24; border-color: rgba(251,191,36,.3); }

/* Stats */
.card-stats { display: flex; flex-direction: column; gap: .42rem; }
.stat-row { display: flex; align-items: center; gap: .38rem; }
.stat-label { font-size: .66rem; color: var(--text-3); min-width: 4.5rem; }
.stat-value { font-family: var(--font-mono); font-size: .68rem; color: var(--text-2); margin-left: auto; white-space: nowrap; }
.stat-bar-track {
  flex: 1; height: 3px; background: var(--bg-surface3); border-radius: 2px; overflow: hidden; min-width: 50px;
}
.stat-bar-fill { height: 100%; border-radius: 2px; transition: width .55s cubic-bezier(.4,0,.2,1); }
.stat-bar-fill.sp { background: linear-gradient(90deg,#2563eb,#60a5fa); }
.stat-bar-fill.ce { background: linear-gradient(90deg,#0891b2,#22d3ee); }
.stat-bar-fill.ra { background: linear-gradient(90deg,#7c3aed,#a78bfa); }

/* Card actions */
.card-actions { display: flex; gap: .38rem; margin-top: auto; padding-top: .2rem; }
.btn-detail {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .28rem;
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
  padding: .42rem .7rem; font-size: .75rem; font-weight: 600;
  transition: background var(--t-fast), transform var(--t-fast);
}
.btn-detail:hover { background: #1d4ed8; transform: translateY(-1px); }
.btn-detail:active { transform: none; }

.btn-icon {
  width: 33px; height: 33px; display: grid; place-items: center;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-3);
  transition: all var(--t-fast);
}
.btn-icon:hover { color: var(--text-1); border-color: var(--border-strong); background: var(--bg-surface3); }
.fav-btn.active { color: #f59e0b; border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); }
.cmp-btn.active { color: var(--primary); border-color: rgba(59,130,246,.4); background: var(--primary-glow); }

/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state {
  grid-column: 1/-1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 40vh; gap: 1rem; position: relative; overflow: hidden;
}
.hud-lines { position: absolute; inset: 0; pointer-events: none; }
.hud-scan-line {
  width: 100%; height: 1px;
  background: linear-gradient(90deg,transparent,var(--primary-glow),transparent);
  animation: scan 3s ease-in-out infinite;
}
@keyframes scan {
  0%,100% { transform: translateY(0); opacity: 0; }
  50% { opacity: 1; transform: translateY(80px); }
}
.empty-icon { width: 44px; height: 44px; color: var(--text-3); }
.empty-title { font-family: var(--font-head); font-size: .75rem; letter-spacing: .1em; color: var(--text-3); }
.empty-msg { font-size: .82rem; color: var(--text-4); text-align: center; max-width: 26rem; }

/* ── RANKING ──────────────────────────────────────── */
.ranking-pills {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; padding: .5rem 0;
}
.ranking-pills-label { font-size: .73rem; color: var(--text-3); }
.rank-stat-pill {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: .28rem .7rem; font-size: .73rem; color: var(--text-2);
  transition: all var(--t-fast);
}
.rank-stat-pill:hover { border-color: var(--primary); color: var(--primary); }
.rank-stat-pill.active { background: var(--primary-glow); border-color: var(--primary); color: var(--primary); font-weight: 600; }

.ranking-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ranking-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ranking-table th {
  text-align: left; padding: .55rem .7rem;
  font-size: .67rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  background: var(--bg-surface2);
}
.ranking-table th.sort-th { cursor: pointer; user-select: none; }
.ranking-table th.sort-th:hover { color: var(--primary); }
.ranking-table th.sorted { color: var(--primary); }
.sort-icon { font-size: .68rem; }
.rank-row { border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--t-fast); }
.rank-row:hover, .rank-row:focus-visible { background: var(--bg-surface2); outline: none; }
.rank-row td { padding: .55rem .7rem; vertical-align: middle; }
.rank-pos { font-family: var(--font-mono); font-size: .82rem; color: var(--text-2); min-width: 2.2rem; }
.rank-plane-cell { display: flex; align-items: center; gap: .65rem; }
.rank-thumb { width: 50px; height: 28px; object-fit: cover; border-radius: 4px; background: var(--bg-surface2); flex-shrink: 0; }
.rank-name { font-family: var(--font-head); font-size: .78rem; font-weight: 600; }
.rank-sub { font-family: var(--font-mono); font-size: .66rem; color: var(--text-3); margin-top: 2px; }
.rank-stat-cell { min-width: 130px; }
.rank-stat-val { font-size: .8rem; font-weight: 600; display: block; margin-bottom: .18rem; }
.rank-bar-track { height: 3px; background: var(--bg-surface3); border-radius: 2px; }
.rank-bar-fill { height: 100%; border-radius: 2px; transition: width .45s ease; }
.rank-type-badge {
  font-size: .62rem; padding: .12rem .38rem; border-radius: 4px;
  border: 1px solid var(--border); color: var(--text-3); white-space: nowrap;
}
.rank-empty { text-align: center; padding: 3rem; color: var(--text-3); }

/* ── COMPARE BAR ──────────────────────────────────── */
.compare-bar {
  position: fixed; bottom: -120px; left: 50%; transform: translateX(-50%);
  z-index: 200; width: min(740px, calc(100vw - 2rem));
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transition: bottom var(--t-mid);
}
.compare-bar.visible { bottom: 1.25rem; }
.compare-bar-inner {
  display: flex; align-items: center; gap: .65rem;
  padding: .7rem 1rem; flex-wrap: wrap;
}
.compare-bar-left  { display: flex; align-items: center; gap: .45rem; flex: 1; flex-wrap: wrap; }
.compare-bar-right { display: flex; align-items: center; gap: .45rem; }
.compare-bar-label { font-size: .76rem; font-weight: 600; color: var(--text-2); }
.compare-slot {
  display: flex; align-items: center; gap: .28rem;
  background: var(--primary-glow); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: var(--radius); padding: .18rem .48rem;
  font-size: .7rem; color: var(--text-1);
}
.compare-slot button { color: var(--text-3); font-size: .82rem; line-height: 1; padding: 0 2px; }
.compare-hint { font-size: .73rem; color: var(--text-3); }
.btn-compare {
  display: flex; align-items: center; gap: .32rem;
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius); padding: .38rem .8rem;
  font-size: .76rem; font-weight: 600; transition: background var(--t-fast);
}
.btn-compare:disabled { opacity: .4; cursor: not-allowed; }
.btn-compare:not(:disabled):hover { background: #1d4ed8; }
.btn-cancel {
  display: flex; align-items: center; gap: .28rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .38rem .7rem;
  font-size: .76rem; color: var(--text-2); transition: all var(--t-fast);
}
.btn-cancel:hover { border-color: var(--danger); color: var(--danger); }

/* ── TOAST ────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(1rem);
  z-index: 9999; background: var(--text-1); color: var(--bg-base);
  padding: .6rem 1.2rem; border-radius: 999px;
  font-size: .8rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity var(--t-mid), transform var(--t-mid);
}
.toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── DETAIL VIEW ──────────────────────────────────── */
.detail-view {
  display: flex; flex-direction: column; gap: 0;
  max-width: 1200px; margin: 0 auto;
  animation: fadeUp .3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.detail-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem 0 .9rem;
}
.detail-topbar-actions { display: flex; gap: .45rem; }

.btn-back {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--text-3); font-size: .78rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: .38rem .7rem; background: var(--bg-surface);
  text-decoration: none; cursor: pointer;
  font-family: inherit;
  transition: all var(--t-fast);
}
.btn-back:hover { color: var(--text-1); border-color: var(--border-strong); }

.btn-share, .btn-compare-detail {
  display: flex; align-items: center; gap: .32rem;
  font-size: .76rem; padding: .38rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-surface); color: var(--text-2);
  transition: all var(--t-fast);
}
.btn-share:hover { border-color: var(--primary); color: var(--primary); }
.btn-compare-detail { background: var(--bg-surface2); }
.btn-compare-detail.active,
.btn-compare-detail:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }

.detail-grid {
  display: grid; grid-template-columns: 1fr; gap: 2rem;
}
@media (min-width: 900px) {
  .detail-grid { grid-template-columns: 1fr 360px; align-items: start; }
  .detail-visual { position: sticky; top: 64px; }
}

.detail-info { display: flex; flex-direction: column; gap: 1.1rem; }

.detail-header-block { display: flex; flex-direction: column; gap: .42rem; }
.detail-name {
  font-family: var(--font-head);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 900; line-height: 1.1; color: var(--text-1);
}
.detail-badges-row { display: flex; flex-wrap: wrap; align-items: center; gap: .38rem; }
.detail-type-badge {
  background: var(--primary); color: #fff;
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: .18rem .55rem; border-radius: 4px;
}
.detail-country { font-size: .76rem; color: var(--text-3); font-family: var(--font-mono); }
.detail-caps-row { display: flex; flex-wrap: wrap; gap: .38rem; margin-top: .1rem; }
.cap-icon {
  font-size: .7rem; color: var(--text-2);
  background: var(--bg-surface2); border: 1px solid var(--border);
  padding: .18rem .48rem; border-radius: 4px;
}
.detail-desc { color: var(--text-2); font-size: .88rem; line-height: 1.72; }

/* Detail sections */
.detail-section {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .95rem 1rem;
}
.detail-section-title {
  display: flex; align-items: center; gap: .38rem;
  font-family: var(--font-head); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-3);
  margin-bottom: .7rem;
}

/* Wikipedia */
.wiki-spinner {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; margin-left: .2rem;
}
.wiki-spinner.hidden { display: none; }
.wiki-text { font-size: .84rem; color: var(--text-2); line-height: 1.7; }
.wiki-text.loading { color: var(--text-4); font-style: italic; }
.wiki-link {
  display: inline-flex; align-items: center; gap: .28rem;
  font-size: .76rem; margin-top: .45rem; color: var(--primary);
}
.wiki-link:hover { text-decoration: underline; }

/* Specs grid */
.detail-specs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .38rem .65rem;
}
.detail-specs-grid4 { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.spec-item {
  display: flex; flex-direction: column; gap: .08rem;
  padding: .38rem .48rem; background: var(--bg-surface2); border-radius: 6px;
}
.spec-item.spec-full { grid-column: 1/-1; }
.spec-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.spec-value { font-family: var(--font-mono); font-size: .76rem; color: var(--text-1); }

/* Gauges */
.gauges-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: .7rem; justify-content: center; }
.gauge-item { flex: 1; min-width: 85px; max-width: 130px; display: grid; place-items: center; }

/* Radar chart */
.radar-chart-wrap { display: flex; justify-content: center; padding: .4rem 0; }

/* Armament */
.armament-block { display: flex; flex-direction: column; gap: .38rem; }
.arm-row { display: flex; align-items: flex-start; gap: .45rem; font-size: .8rem; }
.arm-icon { font-size: .9rem; flex-shrink: 0; margin-top: 1px; }
.arm-label { color: var(--text-3); min-width: 6.5rem; flex-shrink: 0; font-size: .72rem; }
.arm-val { font-family: var(--font-mono); font-size: .73rem; color: var(--text-1); flex: 1; line-height: 1.5; }

/* Status / Stealth / Radar badges */
.status-badge { font-size: .62rem; padding: .13rem .42rem; border-radius: 4px; font-weight: 600; }
.status-badge.active  { background: rgba(22,163,74,.1);  color: #16a34a; }
.status-badge.retired { background: var(--bg-surface2);  color: var(--text-3); }
.status-badge.proto   { background: rgba(139,92,246,.1); color: #8b5cf6; }
.status-badge.limited { background: rgba(245,158,11,.1); color: #f59e0b; }

.stealth-badge { font-size: .62rem; padding: .13rem .42rem; border-radius: 4px; font-weight: 600; }
.stealth-badge.high   { background: rgba(244,114,182,.1); color: #f472b6; }
.stealth-badge.medium { background: rgba(167,139,250,.1); color: #a78bfa; }
.stealth-badge.low    { background: var(--bg-surface2);   color: var(--text-3); }

.radar-badge { font-size: .58rem; padding: .1rem .32rem; border-radius: 3px; font-family: var(--font-mono); font-weight: 600; }
.radar-badge.aesa { background: rgba(59,130,246,.14); color: var(--primary); }
.radar-badge.pesa { background: rgba(139,92,246,.14); color: #8b5cf6; }
.radar-badge.mech { background: rgba(100,116,139,.14);color: #64748b; }
.radar-badge.none { background: var(--bg-surface2);   color: var(--text-4); }

/* T/W bar */
.detail-tw-bar { margin-top: .7rem; }
.tw-bar-label { display: flex; justify-content: space-between; margin-bottom: .28rem; font-size: .7rem; color: var(--text-3); }
.tw-bar-val { color: var(--text-1); font-family: var(--font-mono); }
.tw-bar-track { height: 5px; background: var(--bg-surface3); border-radius: 3px; overflow: hidden; }
.tw-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .7s ease; }
.tw-bar-fill.over-unity { background: #f59e0b; }
.tw-note { font-family: var(--font-mono); font-size: .62rem; color: var(--text-3); margin-top: .28rem; }

/* Roles / Variants / Tags */
.roles-row, .variants-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.role-tag, .variant-tag {
  font-size: .68rem; padding: .18rem .5rem; border-radius: 4px;
  border: 1px solid var(--border); color: var(--text-2); background: var(--bg-surface2);
}
.variant-tag {
  font-family: var(--font-mono); color: var(--accent);
  border-color: rgba(34,211,238,.2); background: rgba(34,211,238,.05);
}
.detail-tags { display: flex; flex-wrap: wrap; gap: .28rem; }
.tech-tag {
  font-size: .62rem; color: var(--text-3); background: var(--bg-surface2);
  border: 1px solid var(--border); padding: .13rem .38rem;
  border-radius: 3px; font-family: var(--font-mono);
}

/* Conflict chips */
.conflict-chips-wrap { display: flex; flex-wrap: wrap; gap: .45rem; }
.conflict-chip {
  display: inline-flex; align-items: center; gap: .28rem;
  padding: .22rem .55rem; border-radius: var(--radius);
  font-size: .7rem; font-weight: 500;
  border: 1px solid var(--chip-color, var(--border));
  background: color-mix(in srgb, var(--chip-color, var(--primary)) 10%, transparent);
  color: var(--text-1); transition: background var(--t-fast);
}
.conflict-chip:hover { background: color-mix(in srgb, var(--chip-color, var(--primary)) 20%, transparent); }
.no-conflicts { font-size: .8rem; color: var(--text-4); }

/* Combat history */
.combat-history { display: flex; flex-direction: column; gap: .7rem; }
.combat-entry { border-left: 2px solid var(--border); padding-left: .7rem; }
.combat-label { font-weight: 600; font-size: .78rem; margin-bottom: .18rem; }
.combat-missions { font-family: var(--font-mono); font-size: .7rem; color: var(--primary); margin-bottom: .18rem; }
.combat-notes { font-size: .78rem; color: var(--text-2); line-height: 1.65; }

/* RCS / Trivia */
.rcs-value { font-family: var(--font-mono); font-size: .84rem; color: var(--text-2); }
.detail-trivia { border-left: 3px solid var(--primary); }
.trivia-text { font-size: .86rem; color: var(--text-2); line-height: 1.72; font-style: italic; }

/* Related */
.related-aircraft { display: flex; align-items: center; flex-wrap: wrap; gap: .38rem; margin-top: .5rem; }
.related-label { font-size: .68rem; color: var(--text-3); font-family: var(--font-mono); }
.related-btn {
  font-size: .72rem; padding: .2rem .5rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-2);
  transition: all var(--t-fast); cursor: pointer;
}
.related-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Detail visual */
.detail-visual { display: flex; flex-direction: column; gap: .9rem; }
.detail-img-glow {
  display: none;
}
@media (min-width: 900px) {
  .detail-img-glow {
    display: block; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    border-radius: 2px; opacity: .5;
  }
}
.detail-img {
  width: 100%; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-surface2);
  object-fit: cover;
}
.detail-img-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem;
}
.img-stat {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .65rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.img-stat-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.img-stat-val { font-family: var(--font-head); font-size: .85rem; font-weight: 700; color: var(--text-1); }

/* Not found */
.not-found-view, .detail-not-found {
  display: flex; align-items: center; justify-content: center; min-height: 60vh;
}
.not-found-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.not-found-code { font-family: var(--font-head); font-size: 5rem; font-weight: 900; color: var(--border-strong); }
.not-found-title { font-family: var(--font-head); font-size: 1rem; color: var(--text-2); }
.not-found-sub { font-size: .82rem; color: var(--text-3); }
.btn-back-home {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
  padding: .55rem 1.1rem; font-size: .82rem; font-weight: 600;
  transition: background var(--t-fast);
}
.btn-back-home:hover { background: #1d4ed8; }

/* ── COMPARE VIEW ─────────────────────────────────── */
.compare-view { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.75rem; }
.compare-header {
  display: flex; align-items: center; gap: .75rem; padding: .65rem 0 .5rem;
}
.compare-clear-btn { margin-left: auto; flex-shrink: 0; }
.compare-title {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--text-1);
}
.compare-empty {
  display: flex; align-items: center; justify-content: center; min-height: 60vh;
}
.compare-empty-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.compare-empty-icon { font-size: 3.5rem; }
.compare-empty-title { font-family: var(--font-head); font-size: .95rem; color: var(--text-2); }
.compare-empty-sub { font-size: .84rem; color: var(--text-3); max-width: 24rem; }

.compare-planes {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(var(--n,2), 1fr);
}
.compare-plane-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  border-top: 3px solid var(--accent,var(--primary));
}
.compare-plane-img-wrap { position: relative; aspect-ratio: 16/9; background: var(--bg-surface2); overflow: hidden; }
.compare-plane-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.compare-plane-color-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; }
.compare-plane-info { padding: .7rem .85rem; }
.compare-plane-name { font-family: var(--font-head); font-size: .88rem; font-weight: 700; margin-bottom: .28rem; }
.compare-plane-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .28rem; font-size: .7rem; color: var(--text-3); }

.compare-section { display: flex; flex-direction: column; gap: .9rem; }
.compare-section-title {
  font-family: var(--font-head); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-3);
  border-bottom: 1px solid var(--border); padding-bottom: .5rem;
}
.compare-radar-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
@media (min-width: 640px) { .compare-radar-wrap { flex-direction: row; align-items: flex-start; } }
.compare-radar { flex-shrink: 0; }
.radar-legend { display: flex; flex-direction: column; gap: .45rem; }
.radar-legend-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--text-2); }
.radar-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.compare-bar-charts {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.compare-bar-chart-wrap {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .85rem;
}
.compare-bar-title { font-family: var(--font-head); font-size: .68rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .6rem; }
.compare-bar-canvas { width: 100%; display: block; }

.compare-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.compare-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.compare-table th {
  padding: .55rem .75rem; text-align: left;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--bg-surface2);
  white-space: nowrap;
}
.compare-th-label { color: var(--text-4); }
.compare-table-row { border-bottom: 1px solid var(--border); transition: background var(--t-fast); }
.compare-table-row:hover { background: var(--bg-surface2); }
.compare-td-label { font-size: .72rem; color: var(--text-3); padding: .5rem .75rem; white-space: nowrap; }
.compare-td { padding: .5rem .75rem; font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); }
.compare-td.best { font-weight: 700; }
.compare-td.worst { color: var(--text-4); }
.best-badge { font-size: .6rem; margin-left: .28rem; vertical-align: middle; }

/* ── MACH VIEW ────────────────────────────────────── */
.mach-view { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.mach-header { display: flex; align-items: center; gap: 1rem; padding: .6rem 0 .5rem; }
.mach-title { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--text-1); }

.mach-layout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .mach-layout { grid-template-columns: 1.2fr 1fr; align-items: start; } }

.mach-calc-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}

.mach-input-group { display: flex; flex-direction: column; gap: .45rem; }
.mach-label { font-size: .76rem; font-weight: 600; color: var(--text-2); }
.mach-alt-val { color: var(--primary); font-family: var(--font-mono); margin-left: .4rem; }
.mach-speed-row { display: flex; gap: .5rem; }
.mach-number-input {
  flex: 1; background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .8rem;
  font-family: var(--font-mono); font-size: 1.1rem; color: var(--text-1); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.mach-number-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.mach-unit-select {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .6rem;
  font-size: .82rem; color: var(--text-2); outline: none; cursor: pointer;
  transition: border-color var(--t-fast);
}
.mach-unit-select:focus { border-color: var(--primary); }

.mach-slider {
  width: 100%; height: 4px; appearance: none;
  background: var(--bg-surface3); border-radius: 2px; outline: none;
}
.mach-slider::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--primary); cursor: pointer;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.mach-slider-labels { display: flex; justify-content: space-between; font-size: .62rem; color: var(--text-4); font-family: var(--font-mono); }

.mach-result-area {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.2rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.mach-result-main { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.mach-result {
  font-family: var(--font-head); font-size: 2.8rem; font-weight: 900;
  color: var(--text-1); letter-spacing: .05em;
  transition: color var(--t-mid);
}
.mach-category {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--text-3);
}
.mach-result.subsonic,    .mach-category.subsonic    { color: #64748b; }
.mach-result.transonic,   .mach-category.transonic   { color: #f59e0b; }
.mach-result.supersonic,  .mach-category.supersonic  { color: var(--primary); }
.mach-result.hypersonic,  .mach-category.hypersonic  { color: #f472b6; }
.mach-result.highersonic, .mach-category.highersonic { color: #fbbf24; }

.mach-result-sub { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.mach-sub-row { display: flex; align-items: center; gap: .45rem; font-size: .76rem; }
.mach-sub-label { color: var(--text-3); }

.mach-sos-info {
  display: flex; align-items: center; gap: .5rem;
  font-size: .74rem; color: var(--text-3);
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .45rem .7rem;
}
.mach-sos-val { color: var(--accent); }

.mach-reference { display: flex; flex-direction: column; gap: .55rem; }
.mach-ref-title { font-size: .72rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; }
.mach-ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.mach-ref-btn {
  display: flex; flex-direction: column; gap: .1rem; align-items: flex-start;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .45rem .6rem;
  text-align: left; transition: all var(--t-fast);
}
.mach-ref-btn:hover { border-color: var(--primary); background: var(--primary-glow); }
.mach-ref-name { font-size: .7rem; color: var(--text-2); font-weight: 500; }
.mach-ref-speed { font-size: .68rem; color: var(--text-3); }

.mach-info-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.mach-info-title { font-family: var(--font-head); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); }
.mach-regimes { display: flex; flex-direction: column; gap: .45rem; }
.mach-regime {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .75rem; border-left: 3px solid;
}
.mach-regime.subsonic    { border-left-color: #64748b; }
.mach-regime.transonic   { border-left-color: #f59e0b; }
.mach-regime.supersonic  { border-left-color: var(--primary); }
.mach-regime.hypersonic  { border-left-color: #f472b6; }
.mach-regime.highersonic { border-left-color: #fbbf24; }
.mach-regime-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .22rem; }
.mach-regime-name { font-size: .74rem; font-weight: 600; color: var(--text-1); }
.mach-regime-range { font-size: .66rem; color: var(--text-3); }
.mach-regime-desc { font-size: .72rem; color: var(--text-3); line-height: 1.5; }

.mach-sos-chart { display: flex; flex-direction: column; gap: .35rem; }
.mach-sos-chart-labels {
  display: flex; justify-content: space-between;
  font-size: .62rem; color: var(--text-4); font-family: var(--font-mono);
}

/* ── FLEETS VIEW ──────────────────────────────────── */
.fleets-view { display: flex; flex-direction: column; gap: 1.25rem; }
.fleets-header { display: flex; align-items: center; gap: 1rem; padding: .6rem 0 .3rem; }
.fleets-title { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--text-1); }

.fleets-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.flt-summary-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .9rem .75rem; text-align: center;
}
.flt-summary-num { font-family: var(--font-head); font-size: 1.4rem; font-weight: 900; color: var(--primary); }
.flt-summary-label { font-size: .68rem; color: var(--text-3); margin-top: .18rem; }

.fleets-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.fleets-count { font-size: .73rem; color: var(--text-3); margin-left: auto; }

.fleets-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.fleet-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem;
  display: flex; flex-direction: column; gap: .7rem;
  transition: box-shadow var(--t-mid);
}
.fleet-card:hover { box-shadow: var(--shadow-md); }

.fleet-card-header { display: flex; align-items: center; gap: .65rem; }
.fleet-flag { font-size: 1.6rem; flex-shrink: 0; }
.fleet-name { font-family: var(--font-head); font-size: .88rem; font-weight: 700; }
.fleet-af { font-size: .68rem; color: var(--text-3); margin-top: 2px; }
.fleet-rank-badge {
  margin-left: auto; flex-shrink: 0;
  font-family: var(--font-mono); font-size: .65rem; font-weight: 700;
  background: var(--primary-glow); color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  padding: .15rem .45rem; border-radius: 4px;
}
.fleet-quick-stats { display: flex; gap: .4rem; }
.fleet-qs { flex: 1; text-align: center; background: var(--bg-surface2); border-radius: 6px; padding: .45rem .3rem; }
.fleet-qs-num { font-family: var(--font-head); font-size: .9rem; font-weight: 700; }
.fleet-qs-label { font-size: .6rem; color: var(--text-3); margin-top: 2px; }

.fleet-aircraft-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.fleet-aircraft-row {
  border-top: 1px solid var(--border); cursor: pointer;
  transition: background var(--t-fast);
}
.fleet-aircraft-row:hover, .fleet-aircraft-row:focus-visible { background: var(--bg-surface2); outline: none; }
.fleet-aircraft-row td { padding: .4rem .3rem; vertical-align: middle; }
.fat-img { width: 44px; height: 25px; object-fit: cover; border-radius: 4px; background: var(--bg-surface2); }
.fat-name { font-size: .75rem; font-weight: 500; color: var(--text-1); }
.fat-role { font-size: .65rem; color: var(--text-3); }
.fat-qty { font-family: var(--font-head); font-size: .82rem; font-weight: 700; }
.fat-note { font-size: .65rem; color: var(--text-3); max-width: 140px; }

.fleet-type-bar { display: flex; align-items: center; gap: .5rem; }
.fleet-type-bar-label { font-size: .6rem; color: var(--text-4); font-family: var(--font-mono); }
.fleet-type-bar-track { flex: 1; height: 5px; border-radius: 3px; overflow: hidden; display: flex; }
.fleet-type-segment { height: 100%; transition: width .4s ease; }
.fleet-notes { font-size: .72rem; color: var(--text-3); line-height: 1.5; }
.fleets-empty { color: var(--text-3); text-align: center; padding: 2rem; }

/* ── KILLS VIEW ───────────────────────────────────── */
.kills-view { display: flex; flex-direction: column; gap: 1.1rem; }
.kills-header { display: flex; align-items: center; gap: 1rem; padding: .6rem 0 .3rem; }
.kills-title { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--text-1); }
.kills-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.kills-count { font-size: .73rem; color: var(--text-3); font-family: var(--font-mono); margin-left: auto; }

.kills-layout { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .kills-layout { grid-template-columns: 1fr 300px; align-items: start; } }

.kills-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kills-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.kills-table th {
  padding: .5rem .7rem; text-align: left;
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--bg-surface2);
}
.kills-row { border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--t-fast); }
.kills-row:hover, .kills-row.active-row { background: var(--bg-surface2); }
.kills-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.kills-row td { padding: .5rem .7rem; vertical-align: middle; }

.kt-plane-cell { display: flex; align-items: center; gap: .6rem; }
.kt-thumb { width: 50px; height: 28px; object-fit: cover; border-radius: 4px; background: var(--bg-surface2); flex-shrink: 0; }
.kt-name { font-family: var(--font-head); font-size: .76rem; font-weight: 600; }
.kt-meta { font-family: var(--font-mono); font-size: .64rem; color: var(--text-3); margin-top: 2px; }

.kt-kills  { font-family: var(--font-head); font-size: .9rem; font-weight: 700; color: var(--success); }
.kt-losses { font-family: var(--font-head); font-size: .9rem; font-weight: 700; color: var(--danger); }
.kt-kills-nd, .kt-losses-nd { color: var(--text-4); font-family: var(--font-mono); }

.kt-ratio-badge {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 700;
  padding: .2rem .5rem; border-radius: 4px;
}
.kt-ratio-badge.dominant { background: rgba(52,211,153,.15); color: #34d399; }
.kt-ratio-badge.positive { background: rgba(59,130,246,.15); color: var(--primary); }
.kt-ratio-badge.negative { background: rgba(248,113,113,.15); color: var(--danger); }
.kt-ratio-badge.nodata   { background: var(--bg-surface2); color: var(--text-4); }

.kt-bar-wrap { display: flex; flex-direction: column; gap: .2rem; min-width: 100px; }
.kt-bar-row  { display: flex; align-items: center; gap: .3rem; }
.kt-bar-label { font-size: .6rem; color: var(--text-4); min-width: 2.5rem; font-family: var(--font-mono); }
.kt-bar-track { flex: 1; height: 4px; background: var(--bg-surface3); border-radius: 2px; overflow: hidden; }
.kt-bar-fill  { height: 100%; border-radius: 2px; transition: width .4s ease; }
.kt-bar-fill.k { background: var(--success); }
.kt-bar-fill.l { background: var(--danger); }

.kt-conflict-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.kt-cf-chip {
  font-size: .6rem; color: var(--text-3);
  background: var(--bg-surface2); border: 1px solid var(--border);
  padding: .1rem .32rem; border-radius: 3px; font-family: var(--font-mono);
}
.kills-empty { text-align: center; padding: 3rem; color: var(--text-3); }

/* Kills detail panel */
.kills-detail {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem;
  position: relative;
}
.kills-detail-close {
  position: absolute; top: .7rem; right: .7rem;
  width: 24px; height: 24px;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 50%; font-size: .85rem; color: var(--text-3);
  display: grid; place-items: center; cursor: pointer; line-height: 1;
  transition: all var(--t-fast);
}
.kills-detail-close:hover { border-color: var(--danger); color: var(--danger); }
.kills-detail-plane { font-family: var(--font-head); font-size: .92rem; font-weight: 700; margin-bottom: .2rem; padding-right: 2rem; }
.kills-detail-meta { font-size: .7rem; color: var(--text-3); margin-bottom: .9rem; }

.cd-conflict-entry { margin-bottom: .85rem; border-left: 2px solid var(--border); padding-left: .7rem; }
.cd-cf-title { font-weight: 600; font-size: .78rem; margin-bottom: .3rem; }
.cd-cf-stats { display: flex; flex-direction: column; gap: .15rem; margin-bottom: .3rem; }
.cd-cf-stat { font-size: .74rem; color: var(--text-2); }
.cd-cf-stat .green { color: var(--success); font-weight: 600; }
.cd-cf-stat .red   { color: var(--danger);  font-weight: 600; }
.cd-cf-notes { font-size: .74rem; color: var(--text-3); line-height: 1.55; }
.kills-detail-notes  { font-size: .76rem; color: var(--text-2); border-top: 1px solid var(--border); padding-top: .7rem; margin-top: .3rem; }
.kills-detail-source { font-size: .66rem; color: var(--text-4); margin-top: .4rem; }

/* ── LOADING SKELETON ─────────────────────────────── */
.loading-skeleton { color: var(--text-3); font-size: .82rem; padding: 2rem; text-align: center; }
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface2) 25%, var(--bg-surface3) 50%, var(--bg-surface2) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 4px;
}

/* ── RESPONSIVE UTILITIES ─────────────────────────── */
@media (max-width: 640px) {
  .header-row { flex-wrap: wrap; height: auto; padding: .5rem 0; }
  .header-controls { flex-wrap: wrap; }
  .search-input { width: 100% !important; }
  .gallery-grid { grid-template-columns: 1fr; }
  .compare-planes { grid-template-columns: 1fr !important; }
  .mach-ref-grid { grid-template-columns: 1fr; }
  .detail-img-stats { grid-template-columns: repeat(4,1fr); }
  .img-stat-val { font-size: .72rem; }
}

@media (max-width: 480px) {
  #app-outlet { padding: .75rem; }
  .cat-select { font-size: .7rem; }
  .fleets-summary { grid-template-columns: repeat(2,1fr); }
}

/* ── FOCUS VISIBLE ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════
   FAVORITES VIEW
═══════════════════════════════════════════════════ */

/* ── Header ───────────────────────────────────────── */
.favs-view { display: flex; flex-direction: column; gap: 1.1rem; max-width: 1100px; margin: 0 auto; }
.favs-header {
  display: flex; align-items: center; gap: .85rem;
  padding: .65rem 0 .3rem; flex-wrap: wrap;
}
.favs-title-wrap { flex: 1; min-width: 0; }
.favs-title {
  display: flex; align-items: center; gap: .45rem;
  font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--text-1);
}
.favs-subtitle { font-size: .75rem; color: var(--text-3); margin-top: .1rem; font-family: var(--font-mono); }
.favs-header-actions { display: flex; gap: .4rem; margin-left: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Stats ────────────────────────────────────────── */
.favs-stats {
  display: grid; gap: .65rem;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.fav-stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .7rem .65rem; text-align: center;
}
.fav-stat-num {
  font-family: var(--font-head); font-size: 1.15rem; font-weight: 900;
  color: var(--primary); line-height: 1.1;
}
.fav-stat-label { font-size: .62rem; color: var(--text-3); margin-top: .18rem; }

/* ── Controls ─────────────────────────────────────── */
.favs-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.favs-count { font-size: .72rem; color: var(--text-3); font-family: var(--font-mono); margin-left: auto; }

.favs-tag-filter { display: flex; flex-wrap: wrap; gap: .3rem; }
.fav-tag-pill {
  font-size: .68rem; padding: .22rem .6rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-3); cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap;
}
.fav-tag-pill:hover { border-color: var(--primary); color: var(--primary); }
.fav-tag-pill.active { background: var(--primary-glow); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ── Favorites List ───────────────────────────────── */
.favs-list { display: flex; flex-direction: column; gap: .75rem; }

/* ── Fav Card ─────────────────────────────────────── */
.fav-card {
  display: grid;
  grid-template-columns: 20px 120px 1fr;
  gap: .85rem;
  align-items: start;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .85rem 1rem;
  transition: box-shadow var(--t-mid), border-color var(--t-mid), opacity var(--t-fast);
  position: relative;
  animation: fadeUp .25s ease;
}
@media (max-width: 640px) {
  .fav-card { grid-template-columns: 20px 1fr; }
  .fav-card-img-wrap { display: none; }
}
.fav-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.fav-card.pinned { border-left: 3px solid #f59e0b; }
.fav-card.dragging { opacity: .45; box-shadow: var(--shadow-lg); }
.fav-card.drag-over { border-color: var(--primary); border-style: dashed; }

.fav-card-drag-handle {
  cursor: grab; color: var(--text-4); display: flex; align-items: flex-start;
  padding-top: 4px; flex-shrink: 0;
  transition: color var(--t-fast);
}
.fav-card-drag-handle:active { cursor: grabbing; }
.fav-card:hover .fav-card-drag-handle { color: var(--text-3); }

.fav-card-img-wrap {
  position: relative; flex-shrink: 0;
  width: 120px; height: 68px;
  border-radius: var(--radius); overflow: hidden; background: var(--bg-surface2);
}
.fav-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.fav-pin-badge {
  position: absolute; top: 3px; left: 3px;
  font-size: .75rem; line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}

.fav-card-body { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }

.fav-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.fav-card-info { min-width: 0; flex: 1; }
.fav-card-name { font-family: var(--font-head); font-size: .9rem; font-weight: 700; line-height: 1.2; }
.fav-card-name-link { color: var(--text-1); transition: color var(--t-fast); }
.fav-card-name-link:hover { color: var(--primary); }

.fav-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .25rem; }
.fav-meta-badge {
  font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  background: var(--primary); color: #fff; padding: .1rem .38rem; border-radius: 3px;
}
.fav-meta-country, .fav-meta-year { font-size: .68rem; color: var(--text-3); }

/* Stars display */
.fav-card-rating { display: flex; gap: 2px; flex-shrink: 0; }
.fav-star { font-size: .9rem; color: var(--bg-surface3); transition: color var(--t-fast); }
.fav-star.filled { color: #f59e0b; }

/* Note */
.fav-card-note {
  font-size: .78rem; color: var(--text-2); font-style: italic;
  line-height: 1.55; border-left: 2px solid var(--border);
  padding-left: .6rem; margin-left: .1rem;
}

/* Tags */
.fav-card-tags { display: flex; flex-wrap: wrap; gap: .28rem; }
.fav-tag-chip {
  font-size: .62rem; padding: .12rem .38rem;
  background: var(--primary-glow);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 999px; color: var(--primary);
  font-family: var(--font-mono);
}

/* Stats */
.fav-card-stats { display: flex; flex-wrap: wrap; gap: .35rem; }
.fav-stat-chip {
  font-size: .66rem; padding: .13rem .42rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-2); font-family: var(--font-mono);
  white-space: nowrap;
}

/* Footer / Actions */
.fav-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .45rem; margin-top: .1rem;
}
.fav-added-date { font-size: .62rem; color: var(--text-4); font-family: var(--font-mono); }

.fav-card-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.fav-action-btn {
  display: inline-flex; align-items: center; gap: .28rem;
  font-size: .7rem; padding: .28rem .55rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-3);
  cursor: pointer; transition: all var(--t-fast);
}
.fav-action-btn:hover { color: var(--text-1); border-color: var(--border-strong); background: var(--bg-surface3); }
.fav-pin-btn { padding: .28rem; width: 30px; justify-content: center; font-size: .82rem; }
.fav-pin-btn.active { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); }
.fav-edit-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.fav-compare-btn:hover { border-color: #06b6d4; color: #06b6d4; background: rgba(6,182,212,.08); }
.fav-remove-btn { width: 30px; padding: 0; justify-content: center; }
.fav-remove-btn:hover { border-color: var(--danger); color: var(--danger); background: rgba(220,38,38,.08); }

/* ── Empty states ─────────────────────────────────── */
.favs-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 40vh; gap: .75rem; text-align: center; padding: 2rem;
}
.favs-empty-icon { font-size: 3rem; }
.favs-empty-title { font-family: var(--font-head); font-size: .9rem; color: var(--text-2); }
.favs-empty-sub { font-size: .84rem; color: var(--text-3); max-width: 26rem; line-height: 1.6; }

/* ── Modal de edición ─────────────────────────────── */
.favs-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.favs-modal.hidden { display: none; }
.favs-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.favs-modal-inner {
  position: relative; z-index: 1;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); width: min(520px, 100%);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  max-height: 90vh; overflow: hidden;
  animation: fadeUp .2s ease;
}

.favs-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}
.favs-modal-title { font-family: var(--font-head); font-size: .88rem; font-weight: 700; color: var(--text-1); }
.favs-modal-close {
  width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 50%; font-size: 1rem; color: var(--text-3);
  cursor: pointer; line-height: 1; transition: all var(--t-fast);
}
.favs-modal-close:hover { border-color: var(--danger); color: var(--danger); }
.favs-modal-plane { font-size: .72rem; color: var(--text-3); padding: 0 1.25rem .5rem; font-family: var(--font-mono); }

.favs-modal-body {
  overflow-y: auto; padding: .75rem 1.25rem;
  display: flex; flex-direction: column; gap: 1rem; flex: 1;
}
.favs-modal-field { display: flex; flex-direction: column; gap: .4rem; }
.favs-modal-label {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3);
}

/* Stars modal */
.favs-stars { display: flex; gap: .3rem; }
.star-btn {
  font-size: 1.4rem; color: var(--bg-surface3); background: none; border: none;
  cursor: pointer; padding: .1rem; line-height: 1;
  transition: color var(--t-fast), transform var(--t-fast);
}
.star-btn:hover, .star-btn.active { color: #f59e0b; transform: scale(1.15); }

/* Textarea */
.favs-modal-textarea {
  resize: vertical; min-height: 72px;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .55rem .65rem;
  font-family: var(--font-sans); font-size: .82rem; color: var(--text-1);
  outline: none; transition: border-color var(--t-fast);
}
.favs-modal-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* Tags en modal */
.favs-modal-tags-wrap { display: flex; flex-direction: column; gap: .5rem; }
.favs-modal-active-tags { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 24px; }
.modal-active-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .68rem; padding: .18rem .48rem;
  background: var(--primary-glow);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 999px; color: var(--primary);
}
.modal-tag-remove {
  color: var(--primary); background: none; border: none;
  font-size: .8rem; cursor: pointer; line-height: 1; padding: 0 2px;
  opacity: .7; transition: opacity var(--t-fast);
}
.modal-tag-remove:hover { opacity: 1; }

.favs-modal-tag-input-row { display: flex; gap: .4rem; }
.favs-modal-tag-input {
  flex: 1; background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .38rem .55rem;
  font-size: .78rem; color: var(--text-1); outline: none;
  transition: border-color var(--t-fast);
}
.favs-modal-tag-input:focus { border-color: var(--primary); }
.favs-modal-add-tag {
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius); padding: .38rem .7rem;
  font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast);
}
.favs-modal-add-tag:hover { background: #1d4ed8; }

.favs-modal-suggested-tags { display: flex; flex-wrap: wrap; gap: .28rem; }
.fav-tag-suggested {
  font-size: .65rem; padding: .15rem .42rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-3); cursor: pointer;
  transition: all var(--t-fast);
}
.fav-tag-suggested:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }

/* Modal footer */
.favs-modal-footer {
  display: flex; gap: .5rem; padding: .85rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}
.favs-modal-save {
  flex: 1; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius); padding: .5rem 1rem;
  font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast);
}
.favs-modal-save:hover { background: #1d4ed8; }
.favs-modal-remove {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem 1rem;
  font-size: .78rem; color: var(--danger); cursor: pointer;
  transition: all var(--t-fast);
}
.favs-modal-remove:hover { background: rgba(220,38,38,.1); border-color: var(--danger); }

/* ═══════════════════════════════════════════════════
   PREFERENCES — clases de sistema de preferencias
═══════════════════════════════════════════════════ */

/* ── Reducir movimiento ───────────────────────────── */
.no-animations *,
.no-animations *::before,
.no-animations *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ── Alto contraste ───────────────────────────────── */
[data-theme="high-contrast"],
body.high-contrast {
  color-scheme: dark;
}
[data-theme="high-contrast"] {
  --bg-base:       #000000;
  --bg-surface:    #0a0a0a;
  --bg-surface2:   #111111;
  --bg-surface3:   #1a1a1a;
  --border:        rgba(255,255,255,0.35);
  --border-strong: rgba(255,255,255,0.6);
  --text-1:        #ffffff;
  --text-2:        #f0f0f0;
  --text-3:        #cccccc;
  --text-4:        #aaaaaa;
  --primary:       #4d9fff;
  --primary-glow:  rgba(77,159,255,0.2);
  --accent:        #00ffff;
  --warning:       #ffdd00;
  --danger:        #ff4444;
  --success:       #00ff88;
  --header-bg:     #000000;
  --header-shadow: 0 2px 0 rgba(255,255,255,0.3);
}
[data-theme="high-contrast"] .card,
[data-theme="high-contrast"] .detail-section,
[data-theme="high-contrast"] .fav-card {
  border-width: 2px;
}
[data-theme="high-contrast"] .gen-badge,
[data-theme="high-contrast"] .status-badge,
[data-theme="high-contrast"] .radar-badge {
  border-width: 2px;
  font-weight: 700;
}
/* Force HC background - override dark body rules */
body.high-contrast {
  background: #000000 !important;
  color: #ffffff !important;
}
body.high-contrast .site-header {
  background: #000000 !important;
  border-bottom: 2px solid rgba(255,255,255,0.5) !important;
}
/* HC nav links get stronger contrast */
[data-theme="high-contrast"] .nav-link,
[data-theme="high-contrast"] .header-btn { color: #ffffff; }
[data-theme="high-contrast"] .nav-link:hover,
[data-theme="high-contrast"] .nav-link.active { color: #4d9fff; background: rgba(77,159,255,0.15); }
[data-theme="high-contrast"] .card { border: 2px solid rgba(255,255,255,0.4); }
[data-theme="high-contrast"] .card:hover { border-color: #4d9fff; }
[data-theme="high-contrast"] a { color: #4d9fff; text-decoration: underline; }
[data-theme="high-contrast"] button:focus-visible,
[data-theme="high-contrast"] a:focus-visible {
  outline: 3px solid #ffdd00 !important;
  outline-offset: 2px !important;
}

/* ── Focus ring siempre visible ───────────────────── */
.focus-ring-always :focus {
  outline: 3px solid var(--primary) !important;
  outline-offset: 3px !important;
}

/* ── Densidad de tarjetas ─────────────────────────── */
.gallery-grid[data-density="compact"] {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .65rem;
}
.gallery-grid[data-density="compact"] .card-name { font-size: .8rem; }
.gallery-grid[data-density="compact"] .card-img-wrap { aspect-ratio: 2/1; }
.gallery-grid[data-density="compact"] .card-body { padding: .6rem; gap: .4rem; }

.gallery-grid[data-density="large"] {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.4rem;
}
.gallery-grid[data-density="large"] .card-name { font-size: 1rem; }
.gallery-grid[data-density="large"] .card-body { padding: 1rem; gap: .75rem; }

/* ═══════════════════════════════════════════════════
   SETTINGS VIEW
═══════════════════════════════════════════════════ */

.settings-view {
  max-width: 960px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 1.25rem;
}

.settings-header {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .65rem 0 .5rem;
}
.settings-title {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-head); font-size: 1.1rem; font-weight: 700;
  color: var(--text-1); margin: 0;
}
.settings-subtitle { font-size: .73rem; color: var(--text-3); margin: .2rem 0 0; }

.settings-layout {
  display: grid; grid-template-columns: 180px 1fr; gap: 1.5rem; align-items: start;
}
@media (max-width: 640px) { .settings-layout { grid-template-columns: 1fr; } }

/* Sidebar nav */
.settings-nav {
  position: sticky; top: 64px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .5rem;
  display: flex; flex-direction: column; gap: .15rem;
}
@media (max-width: 640px) {
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
.settings-nav-item {
  display: flex; align-items: center; gap: .45rem;
  padding: .45rem .65rem; border-radius: var(--radius);
  font-size: .78rem; color: var(--text-3); cursor: pointer;
  transition: all var(--t-fast); text-decoration: none;
}
.settings-nav-item:hover { color: var(--text-1); background: var(--bg-surface2); }
.settings-nav-item.active { color: var(--primary); background: var(--primary-glow); }

/* Sections */
.settings-content { display: flex; flex-direction: column; gap: 1.25rem; }

.settings-section {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
  scroll-margin-top: 72px;
}

.settings-section-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: .75rem; border-bottom: 1px solid var(--border);
}
.settings-section-title {
  font-family: var(--font-head); font-size: .82rem; font-weight: 700;
  color: var(--text-1); margin: 0;
}
.settings-reset-btn {
  font-size: .68rem; color: var(--text-3);
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .25rem .6rem;
  cursor: pointer; transition: all var(--t-fast);
}
.settings-reset-btn:hover { color: var(--warning); border-color: rgba(245,158,11,.3); }

/* Fields */
.settings-field { display: flex; flex-direction: column; gap: .45rem; }
.settings-label {
  font-size: .75rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .06em;
}
.settings-desc { font-size: .75rem; color: var(--text-3); line-height: 1.55; margin: 0; }
.settings-select {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .45rem .65rem;
  font-size: .82rem; color: var(--text-1); outline: none;
  cursor: pointer; max-width: 320px; transition: border-color var(--t-fast);
}
.settings-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* Radio cards */
.settings-radio-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.settings-radio-card {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: .6rem .9rem; border-radius: var(--radius);
  background: var(--bg-surface2); border: 2px solid var(--border);
  cursor: pointer; min-width: 80px; text-align: center;
  transition: all var(--t-fast);
}
.settings-radio-card:hover { border-color: var(--primary); background: var(--primary-glow); }
.settings-radio-card input { display: none; }
.settings-radio-card:has(input:checked) {
  border-color: var(--primary); background: var(--primary-glow);
}
.radio-card-icon { font-size: 1.2rem; }
.radio-card-label { font-size: .72rem; font-weight: 600; color: var(--text-1); }
.radio-card-desc { font-size: .62rem; color: var(--text-3); }

/* Range */
.settings-range {
  width: 100%; max-width: 320px; height: 4px;
  appearance: none; background: var(--bg-surface3); border-radius: 2px; outline: none;
}
.settings-range::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); cursor: pointer; box-shadow: 0 0 0 3px var(--primary-glow);
}
.settings-range-val { font-family: var(--font-mono); color: var(--primary); font-size: .78rem; }
.settings-range-labels {
  display: flex; justify-content: space-between; max-width: 320px;
  font-size: .62rem; color: var(--text-4); font-family: var(--font-mono);
}

/* Toggle switch */
.settings-toggle-label {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; cursor: pointer;
}
.settings-toggle-input { display: none; }
.settings-toggle-track {
  width: 40px; height: 22px; flex-shrink: 0;
  background: var(--bg-surface3); border: 1px solid var(--border);
  border-radius: 999px; position: relative; transition: all var(--t-mid);
  margin-top: 2px;
}
.settings-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-4); transition: all var(--t-mid);
}
.settings-toggle-input:checked + .settings-toggle-track {
  background: var(--primary); border-color: var(--primary);
}
.settings-toggle-input:checked + .settings-toggle-track::after {
  background: #fff; transform: translateX(18px);
}

/* Checkboxes */
.settings-checkboxes { display: flex; flex-wrap: wrap; gap: .5rem; }
.settings-checkbox-label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .75rem; color: var(--text-2); cursor: pointer;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .28rem .6rem;
  transition: all var(--t-fast);
}
.settings-checkbox-label:has(input:checked) {
  border-color: var(--primary); background: var(--primary-glow); color: var(--primary);
}
.settings-checkbox-label input { display: none; }

/* Badges de info */
.settings-badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-family: var(--font-mono);
  padding: .18rem .5rem; border-radius: 4px;
  background: var(--bg-surface2); border: 1px solid var(--border);
  color: var(--text-2); margin: .15rem;
}
.settings-saved-filters, .settings-favs-info { display: flex; flex-wrap: wrap; gap: .25rem; }

/* Action buttons */
.settings-actions-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.settings-action-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .75rem; padding: .42rem .8rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-2); cursor: pointer;
  transition: all var(--t-fast);
}
.settings-action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.settings-action-btn.danger { color: var(--danger); border-color: rgba(220,38,38,.2); }
.settings-action-btn.danger:hover { background: rgba(220,38,38,.1); border-color: var(--danger); }

/* Danger zone */
.settings-danger-zone {
  border: 1px solid rgba(220,38,38,.2);
  border-radius: var(--radius); padding: .85rem;
  background: rgba(220,38,38,.04);
}

/* localStorage info */
.settings-ls-info {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .65rem .75rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.ls-row { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; }
.ls-key { color: var(--accent); font-size: .68rem; }
.ls-size { color: var(--text-3); }
.ls-total { border-top: 1px solid var(--border); padding-top: .35rem; font-size: .72rem; color: var(--text-2); }

/* Shortcuts */
.settings-shortcuts { display: flex; flex-direction: column; gap: .3rem; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; padding: .25rem 0; border-bottom: 1px solid var(--border); }
.shortcut-row:last-child { border: none; }
.shortcut-desc { color: var(--text-2); }
.shortcut-key {
  font-family: var(--font-mono); font-size: .65rem; color: var(--text-1);
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: .12rem .42rem;
}

/* ── DENSITY TOGGLE en header ─────────────────────── */
.density-toggle {
  display: flex; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.density-btn {
  background: var(--bg-surface2); border: none; border-right: 1px solid var(--border);
  color: var(--text-3); padding: .36rem .46rem; cursor: pointer;
  transition: all var(--t-fast); display: grid; place-items: center;
}
.density-btn:last-child { border-right: none; }
.density-btn:hover { color: var(--text-1); background: var(--bg-surface3); }
.density-btn.active { color: var(--primary); background: var(--primary-glow); }

/* ── GALLERY COLUMNS preference ───────────────────── */
:root[data-gallery-cols="2"] .gallery-grid { grid-template-columns: repeat(2, 1fr) !important; }
:root[data-gallery-cols="3"] .gallery-grid { grid-template-columns: repeat(3, 1fr) !important; }
:root[data-gallery-cols="4"] .gallery-grid { grid-template-columns: repeat(4, 1fr) !important; }

/* ── STAT BARS off ────────────────────────────────── */
.no-stat-bars .card-stats .stat-bar-track { display: none; }
.no-stat-bars .card-stats .stat-value { margin-left: 0; }

/* ── THEME: high-contrast icon ────────────────────── */
.theme-icon-hc { display: none; font-size: .85rem; }
[data-theme="high-contrast"] .theme-icon-sun  { display: none; }
[data-theme="high-contrast"] .theme-icon-moon { display: none; }
[data-theme="high-contrast"] .theme-icon-hc   { display: inline; }

/* ── SETTINGS nav active ──────────────────────────── */
.settings-btn.active {
  color: var(--primary); background: var(--primary-glow);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}

/* ── @media reduce-motion fallback ───────────────── */
@media (prefers-reduced-motion: reduce) {
  .theater-pulse { animation: none; fill-opacity: 0.08; }
  *:not(.no-animations *) {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════
   FASES 3-6: Theater, Collections, PWA, A11y
═══════════════════════════════════════════════════ */

/* ── Theater ──────────────────────────────────────── */
.theater-view { display:flex; flex-direction:column; gap:1rem; }
.theater-header { display:flex; align-items:flex-start; gap:.85rem; padding:.65rem 0 .3rem; }
.theater-title { display:flex; align-items:center; gap:.4rem; font-family:var(--font-head); font-size:1.05rem; font-weight:700; margin:0; }
.theater-subtitle { font-size:.72rem; color:var(--text-3); margin:.1rem 0 0; font-family:var(--font-mono); }

.theater-era-bar { display:flex; flex-wrap:wrap; gap:.35rem; align-items:center; }
.theater-era-btn {
  padding:.28rem .65rem; border:1px solid var(--border); border-radius:999px;
  background:var(--bg-surface2); font-size:.72rem; color:var(--text-3);
  cursor:pointer; transition:all var(--t-fast);
}
.theater-era-btn:hover { border-color:var(--primary); color:var(--primary); }
.theater-era-btn.active { background:var(--primary-glow); border-color:var(--primary); color:var(--primary); font-weight:600; }
.theater-count-badge { font-family:var(--font-mono); font-size:.68rem; color:var(--text-3); margin-left:auto; }

.theater-layout { display:grid; grid-template-columns:1fr 300px; gap:1.25rem; align-items:start; }
@media (max-width:768px) { .theater-layout { grid-template-columns:1fr; } }

.theater-map-wrap {
  background:var(--bg-surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); overflow:hidden; position:relative;
  min-height:320px;
}
.theater-map { width:100%; height:420px; position:relative; }
.theater-svg { display:block; }
.theater-ocean { color:var(--bg-surface2); }
[data-theme="dark"] .theater-ocean { color:#0c1a2e; }
.theater-land { fill:var(--bg-surface3); stroke:var(--border); stroke-width:.5; }
[data-theme="dark"] .theater-land { fill:#1a2744; }
.theater-equator { stroke:var(--border); stroke-width:.5; stroke-dasharray:4,4; }

.theater-conflict-group { cursor:pointer; }
.theater-conflict-group:hover .theater-dot-main { r:9; }
.theater-conflict-group.selected .theater-dot-main { r:9; stroke:#fff; stroke-width:2; }
.theater-conflict-group:focus-visible { outline:none; }
.theater-conflict-group:focus-visible .theater-dot-main { stroke:#fff; stroke-width:2.5; r:9; }

.theater-pulse { fill-opacity:.12; animation:pulse-ring 4s ease-out infinite; }
@keyframes pulse-ring { 0%{r:6;fill-opacity:.18} 70%{r:14;fill-opacity:.04} 100%{r:16;fill-opacity:0} }

.theater-dot-main { transition:r .15s; }
.theater-dot--wwii    { fill:#f59e0b; } .theater-pulse--wwii    { fill:#f59e0b; }
.theater-dot--korea   { fill:#3b82f6; } .theater-pulse--korea   { fill:#3b82f6; }
.theater-dot--coldwar { fill:#8b5cf6; } .theater-pulse--coldwar { fill:#8b5cf6; }
.theater-dot--modern  { fill:#ef4444; } .theater-pulse--modern  { fill:#ef4444; }
.theater-flag-text { pointer-events:none; fill:var(--text-1); font-size:10px; }

.theater-legend {
  position:absolute; bottom:.75rem; left:.75rem;
  display:flex; gap:.5rem; flex-wrap:wrap;
  background:rgba(0,0,0,.5); border-radius:6px; padding:.35rem .55rem;
  backdrop-filter:blur(6px);
}
.theater-legend-item { display:flex; align-items:center; gap:.28rem; font-size:.62rem; color:#e2e8f0; }
.theater-dot { display:inline-block; width:8px; height:8px; border-radius:50%; }
.theater-dot.wwii { background:#f59e0b; }
.theater-dot.coldwar { background:#8b5cf6; }
.theater-dot.modern { background:#ef4444; }
.theater-dot.selected { background:#fff; }
.theater-era-dot { display:inline-block; width:6px; height:6px; border-radius:50%; }

.theater-tooltip {
  position:absolute; top:0; left:0; pointer-events:none;
  background:rgba(0,0,0,.82); color:#f1f5f9; border-radius:6px;
  padding:.35rem .6rem; font-size:.72rem; backdrop-filter:blur(4px);
  white-space:nowrap; opacity:0; transition:opacity .12s; z-index:10;
}
.theater-tooltip--visible { opacity:1; }

.theater-panel { display:flex; flex-direction:column; gap:.85rem; }

.theater-detail {
  background:var(--bg-surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:1rem; min-height:140px;
}
.theater-detail-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.5rem; min-height:140px; color:var(--text-4); font-size:.8rem; text-align:center; }
.theater-detail-header { display:flex; gap:.65rem; align-items:flex-start; margin-bottom:.65rem; }
.theater-detail-flag { font-size:1.5rem; flex-shrink:0; }
.theater-detail-title { font-family:var(--font-head); font-size:.9rem; font-weight:700; margin:0 0 .12rem; }
.theater-detail-years { font-family:var(--font-mono); font-size:.68rem; color:var(--text-3); }
.theater-detail-desc { font-size:.75rem; color:var(--text-2); line-height:1.6; margin-bottom:.75rem; }
.theater-detail-section { margin-top:.75rem; padding-top:.65rem; border-top:1px solid var(--border); }
.theater-detail-sub { display:flex; align-items:center; gap:.3rem; font-family:var(--font-head); font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-3); margin-bottom:.55rem; }
.theater-planes-grid { display:flex; flex-direction:column; gap:.35rem; max-height:220px; overflow-y:auto; }
.theater-plane-chip {
  display:flex; align-items:center; gap:.5rem; width:100%;
  background:var(--bg-surface2); border:1px solid var(--border); border-radius:var(--radius);
  padding:.35rem .5rem; cursor:pointer; text-align:left; transition:all var(--t-fast);
}
.theater-plane-chip:hover { border-color:var(--primary); color:var(--primary); }
.theater-plane-chip-info { display:flex; flex-direction:column; }
.theater-plane-name { font-size:.72rem; font-weight:600; }
.theater-plane-country { font-size:.62rem; color:var(--text-3); font-family:var(--font-mono); }
.theater-kill-row { display:flex; align-items:center; gap:.5rem; font-size:.72rem; padding:.2rem 0; border-bottom:1px solid var(--border); }
.theater-kill-name { flex:1; color:var(--text-2); }
.theater-detail-actions { margin-top:.75rem; }
.theater-filter-btn { width:100%; justify-content:center; }

.theater-list-wrap { background:var(--bg-surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:.75rem; }
.theater-list { display:flex; flex-direction:column; gap:.25rem; max-height:300px; overflow-y:auto; }
.theater-list-item {
  display:flex; align-items:center; gap:.5rem; width:100%;
  padding:.38rem .55rem; border-radius:var(--radius); border:1px solid transparent;
  background:none; cursor:pointer; text-align:left; transition:all var(--t-fast);
}
.theater-list-item:hover { background:var(--bg-surface2); }
.theater-list-item.active { background:var(--primary-glow); border-color:color-mix(in srgb, var(--primary) 30%, transparent); }
.theater-list-flag { font-size:.9rem; flex-shrink:0; }
.theater-list-info { display:flex; flex-direction:column; flex:1; min-width:0; }
.theater-list-label { font-size:.72rem; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.theater-list-years { font-family:var(--font-mono); font-size:.62rem; color:var(--text-3); }

/* ── Collections sidebar ──────────────────────────── */
.favs-main-layout { display:grid; grid-template-columns:180px 1fr; gap:1.25rem; align-items:start; }
@media (max-width:640px) { .favs-main-layout { grid-template-columns:1fr; } }

.favs-collections-sidebar {
  background:var(--bg-surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:.65rem;
  position:sticky; top:64px;
}
@media (max-width:640px) { .favs-collections-sidebar { position:static; } }

.favs-col-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.5rem; padding-bottom:.4rem; border-bottom:1px solid var(--border); }
.favs-col-title { font-family:var(--font-head); font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-3); }
.favs-col-new-btn { width:22px; height:22px; background:var(--primary-glow); border:1px solid color-mix(in srgb, var(--primary) 35%, transparent); border-radius:50%; color:var(--primary); font-size:.9rem; display:grid; place-items:center; cursor:pointer; transition:all var(--t-fast); }
.favs-col-new-btn:hover { background:var(--primary); color:#fff; }

.favs-col-list { display:flex; flex-direction:column; gap:.15rem; }
.favs-col-item-wrap { display:flex; align-items:center; gap:.2rem; }
.favs-col-item {
  flex:1; display:flex; align-items:center; gap:.4rem; padding:.38rem .5rem;
  border-radius:var(--radius); border:1px solid transparent;
  background:none; cursor:pointer; text-align:left; font-size:.75rem; color:var(--text-2);
  transition:all var(--t-fast);
}
.favs-col-item:hover { background:var(--bg-surface2); }
.favs-col-item.active { background:var(--primary-glow); border-color:color-mix(in srgb, var(--primary) 35%, transparent); color:var(--primary); font-weight:600; }
.favs-col-item span:first-child { font-size:.9rem; }
.favs-col-item span:last-child { margin-left:auto; }
.favs-col-count { font-family:var(--font-mono); font-size:.62rem; color:var(--text-3); }
.favs-col-delete-btn { width:18px; height:18px; border-radius:50%; background:none; border:1px solid transparent; color:var(--text-4); font-size:.78rem; display:grid; place-items:center; cursor:pointer; opacity:0; transition:all var(--t-fast); flex-shrink:0; }
.favs-col-item-wrap:hover .favs-col-delete-btn { opacity:1; }
.favs-col-delete-btn:hover { border-color:var(--danger); color:var(--danger); background:rgba(220,38,38,.08); }

/* ── Favs charts ──────────────────────────────────── */
.favs-charts-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
@media (max-width:640px) { .favs-charts-grid { grid-template-columns:1fr; } }
.favs-chart-card { background:var(--bg-surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:.85rem; display:flex; flex-direction:column; align-items:center; gap:.5rem; }
.favs-chart-title { font-family:var(--font-head); font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-3); align-self:flex-start; }
.favs-chart-legend { display:flex; flex-wrap:wrap; gap:.3rem; justify-content:center; }

/* ── Collection modal controls ────────────────────── */
.modal-col-toggle {
  display:inline-flex; align-items:center; gap:.35rem; font-size:.72rem;
  padding:.25rem .55rem; border-radius:var(--radius); border:1px solid var(--border);
  background:var(--bg-surface2); color:var(--text-2); cursor:pointer;
  margin:.2rem; transition:all var(--t-fast);
}
.modal-col-toggle.active { background:var(--col-color,var(--primary)); color:#fff; border-color:transparent; }
.modal-col-toggle:hover:not(.active) { border-color:var(--col-color,var(--primary)); color:var(--col-color,var(--primary)); }

.favs-color-picker, .favs-icon-picker { display:flex; flex-wrap:wrap; gap:.35rem; }
.color-swatch { width:24px; height:24px; border-radius:50%; border:2px solid transparent; cursor:pointer; transition:border-color .12s; }
.color-swatch.selected, .color-swatch:hover { border-color:#fff; box-shadow:0 0 0 2px currentColor; }
.icon-swatch { font-size:1.1rem; width:32px; height:32px; border-radius:var(--radius); border:2px solid transparent; background:var(--bg-surface2); cursor:pointer; display:grid; place-items:center; transition:all var(--t-fast); }
.icon-swatch.selected, .icon-swatch:hover { border-color:var(--primary); background:var(--primary-glow); }

/* ── Fav card compact ─────────────────────────────── */
.fav-card--compact { grid-template-columns:20px 1fr; padding:.5rem .7rem; }
.fav-card--compact .fav-card-body { gap:.3rem; }
.fav-card--compact .fav-card-top { align-items:center; }
.fav-card--compact .fav-card-name { font-size:.78rem; }

/* ── Favs table wrap ──────────────────────────────── */
.favs-table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius-lg); }
.favs-table-wrap .compare-table td { font-size:.72rem; }

/* ── PWA Banner ───────────────────────────────────── */
.pwa-banner {
  position:fixed; bottom:-120px; left:50%; transform:translateX(-50%);
  width:min(480px, calc(100vw - 2rem)); z-index:400;
  background:var(--bg-surface); border:1px solid var(--border-strong);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-lg);
  transition:bottom var(--t-mid);
}
.pwa-banner--visible { bottom:1.25rem; }
.pwa-banner-inner { display:flex; align-items:center; gap:.75rem; padding:.75rem 1rem; }
.pwa-banner-icon { width:36px; height:36px; background:var(--primary-glow); border:1px solid color-mix(in srgb, var(--primary) 35%, transparent); border-radius:var(--radius); display:grid; place-items:center; color:var(--primary); flex-shrink:0; }
.pwa-banner-text { flex:1; }
.pwa-banner-title { font-family:var(--font-head); font-size:.78rem; font-weight:700; }
.pwa-banner-sub { font-size:.68rem; color:var(--text-3); margin-top:.1rem; }
.pwa-banner-actions { display:flex; gap:.35rem; flex-shrink:0; }
.pwa-btn-install { background:var(--primary); color:#fff; border:none; border-radius:var(--radius); padding:.38rem .8rem; font-size:.75rem; font-weight:600; cursor:pointer; transition:background var(--t-fast); }
.pwa-btn-install:hover { background:#1d4ed8; }
.pwa-btn-dismiss { width:28px; height:28px; background:var(--bg-surface2); border:1px solid var(--border); border-radius:50%; color:var(--text-3); cursor:pointer; font-size:.9rem; display:grid; place-items:center; transition:all var(--t-fast); }
.pwa-btn-dismiss:hover { border-color:var(--danger); color:var(--danger); }

/* ── PWA Update toast ─────────────────────────────── */
.pwa-update-toast {
  position:fixed; top:-80px; left:50%; transform:translateX(-50%);
  width:min(440px, calc(100vw - 2rem)); z-index:500;
  background:var(--bg-surface); border:1px solid var(--border-strong);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-lg);
  transition:top var(--t-mid);
}
.pwa-update-toast--visible { top:1rem; }
.pwa-update-inner { display:flex; align-items:center; gap:.65rem; padding:.65rem 1rem; }
.pwa-update-title { font-size:.78rem; font-weight:600; }
.pwa-update-sub { font-size:.68rem; color:var(--text-3); }
.pwa-update-reload { background:var(--primary); color:#fff; border:none; border-radius:var(--radius); padding:.32rem .7rem; font-size:.72rem; font-weight:600; cursor:pointer; margin-left:auto; white-space:nowrap; }
.pwa-update-close { width:24px; height:24px; background:none; border:none; color:var(--text-3); cursor:pointer; font-size:.9rem; display:grid; place-items:center; }

/* ── Shared view ──────────────────────────────────── */
.shared-view { max-width:1100px; margin:0 auto; display:flex; flex-direction:column; gap:1rem; }
.shared-header { display:flex; align-items:flex-start; gap:.85rem; padding:.65rem 0 .3rem; flex-wrap:wrap; }
.shared-title { font-family:var(--font-head); font-size:1.05rem; font-weight:700; margin:0; }
.shared-sub { font-size:.72rem; color:var(--text-3); margin:.12rem 0 0; font-family:var(--font-mono); }
.shared-stats { display:flex; flex-wrap:wrap; gap:.35rem; margin-top:.4rem; font-size:.68rem; color:var(--text-3); font-family:var(--font-mono); }

/* ── A11y: aria-live announcer ────────────────────── */
.sr-only {
  position:absolute; width:1px; height:1px; padding:0;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ── Theater nav link ─────────────────────────────── */
/* añadido en Header dinámicamente */

/* ═══════════════════════════════════════════════════
   BUG FIXES & NEW FEATURES CSS
═══════════════════════════════════════════════════ */

/* ── Home toolbar ─────────────────────────────────── */
.home-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .5rem; padding: .4rem 0;
}
.home-toolbar-actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }
.timeline-toggle-btn { gap: .35rem; }
/* ── Timeline panel ───────────────────────────────── */
.timeline-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  max-height: 0; transition: max-height .35s ease, opacity .25s ease;
  opacity: 0; pointer-events: none;
}
.timeline-panel--open {
  max-height: 260px; opacity: 1; pointer-events: auto;
}
.timeline-panel-inner { padding: 1rem 1.1rem; }

.timeline-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem;
}
.timeline-header-left { display: flex; align-items: center; gap: .45rem; }
.timeline-title {
  font-family: var(--font-head); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-2);
}
.timeline-range-label {
  font-family: var(--font-mono); font-size: .65rem; color: #60a5fa;
  background: rgba(96,165,250,.1); border: 1px solid rgba(96,165,250,.2);
  padding: .1rem .4rem; border-radius: 4px;
}
.timeline-reset-btn {
  display: flex; align-items: center; gap: .3rem;
  font-size: .7rem; color: var(--text-3);
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .28rem .6rem; cursor: pointer;
  transition: all var(--t-fast);
}
.timeline-reset-btn:not(:disabled):hover { color: var(--warning); border-color: rgba(245,158,11,.3); }
.timeline-reset-btn:disabled { opacity: .35; cursor: default; }

/* Decade marks */
.decade-marks {
  display: flex; justify-content: space-between;
  margin-bottom: .4rem; gap: .2rem;
}
.decade-mark {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer; padding: .2rem .3rem;
  border-radius: 4px; transition: all var(--t-fast); flex: 1;
}
.decade-mark:hover { background: var(--bg-surface2); }
.decade-mark.active .decade-dot { background: #60a5fa; }
.decade-mark.active .decade-label { color: #60a5fa; }
.decade-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bg-surface3); transition: background var(--t-fast); }
.decade-label { font-family: var(--font-mono); font-size: .6rem; color: var(--text-4); }

/* Dual range slider */
.timeline-sliders-wrap {
  position: relative; height: 20px; margin: .4rem 0;
}
.timeline-track-bg {
  position: absolute; top: 50%; left: 0; right: 0; height: 4px;
  background: var(--bg-surface3); border-radius: 2px; transform: translateY(-50%);
}
.timeline-track-fill {
  position: absolute; height: 100%; background: #3b82f6; border-radius: 2px;
}
.timeline-input {
  position: absolute; top: 0; width: 100%; height: 100%;
  appearance: none; background: transparent; pointer-events: none;
}
.timeline-input::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #3b82f6; border: 2px solid #fff; pointer-events: all;
  cursor: grab; box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: transform .12s;
}
.timeline-input::-webkit-slider-thumb:active { transform: scale(1.2); cursor: grabbing; }
.timeline-input::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #3b82f6; border: 2px solid #fff; pointer-events: all; cursor: grab; }

.timeline-ticks {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: .6rem; color: var(--text-4);
  margin-bottom: .3rem;
}
.timeline-hint { font-size: .68rem; color: var(--text-4); }

/* ── Stats view ───────────────────────────────────── */
.stats-view { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }
.stats-header { display: flex; align-items: flex-start; gap:.85rem; padding:.65rem 0 .3rem; }
.stats-title { display: flex; align-items: center; gap: .45rem; font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; margin: 0; }
.stats-subtitle { font-size: .73rem; color: var(--text-3); margin: .12rem 0 0; font-family: var(--font-mono); }

.stats-mega-grid {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.stats-mega-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .85rem .75rem; text-align: center;
}
.stats-mega-num {
  font-family: var(--font-head); font-size: 1.2rem; font-weight: 900;
  line-height: 1.1;
}
.stats-mega-label { font-size: .65rem; color: var(--text-3); margin-top: .2rem; }

.stats-section {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem;
}
.stats-section-title {
  font-family: var(--font-head); font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-2);
  margin-bottom: .85rem;
}
.stats-charts-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.stats-records-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stats-record-card {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .75rem; text-align: left;
  cursor: pointer; transition: all var(--t-mid); width: 100%;
}
.stats-record-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stats-record-label { font-size: .65rem; color: var(--text-3); margin-bottom: .2rem; }
.stats-record-plane { font-family: var(--font-head); font-size: .8rem; font-weight: 700; }
.stats-record-val { font-family: var(--font-mono); font-size: .78rem; color: var(--primary); margin-top: .1rem; }
.stats-record-country { font-size: .62rem; color: var(--text-3); margin-top: .08rem; }

.stats-chart-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stats-legend { display: flex; flex-direction: column; gap: .35rem; flex: 1; min-width: 140px; }

.stats-top-list { display: flex; flex-direction: column; gap: .35rem; }
.stats-top-item {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .45rem .65rem;
  cursor: pointer; text-align: left; transition: all var(--t-fast);
}
.stats-top-item:hover { border-color: var(--primary); background: var(--primary-glow); }
.stats-top-rank { font-size: .85rem; min-width: 1.8rem; }
.stats-top-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.stats-top-name { font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-top-country { font-family: var(--font-mono); font-size: .62rem; color: var(--text-3); }
.stats-top-val { font-family: var(--font-head); font-size: .8rem; font-weight: 700; flex-shrink: 0; }

.stats-speed-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: .5rem; font-size: .68rem; color: var(--text-3); font-family: var(--font-mono); }

/* ── 404 mejorado ─────────────────────────────────── */
.not-found-recents { margin-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.not-found-recents-label { font-size: .72rem; color: var(--text-3); font-family: var(--font-mono); margin-bottom: .1rem; }
.not-found-recent-item {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .4rem .65rem;
  font-size: .78rem; color: var(--text-1); text-decoration: none;
  transition: all var(--t-fast);
}
.not-found-recent-item:hover { border-color: var(--primary); color: var(--primary); }

/* ── Router error ─────────────────────────────────── */
.route-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .65rem; min-height: 50vh; text-align: center; padding: 2rem;
  color: var(--text-3); font-size: .85rem;
}

/* ═══════════════════════════════════════════════════
   FEATURE CSS: Búsqueda avanzada, Recientes,
   Quick Compare, Markdown, Ranking mobile fix
═══════════════════════════════════════════════════ */

/* ── Búsqueda avanzada — hint ─────────────────────── */
.search-hint {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .8rem; border-radius: var(--radius);
  background: var(--primary-glow);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  font-size: .72rem; color: var(--primary); font-family: var(--font-mono);
  animation: fadeUp .2s ease;
}
.search-hint::before { content: '🔍'; }

/* ── Panel de recientes ───────────────────────────── */
.recents-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .75rem;
  animation: fadeUp .2s ease;
}
.recents-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .55rem;
}
.recents-panel-title {
  font-family: var(--font-head); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--text-3);
}
.recents-clear-btn {
  font-size: .68rem; color: var(--text-4);
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: .18rem .5rem; cursor: pointer;
  transition: all var(--t-fast);
}
.recents-clear-btn:hover { color: var(--danger); border-color: rgba(220,38,38,.3); }

.recents-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .35rem; max-height: 280px; overflow-y: auto;
}
.recents-item {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .42rem .6rem;
  cursor: pointer; text-align: left; transition: all var(--t-fast);
}
.recents-item:hover { border-color: var(--primary); background: var(--primary-glow); }
.recents-item-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.recents-item-name {
  font-size: .75rem; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.recents-item-sub { font-family: var(--font-mono); font-size: .62rem; color: var(--text-3); }
.recents-empty { font-size: .76rem; color: var(--text-4); padding: .5rem 0; text-align: center; }


.card:hover /* Cuando NO está anclado a una card, lo centramos */
/* ── Markdown lite ────────────────────────────────── */
.md-note {
  font-size: .78rem; color: var(--text-2); line-height: 1.65;
  border-left: 2px solid var(--border); padding-left: .6rem;
  margin-left: .1rem;
}
.md-note strong { color: var(--text-1); }
.md-note em { font-style: italic; color: var(--text-2); }
.md-note .md-code {
  font-family: var(--font-mono); font-size: .72rem;
  background: var(--bg-surface2); padding: .05rem .28rem;
  border-radius: 3px; color: var(--accent);
}
.md-note .md-list { list-style: none; padding: 0; margin: .25rem 0; display: flex; flex-direction: column; gap: .18rem; }
.md-note .md-li::before { content: '·'; margin-right: .35rem; color: var(--primary); }
.md-note .md-blockquote {
  border-left: 2px solid var(--primary); padding-left: .5rem;
  color: var(--text-3); font-style: italic; margin: .25rem 0;
}
.md-note .md-p { display: inline; }

/* Markdown toolbar en modal */
.md-note-toolbar {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem;
}
.md-toolbar-btns { display: flex; gap: .25rem; }
.md-btn {
  width: 24px; height: 24px; display: grid; place-items: center;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: 4px; font-size: .75rem; cursor: pointer; color: var(--text-2);
  transition: all var(--t-fast);
}
.md-btn:hover, .md-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.md-btn code { font-size: .75rem; }

.md-preview {
  min-height: 60px; padding: .5rem .65rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .78rem; color: var(--text-2);
  line-height: 1.65; border-top: none; border-radius: 0 0 var(--radius) var(--radius);
}
.md-preview strong { color: var(--text-1); }
.md-preview em { font-style: italic; }
.md-preview .md-code { font-family: var(--font-mono); background: var(--bg-surface3); padding: .05rem .25rem; border-radius: 3px; color: var(--accent); }
.md-preview .md-list { list-style: none; padding: 0; margin: .2rem 0; }
.md-preview .md-li::before { content: '·'; margin-right: .35rem; color: var(--primary); }
.md-preview .md-blockquote { border-left: 2px solid var(--primary); padding-left: .5rem; color: var(--text-3); }

.md-hint { font-family: var(--font-mono); font-size: .62rem; color: var(--text-4); margin-top: .3rem; }

/* Modal textarea + preview sin gap */
.favs-modal-textarea:has(+ #mdPreview:not(.hidden)) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ── Ranking mobile fixes ─────────────────────────── */
.rank-dir-btn {
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .28rem .55rem; cursor: pointer;
  color: var(--text-3); display: flex; align-items: center;
  transition: all var(--t-fast); margin-left: auto;
}
.rank-dir-btn:hover { border-color: var(--primary); color: var(--primary); }

.sort-th-inner {
  display: flex; align-items: center; gap: .3rem;
  white-space: nowrap;
}
.ranking-table th.sort-th { padding: 0; }
.ranking-table th.sort-th .sort-th-inner { padding: .55rem .7rem; }

/* Touch target mínimo para headers de tabla */
@media (max-width: 768px) {
  .sort-th-inner { padding: .7rem .6rem !important; }
  .ranking-table th.sort-th { min-width: 80px; }
}

.rank-sort-info {
  font-size: .68rem; color: var(--text-3); text-align: center;
  padding: .4rem; border-top: 1px solid var(--border);
  display: none;
}
@media (max-width: 640px) { .rank-sort-info { display: block; } }

/* aria-sort feedback visual */
th[aria-sort="ascending"]  .sort-icon { color: var(--primary); }
th[aria-sort="descending"] .sort-icon { color: var(--primary); }
th[aria-sort="none"]       .sort-icon { color: var(--text-4); }

/* ── Advanced search operators hint ──────────────── */
.search-operators-hint {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: .5rem .75rem; font-size: .7rem; color: var(--text-3);
  box-shadow: var(--shadow-md); display: none;
}
.search-wrap:focus-within .search-operators-hint { display: block; }

/* ── Animations ───────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Home toolbar responsive ──────────────────────── */
@media (max-width: 480px) {
  .home-toolbar { flex-direction: column; align-items: flex-start; }
  .home-toolbar-actions { width: 100%; }
}

/* ═══════════════════════════════════════════════════
   HELP VIEW
═══════════════════════════════════════════════════ */
.help-view { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }
.help-header { display: flex; align-items: flex-start; gap: .85rem; padding: .65rem 0 .3rem; }
.help-title { display: flex; align-items: center; gap: .45rem; font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; margin: 0; }
.help-subtitle { font-size: .73rem; color: var(--text-3); margin: .12rem 0 0; }

.help-layout { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 640px) { .help-layout { grid-template-columns: 1fr; } }

.help-nav {
  position: sticky; top: 64px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .5rem; display: flex; flex-direction: column; gap: .1rem;
}
@media (max-width: 640px) { .help-nav { position: static; flex-direction: row; flex-wrap: wrap; } }

.help-nav-item {
  display: flex; align-items: center; gap: .45rem; width: 100%;
  padding: .42rem .65rem; border-radius: var(--radius);
  font-size: .78rem; color: var(--text-3); cursor: pointer;
  text-decoration: none; background: none; border: none; text-align: left;
  transition: all var(--t-fast);
}
.help-nav-item:hover { color: var(--text-1); background: var(--bg-surface2); }
.help-nav-item.active { color: var(--primary); background: var(--primary-glow); font-weight: 600; }
.help-nav-link { color: var(--text-3) !important; }
.help-nav-link:hover { color: var(--primary) !important; }
.help-nav-divider { height: 1px; background: var(--border); margin: .35rem 0; }

.help-content { min-height: 400px; }
.help-section-content { animation: fadeUp .2s ease; }
.help-section-header { display: flex; align-items: center; gap: .55rem; margin-bottom: 1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--border); }
.help-section-icon { font-size: 1.4rem; }
.help-section-title { font-family: var(--font-head); font-size: .95rem; font-weight: 700; color: var(--text-1); margin: 0; }

.help-section-body { display: flex; flex-direction: column; gap: 1rem; font-size: .84rem; color: var(--text-2); line-height: 1.7; }
.help-sub { font-family: var(--font-head); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); margin: 0 0 .4rem; padding-top: .25rem; }
.help-sub:not(:first-child) { margin-top: .85rem; }

.help-list { padding-left: 1.2rem; margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.help-list--numbered { list-style: decimal; }
.help-list li { font-size: .82rem; line-height: 1.6; }

.help-operators-grid { display: flex; flex-direction: column; gap: .3rem; padding: .65rem .85rem; background: var(--bg-surface2); border: 1px solid var(--border); border-radius: var(--radius); }
.help-op-row { display: flex; align-items: center; gap: .65rem; }
.help-op-code { font-family: var(--font-mono); font-size: .75rem; color: var(--accent); background: rgba(34,211,238,.08); padding: .15rem .5rem; border-radius: 4px; min-width: 10rem; flex-shrink: 0; }
.help-op-desc { font-size: .76rem; color: var(--text-2); }

.help-example-box { background: var(--bg-surface2); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius); padding: .65rem .85rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.help-example-label { font-size: .7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; margin-right: .25rem; flex-shrink: 0; }
.help-example-box code { font-family: var(--font-mono); font-size: .75rem; color: var(--primary); background: var(--primary-glow); padding: .2rem .5rem; border-radius: 4px; }

.help-md-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .65rem; padding: .55rem .75rem; background: var(--bg-surface2); border: 1px solid var(--border); border-radius: var(--radius); }
.help-md-grid code { font-family: var(--font-mono); font-size: .74rem; color: var(--accent); }
.help-md-grid span { font-size: .76rem; color: var(--text-2); }

.help-types-grid { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.help-type-chip { font-size: .72rem; padding: .18rem .55rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-surface2); color: var(--text-2); }
.help-type-chip strong { color: var(--primary); margin-left: .25rem; }

.help-shortcuts-mini { display: flex; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .3rem; }
.help-shortcuts-mini span { display: flex; align-items: center; gap: .3rem; font-size: .74rem; color: var(--text-2); }

.help-section-label { font-family: var(--font-head); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: .85rem; }
.help-shortcuts-ref { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem; }
.help-shortcuts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem; }
.help-shortcut-item { display: flex; align-items: center; gap: .5rem; padding: .28rem .2rem; }

/* Help btn in header */
.help-btn.active { color: var(--primary); background: var(--primary-glow); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }

/* ── HelpView additions ───────────────────────────────────────── */
.help-code-block {
  display: flex; flex-direction: column; gap: .3rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .65rem .85rem;
}
.help-code-block code {
  font-family: var(--font-mono); font-size: .78rem; color: var(--accent);
  display: block;
}
.help-pages-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .5rem; margin-top: .4rem;
}
.help-page-card {
  display: flex; flex-direction: column; gap: .18rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: .65rem .75rem;
  text-decoration: none; transition: all var(--t-mid);
}
.help-page-card:hover { border-color: var(--primary); background: var(--primary-glow); }
.help-page-name { font-family: var(--font-head); font-size: .8rem; font-weight: 700; color: var(--text-1); }
.help-page-url  { font-family: var(--font-mono); font-size: .65rem; color: var(--primary); }
.help-page-desc { font-size: .7rem; color: var(--text-3); line-height: 1.45; }

/* ═══════════════════════════════════════════════════
   MOBILE NAV HAMBURGER + ARCHIVE CONTROLS REFACTOR
═══════════════════════════════════════════════════ */

/* ── Hamburger button ─────────────────────────────── */
.nav-toggle-btn {
  display: none;   /* hidden on desktop */
}
@media (max-width: 767px) {
  .nav-toggle-btn { display: grid; place-items: center; }
}

/* ── Main nav — mobile drawer ─────────────────────── */
@media (max-width: 767px) {
  .main-nav {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 9000;
    padding-top: 4rem;
    background: var(--bg-base);
    padding: .75rem .75rem 2rem;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    border-right: 1px solid var(--border);
    width: min(260px, 85vw);
  }
  .main-nav.nav-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.45);
  }
  /* Overlay behind the drawer */
  /* In mobile drawer: flatten "Más" menu — show all items directly */
  .nav-more { position: static; }
  .nav-more-btn { display: none; }
  .nav-dropdown {
    position: static !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }
  .nav-dropdown-item {
    padding: .55rem .65rem !important;
    border-radius: var(--radius) !important;
  }
  .main-nav.nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: -1;
    backdrop-filter: blur(2px);
  }
  .nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem .75rem;
    border-radius: var(--radius);
    font-size: .92rem;
    font-weight: 500;
    width: 100%;
    border-bottom: 1px solid var(--border);
    min-height: 48px;  /* accessible touch target */
  }
  .nav-link:last-child { border-bottom: none; }
  .nav-link svg { flex-shrink: 0; width: 16px; height: 16px; }
}

/* ── Archive controls ─────────────────────────────── */
.archive-controls {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .5rem;
}
.archive-controls-row1 {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.archive-controls-row2 {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.archive-search {
  flex: 1;
  min-width: 180px;
}
.archive-actions {
  display: flex;
  gap: .35rem;
  flex-shrink: 0;
}
.archive-btn {
  cursor: pointer;
  gap: .3rem;
  white-space: nowrap;
}
.archive-btn-label {
  font-size: .72rem;
}
@media (max-width: 540px) {
  .archive-btn-label { display: none; }
  .archive-controls-row1 { flex-wrap: nowrap; }
}

/* ── Result bar inside archive controls ───────────── */
.result-bar {
  flex: 1;
  font-size: .72rem;
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
}

/* ── View btn label (show text on archive bar) ────── */
.view-btn-label {
  font-size: .72rem;
  margin-left: .2rem;
}
@media (max-width: 480px) {
  .view-btn-label { display: none; }
}

/* ── Density toggle visibility ────────────────────── */
.archive-density {
  /* will be hidden in ranking view via JS */
}

/* ── Mach recents ─────────────────────────────────── */
.mach-ref-btn--recent {
  display: flex !important;
  align-items: center;
  gap: .5rem;
  text-align: left;
  height: auto;
  padding: .38rem .55rem;
}

/* ── Detail fav button ────────────────────────────── */
.btn-detail-fav {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .85rem;
  background: var(--bg-surface2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .78rem; font-weight: 500;
  color: var(--text-2); cursor: pointer;
  transition: all var(--t-mid);
}
.btn-detail-fav svg { flex-shrink: 0; color: var(--text-3); transition: color var(--t-fast); }
.btn-detail-fav:hover { border-color: #f59e0b; color: #f59e0b; }
.btn-detail-fav:hover svg { color: #f59e0b; }
.btn-detail-fav.active { background: rgba(245,158,11,.12); border-color: #f59e0b; color: #f59e0b; }
.btn-detail-fav.active svg { color: #f59e0b; }

/* ═══════════════════════════════════════════════════
   HEADER: DROPDOWN + BADGE + DENSITY ACTIVE STATE
═══════════════════════════════════════════════════ */

/* Nav badge (compare count on link) */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--primary); color: #fff;
  font-size: .6rem; font-weight: 700; border-radius: 999px;
  margin-left: .25rem; line-height: 1;
}
.nav-badge.hidden { display: none; }

/* "Más" dropdown */
.nav-more { position: relative; }
.nav-more-btn {
  display: flex; align-items: center; gap: .3rem;
  background: none; border: none; cursor: pointer;
}
.nav-more-chevron {
  transition: transform var(--t-fast);
}
.nav-more-btn[aria-expanded="true"] .nav-more-chevron {
  transform: rotate(180deg);
}
.nav-dropdown {
  position: fixed;
  min-width: 180px; z-index: 9999;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: .4rem;
  opacity: 0; transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.nav-dropdown.open {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.nav-dropdown-item {
  display: flex !important; align-items: center; gap: .5rem;
  padding: .5rem .65rem !important; border-radius: var(--radius) !important;
  font-size: .8rem !important; width: 100%;
}
.nav-dropdown-item:hover { background: var(--bg-surface2); }

/* ── Density buttons — clear active state ──────── */
.density-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--radius); color: var(--text-3);
  border: 1px solid transparent;
  transition: all var(--t-fast);
}
.density-btn:hover { color: var(--text-1); background: var(--bg-surface2); }
.density-btn.active {
  color: var(--primary) !important;
  background: var(--primary-glow) !important;
  border-color: color-mix(in srgb, var(--primary) 40%, transparent) !important;
}

/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 1rem 1.25rem;
}
.footer-inner {
  max-width: 1440px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
}
.footer-left { display: flex; flex-direction: column; gap: .35rem; }
.footer-logo {
  font-family: var(--font-head); font-size: .85rem; font-weight: 700;
  color: var(--text-1); text-decoration: none; letter-spacing: .05em;
}
.footer-logo span { color: var(--primary); }
.footer-tagline { font-size: .7rem; color: var(--text-3); }
.footer-links {
  display: flex; align-items: center; gap: .85rem; flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 640px) { .footer-links { justify-content: center; } }
.footer-link {
  font-size: .74rem; color: var(--text-3); text-decoration: none;
  display: flex; align-items: center; gap: .3rem;
  transition: color var(--t-fast);
}
.footer-link:hover { color: var(--primary); }
.footer-divider {
  color: var(--text-4); font-size: .7rem; border: none;
  border-top: 1px solid var(--border); margin: .75rem 0 0;
  grid-column: 1 / -1;
}
.footer-bottom {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .5rem;
  font-size: .67rem; color: var(--text-4);
  padding-top: .65rem; border-top: 1px solid var(--border); margin-top: .5rem;
}

/* ── Floating action bar (shortcut to key actions on long pages) */
.fab-bar {
  position: fixed; bottom: 5.5rem; right: 1.25rem;
  display: flex; flex-direction: column; gap: .4rem;
  z-index: 150;
}
.fab-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--t-mid);
}
.fab-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.08); }
.fab-btn[title]:hover::before {
  content: attr(title);
  position: absolute; right: calc(100% + .5rem);
  background: var(--bg-surface3); color: var(--text-1);
  font-size: .7rem; padding: .25rem .55rem;
  border-radius: var(--radius); white-space: nowrap;
  border: 1px solid var(--border); pointer-events: none;
}

/* ═══════════════════════════════════════════════
   AIRCRAFT DETAIL — IMAGE GALLERY
═══════════════════════════════════════════════ */
.detail-img-thumbs {
  display: flex; gap: .4rem; flex-wrap: wrap;
  margin-top: .6rem;
}
.detail-thumb {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 2px; cursor: pointer;
  background: var(--bg-surface2);
  opacity: .65;
  transition: opacity var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.detail-thumb:hover { opacity: .9; }
.detail-thumb.active {
  border-color: var(--primary);
  opacity: 1;
}
.detail-thumb img {
  display: block; border-radius: 3px;
  width: 72px; height: 40px; object-fit: cover;
}

/* ═══════════════════════════════════════════════
   STYLE CONSISTENCY — GLOBAL TOKENS
═══════════════════════════════════════════════ */

/* Ensure all page views have consistent top padding */
.compare-view,
.favorites-view,
.kills-view,
.fleets-view,
.mach-view,
.stats-view,
.settings-view,
.help-view,
.theater-view {
  padding-top: .5rem;
}

/* Consistent page titles across all views */
.page-title {
  font-family: var(--font-head);
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: .03em;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
}

/* Consistent section card style */
.view-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  margin-bottom: .75rem;
}

/* Consistent empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  gap: .75rem;
  text-align: center;
  color: var(--text-3);
}
.empty-state-icon { font-size: 2.5rem; }
.empty-state-title { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--text-2); }
.empty-state-sub { font-size: .85rem; max-width: 28rem; }

/* Consistent btn-back hover */
.btn-back:hover {
  color: var(--text-1);
  border-color: var(--border-strong);
  background: var(--bg-surface2);
}

/* Consistent page-header pattern (back + title) */
.page-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-header .page-title { margin: 0; }

/* nav-link consistent active underline */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 8px; right: 8px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}
.nav-link { position: relative; }

/* Consistent focus ring */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Consistent table style */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.data-table th {
  text-align: left;
  padding: .45rem .65rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-surface2); }
.data-table tr:last-child td { border-bottom: none; }

/* Consistent badge */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .18rem .5rem;
  border-radius: var(--radius);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge--primary { background: var(--primary-glow); color: var(--primary); }
.badge--success { background: #d1fae5; color: #065f46; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge--success { background: #052e16; color: #4ade80; }
[data-theme="dark"] .badge--warning { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .badge--danger  { background: #450a0a; color: #f87171; }

/* Consistent scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Consistent loading skeleton */
@keyframes skeleton-pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: .8; }
}
.skeleton {
  background: var(--bg-surface2);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* Gallery image swap animation */
#detailMainImg {
  transition: opacity .2s ease;
}
#detailMainImg.swapping { opacity: 0; }
