/* ============================================================
   Arkham Compass — Stylesheet
   ============================================================ */

/* --- Arkham icons font ------------------------------------- */
@font-face {
  font-family: 'arkham-icons';
  src: url('arkham-icons.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
  font-family: 'arkham-icons';
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.icon-reaction::before     { content: "!"; }
.icon-fast::before,
.icon-free::before,
.icon-lightning::before    { content: "j"; }
.icon-elder_sign::before,
.icon-eldersign::before    { content: "o"; }
.icon-action::before       { content: "i"; }
.icon-strength::before,
.icon-combat::before       { content: "c"; color: #661e09; }
.icon-agility::before      { content: "a"; color: #00543a; }
.icon-will::before,
.icon-willpower::before    { content: "p"; color: #003961; }
.icon-lore::before,
.icon-intellect::before    { content: "b"; color: #4e1a45; }
.icon-wild::before         { content: "?"; font-weight: bold; padding-right: 2px; color: #635120; }
.icon-unique::before       { content: "s"; font-size: 1.1em; }
.icon-elder_thing::before  { content: "n"; }
.icon-skull::before        { content: "k"; }
.icon-frost::before        { content: "x"; }
.icon-seal_a::before       { content: "1"; }
.icon-seal_b::before       { content: "=2"; }
.icon-seal_c::before       { content: "3"; }
.icon-seal_d::before       { content: "4"; }
.icon-seal_e::before       { content: "5"; }
.icon-auto_fail::before    { content: "m"; }
.icon-cultist::before      { content: "l"; }
.icon-tablet::before       { content: "q"; }
.icon-bless::before        { content: "v"; }
.icon-curse::before        { content: "w"; }
.icon-per_investigator::before { content: "u"; vertical-align: top; font-size: 12px; }
.icon-null::before         { content: "t"; }

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

:root {
  --bg:          #0c0a08;
  --bg-card:     #161210;
  --bg-card-2:   #1e1915;
  --border:      #2e2518;
  --text:        #d4cebe;
  --text-muted:  #7a6e5a;
  --accent:      #c9a227;
  --accent-glow: rgba(201,162,39,0.22);
  --gold:        #c9a227;

  --guardian:    #2563a8;
  --seeker:      #c9a227;
  --rogue:       #1a7a46;
  --mystic:      #7b3fa0;
  --survivor:    #a03020;
  --neutral:     #5a5040;

  --radius:    6px;
  --radius-lg: 12px;
  --shadow:    0 2px 16px rgba(0,0,0,0.75);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Header ------------------------------------------------ */
.site-header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--accent);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: .04em;
  color: var(--accent);
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; opacity: .85; }
.logo-icon { font-size: 1.3rem; }

/* --- Search ------------------------------------------------ */
.site-search {
  position: relative;
  flex: 1;
  max-width: 320px;
  margin: 0 .5rem;
}

.site-search__input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem 1rem;
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.site-search__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.site-search__input::placeholder { color: var(--text-muted); }

.site-search__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}

.search-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .9rem;
  text-decoration: none;
  color: var(--text);
  font-size: .88rem;
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item--active { background: var(--bg-card-2); text-decoration: none; }

.search-item__type {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  width: 70px;
  flex-shrink: 0;
}
.search-item--investigator .search-item__type { color: var(--gold); }
.search-item__faction--guardian   { color: var(--guardian); }
.search-item__faction--seeker     { color: var(--seeker); }
.search-item__faction--rogue      { color: var(--rogue); }
.search-item__faction--mystic     { color: var(--mystic); }
.search-item__faction--survivor   { color: var(--survivor); }
.search-item__faction--neutral    { color: var(--neutral); }

.search-item__name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-no-results {
  padding: .7rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
}

/* --- Language switcher ------------------------------------- */
.lang-nav {
  margin-left: auto;
  display: flex;
  gap: .3rem;
  align-items: center;
}

.lang-switch {
  font-size: 1.1rem;
  padding: .15rem .3rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: opacity .15s, border-color .15s;
  line-height: 1;
}
.lang-switch:hover { opacity: .75; text-decoration: none; border-color: var(--border); }
.lang-switch--active { border-color: var(--accent); pointer-events: none; box-shadow: 0 0 0 1px var(--accent); }

/* --- Main layout ------------------------------------------- */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Hero/page banner -------------------------------------- */
.page-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}
.page-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: Georgia, 'Times New Roman', serif;
  background: linear-gradient(135deg, var(--accent), #f0d060);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .5rem;
}
.page-hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

/* --- Investigator grid ------------------------------------- */
.hero-grid-section__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: 1.5rem;
}

.hero-grid-section h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-family: Georgia, serif;
  margin-bottom: 0;
  flex: 1;
}

.sort-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.sort-toggle__label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.sort-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .25rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: .03em;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.sort-btn:hover { color: var(--text); border-color: var(--text-muted); }
.sort-btn--active {
  background: var(--accent);
  color: #0c0a08;
  border-color: var(--accent);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
}

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .18s, border-color .18s, box-shadow .18s;
  color: var(--text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.hero-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px var(--accent-glow);
  text-decoration: none;
}

.hero-card__art {
  width: 100%;
  aspect-ratio: 5/7;
  background: var(--bg-card-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}
.hero-card__img--placeholder {
  font-size: 3.5rem;
  font-weight: 800;
  font-family: Georgia, serif;
  color: var(--text-muted);
}

.hero-card__body {
  padding: .8rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.hero-card__name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .2rem;
}
.hero-card__alter-ego {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: .2rem;
}
.hero-card__meta {
  font-size: .72rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin-top: auto;
  padding-top: .5rem;
}

/* --- Investigator detail ----------------------------------- */
.hero-detail__header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.hero-detail__art-wrap {
  flex-shrink: 0;
}

.hero-detail__img {
  width: 140px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  display: block;
}

.hero-detail__img--placeholder {
  width: 140px;
  height: 196px;
  background: var(--bg-card-2);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-family: Georgia, serif;
  color: var(--text-muted);
}

.hero-detail__info { flex: 1; min-width: 220px; }

.back-link {
  font-size: .85rem;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: .6rem;
}
.back-link:hover { color: var(--text); }

.hero-detail__name {
  font-size: 2rem;
  font-weight: 800;
  font-family: Georgia, 'Times New Roman', serif;
  margin-bottom: .2rem;
  color: var(--text);
}
.hero-detail__alter-ego {
  font-size: .9rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: .6rem;
}

.hero-detail__stats {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .35rem .8rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.stat strong { color: var(--text); font-size: 1rem; }
.stat--will strong { color: var(--mystic); }
.stat--int  strong { color: var(--seeker); }
.stat--cbt  strong { color: var(--guardian); }
.stat--agi  strong { color: var(--rogue); }

/* --- Filters ----------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
}

.filters__label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-right: .3rem;
}

.filter-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .8rem;
  font-size: .88rem;
  cursor: pointer;
  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='%237a6e5a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  padding-right: 2rem;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

.filter-reset {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .9rem;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.filter-reset:hover { border-color: var(--accent); color: var(--text); }

.filters__count {
  font-size: .82rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* --- Top 100 page ------------------------------------------ */
.top-section { max-width: 860px; margin-left: auto; margin-right: auto; }
.top-list { display: flex; flex-direction: column; gap: .6rem; }

.top-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.top-row:hover { border-color: var(--accent); transform: translateX(2px); text-decoration: none; }
.top-row:hover .card-row__name { color: var(--text); }

.top-row__rank {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: .25em;
}
.top-list .top-row:nth-child(1) .top-row__rank { color: #c9a227; }
.top-list .top-row:nth-child(2) .top-row__rank { color: #a0a0a0; }
.top-list .top-row:nth-child(3) .top-row__rank { color: #8b6040; }

/* --- Signature cards --------------------------------------- */
.signature-section {
  margin-bottom: 2rem;
  background: var(--bg-card-2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent);
}
.signature-section__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  color: var(--accent);
}
.signature-section__desc {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.signature-section .card-list {
  grid-template-columns: 1fr;
}
@media (min-width: 760px) {
  .signature-section .card-list { grid-template-columns: repeat(2, 1fr); }
}

/* --- Card list --------------------------------------------- */
.card-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.card-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.card-row:hover { border-color: var(--accent); transform: translateX(2px); text-decoration: none; }
.card-row.hidden, .top-row.hidden { display: none; }
.top-list .card-row:nth-child(1) .top-row__rank { color: #c9a227; }
.top-list .card-row:nth-child(2) .top-row__rank { color: #a0a0a0; }
.top-list .card-row:nth-child(3) .top-row__rank { color: #8b6040; }

.card-row__art {
  width: 52px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-row__img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card-row__img--placeholder { font-size: 1.4rem; font-weight: 800; color: var(--text-muted); }
.card-row__main { flex: 1; min-width: 0; }

.card-row__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
}

.card-row__name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold);
  flex: 1;
  min-width: 120px;
}
.card-row:hover .card-row__name { color: var(--text); }
.card-row__badges { display: flex; flex-wrap: wrap; gap: .3rem; }

.card-row__text {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .45rem;
  line-height: 1.5;
}

/* --- Frequency bar ----------------------------------------- */
.card-row__freq { display: flex; align-items: center; gap: .75rem; }

.freq-bar {
  flex: 1;
  height: 5px;
  background: var(--bg-card-2);
  border-radius: 3px;
  overflow: hidden;
  max-width: 320px;
}
.freq-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f0d060);
  border-radius: 3px;
  transition: width .3s ease;
}

.freq-label { white-space: nowrap; font-size: .9rem; font-weight: 800; color: var(--text); flex-shrink: 0; }
.freq-label__decks { font-size: .78rem; font-weight: 400; color: var(--text-muted); }

/* --- Badges ------------------------------------------------ */
.badge {
  font-size: .70rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge--cost {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge--cost::before { content: "◈ "; }

/* Type badges */
.badge--type { background: rgba(90,80,64,.3); color: #9a8e78; }

/* Faction/class badges */
.badge--faction-guardian  { background: rgba(37,99,168,.2);   color: var(--guardian); }
.badge--faction-seeker    { background: rgba(201,162,39,.2);  color: var(--seeker); }
.badge--faction-rogue     { background: rgba(26,122,70,.2);   color: var(--rogue); }
.badge--faction-mystic    { background: rgba(123,63,160,.2);  color: var(--mystic); }
.badge--faction-survivor  { background: rgba(160,48,32,.2);   color: var(--survivor); }
.badge--faction-neutral   { background: rgba(90,80,64,.2);    color: var(--neutral); }

/* --- Card detail page -------------------------------------- */
.card-detail__header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.card-detail__art {
  flex-shrink: 0;
  width: 160px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-detail__img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  display: block;
}
.card-detail__img--placeholder {
  width: 160px;
  height: 224px;
  font-size: 4rem;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-detail__info { flex: 1; min-width: 220px; }
.card-detail__name {
  font-size: 2rem;
  font-weight: 800;
  font-family: Georgia, 'Times New Roman', serif;
  margin: .4rem 0 .7rem;
}
.card-detail__badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.card-detail__traits { font-size: .82rem; color: var(--text-muted); font-style: italic; margin-bottom: .6rem; }
.card-detail__text { font-size: .9rem; color: var(--text-muted); line-height: 1.6; margin-bottom: .9rem; max-width: 540px; }
.card-detail__packs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.card-pack { font-size: .75rem; background: var(--bg-card-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .2rem .6rem; color: var(--text-muted); }
.card-pack__qty { margin-left: .35rem; color: var(--gold); font-weight: 600; }
.card-detail__external { font-size: .82rem; color: var(--text-muted); }
.card-detail__external:hover { color: var(--gold); }

/* --- Icon tokens (Arkham card text) ------------------------ */
.icon-token { font-size: .8em; color: var(--text-muted); font-style: italic; }

/* --- Heroes section (used by investigators) ---------------- */
.heroes-section { margin-top: 1rem; }
.section-title {
  font-size: 1.1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: Georgia, serif;
  margin-bottom: 1.2rem;
}
.hero-usage-list { display: flex; flex-direction: column; gap: .6rem; }
.hero-usage-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.hero-usage-row:hover { border-color: var(--accent); transform: translateX(2px); text-decoration: none; }
.hero-usage__art {
  width: 52px;
  height: 68px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-usage__img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.hero-usage__img--placeholder { font-size: 1.4rem; font-weight: 800; color: var(--text-muted); }
.hero-usage__main { flex: 1; min-width: 0; }
.hero-usage__name { display: block; font-weight: 700; font-size: .95rem; color: var(--gold); margin-bottom: .35rem; }
.hero-usage-row:hover .hero-usage__name { color: var(--text); }

/* --- Algorithm page ---------------------------------------- */
.algo-page { max-width: 720px; }
.algo-page__title {
  font-size: 2rem;
  font-weight: 800;
  font-family: Georgia, 'Times New Roman', serif;
  margin: .6rem 0 1.5rem;
}
.algo-page__intro {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 2rem;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.algo-section { margin-bottom: 2rem; }
.algo-section h2 { font-size: 1.1rem; font-weight: 700; color: var(--gold); margin-bottom: .7rem; text-transform: uppercase; letter-spacing: .05em; font-family: Georgia, serif; }
.algo-section p { color: var(--text-muted); line-height: 1.7; }
.algo-formula__label { font-size: .85rem; color: var(--text-muted); margin-bottom: .3rem; }
.algo-formula {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1.2rem;
  margin-bottom: .8rem;
  overflow-x: auto;
}
.algo-formula code { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: .95rem; color: var(--text); }
.algo-formula sup { font-size: .7em; vertical-align: super; }
.algo-formula__legend { font-size: .82rem; color: var(--text-muted); font-style: italic; }
.algo-table { border-collapse: collapse; width: 100%; }
.algo-table th, .algo-table td { padding: .6rem .9rem; text-align: left; border: 1px solid var(--border); font-size: .9rem; }
.algo-table th { background: var(--bg-card); color: var(--text-muted); font-weight: 600; width: 160px; }
.algo-table td { color: var(--text-muted); }
.algo-table td strong { color: var(--text); }
.algo-note { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; font-size: .88rem; color: var(--text-muted); line-height: 1.6; }

/* --- Site nav strip ---------------------------------------- */
.site-nav {
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  gap: .25rem;
  overflow-x: auto;
}

.site-nav__link {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: .55rem .75rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.site-nav__link:hover,
.site-nav__link--active {
  color: var(--text);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* --- Footer ------------------------------------------------ */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.2rem 2rem;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--gold); }
.site-footer__link { color: var(--text-muted); }
.site-footer__link:hover { color: var(--gold); }
.site-footer__legal { margin-top: .75rem; font-size: .72rem; opacity: .5; line-height: 1.5; }

/* --- Consent banner ---------------------------------------- */
#consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card-2);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  z-index: 1000;
}
#consent-banner p { flex: 1; min-width: 200px; font-size: .85rem; color: var(--text-muted); margin: 0; }
.consent-banner__actions { display: flex; gap: .75rem; flex-shrink: 0; }
.consent-btn {
  padding: .45rem 1.1rem;
  border-radius: 6px;
  font-size: .85rem;
  cursor: pointer;
  border: 1px solid var(--border);
  font-family: inherit;
  transition: opacity .15s, color .15s, border-color .15s;
}
.consent-btn--accept { background: var(--accent); color: #0c0a08; border-color: var(--accent); font-weight: 700; }
.consent-btn--accept:hover { opacity: .85; }
.consent-btn--reject { background: transparent; color: var(--text-muted); }
.consent-btn--reject:hover { color: var(--text); border-color: var(--text-muted); }

/* --- Card image overlay ------------------------------------ */
.card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  cursor: pointer;
  padding: 1.5rem;
}
.card-overlay__img {
  max-height: 90vh;
  max-width: min(90vw, 420px);
  border-radius: 10px;
  box-shadow: 0 12px 60px rgba(0,0,0,.8);
  cursor: default;
}

/* --- Trend badge ------------------------------------------- */
.trend-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.trend-badge--up   { color: #22c55e; background: rgba(34,197,94,.12); }
.trend-badge--down { color: #ef4444; background: rgba(239,68,68,.12); }

/* --- Usage over time chart -------------------------------- */
.usage-chart { margin: 0; }
.usage-chart__header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
}
.usage-chart .section-title { margin: 0; }
.usage-chart__stability {
  font-size: .72rem;
  padding: .15em .55em;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.usage-chart__stability--staple      { background: rgba(34,197,94,.15);  color: #22c55e; }
.usage-chart__stability--declining   { background: rgba(234,179,8,.15);  color: #eab308; }
.usage-chart__stability--hype        { background: rgba(239,68,68,.15);  color: #ef4444; }
.usage-chart__stability--late_bloomer { background: rgba(129,140,248,.15); color: #818cf8; }
.usage-chart__wrap { position: relative; }
.usage-chart__ymax {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: .68rem;
  color: #555;
}
.usage-chart__svg {
  display: block;
  width: 100%;
  height: 56px;
  border-radius: 4px;
  background: rgba(255,255,255,.03);
}
.usage-chart__area { fill: rgba(160,130,80,.18); }
.usage-chart__line {
  fill: none;
  stroke: rgba(200,165,100,.75);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.usage-chart__xaxis {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: #555;
  margin-top: .25rem;
}
.usage-chart__tabs {
  display: flex;
  gap: .3rem;
  margin-left: auto;
}
.usage-chart__tab {
  font-size: .68rem;
  padding: .2em .65em;
  border-radius: 999px;
  border: 1px solid rgba(160,130,80,.35);
  background: transparent;
  color: #777;
  cursor: pointer;
  line-height: 1.4;
  transition: background .15s, color .15s;
}
.usage-chart__tab:hover { background: rgba(160,130,80,.1); color: #bbb; }
.usage-chart__tab--active { background: rgba(160,130,80,.2); color: #c8a564; border-color: rgba(160,130,80,.6); }
.breadcrumb { font-size: .82rem; color: var(--text-muted); margin: 0 0 .4rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.stability-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  max-width: 860px;
  margin: 0 auto;
}
@media (min-width: 600px) { .stability-home-grid { grid-template-columns: repeat(2, 1fr); } }
.stability-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
  display: block;
}
.stability-card:hover { border-color: var(--accent); transform: translateX(2px); }
.stability-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.stability-card__count { font-size: .78rem; color: var(--text-muted); }
.stability-card__desc { font-size: .82rem; color: var(--text-muted); margin: 0; }
.usage-chart__stability { text-decoration: none; }
.usage-chart__stability:hover { opacity: .8; }
.usage-chart__release-line {
  stroke: rgba(160,130,80,.4);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.mini-chart {
  display: block;
  width: 80px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 3px;
  background: rgba(255,255,255,.03);
  margin-left: auto;
}
.badge--stability {
  border-radius: 4px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.badge--stability--staple      { background: rgba(34,197,94,.15);  color: #22c55e; }
.badge--stability--declining   { background: rgba(234,179,8,.15);  color: #eab308; }
.badge--stability--hype        { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge--stability--late_bloomer { background: rgba(129,140,248,.15); color: #818cf8; }
.badge--stability--new         { background: rgba(100,180,255,.15); color: #64b4ff; }

/* algo-table thead */
.algo-table thead th { background: rgba(255,255,255,.06); font-size: .8rem; }

/* --- Not-translated note ---------------------------------- */
.card-detail__not-translated {
  font-size: .78rem;
  color: #888;
  font-style: italic;
  margin: -.2rem 0 .6rem;
}

/* --- Card sections (card detail page) ---------------------- */
.card-section {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.expandable-list__items { display: flex; flex-direction: column; gap: .6rem; }
.expandable-list__items > .expandable-list__item--hidden { display: none; }
.expandable-list.expanded .expandable-list__items > .expandable-list__item--hidden { display: flex; }

.expand-btn {
  display: block;
  margin: .75rem auto 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .85rem;
  font-family: inherit;
  padding: .4rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.expand-btn:hover { color: var(--text); border-color: var(--accent); }

/* --- Sister card row --------------------------------------- */
.sister-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  display: flex;
  gap: .85rem;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.sister-row:hover { border-color: var(--accent); transform: translateX(2px); text-decoration: none; }

.sister-row__img {
  width: 44px;
  height: 60px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  flex-shrink: 0;
}
.sister-row__img--placeholder {
  width: 44px;
  height: 60px;
  border-radius: 4px;
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sister-row__main { flex: 1; min-width: 0; }

.sister-row__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
}

.sister-row__name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent);
  flex: 1;
  min-width: 100px;
}
.sister-row:hover .sister-row__name { color: var(--text); }

.sister-row__badges { display: flex; flex-wrap: wrap; gap: .3rem; }

/* --- Responsive -------------------------------------------- */
@media (max-width: 600px) {
  .site-header {
    height: auto;
    padding: .5rem 1rem;
    flex-wrap: wrap;
    gap: .4rem .5rem;
  }
  .site-nav { padding: 0 .5rem; }
  .site-search {
    order: 3;
    flex: none;
    width: 100%;
    max-width: 100%;
    margin: 0 0 .3rem;
  }
  .hero-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .hero-detail__img { width: 100px; }
  .hero-detail__name { font-size: 1.5rem; }
  .card-row__name { width: 100%; flex: none; }
  .card-row__badges { width: 100%; }
}
