:root {
  --bg: #070a10;
  --bg2: #0d1220;
  --bg3: #111827;
  --panel: #0f1824;
  --border: #1e2d45;
  --border-bright: #2a4060;
  --gold: #c9a84c;
  --gold-dim: #7a6030;
  --gold-bright: #f0ca6a;
  --teal: #1de9d4;
  --teal-dim: #0d6b60;
  --red: #e85050;
  --text: #c8d8e8;
  --text-dim: #6a8aaa;
  --text-bright: #e8f2ff;

  /* Domains */
  --fury: #e05050;
  --calm: #50c060;
  --chaos: #9060e0;
  --order: #e0b030;
  --resolve: #4080e0;
  --cunning: #e06030;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated starfield bg */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 15%, rgba(200,220,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 40%, rgba(200,220,255,0.2) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 70%, rgba(200,220,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 80%, rgba(200,220,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 20%, rgba(200,220,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 10% 60%, rgba(200,220,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 45%, rgba(200,220,255,0.2) 0%, transparent 100%);
  pointer-events: none; z-index: 0;
}

/* Rift glow top */
body::after {
  content: '';
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 700px; height: 300px;
  background: radial-gradient(ellipse at 50% 0%, rgba(29,233,212,0.06) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* -- NAV -- */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7,10,16,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex; align-items: center; gap: 0;
  height: 58px;
}

.nav-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem; font-weight: 900;
  color: var(--gold-bright);
  letter-spacing: 0.15em;
  margin-right: 2.5rem;
  text-shadow: 0 0 20px rgba(240,202,106,0.4);
  white-space: nowrap;
}

.nav-logo span { color: var(--teal); }

.nav-links { display: flex; gap: 0.2rem; }

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text-bright);
  background: rgba(29,233,212,0.07);
}
.nav-links a.active { color: var(--teal); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.nav-badge {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--teal-dim), var(--teal));
  color: var(--bg); padding: 0.25rem 0.7rem; border-radius: 20px;
}

/* -- HERO -- */
.hero {
  position: relative; z-index: 1;
  padding: 5rem 2rem 4rem;
  text-align: center;
  max-width: 900px; margin: 0 auto;
}

.hero-eyebrow {
  font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--teal); font-weight: 600;
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900; line-height: 1.15;
  color: var(--text-bright);
  margin-bottom: 1.2rem;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1rem; color: var(--text-dim);
  max-width: 560px; margin: 0 auto 2.5rem;
  font-family: 'Exo 2', sans-serif; font-weight: 300;
}

/* -- CHAMPION SEARCH -- */
.search-box {
  position: relative;
  max-width: 560px; margin: 0 auto 1rem;
  display: flex; gap: 0;
}

.search-box select, .search-box input {
  background: var(--bg2);
  border: 1px solid var(--border-bright);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem; font-weight: 500;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box select {
  border-right: none;
  border-radius: 6px 0 0 6px;
  width: 150px; flex-shrink: 0;
  cursor: pointer;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a8aaa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.search-box select option { background: var(--bg2); }

.search-box input {
  flex: 1;
  border-left: 1px solid var(--border-bright);
  border-radius: 0;
}
.search-box input:focus { border-color: var(--teal); }

#search-btn {
  background: linear-gradient(135deg, var(--teal-dim), var(--teal));
  color: var(--bg); border: none;
  padding: 0 1.5rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
#search-btn:hover { filter: brightness(1.15); }

/* -- QUICK CHAMPIONS -- */
.quick-champs {
  max-width: 900px; margin: 0 auto 4rem;
  padding: 0 2rem;
}

.section-label {
  font-size: 0.7rem; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.champ-chips {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  justify-content: center;
}

.champ-chip {
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 1px solid var(--border-bright);
  background: var(--bg2);
  color: var(--text); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 0.4rem;
}
.champ-chip:hover {
  border-color: var(--teal); color: var(--teal);
  background: rgba(29,233,212,0.07);
  transform: translateY(-1px);
}
.domain-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* -- MAIN LAYOUT -- */
main {
  position: relative; z-index: 1;
  max-width: 1400px; margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* -- RESULTS AREA -- */
#results-area { display: none; }
#results-area.visible { display: block; }

.results-header {
  display: flex; align-items: flex-start; gap: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.champ-portrait {
  width: 90px; height: 120px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  border: 1px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; flex-shrink: 0;
  position: relative; overflow: hidden;
}
.champ-portrait::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.5));
}

.champ-meta h2 {
  font-family: 'Cinzel', serif; font-size: 1.8rem;
  color: var(--text-bright); font-weight: 700;
  margin-bottom: 0.4rem;
}

.domain-badges { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; }
.domain-badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.2rem 0.7rem; border-radius: 3px;
}

.champ-stats {
  display: flex; gap: 1.5rem;
  font-size: 0.82rem; color: var(--text-dim);
}
.champ-stat strong { color: var(--gold); }

/* -- TABS -- */
.tabs {
  display: flex; gap: 0; margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.7rem 1.2rem;
  cursor: pointer; transition: all 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* -- CARD GRID -- */
.results-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}

.cards-section h3 {
  font-family: 'Cinzel', serif; font-size: 1rem;
  color: var(--gold-bright); font-weight: 700;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.cards-section h3 .count {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem; color: var(--text-dim);
  background: var(--bg2); border: 1px solid var(--border);
  padding: 0.1rem 0.5rem; border-radius: 3px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.card-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative; overflow: hidden;
}
.card-tile::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.02));
  pointer-events: none;
}
.card-tile:hover {
  border-color: var(--teal-dim);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.card-tile-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 0.4rem;
}

