/* POE Complete — design system
   Dark theme, PoE-flavored accent/resistance colors, card-based layout,
   Maxroll-inspired: image-forward guide cards, glowing accent header,
   condensed bold headline type. Pure CSS — no JS, no build step, matching
   the app's own "no JS required" philosophy (see routers/pages.py). */

:root {
  /* Surfaces */
  --bg: #0a0b0f;
  --bg-elevated: #15171f;
  --card: #181a23;
  --card-hover: #1e212c;
  --border: #2a2d3a;
  --border-soft: #21232e;

  /* Text */
  --text: #e9e7e2;
  --text-muted: #9497a8;
  --text-faint: #6b6e7f;

  /* Brand accent — exalted-orb gold */
  --gold: #d4af5a;
  --gold-bright: #e9c877;
  --gold-dim: #8a743f;

  /* Secondary brand accent — molten-orange glow (Maxroll-style punch) */
  --accent: #ff8a3d;
  --accent-bright: #ffab66;
  --accent-glow: rgba(255, 138, 61, 0.35);

  /* Real PoE stat colors */
  --life: #e0524d;
  --es: #4fc3e0;
  --evasion: #7fd88a;
  --armour: #c9a876;
  --fire: #e0524d;
  --cold: #5ec6e8;
  --lightning: #f0d550;
  --chaos: #c45de0;
  --dps: #e9895a;

  /* Grade tones */
  --grade-a: #5fb86e;
  --grade-b: #8bc46a;
  --grade-c: #e0c04d;
  --grade-d: #e0954d;
  --grade-f: #d9544a;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 900px 480px at 12% -10%, rgba(255, 138, 61, 0.08), transparent 60%),
    radial-gradient(ellipse 900px 480px at 88% 0%, rgba(212, 175, 90, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.5;
  font-size: 15px;
}

.headline, h1, h2, .brand, .build-card-title {
  font-family: "Barlow Condensed", "Inter", system-ui, sans-serif;
}

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

code {
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.85em;
  color: var(--gold-bright);
}

/* ---------- Layout shell ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 11, 15, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold-bright) 45%, transparent 75%);
  opacity: 0.85;
  box-shadow: 0 0 16px 0 var(--accent-glow);
}

.site-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: uppercase;
  text-decoration: none;
}
.brand-logo {
  height: 42px;
  width: 42px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.brand-mark {
  background: linear-gradient(120deg, var(--accent-bright), var(--gold-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: "Inter", sans-serif;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  align-self: center;
  padding-left: 0.3rem;
  border-left: 1px solid var(--border);
  margin-left: 0.15rem;
}

.site-nav { display: flex; gap: 0.3rem; }

.site-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.site-auth a { color: var(--text-muted); font-weight: 600; }
.site-auth a:hover { color: var(--text); }
.site-auth a.active { color: var(--accent-bright); }
.site-nav a {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover {
  color: var(--text);
  background: var(--bg-elevated);
  text-decoration: none;
}
.site-nav a.active {
  color: #17120a;
  background: linear-gradient(120deg, var(--accent-bright), var(--gold-bright));
}

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  margin: -0.5rem -1.5rem 2.25rem;
  padding: 3.2rem 1.5rem 2.6rem;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 720px 320px at 50% -20%, var(--accent-glow), transparent 65%),
    radial-gradient(ellipse 500px 300px at 15% 110%, rgba(212, 175, 90, 0.14), transparent 60%);
}
.hero .eyebrow { justify-content: center; }
.hero-banner {
  display: block;
  max-width: 420px;
  width: 100%;
  height: auto;
  margin: 0 auto 1.4rem;
  border-radius: 12px;
}
.hero h1 {
  font-size: 3rem;
  line-height: 1;
  margin: 0.3rem 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.hero p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin: 0 0 0.2rem;
}
.eyebrow::before, .eyebrow::after {
  content: "";
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.build-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 0.25rem;
}
.class-portrait {
  position: relative;
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}
.class-portrait > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.ascendancy-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--card);
  object-fit: contain;
  padding: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.build-header h1 { margin-bottom: 0.2rem; }

.gem-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.15rem 0.6rem 0.15rem 0.15rem;
  margin: 0.15rem 0.3rem 0.15rem 0;
  font-size: 0.85rem;
}
.gem-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
}

.class-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 0.5rem;
  background: var(--bg-elevated);
}

.page h1 {
  font-size: 2.1rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.page h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.4rem 0 0.9rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.005em;
  padding-left: 0.7rem;
  border-left: 3px solid var(--accent);
}
.page h3, .page h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.5rem 0 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.muted { color: var(--text-muted); font-size: 0.9rem; }
.faint { color: var(--text-faint); font-size: 0.82rem; }

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card.card-flush { padding: 0; }
.card.card-flush table { font-size: 0.9rem; }
.card.card-flush th:first-child, .card.card-flush td:first-child { padding-left: 1.4rem; }
.card.card-flush th:last-child, .card.card-flush td:last-child { padding-right: 1.4rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* ---------- Build guide cards (Maxroll-style image-forward grid) ---------- */

.build-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.build-card {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.build-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--gold-dim);
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 175, 90, 0.25);
}

