  /* ===== Faction header (slim, ceremonial) ===== */
  .faction { margin-bottom: 56px; }
  .faction__head {
    display: flex; align-items: center; gap: 22px;
    padding: 22px 30px;
    margin-bottom: 22px;
    border: 1px solid var(--line);
    background:
      radial-gradient(ellipse 50% 100% at 100% 50%, var(--faction-glow, transparent), transparent 70%),
      linear-gradient(180deg, var(--bg-panel), var(--bg-panel-2));
    position: relative; overflow: hidden;
  }
  .faction--light { --faction-glow: rgba(111,163,200,0.16); --faction-color: var(--light-2); --faction-edge: rgba(111,163,200,0.45); }
  .faction--fury  { --faction-glow: rgba(168,48,64,0.18);  --faction-color: var(--fury-2);  --faction-edge: rgba(217,98,116,0.45); }
  .faction--light .faction__head, .faction--fury .faction__head { border-color: var(--faction-edge); }
  .faction-crest {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border: 1px solid currentColor; border-radius: 50%;
    color: var(--faction-color);
    background: rgba(0,0,0,0.35);
    flex-shrink: 0;
  }
  .faction-crest svg { width: 30px; height: 30px; stroke: currentColor; fill: none; stroke-width: 1.4; }
  .faction__title { font-family: var(--font-head); font-size: 32px; line-height: 1; color: var(--ink); margin: 0; }
  .faction__lede { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; }

  /* ===== Race row ===== */
  .race-spread {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
    align-items: stretch;
  }

  /* ===== Race intro panel ===== */
  .race-intro {
    position: relative;
    padding: 32px 28px 28px;
    background: linear-gradient(180deg, #14171f 0%, #0a0c12 100%);
    border: 1px solid var(--line);
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .race-intro::before {
    content: ''; position: absolute; inset: 6px;
    border: 1px solid rgba(201,164,74,0.16);
    pointer-events: none;
  }
  .race-intro__name {
    font-family: var(--font-head);
    font-size: 42px; line-height: 1;
    color: var(--ink);
    margin: 0 0 18px;
    position: relative; z-index: 1;
    letter-spacing: 0.005em;
  }
  .race-intro__rule {
    width: 56px; height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
    margin-bottom: 18px;
    position: relative; z-index: 1;
  }
  .race-intro__lede {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-soft);
    position: relative; z-index: 1;
    text-wrap: pretty;
    margin: 0;
  }
  .race-intro__sigil {
    position: relative; z-index: 1;
    margin-top: auto;
    padding-top: 28px;
    display: flex; justify-content: center;
    color: var(--faction-color); opacity: 0.5;
  }
  .race-intro__sigil svg { width: 56px; height: 56px; stroke: currentColor; fill: none; stroke-width: 1.2; }

  /* ===== Class card — clean codex entry ===== */
  .class-card {
    position: relative;
    display: flex; flex-direction: column;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #14171f 0%, #0a0c12 100%);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  }
  .class-card:hover, .class-card.is-active, .class-card:focus-visible {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(201,164,74,0.18), 0 16px 40px rgba(0,0,0,0.55);
    outline: none;
    z-index: 2;
  }

  /* Portrait area — tall frame, full figure always visible (contain) */
  .class-card__portrait {
    position: relative;
    aspect-ratio: 3 / 5;
    overflow: hidden;
    background:
      radial-gradient(ellipse 70% 80% at 50% 60%, rgba(201,164,74,0.10), transparent 65%),
      radial-gradient(ellipse 90% 50% at 50% 100%, rgba(11,13,18,0.85), transparent 60%),
      linear-gradient(180deg, #1d2230 0%, #0a0c12 100%);
  }
  /* clip the textured backdrop to the portrait frame (image is free to break out) */
  .class-card__portrait::before {
    content: ''; position: absolute; inset: 0;
    background-image:
      repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 7px);
    pointer-events: none;
    z-index: 1;
  }
  .class-card__portrait img {
    position: absolute;
    bottom: 0;
    left: 50%;
    height: 100%;
    width: auto;
    max-width: none;
    transform: translateX(-50%);
    transform-origin: 50% 100%;
    transition: transform 0.5s ease, filter 0.4s ease;
    filter: saturate(0.95) brightness(0.96) drop-shadow(0 8px 14px rgba(0,0,0,0.5));
    z-index: 2;
  }
  .class-card:hover .class-card__portrait img,
  .class-card.is-active .class-card__portrait img,
  .class-card:focus-visible .class-card__portrait img {
    filter: saturate(1.06) brightness(1) drop-shadow(0 12px 18px rgba(0,0,0,0.6));
  }
  /* Bottom fade keeps the body border looking soft */
  .class-card__portrait::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 28%;
    background: linear-gradient(180deg, transparent, rgba(10,12,18,0.55));
    pointer-events: none;
    z-index: 1;
  }

  /* Chips moved INTO body — a small bar above the name */
  .class-card__top {
    display: flex; justify-content: space-between; gap: 8px;
    margin-bottom: 14px;
  }
  .class-card__role,
  .class-card__stat {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase;
    padding: 5px 9px;
    background: rgba(11,13,18,0.6);
    border: 1px solid rgba(201,164,74,0.4);
    color: var(--gold);
  }
  .class-card__stat {
    color: var(--faction-color, var(--gold));
    border-color: currentColor;
  }

  /* Body block — name, rule, description, features */
  .class-card__body {
    flex: 1;
    padding: 22px 22px 22px;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, #14171f, #0a0c12);
    border-top: 1px solid var(--line-soft);
    position: relative;
  }
  .class-card__name {
    font-family: var(--font-head);
    font-size: 28px;
    line-height: 1;
    color: var(--ink);
    margin: 0;
    letter-spacing: 0.01em;
  }
  .class-card__rule {
    width: 40px; height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
    opacity: 0.7;
    margin: 12px 0 14px;
  }
  .class-card__desc {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 0;
  }
  .class-card__features {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    display: grid; gap: 6px;
    max-height: 0;
    opacity: 0;
    transform: translateY(6px);
    transition: max-height 0.4s ease, opacity 0.3s ease, transform 0.4s ease;
    overflow: hidden;
  }
  .class-card:hover .class-card__features,
  .class-card.is-active .class-card__features,
  .class-card:focus-visible .class-card__features {
    max-height: 240px;
    opacity: 1;
    transform: translateY(0);
  }
  .class-card__features li {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-soft);
    padding-left: 14px;
    position: relative;
  }
  .class-card__features li::before {
    content: ''; position: absolute;
    left: 0; top: 7px;
    width: 5px; height: 5px;
    background: var(--gold); transform: rotate(45deg);
  }

  /* Hint */
  .class-card__hint {
    position: absolute; bottom: 18px; right: 22px;
    z-index: 4;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--gold); opacity: 0.55;
    transition: opacity 0.25s;
    pointer-events: none;
    display: inline-flex; align-items: center; gap: 6px;
  }
  .class-card__hint svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform 0.3s; }
  .class-card:hover .class-card__hint,
  .class-card.is-active .class-card__hint { opacity: 0; }

  /* Top hint */