.card-icon { font-size: 1.6rem; line-height: 1; }

.card-cost {
  font-family: 'Cinzel', serif; font-size: 0.85rem; font-weight: 700;
  color: var(--gold);
  background: rgba(201,168,76,0.12); border: 1px solid var(--gold-dim);
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.card-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text-bright);
  line-height: 1.3; margin-bottom: 0.3rem;
}

.card-type-tag {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.5rem;
}

.synergy-bar {
  height: 3px; border-radius: 2px;
  background: var(--border);
  margin-bottom: 0.3rem;
  overflow: hidden;
}
.synergy-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal));
  transition: width 0.6s ease;
}

.synergy-pct {
  font-size: 0.68rem; color: var(--teal); font-weight: 600;
  display: flex; justify-content: space-between;
}
.synergy-pct span:last-child { color: var(--text-dim); }

/* -- SIDEBAR -- */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

.sidebar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-panel-header {
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold-bright);
}

.sidebar-panel-body { padding: 1rem; }

/* Domain filter */
.domain-filters { display: flex; flex-direction: column; gap: 0.4rem; }
.domain-filter-btn {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.7rem; border-radius: 5px;
  background: none; border: 1px solid transparent;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-align: left; width: 100%;
}
.domain-filter-btn:hover { background: var(--bg2); border-color: var(--border); }
.domain-filter-btn.active { border-color: var(--border-bright); background: var(--bg2); }
.domain-filter-btn .d-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.domain-filter-btn .d-count {
  margin-left: auto; font-size: 0.7rem; color: var(--text-dim);
}

/* Stat breakdown */
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.82rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .label { color: var(--text-dim); }
.stat-row .value { color: var(--text-bright); font-weight: 600; }

/* Cost curve chart */
.curve-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 60px; padding: 0 0 4px;
}
.curve-bar {
  flex: 1; background: var(--teal-dim); border-radius: 2px 2px 0 0;
  transition: all 0.4s; position: relative; min-height: 4px;
  cursor: default;
}
.curve-bar:hover { background: var(--teal); }
.curve-bar .bar-tip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  font-size: 0.65rem; color: var(--teal);
  white-space: nowrap; margin-bottom: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.curve-bar:hover .bar-tip { opacity: 1; }
.curve-labels {
  display: flex; gap: 4px;
  font-size: 0.62rem; color: var(--text-dim); text-align: center;
}
.curve-labels span { flex: 1; }

/* AI analysis */
#ai-analysis {
  font-family: 'Exo 2', sans-serif; font-size: 0.85rem;
  color: var(--text); line-height: 1.65;
}

.ai-typing-cursor {
  display: inline-block; width: 2px; height: 14px;
  background: var(--teal); animation: blink 0.7s infinite;
  vertical-align: text-bottom; margin-left: 1px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* -- LOADING -- */
.loading-spinner {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 3rem; color: var(--text-dim);
  font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase;
}

.rift-spinner {
  width: 40px; height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- HOMEPAGE CONTENT -- */
#home-content { }

.stats-bar {
  display: flex; gap: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 3rem;
  overflow: hidden;
}

.stat-item {
  flex: 1; padding: 1.2rem 1.5rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }

.stat-num {
  font-family: 'Cinzel', serif; font-size: 1.6rem;
  color: var(--gold-bright); font-weight: 700;
  line-height: 1;
}
.stat-lbl {
  font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-dim); margin-top: 0.3rem; font-weight: 600;
}

/* Top champions grid */
.champ-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

.champ-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.champ-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}
.champ-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}

.champ-card-icon { font-size: 2.5rem; margin-bottom: 0.7rem; }
.champ-card h4 {
  font-family: 'Cinzel', serif; font-size: 0.95rem; font-weight: 700;
  color: var(--text-bright); margin-bottom: 0.4rem;
}
.champ-card .domains-row { display: flex; gap: 0.3rem; margin-bottom: 0.6rem; }
.champ-card .d-pill {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem; border-radius: 3px;
}
.champ-card .meta-line {
  font-size: 0.75rem; color: var(--text-dim);
  display: flex; justify-content: space-between;
}
.champ-card .meta-line strong { color: var(--teal); }

/* -- META SECTION -- */
.meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  margin-bottom: 3rem;
}

.meta-panel {
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}

.meta-panel-header {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  font-family: 'Cinzel', serif; font-size: 0.9rem; font-weight: 700;
  color: var(--gold-bright);
  display: flex; align-items: center; gap: 0.6rem;
}

.meta-panel-body { padding: 0.5rem 0; }

.meta-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.55rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.15s; cursor: pointer;
}
.meta-row:last-child { border-bottom: none; }
.meta-row:hover { background: rgba(255,255,255,0.03); }

.meta-row .rank {
  font-family: 'Cinzel', serif; font-size: 0.75rem; font-weight: 700;
  color: var(--text-dim); width: 20px; text-align: center; flex-shrink: 0;
}
.meta-row .rank.gold { color: var(--gold); }

.meta-row .name {
  flex: 1; font-size: 0.85rem; font-weight: 600; color: var(--text);
}
.meta-row .pct {
  font-size: 0.78rem; font-weight: 700; color: var(--teal);
  font-family: 'Exo 2', sans-serif;
}
.meta-row .bar-bg {
  width: 60px; height: 4px; background: var(--border); border-radius: 2px;
  overflow: hidden;
}
.meta-row .bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--teal-dim), var(--teal));
  border-radius: 2px;
}

/* -- DECK BUILDER -- */
#builder-tab { display: none; }
#builder-tab.visible { display: block; }

.builder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem; margin-bottom: 2rem;
}

.builder-input-area {
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}

.builder-input-area textarea {
  width: 100%; min-height: 280px;
  background: transparent;
  border: none; outline: none; resize: vertical;
  padding: 1rem; color: var(--text);
  font-family: 'Exo 2', sans-serif; font-size: 0.82rem; line-height: 1.7;
}
.builder-input-area textarea::placeholder { color: var(--text-dim); }

.builder-btn {
  display: block; width: 100%;
  background: linear-gradient(135deg, #0d5050, var(--teal));
  color: var(--bg); border: none;
  padding: 0.9rem;
  font-family: 'Cinzel', serif; font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  cursor: pointer; transition: all 0.2s;
}
.builder-btn:hover { filter: brightness(1.1); }

#recs-output {
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1.2rem;
  min-height: 200px;
  font-family: 'Exo 2', sans-serif; font-size: 0.85rem;
  line-height: 1.7; color: var(--text);
}

.rec-card-item {
  padding: 0.6rem 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 0.8rem;
  animation: fadeSlideIn 0.3s ease;
}
.rec-card-item:last-child { border-bottom: none; }
.rec-card-item .ri { font-size: 1.3rem; flex-shrink: 0; }
.rec-card-item .rn { font-size: 0.85rem; font-weight: 700; color: var(--text-bright); }
.rec-card-item .rd { font-size: 0.78rem; color: var(--text-dim); }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- UTILITY -- */
.tag {
  display: inline-block;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.placeholder-msg {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem; font-family: 'Exo 2', sans-serif;
}
.placeholder-msg .big { font-size: 2rem; margin-bottom: 0.5rem; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* responsive */
@media (max-width: 900px) {
  .results-layout { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .builder-layout { grid-template-columns: 1fr; }
  .stats-bar { flex-wrap: wrap; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border); min-width: 50%; }
  .nav-links { display: none; }
}