.build-card-media {
  position: relative;
  height: 150px;
  background: var(--bg-elevated) center 15% / cover no-repeat;
}
.build-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 11, 15, 0) 30%, rgba(10, 11, 15, 0.94) 100%);
}
.build-card-media img.ascendancy-badge {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  z-index: 1;
  width: 38px;
  height: 38px;
}
.build-card-grade {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 1;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  background: rgba(10, 11, 15, 0.75);
  backdrop-filter: blur(2px);
  border: 1.5px solid currentColor;
}
.build-card-grade.grade-A { color: var(--grade-a); }
.build-card-grade.grade-B { color: var(--grade-b); }
.build-card-grade.grade-C { color: var(--grade-c); }
.build-card-grade.grade-D { color: var(--grade-d); }
.build-card-grade.grade-F { color: var(--grade-f); }

.build-card-title {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.6rem;
  z-index: 1;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.build-card-body {
  padding: 0.7rem 0.9rem 0.9rem;
}
.build-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.55rem;
}
.build-card-scores {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.build-card-score {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}
.build-card-score strong { color: var(--text); font-family: "JetBrains Mono", monospace; }

/* ---------- Messages ---------- */

.error, .notice {
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.error {
  background: rgba(217, 84, 74, 0.1);
  border-color: rgba(217, 84, 74, 0.35);
  color: #f2a29c;
}
.notice {
  background: rgba(212, 175, 90, 0.08);
  border-color: rgba(212, 175, 90, 0.3);
  color: var(--gold-bright);
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 1rem 0 0.35rem;
}
label:first-child { margin-top: 0; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea {
  min-height: 150px;
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(212, 175, 90, 0.15);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

/* ---------- Searchable select (searchable_select.js) ---------- */
.searchable-select { position: relative; }
.searchable-select-input.searchable-select-input {
  /* Extra specificity over the generic input[type="text"] rule above
     isn't needed for the properties themselves -- this selector just
     keeps the block visually grouped with the widget it belongs to. */
  cursor: text;
}
.searchable-select-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 40;
  max-height: 220px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 0.3rem;
}
.searchable-select-row {
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.searchable-select-row:hover,
.searchable-select-row.active { background: var(--card-hover); color: var(--text); }
.searchable-select-row.selected { color: var(--gold-dim); font-weight: 600; }
.searchable-select-empty {
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ---------- Rich text editor (build_edit.html, rich_text.js) ---------- */
.rich-text-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.rich-text-toolbar button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.85rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.rich-text-toolbar button:hover { filter: none; background: var(--card-hover); }
.rich-text-status { margin-left: 0.4rem; }
.rich-text-content {
  min-height: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.92rem;
}
.rich-text-content:focus { outline: none; border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(212, 175, 90, 0.15); }
.rich-text-content:empty:before { content: attr(data-placeholder); color: var(--text-faint); }

/* ---------- Item picker modal (build_edit.html, build_editor.js) ---------- */
#item-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
/* [hidden]'s plain-attribute-selector specificity loses to the ID
   selector above, so `display: flex` there would otherwise override
   the browser's own [hidden] -> display:none and leave the backdrop
   permanently covering the whole page -- confirmed live (it rendered
   full-screen immediately on page load, hiding the nav/gear grid
   behind it, not just when a slot was clicked). This rule's extra
   attribute selector outranks it and wins. */
#item-picker-backdrop[hidden] {
  display: none;
}
#item-picker-modal {
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
}
#item-picker-left {
  width: 40%;
  min-width: 220px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
}
#item-picker-search { margin-bottom: 0.75rem; }
#item-picker-list {
  overflow-y: auto;
  flex: 1;
}
.item-picker-row {
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.item-picker-row:hover { background: var(--card-hover); }
.item-picker-row.selected { background: var(--card-hover); color: var(--gold-dim); font-weight: 600; }
#item-picker-right {
  width: 60%;
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

@media (max-width: 720px) {
  #item-picker-modal { flex-direction: column; max-height: 92vh; }
  #item-picker-left, #item-picker-right { width: 100%; }
  #item-picker-left { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
}

/* ---------- Gear paper-doll grid (build_edit.html) ---------- */
/* Real PoE character-panel layout: weapons tall on the sides, helmet/
   amulet/body/gloves/boots stacked center, rings flanking near the
   bottom, belt spanning the width. Flasks/charms are a separate row
   below (build_edit.html), matching how the real game UI also keeps
   consumables out of the paper doll itself. */
#gear-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 130px));
  grid-template-rows: repeat(4, 56px) 56px 56px 56px;
  grid-template-areas:
    ".     helmet .    "
    "wpn1  amulet wpn2 "
    "wpn1  body   wpn2 "
    "wpn1  body   wpn2 "
    "ring1 gloves ring2"
    ".     boots  .    "
    "belt  belt   belt ";
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1rem;
}
#gear-slots [data-slot="Helmet"] { grid-area: helmet; }
#gear-slots [data-slot="Amulet"] { grid-area: amulet; }
#gear-slots [data-slot="Body Armour"] { grid-area: body; }
#gear-slots [data-slot="Gloves"] { grid-area: gloves; }
#gear-slots [data-slot="Boots"] { grid-area: boots; }
#gear-slots [data-slot="Belt"] { grid-area: belt; }
#gear-slots [data-slot="Weapon 1"] { grid-area: wpn1; }
#gear-slots [data-slot="Weapon 2"] { grid-area: wpn2; }
#gear-slots [data-slot="Ring 1"] { grid-area: ring1; }
#gear-slots [data-slot="Ring 2"] { grid-area: ring2; }

#gear-consumables {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.gear-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}
#gear-consumables .gear-slot { width: 90px; height: 76px; }
.gear-slot:hover { border-color: var(--gold-dim); background: var(--card-hover); }
.gear-slot-icon { width: 28px; height: 28px; opacity: 0.55; image-rendering: pixelated; }
.gear-slot.filled .gear-slot-icon { opacity: 0.9; }
.gear-slot-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}
.gear-slot.filled .gear-slot-label { display: none; }
.gear-slot-empty { color: var(--text-faint); font-size: 0.78rem; margin: 0; }
.gear-slot-item-name {
  font-size: 0.72rem;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
  padding-right: 20px;
}
.gear-slot-item-base { font-size: 0.62rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; box-sizing: border-box; padding-right: 20px; }

/* Real PoE2-style item tooltip on hover -- pure CSS show/hide (no JS),
   matches the in-game tooltip's dark ground / gold border / centered
   rarity-colored name / implicit(blue)-then-divider-then-explicit
   layout a user referenced via a real screenshot. `.gear-slot:hover`
   flips overflow to visible + raises z-index so the tooltip (a child
   of the slot, which is normally overflow:hidden for its own text
   ellipsis) can actually escape the slot's box and sit above sibling
   grid cells. */
.gear-slot:hover { overflow: visible; z-index: 20; }
.item-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 0.6rem 0.8rem;
  background: #0c0a08;
  border: 1px solid #7a6a3f;
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  text-align: center;
  cursor: default;
  white-space: normal;
}
.gear-slot:hover .item-tooltip { display: block; }
.item-tooltip-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #c8c8c8;
}
.item-tooltip-name.rarity-magic { color: #8888ff; }
.item-tooltip-name.rarity-rare { color: #ffff77; }
.item-tooltip-base { font-size: 0.78rem; color: inherit; margin-top: 0.1rem; }
.item-tooltip-name.rarity-magic ~ .item-tooltip-base { color: #8888ff; }
.item-tooltip-name.rarity-rare ~ .item-tooltip-base { color: #ffff77; }
.item-tooltip-type { font-size: 0.68rem; color: #8d8d8d; margin-top: 0.3rem; }
.item-tooltip-req { font-size: 0.68rem; color: #8d8d8d; margin-top: 0.15rem; }
.item-tooltip-divider {
  height: 1px;
  margin: 0.45rem 0;
  background: linear-gradient(to right, transparent, #7a6a3f, transparent);
}
.item-tooltip-line { font-size: 0.72rem; line-height: 1.35; color: #b4b4ff; }
.item-tooltip-line.implicit { color: #8888ff; }
.item-tooltip-line.faint { color: var(--text-faint); }
.item-tooltip-trade-link {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-bright);
  text-decoration: none;
}
.item-tooltip-trade-link:hover { text-decoration: underline; }

/* ---------- Item Crafter (craft_edit.html) ---------- */
/* Same .item-tooltip visual system as the gear-slot hover tooltip
   above, but always visible (not hover-gated) since this is the page's
   primary content, not a small grid tile's hover affordance. */
.item-tooltip.static {
  display: block;
  position: static;
  transform: none;
  width: auto;
  max-width: none;
  margin: 0;
}
.craft-panels {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.craft-panel { flex: 1; min-width: 260px; }
#current-rune-list, #target-rune-list {
  list-style: none;
  padding-left: 0;
}
#current-rune-list li, #target-rune-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
#current-rune-list li:last-child, #target-rune-list li:last-child { border-bottom: none; }
.craft-panel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}
/* Fields only relevant when editing the item's CURRENT (already-rolled)
   state -- hidden when the shared modal is editing TARGET mods, which
   have no name/rarity/quality/item level or roll % of their own. */
#item-picker-modal.editing-target .current-only { display: none; }
/* Corruption is target-only (a corrupted item is terminal, never a
   valid planning INPUT, so there's no "current" equivalent) -- mirror
   image of .current-only above. */
#item-picker-modal:not(.editing-target) .target-only { display: none; }

.gear-slot-screenshot-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-faint);
  cursor: pointer;
  z-index: 1;
}
.gear-slot-screenshot-btn:hover { color: var(--gold-dim); border-color: var(--gold-dim); }

/* Real PoE rarity colors */
.gear-slot.rarity-magic { border-color: #8888ff; }
.gear-slot.rarity-magic .gear-slot-item-name { color: #8888ff; }
.gear-slot.rarity-rare { border-color: #ffff77; }
.gear-slot.rarity-rare .gear-slot-item-name { color: #ffff77; }

@media (max-width: 480px) {
  #gear-slots { grid-template-columns: repeat(3, minmax(70px, 1fr)); }
}

/* ---------- Passive tree (build_tree.html, tree_editor.js) ---------- */
#tree-viewport {
  width: 100%;
  height: 70vh;
  min-height: 420px;
  background: #0a0b0f;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
#tree-viewport:active { cursor: grabbing; }
#tree-svg { width: 100%; height: 100%; display: block; }
.tree-node { cursor: pointer; transition: fill 0.1s ease, stroke 0.1s ease; }
.tree-node:hover { filter: brightness(1.3); }
#tree-search-results { display: flex; flex-wrap: wrap; gap: 0.3rem; }
/* Real PoE2-style node tooltip, mouse-follow (SVG nodes have no per-node
   box to anchor a CSS-only :hover tooltip to like the gear slots do) --
   same dark/gold look as .item-tooltip for visual consistency. */
#tree-tooltip {
  position: fixed;
  z-index: 50;
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 0.6rem 0.8rem;
  background: #0c0a08;
  border: 1px solid #7a6a3f;
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  white-space: normal;
  text-align: center;
}
.tree-tooltip-name { font-size: 0.85rem; font-weight: 700; color: #e0c887; }
.tree-tooltip-type { font-size: 0.65rem; color: #8d8d8d; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.15rem; }
.tree-tooltip-line { font-size: 0.72rem; line-height: 1.35; color: #b4b4ff; margin-top: 0.35rem; }
#attribute-picks-list button.secondary.active { background: var(--card-hover); border-color: var(--gold-dim); color: var(--gold-bright); }

/* ---------- Skills / gem picker (build_skills.html, skill_editor.js) ---------- */
.gem-type-filter.active { background: var(--card-hover); border-color: var(--gold-dim); color: var(--gold-bright); }

/* ---------- Build editor sub-nav (build_edit/build_tree/build_skills.html) ---------- */
.build-editor-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.build-editor-nav a {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}
.build-editor-nav a:hover { background: var(--card-hover); color: var(--text); }
.build-editor-nav a.active { background: var(--gold-dim); border-color: var(--gold-dim); color: #1a1408; }

.chat-input {
  min-height: 4.5rem;
  font-family: inherit;
  font-size: 0.92rem;
}

/* ---------- Lulie chat (build_detail.html) ---------- */

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0 0 1rem;
  max-height: 26rem;
  overflow-y: auto;
}
.chat-message {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}
.chat-message.assistant {
  background: var(--card-hover);
  border-color: rgba(212, 175, 90, 0.25);
}
.chat-message p { margin: 0.25rem 0 0; white-space: pre-wrap; }
.chat-role {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.chat-message.assistant .chat-role { color: var(--gold-bright); }
.chat-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.chat-image-thumb {
  max-width: 9rem;
  max-height: 9rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}

button, a.button {
  background: linear-gradient(120deg, var(--accent-bright), var(--gold-bright));
  color: #221a08;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.5rem;
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  margin-top: 1.1rem;
  margin-right: 0.5rem;
  transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px -6px var(--accent-glow);
  display: inline-block;
  text-decoration: none;
}
button:hover, a.button:hover { filter: brightness(1.08); box-shadow: 0 6px 20px -6px var(--accent-glow); }
button:active, a.button:active { transform: translateY(1px); }
button.secondary, a.button.secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.secondary:hover, a.button.secondary:hover { filter: none; background: var(--card-hover); box-shadow: none; }

/* ---------- Hot List (admin_hot_list.html) ---------- */
.hot-list-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.hot-list-row:last-child { border-bottom: none; }
.hot-list-row-archetype { align-items: flex-start; }
.hot-list-icon { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.hot-list-row-main { display: flex; flex-direction: column; flex: 1; gap: 0.15rem; }
.hot-list-name { font-weight: 700; font-size: 0.92rem; }
.hot-list-row form { flex-shrink: 0; }
.hot-list-row button { margin: 0; }
.hot-list-stat-list {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}
.hot-list-stat-list li { margin-bottom: 0.1rem; }
.hot-list-ingest-log {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.78rem;
  margin-top: 0.3rem;
}
.hot-list-ingest-log-row { padding: 0.15rem 0; border-bottom: 1px solid var(--border-soft); }
.hot-list-ingest-log-row:last-child { border-bottom: none; }
.hot-list-ingest-log-row.ok { color: var(--text-faint); }
.hot-list-ingest-log-row.failed { color: #e07a7a; }

fieldset {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem 1.3rem;
  background: var(--card);
}
legend {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding: 0 0.4rem;
}

/* ---------- Tables ---------- */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}
th {
  color: var(--text-faint);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody tr:hover { background: var(--bg-elevated); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Grade hero ---------- */

.grade-hero {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 420px 200px at 0% 0%, var(--accent-glow), transparent 70%),
    radial-gradient(ellipse at top left, var(--card-hover), var(--card));
  margin: 1rem 0 1.25rem;
  box-shadow: var(--shadow);
}
.grade-letter {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  width: 4.2rem;
  text-align: center;
  flex-shrink: 0;
}
.grade-letter.grade-A { color: var(--grade-a); }
.grade-letter.grade-B { color: var(--grade-b); }
.grade-letter.grade-C { color: var(--grade-c); }
.grade-letter.grade-D { color: var(--grade-d); }
.grade-letter.grade-F { color: var(--grade-f); }

.grade-meta-row { font-size: 0.95rem; margin-bottom: 0.3rem; }
.grade-meta-row strong { color: var(--text); }
.grade-sub-row { font-size: 0.88rem; color: var(--text-muted); }

/* Small secondary "score card" (boss readiness / piloting difficulty) */
.mini-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  margin-bottom: 1.25rem;
}
.mini-hero .grade-letter { font-size: 2rem; width: 3rem; color: var(--gold-bright); }

/* Score contribution bars */
.bar-track {
  background: var(--bg-elevated);
  border-radius: 999px;
  height: 6px;
  width: 100%;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
  border-radius: 999px;
}

/* ---------- Stat grid ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.6rem 1rem;
}
.stat-tile {
  border-left: 3px solid var(--border);
  padding: 0.15rem 0 0.15rem 0.7rem;
}
.stat-tile .stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-tile .stat-value {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.stat-tile.life { border-color: var(--life); }
.stat-tile.es { border-color: var(--es); }
.stat-tile.evasion { border-color: var(--evasion); }
.stat-tile.armour { border-color: var(--armour); }
.stat-tile.fire { border-color: var(--fire); }
.stat-tile.cold { border-color: var(--cold); }
.stat-tile.lightning { border-color: var(--lightning); }
.stat-tile.chaos { border-color: var(--chaos); }
.stat-tile.dps { border-color: var(--dps); }
.stat-tile.gold { border-color: var(--gold); }

/* ---------- Misc ---------- */

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 1.5rem 0;
}

/* ---------- Header account dropdown ---------- */

.site-auth { position: relative; }

.account-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem 0.3rem 0.3rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.account-trigger:hover { border-color: var(--gold-dim); }

.avatar-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(120deg, var(--accent-bright), var(--gold-bright));
  color: #17120a;
  font-weight: 800;
  font-size: 0.85rem;
}

.account-trigger-email {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-trigger-caret {
  color: var(--text-faint);
  font-size: 0.7rem;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  z-index: 20;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem;
}
.account-menu a,
.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  margin: 0;
}
.account-menu a:hover,
.account-menu button:hover {
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
}
.account-menu hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 0.4rem 0;
}
.account-menu form { margin: 0; }
.account-menu-league {
  padding: 0.55rem 0.7rem;
}
.account-menu-league label {
  display: block;
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
}
.account-menu-league select {
  width: 100%;
}

/* ---------- Homepage sections ---------- */

.home-section { margin-top: 3rem; }

.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.home-section-head h2 {
  margin: 0.2rem 0 0;
  font-size: 1.6rem;
}
.home-section-head .view-all { font-size: 0.85rem; font-weight: 600; white-space: nowrap; }

.capability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.capability-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.capability-card:hover {
  text-decoration: none;
  border-color: var(--gold-dim);
  transform: translateY(-2px);
}
.capability-card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.4rem;
}
.capability-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
}
.news-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.news-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.news-card-byline {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin: 0 0 0.6rem;
}
.news-card-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.streamer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.streamer-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.streamer-card .avatar-circle { width: 36px; height: 36px; font-size: 1rem; }
.streamer-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  display: block;
}
.streamer-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--grade-a);
  margin-top: 0.15rem;
}
.live-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grade-a);
  box-shadow: 0 0 6px var(--grade-a);
}
