/** neuroscapecards.com — synapset.pro format stylesheet */
:root {
  --bg: #0d0d1a;
  --bg-elev: #151525;
  --bg-surface: #1c1c30;
  --border: #2a2a45;
  --text: #e8e8f0;
  --text-muted: #8888a8;
  --accent: #7c6cff;
  --accent2: #3a86e6;
  --green: #4a9e4a;
  --red: #c41e3a;
  --gold: #e0a72a;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --card-w: 260px;
  --card-h: 380px;
  --art-aspect: 535/750;
  --radius: 8px;
  --nav-w: 240px;
}

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

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

/* ─── Console Shell: rail + content ─── */
.console-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Left Rail Nav ─── */
.console-rail {
  width: var(--nav-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.rail-brand {
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.rail-brand-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff;
  flex-shrink: 0;
}
.rail-brand-text {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap;
}
.rail-brand-tld { color: var(--accent); }

.rail-nav { flex: 1; }
.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 2px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.rail-item:hover { background: var(--bg-surface); color: var(--text); }
.rail-item[aria-current="page"] {
  background: var(--bg-surface);
  color: var(--text);
  font-weight: 500;
}
.rail-spine {
  width: 2px; height: 14px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}
.rail-index {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  width: 18px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.rail-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rail-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ─── Main Content ─── */
.console-content {
  margin-left: var(--nav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.topbar-brand-mark {
  width: 24px; height: 24px;
  background: var(--accent);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff;
}
.topbar-brand-word { font-weight: 600; font-size: 14px; }
.topbar-brand-tld { color: var(--accent); font-size: 12px; }

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.15);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-surface); color: var(--text); }

/* ─── Page Layout: filter sidebar + card grid ─── */
.page-layout {
  display: flex;
  gap: 0;
  padding: 16px 20px;
  flex: 1;
  min-height: 0;
}

.filter-panel {
  width: 220px;
  flex-shrink: 0;
  padding-right: 16px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
}
.filter-section {
  margin-bottom: 20px;
}
.filter-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 4px;
}
.filter-chips { display: flex; flex-direction: column; gap: 2px; }
.chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
  user-select: none;
  border: 1px solid transparent;
}
.chip:hover { background: var(--bg-surface); color: var(--text); }
.chip.selected {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--border);
}
.chip-swatch {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chip-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 8px;
}

.card-area {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

/* ─── Card Grid ─── */
.card-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  padding-bottom: 20px;
}
.card-grid-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Card Tile ─── */
.card-tile {
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
}
.card-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Strip: factions + number + cost */
.card-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.card-strip-nodes {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.card-faction-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--faction-color, #555);
  position: relative;
  flex-shrink: 0;
}
.card-faction-swatch::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--faction-color) 40%, transparent);
}

.card-number {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.card-cost {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Art + combat */
.card-art-area {
  position: relative;
  aspect-ratio: var(--art-aspect);
  overflow: hidden;
  background: var(--bg);
}
.card-art-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.card-tile:hover .card-art-img { transform: scale(1.04); }
.card-art-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a3e 0%, #0d0d1a 100%);
  color: var(--text-muted);
  font-size: 11px;
}

.card-combat {
  position: absolute;
  bottom: 8px; left: 8px;
  display: flex; gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.card-combat-atk { color: var(--red); }
.card-combat-def { color: var(--green); }
.card-combat-label {
  font-weight: 400;
  opacity: 0.8;
  font-size: 9px;
  text-transform: uppercase;
}

.card-mainframe-flag {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; align-items: center; gap: 3px;
  padding: 2px 6px;
  background: rgba(58, 134, 230, 0.2);
  border: 1px solid rgba(58, 134, 230, 0.4);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent2);
  text-transform: uppercase;
}
.card-mainframe-flag-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent2);
}

/* Footer */
.card-footer {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.card-meta {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Quick View Modal ─── */
.quick-view-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.quick-view-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.qv-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-elev);
  border-radius: 12px 12px 0 0;
  z-index: 1;
}
.qv-close {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}
.qv-close:hover { background: var(--bg); color: var(--text); }

.qv-body {
  display: flex;
  gap: 0;
}
.qv-art-col {
  flex: 0 0 46%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.qv-art {
  width: 100%;
  aspect-ratio: var(--art-aspect);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.qv-art-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.qv-art-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a3e 0%, #0d0d1a 100%);
  color: var(--text-muted);
}
.qv-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.qv-details-col {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.qv-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.qv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.qv-rarity {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--rarity-color) 20%, transparent);
  color: var(--rarity-color);
  border: 1px solid color-mix(in srgb, var(--rarity-color) 30%, transparent);
}
.qv-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qv-stats {
  display: flex;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.qv-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qv-stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qv-stat-value.atk { color: var(--red); }
.qv-stat-value.def { color: var(--green); }
.qv-stat-value.cost { color: var(--gold); }
.qv-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.qv-factions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.qv-faction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: var(--faction-color);
}
.qv-faction-abbr { font-weight: 700; font-size: 10px; }

.qv-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.qv-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(58, 134, 230, 0.15);
  color: var(--accent2);
  border: 1px solid rgba(58, 134, 230, 0.3);
}

.qv-abilities {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.qv-ability-name {
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
}

.qv-footer {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}
.qv-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  font-family: var(--font);
}
.qv-btn:hover { background: var(--bg); border-color: var(--text-muted); }
.qv-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.qv-btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }

.qv-related {
  padding: 16px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
}
.qv-related-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.qv-related-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.qv-related-tile {
  flex: 0 0 100px;
  width: 100px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}
.qv-related-tile:hover { border-color: var(--accent); }
.qv-related-tile-img {
  aspect-ratio: var(--art-aspect);
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.qv-related-tile-name {
  font-size: 10px;
  font-weight: 500;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Rules Page ─── */
.rules-page { padding: 24px 24px; max-width: 900px; }
.rules-hero {
  margin-bottom: 24px;
}
.rules-hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.rules-hero p { color: var(--text-muted); font-size: 14px; }

.rules-section {
  margin-bottom: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.rules-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}
.rules-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
}
.rules-text { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.rules-text strong { color: var(--text); }

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.rules-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.rules-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.rules-card-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.rules-turn-flow {
  display: flex;
  gap: 4px;
  margin: 16px 0;
  align-items: stretch;
}
.rules-turn-step {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.rules-turn-step-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(124, 108, 255, 0.15);
  border-radius: 50%;
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.rules-turn-step-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.rules-turn-step-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── Mainframes Page ─── */
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 0 20px 12px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  padding: 0 20px 16px;
}

.mainframes-layout {
  display: flex;
  gap: 0;
  padding: 0 20px 20px;
}
.mainframes-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.mainframe-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mainframe-card:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}
.mainframe-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.mainframe-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}
.mainframe-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── General ─── */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .console-rail { display: none; }
  .console-content { margin-left: 0; }
  .filter-panel { display: none; }
  .page-layout.responsive { flex-direction: column; }
  .topbar-search { max-width: none; }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }
