/* ==========================================================================
   Worth the Camp: dark, minimal, one warm accent.
   No external fonts/CDNs (strict CSP); everything is self-hosted.
   ========================================================================== */
:root {
  --bg: #0a0c10;
  --bg-2: #0f1218;
  --surface: #13171f;
  --surface-2: #181d27;
  --surface-3: #1f2532;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #e8eaf0;
  --text-2: #b4bac8;
  --muted: #7d8597;
  --accent: #f0b84a;
  --accent-2: #f7d27e;
  --accent-ink: #1a1306;
  --accent-soft: rgba(240, 184, 74, 0.12);
  --good: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.12);
  --warn: #fb923c;
  --warn-soft: rgba(251, 146, 60, 0.12);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(240, 184, 74, 0.07), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(99, 102, 241, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; padding: 0 max(16px, calc((100vw - 1180px) / 2));
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 55%, #c98a1c);
  box-shadow: 0 4px 14px -4px rgba(240, 184, 74, 0.6);
}
.brand-mark svg { width: 16px; height: 16px; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a, .nav button.link { color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-size: 0.9rem; }
.nav a:hover, .nav button.link:hover { color: var(--text); background: var(--surface-2); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.88rem; color: var(--text-2); }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 32px 16px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 960px) {
  .sheet-layout, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head .hint { font-size: 0.8rem; color: var(--muted); }
.auth-card { max-width: 400px; margin: 48px auto 0; padding: 28px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card form { margin-top: 20px; }
.auth-card .foot { margin-top: 18px; text-align: center; font-size: 0.9rem; color: var(--muted); }

/* ---------- forms ---------- */
label { display: block; font-size: 0.82rem; font-weight: 550; color: var(--text-2); margin-bottom: 14px; }
label > input, label > select { margin-top: 6px; }
.stat > input, .vital > input { margin-top: 0; }
input, select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder { color: #4f5668; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0 12px; }

/* ---------- buttons ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -8px rgba(240, 184, 74, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.1s, filter 0.15s, background 0.15s;
}
.btn:hover, button:hover { filter: brightness(1.06); color: var(--accent-ink); }
.btn:active, button:active { transform: translateY(1px); }
.btn-ghost, button.btn-ghost { background: var(--surface-3); color: var(--text); border-color: var(--border-2); box-shadow: none; }
.btn-ghost:hover, button.btn-ghost:hover { background: #262d3c; color: var(--text); }
.btn-danger, button.btn-danger { background: transparent; color: var(--bad); border-color: rgba(248, 113, 113, 0.3); box-shadow: none; }
.btn-danger:hover, button.btn-danger:hover { background: var(--bad-soft); color: var(--bad); }
button.link { background: none; border: 0; box-shadow: none; padding: 0; color: var(--text-2); font-weight: 500; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
button[disabled], .is-loading { opacity: 0.7; pointer-events: none; }
.is-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline; }

/* ---------- alerts / chips ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 16px; border: 1px solid; }
.alert-error { color: #fecaca; background: var(--bad-soft); border-color: rgba(248, 113, 113, 0.25); }
.alert-warn { color: #fed7aa; background: var(--warn-soft); border-color: rgba(251, 146, 60, 0.25); }
.alert-info { color: var(--text-2); background: var(--accent-soft); border-color: rgba(240, 184, 74, 0.25); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); }
.chip-accent { color: var(--accent-2); background: var(--accent-soft); border-color: rgba(240, 184, 74, 0.25); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-good { background: var(--good); } .dot-warn { background: var(--warn); } .dot-muted { background: var(--muted); }

/* ---------- avatar ---------- */
.avatar {
  --size: 44px;
  width: var(--size); height: var(--size); border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: calc(var(--size) * 0.42);
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 60%, #b97a14);
}
.avatar-lg { --size: 64px; border-radius: 18px; }
.avatar-sm { --size: 26px; border-radius: 999px; font-size: 0.75rem; }

/* ---------- dashboard ---------- */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.char-card { display: flex; flex-direction: column; gap: 16px; color: var(--text); transition: transform 0.15s, border-color 0.15s; }
.char-card:hover { transform: translateY(-2px); border-color: rgba(240, 184, 74, 0.35); color: var(--text); }
.char-card .top { display: flex; gap: 14px; align-items: center; }
.char-card .name { font-weight: 650; font-size: 1.05rem; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-stats div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.mini-stats b { display: block; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
progress.progress { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
progress.progress::-webkit-progress-bar { background: var(--bg-2); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
progress.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mt-1 { margin-top: 4px; } .mt-3 { margin-top: 16px; } .mb-1 { margin-bottom: 6px; }
.new-card { display: grid; place-items: center; min-height: 180px; border: 1.5px dashed var(--border-2); border-radius: var(--radius); color: var(--muted); text-align: center; gap: 6px; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.new-card:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.new-card .plus { font-size: 1.8rem; line-height: 1; }
.empty-state { text-align: center; padding: 56px 20px; }
.empty-state p { margin: 8px auto 20px; max-width: 420px; }

/* ---------- character hero ---------- */
.hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero .meta { flex: 1; min-width: 220px; }
.hero h1 { display: flex; align-items: center; gap: 10px; }
.hero .chips { margin-top: 8px; }
.hero .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- dropzone ---------- */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 24px; margin: 0 0 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-2); border-radius: var(--radius); background: var(--bg-2);
  color: var(--text-2); font-size: 0.92rem; font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.dropzone .icon { width: 36px; height: 36px; color: var(--accent); margin-bottom: 4px; }
.dropzone .file-name { color: var(--accent-2); font-weight: 600; }
.steps { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; gap: 10px; align-items: baseline; font-size: 0.88rem; color: var(--text-2); counter-increment: step; }
.steps li::before { content: counter(step); flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; color: var(--accent-2); background: var(--accent-soft); }
kbd { font-family: var(--mono); font-size: 0.78rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-2); border-bottom-width: 2px; background: var(--surface-3); color: var(--text); }
details.collapse > summary { cursor: pointer; list-style: none; }
details.collapse > summary::-webkit-details-marker { display: none; }

/* ---------- equipment paper doll ---------- */
.equip-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(7, auto); gap: 8px;
}
.slot {
  position: relative; min-width: 0; min-height: 74px;
  display: flex; flex-direction: column; gap: 4px; padding: 9px 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.slot:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slot.filled { background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); border-color: var(--border-2); }
.slot-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.slot .item-name { font-size: 0.8rem; font-weight: 600; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.slot:not(.filled) .item-name { color: #434a5b; font-weight: 500; }
.slot input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  padding: 25px 10px 9px; border: 0; border-radius: 12px; background: transparent; box-shadow: none !important;
  font-size: 0.8rem; font-weight: 600; line-height: 1.3; color: var(--text);
  opacity: 0; cursor: text;
}
.slot input:focus { opacity: 1; }
/* Filled slots: clicks go to the tile (to show the item card), not the hidden input. */
.slot.filled { cursor: pointer; }
.slot.filled input:not(:focus) { pointer-events: none; }
.slot-edit {
  position: absolute; top: 6px; right: 6px; z-index: 3; margin: 0;
  width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px;
  color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border-2);
  opacity: 0; cursor: pointer; transition: opacity 0.12s, color 0.12s, border-color 0.12s;
}
.slot-edit svg { width: 13px; height: 13px; }
.slot.filled:hover .slot-edit, .slot.pinned .slot-edit { opacity: 1; }
.slot-edit:hover { color: var(--accent-2); border-color: var(--accent); }
.slot:not(.filled) .slot-edit, .slot:focus-within .slot-edit { display: none; }
@media (hover: none) { .slot.filled .slot-edit { opacity: 0.85; } }
.slot.pinned { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); z-index: 40; }
.slot:focus-within .item-name, .slot:focus-within .note { visibility: hidden; }
.slot input::placeholder { color: #5b6275; font-weight: 500; }
.slot-label { position: relative; z-index: 2; pointer-events: none; }
.slot.unknown { border-color: rgba(251, 146, 60, 0.4); }
.slot.confident { border-color: rgba(74, 222, 128, 0.35); }
.slot .note { font-size: 0.68rem; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.slot .note.changed { color: var(--accent-2); }
.slot-ear1 { grid-area: 1 / 2; } .slot-neck { grid-area: 1 / 3; } .slot-head { grid-area: 1 / 4; }
.slot-face { grid-area: 1 / 5; } .slot-ear2 { grid-area: 1 / 6; }
.slot-chest { grid-area: 2 / 1; } .slot-shirt { grid-area: 3 / 1; } .slot-wrist1 { grid-area: 4 / 1; }
.slot-waist { grid-area: 5 / 1; } .slot-finger1 { grid-area: 6 / 1; } .slot-legs { grid-area: 7 / 1; }
.slot-back { grid-area: 2 / 7; } .slot-shoulders { grid-area: 3 / 7; } .slot-wrist2 { grid-area: 4 / 7; }
.slot-hands { grid-area: 5 / 7; } .slot-finger2 { grid-area: 6 / 7; } .slot-feet { grid-area: 7 / 7; }
.slot-primary { grid-area: 7 / 2; } .slot-offhand { grid-area: 7 / 3; }
.slot-ranged { grid-area: 7 / 4; } .slot-ammo { grid-area: 7 / 5; }
.doll-center {
  grid-area: 2 / 2 / 7 / 7; margin: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px;
  border-radius: 18px; border: 1px solid var(--border);
  background:
    radial-gradient(closest-side, rgba(240, 184, 74, 0.10), transparent),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 10px);
}
.doll-center .avatar { --size: 84px; border-radius: 26px; box-shadow: 0 18px 50px -18px rgba(240, 184, 74, 0.6); }
.vitals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 440px; }
.vital { text-align: center; padding: 10px 6px; border-radius: 12px; background: rgba(10, 12, 16, 0.55); border: 1px solid var(--border); }
.vital b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.vital span { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
@media (max-width: 760px) {
  .equip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .equip-grid .slot { grid-area: auto; }
  .doll-center { grid-area: auto; grid-column: 1 / -1; order: -1; margin: 0 0 4px; }
  .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- stats panel ---------- */
.stat-group + .stat-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.stat-group h3 { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.stat-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 6px 6px 10px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border);
}
.stat:focus-within { border-color: var(--accent); }
.stat.check { border-color: rgba(251, 146, 60, 0.5); background: var(--warn-soft); }
.stat span { font-size: 0.72rem; font-weight: 700; color: var(--text-2); letter-spacing: 0.04em; }
.stat input { width: 56px; padding: 3px 6px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; font-size: 0.88rem; border: 0; background: transparent; box-shadow: none !important; }
.cols-4 .stat { flex-direction: column; align-items: stretch; gap: 0; padding: 6px 6px 4px; text-align: center; }
.cols-4 .stat input { width: 100%; text-align: center; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.profile-grid label { margin-bottom: 10px; }
.profile-grid input, .profile-grid select { padding: 8px 10px; font-size: 0.88rem; }

/* ---------- upgrades ---------- */
.upgrade-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.upgrade-card { padding: 14px 16px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); display: grid; gap: 10px; }
.upgrade-card .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.upgrade-card .slot-name { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.upgrade-card .current { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.cand + .cand { padding-top: 10px; border-top: 1px solid var(--border); }
.cand .name { font-weight: 600; font-size: 0.9rem; }
.gain { font-size: 0.78rem; font-weight: 700; color: var(--good); background: var(--good-soft); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.cand .src { grid-column: 1 / -1; font-size: 0.76rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.diff { display: inline-flex; padding: 0 6px; border-radius: 5px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-3); color: var(--text-2); }
.diff-solo { color: var(--good); background: var(--good-soft); }
.diff-group { color: var(--accent-2); background: var(--accent-soft); }
.diff-raid { color: var(--bad); background: var(--bad-soft); }
.no-upgrades { margin-top: 14px; font-size: 0.82rem; color: var(--muted); }

/* ---------- sticky save bar (shown by app.js when the form is dirty) ---------- */
.save-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 0); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px;
  border-radius: 14px; border: 1px solid var(--border-2);
  background: rgba(24, 29, 39, 0.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7);
  font-size: 0.88rem; color: var(--text-2);
  transition: opacity 0.2s, transform 0.2s;
}
/* Hidden until the form is edited (app.js adds .is-dirty). nojs.css keeps it visible without JS. */
form[data-dirty-watch]:not(.is-dirty) .save-bar:not([data-always]) { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }

.danger-zone { margin-top: 32px; display: flex; justify-content: flex-end; }
.review-banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.mb-3 { margin-bottom: 16px; } .mb-section { margin-bottom: 20px; } .mt-section { margin-top: 20px; }
.span-2 { grid-column: 1 / -1; }
details.collapse:not([open]) > summary.card-head { margin-bottom: 0; }
details.collapse > summary h2::after { content: " ▾"; color: var(--muted); font-size: 0.8em; }
details.collapse[open] > summary h2::after { content: " ▴"; }
label.vital { margin: 0; }
.vital input { padding: 0; border: 0; background: transparent; text-align: center; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: none !important; }
.vital.check, .stat.check { border-color: rgba(251, 146, 60, 0.55); background: var(--warn-soft); }
.stat-grid label.stat { margin: 0; }

/* ---------- item tooltips (CSS only) ---------- */
.tip {
  position: absolute; z-index: 50; width: 264px; padding: 12px 14px;
  bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px);
  background: linear-gradient(180deg, #161b25, #0e1219); color: var(--text-2);
  border: 1px solid rgba(240, 184, 74, 0.28); border-radius: 12px;
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.4);
  font-size: 0.78rem; line-height: 1.4; text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.slot:hover { z-index: 40; }
.slot:hover:not(:focus-within) .tip, .slot.pinned:not(:focus-within) .tip,
.has-tip:hover .tip, .has-tip:focus .tip { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
.tip-name { font-size: 0.92rem; font-weight: 700; color: var(--accent-2); letter-spacing: -0.01em; margin-bottom: 6px; }
.tip-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tip-flags span { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; padding: 1px 6px; border-radius: 4px; background: rgba(129, 140, 248, 0.14); color: #a5b4fc; }
.tip-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.tip-row span, .tip-drops > span { color: var(--muted); }
.tip-row b { color: var(--text); font-weight: 600; text-align: right; }
.tip-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 14px; margin: 8px 0; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tip-stats div { display: flex; justify-content: space-between; gap: 6px; }
.tip-stats span { color: var(--text-2); }
.tip-stats b { font-variant-numeric: tabular-nums; }
.tip-stats b.pos { color: var(--good); } .tip-stats b.neg { color: var(--bad); }
.tip-desc { margin-top: 8px; font-style: italic; color: var(--muted); }
.tip-drops { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--text); }
/* Open toward the centre of the paper doll so edge slots never clip. */
.slot-chest .tip, .slot-shirt .tip, .slot-wrist1 .tip, .slot-waist .tip, .slot-finger1 .tip, .slot-legs .tip {
  left: calc(100% + 8px); bottom: auto; top: 0; transform: translate(-4px, 0);
}
.slot-back .tip, .slot-shoulders .tip, .slot-wrist2 .tip, .slot-hands .tip, .slot-finger2 .tip, .slot-feet .tip {
  left: auto; right: calc(100% + 8px); bottom: auto; top: 0; transform: translate(4px, 0);
}
.slot-legs .tip, .slot-feet .tip { top: auto; bottom: 0; }
.slot-ear1 .tip, .slot-neck .tip, .slot-head .tip, .slot-face .tip, .slot-ear2 .tip { bottom: auto; top: calc(100% + 8px); }
.slot-chest:hover:not(:focus-within) .tip, .slot-shirt:hover:not(:focus-within) .tip, .slot-wrist1:hover:not(:focus-within) .tip,
.slot-waist:hover:not(:focus-within) .tip, .slot-finger1:hover:not(:focus-within) .tip, .slot-legs:hover:not(:focus-within) .tip,
.slot-back:hover:not(:focus-within) .tip, .slot-shoulders:hover:not(:focus-within) .tip, .slot-wrist2:hover:not(:focus-within) .tip,
.slot-hands:hover:not(:focus-within) .tip, .slot-finger2:hover:not(:focus-within) .tip, .slot-feet:hover:not(:focus-within) .tip,
.slot-chest.pinned .tip, .slot-shirt.pinned .tip, .slot-wrist1.pinned .tip, .slot-waist.pinned .tip, .slot-finger1.pinned .tip, .slot-legs.pinned .tip,
.slot-back.pinned .tip, .slot-shoulders.pinned .tip, .slot-wrist2.pinned .tip, .slot-hands.pinned .tip, .slot-finger2.pinned .tip, .slot-feet.pinned .tip { transform: none; }
.has-tip { position: relative; cursor: help; text-decoration: underline dotted rgba(255, 255, 255, 0.25); text-underline-offset: 3px; }
.has-tip .tip { left: 0; bottom: calc(100% + 8px); transform: translate(0, 4px); font-weight: 400; }
.has-tip:hover .tip, .has-tip:focus .tip { transform: translate(0, 0); }
.has-tip:focus { outline: none; }
.upgrade-card:hover { position: relative; z-index: 5; }
@media (max-width: 760px) {
  .equip-grid .slot .tip { left: 0; right: auto; top: calc(100% + 6px); bottom: auto; width: min(264px, calc(100vw - 48px)); transform: none; }
  .equip-grid .slot:nth-child(even) .tip { left: auto; right: 0; }
}

.tip-credit { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 0.68rem; color: var(--muted); }
.tip-credit a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.dot-pending { background: #818cf8; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.lookup-notice { align-items: center; }
.spinner { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.site-footer { max-width: 1180px; margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.78rem; display: grid; gap: 4px; }
.site-footer a { color: var(--text-2); }
/* Invisible bridge over the gap between a slot and its tooltip, so the tooltip (and its links) stay hoverable. */
.tip::before { content: ""; position: absolute; inset: -12px; z-index: -1; }

/* observed drops + con colours */
.obs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.obs .rate { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.con { font-size: 0.66rem; font-weight: 800; padding: 0 6px; border-radius: 5px; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.con-red { color: #fecaca; background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.5); }
.con-yellow { color: #fef08a; background: rgba(234, 179, 8, 0.2); border-color: rgba(234, 179, 8, 0.45); }
.con-white { color: #f8fafc; background: rgba(248, 250, 252, 0.12); border-color: rgba(248, 250, 252, 0.35); }
.con-darkblue { color: #bfdbfe; background: rgba(37, 99, 235, 0.3); border-color: rgba(59, 130, 246, 0.5); }
.con-lightblue { color: #a5f3fc; background: rgba(34, 211, 238, 0.15); border-color: rgba(34, 211, 238, 0.4); }
.con-green { color: #bbf7d0; background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.4); }
.con-none { color: var(--text-2); background: var(--surface-3); }

/* upgrades: reach notation + toggle */
.upgrades-head { align-items: flex-start; flex-wrap: wrap; }
.upgrades-head h2 { margin-bottom: 2px; }
.cand .reach { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.74rem; }
.cand.is-out .name, .cand.is-out .gain { opacity: 0.55; }
.cand.is-out .gain { background: var(--surface-3); color: var(--text-2); }
.switch { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-2); box-shadow: none; font-weight: 600; font-size: 0.82rem; }
.switch:hover { color: var(--text); filter: none; }
.switch .knob { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border-2); transition: background 0.15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.switch.on { color: var(--text); border-color: rgba(240, 184, 74, 0.4); }
.switch.on .knob { background: var(--accent-soft); border-color: var(--accent); }
.switch.on .knob::after { transform: translateX(14px); background: var(--accent); }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 10px; }
.prose ul { margin: 10px 0 0; padding-left: 20px; color: var(--text-2); }
.prose li + li { margin-top: 6px; }
.prose h2 { margin-bottom: 10px; }
pre.license { margin: 12px 0 0; padding: 14px; overflow-x: auto; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font: 0.74rem/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; }
.tip-name a { color: inherit; } .tip-name a:hover { color: var(--accent); }
.reach a { color: var(--text-2); text-decoration: underline dotted; text-underline-offset: 2px; }
.nav a.btn { color: var(--accent-ink); } .nav a.btn:hover { color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.con.approx { border-style: dashed; }

/* ======================================================================
   Icons, medallions, hero, item tints, best-upgrades strip
   ====================================================================== */
.icon { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.14em; }
.slot-label .slot-icon { width: 14px; height: 14px; color: var(--muted); }
.slot.filled .slot-label .slot-icon { color: var(--accent); }
.slot-label .mark { display: inline-grid; place-items: center; color: var(--muted); margin-left: -2px; }
.slot-label .mark .icon { width: 11px; height: 11px; }
.slot-name .slot-icon { width: 13px; height: 13px; margin-right: 6px; color: var(--accent); }
.btn-icon { width: 15px; height: 15px; }
.chip-icon { width: 13px; height: 13px; color: var(--accent-2); }

/* element / vital colours */
:root {
  --c-ac: #cbd5e1; --c-hp: #f87171; --c-mana: #60a5fa; --c-endurance: #facc15;
  --c-cold: #7dd3fc; --c-fire: #fb923c; --c-corruption: #a78bfa; --c-holy: #fde68a;
  --c-disease: #a3e635; --c-magic: #c084fc; --c-electric: #fde047; --c-poison: #4ade80;
  --c-magic-item: #93c5fd;
}

/* item tint: magic items read blue like the in-game window */
.slot.rarity-magic .item-name { color: var(--c-magic-item); }
.slot.rarity-magic { background: linear-gradient(180deg, rgba(96, 165, 250, 0.10), rgba(96, 165, 250, 0.03)), var(--surface-2); border-color: rgba(96, 165, 250, 0.28); }
.slot.rarity-known:not(.rarity-magic) { border-color: rgba(255, 255, 255, 0.16); }
.slot.rarity-magic.pinned { border-color: var(--accent); }

/* medallion: class emblem + level badge */
.medallion {
  --size: 92px;
  position: relative; width: var(--size); height: var(--size); flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent-ink);
  background: radial-gradient(circle at 35% 30%, #ffe8ad, var(--accent) 55%, #9a6410 100%);
  box-shadow: 0 0 0 4px rgba(240, 184, 74, 0.18), 0 0 0 9px rgba(240, 184, 74, 0.06), 0 18px 50px -14px rgba(240, 184, 74, 0.7), inset 0 -6px 14px rgba(0, 0, 0, 0.25);
}
.medallion .emblem { width: 50%; height: 50%; }
.medallion .lvl {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  min-width: 30px; padding: 1px 8px; border-radius: 999px; text-align: center;
  font-size: 0.78rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--text); background: #12161e; border: 1px solid rgba(240, 184, 74, 0.5);
}
.medallion-lg { --size: 84px; }
.medallion-sm { --size: 48px; box-shadow: 0 0 0 3px rgba(240, 184, 74, 0.15), 0 8px 20px -10px rgba(240, 184, 74, 0.6); }
.medallion-sm .lvl { font-size: 0.66rem; min-width: 22px; padding: 0 5px; bottom: -5px; }
.doll-center .medallion { --size: 104px; }
.doll-name { text-align: center; display: grid; gap: 2px; margin-top: -4px; }
.doll-name b { font-size: 1.05rem; letter-spacing: -0.01em; }
.doll-name span { font-size: 0.78rem; color: var(--muted); }

/* hero banner */
.hero-card {
  position: relative; overflow: hidden; margin-bottom: 20px;
  border: 1px solid var(--border-2); border-radius: 18px;
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(240, 184, 74, 0.16), transparent 70%),
    radial-gradient(500px 260px at 100% 0%, rgba(129, 140, 248, 0.12), transparent 70%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.hero-main { display: flex; align-items: center; gap: 22px; padding: 24px 24px 20px; flex-wrap: wrap; }
.hero-main .meta { flex: 1; min-width: 200px; }
.hero-main h1 { font-size: 2rem; margin: 2px 0 6px; }
.eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); }
.hero-main .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--border); background: rgba(10, 12, 16, 0.35); }
.hstat { display: flex; align-items: center; gap: 12px; padding: 14px 20px; min-width: 0; }
.hstat + .hstat { border-left: 1px solid var(--border); }
.hstat b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.hstat b small { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.hstat span:not(.hicon) { font-size: 0.72rem; color: var(--muted); }
.hicon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); }
.hicon .icon { width: 19px; height: 19px; }
.hstat-good .hicon { background: var(--good-soft); color: var(--good); }
.hicon-ac { background: rgba(203, 213, 225, 0.1); color: var(--c-ac); }
.hicon-hp { background: rgba(248, 113, 113, 0.12); color: var(--c-hp); }
@media (max-width: 960px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hstat + .hstat { border-left: 0; }
  .hstat { border-top: 1px solid var(--border); }
  .hstat:nth-child(1), .hstat:nth-child(2) { border-top: 0; }
  .hstat:nth-child(even) { border-left: 1px solid var(--border); }
}

/* vitals in the paper-doll centre */
.vital { position: relative; padding-top: 8px; }
.vital-icon { width: 16px; height: 16px; display: block; margin: 0 auto 2px; }
.vital-ac .vital-icon { color: var(--c-ac); } .vital-hp .vital-icon { color: var(--c-hp); }
.vital-mana .vital-icon { color: var(--c-mana); } .vital-endurance .vital-icon { color: var(--c-endurance); }

/* gear contribution on attributes */
.stat > span { display: flex; flex-direction: column; gap: 1px; }
.stat .gear { font-size: 0.64rem; font-weight: 700; color: var(--good); letter-spacing: 0; }

/* resists: element colour + icon */
.resist > span { flex-direction: row !important; align-items: center; justify-content: center; gap: 4px; }
.resist-icon { width: 13px; height: 13px; }
.resist-sv_cold { --el: var(--c-cold); } .resist-sv_fire { --el: var(--c-fire); }
.resist-sv_corruption { --el: var(--c-corruption); } .resist-sv_holy { --el: var(--c-holy); }
.resist-sv_disease { --el: var(--c-disease); } .resist-sv_magic { --el: var(--c-magic); }
.resist-sv_electric { --el: var(--c-electric); } .resist-sv_poison { --el: var(--c-poison); }
.resist { border-top: 2px solid color-mix(in srgb, var(--el) 55%, transparent); }
.resist .resist-icon { color: var(--el); }

/* dashboard mini stats with icons */
.mini-stats .ms { position: relative; }
.ms-icon { position: absolute; top: 8px; right: 8px; width: 12px; height: 12px; opacity: 0.8; }
.ms-ac .ms-icon { color: var(--c-ac); } .ms-hp .ms-icon { color: var(--c-hp); }
.ms-mana .ms-icon { color: var(--c-mana); } .ms-endurance .ms-icon { color: var(--c-endurance); }

/* best upgrades strip */
.strip-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 12px; }
.title-icon { width: 18px; height: 18px; color: var(--good); }
.best-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 960px) { .best-grid { grid-template-columns: minmax(0, 1fr); } }
.best-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 14px;
  border: 1px solid rgba(74, 222, 128, 0.22);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), transparent 60%), linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.best-icon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--good); background: var(--good-soft); border: 1px solid rgba(74, 222, 128, 0.25); }
.best-icon .icon { width: 24px; height: 24px; }
.best-body { min-width: 0; display: grid; gap: 4px; }
.best-slot { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.best-name { font-weight: 650; font-size: 1rem; width: fit-content; }
.best-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.best-card:hover { position: relative; z-index: 5; }

/* ---------- item art (game icons, cached locally) ---------- */
.slot { align-items: center; text-align: center; min-height: 104px; padding-top: 24px; }
.slot-label { position: absolute; top: 7px; left: 9px; right: 9px; justify-content: flex-start; }
.item-art { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 9px; margin: 2px auto 4px; }
.item-art.has-img { background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.35)); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 4px 12px -6px rgba(0, 0, 0, 0.8); }
.item-art img { width: 40px; height: 40px; image-rendering: auto; border-radius: 6px; }
.item-art .art-fallback { width: 26px; height: 26px; color: var(--text-2); opacity: 0.55; }
.slot:not(.filled) .item-art .art-fallback { width: 30px; height: 30px; opacity: 0.16; color: var(--text); }
.slot.rarity-magic .item-art.has-img { border-color: rgba(96, 165, 250, 0.45); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 14px -4px rgba(96, 165, 250, 0.45); }
.slot .item-name { font-size: 0.74rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slot:not(.filled) .item-name { font-size: 0.7rem; }
.slot .note { text-align: center; }
.slot:focus-within .item-art { visibility: hidden; }
.slot input { padding: 26px 10px 9px; text-align: left; }
.tip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tip-head .tip-name { margin-bottom: 0; }
.tip-icon { width: 40px; height: 40px; flex: none; border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(0, 0, 0, 0.35); }
.cand-icon { width: 22px; height: 22px; border-radius: 5px; vertical-align: -6px; margin-right: 8px; border: 1px solid rgba(255, 255, 255, 0.12); }
.best-icon.has-img { background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 255, 255, 0.14); }
.best-icon img { width: 40px; height: 40px; border-radius: 8px; }
@media (max-width: 760px) { .slot { min-height: 96px; } }

/* ---------- character figure (original art) ---------- */
.figure { width: min(100%, 230px); height: auto; overflow: visible; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55)); }
.figure .fig-body { transform-box: view-box; transform-origin: 100px 268px; transition: transform 0.2s; }
.figure.build-large .fig-body { transform: scale(1.16, 1.04); }
.figure.build-stout .fig-body { transform: scale(1.08, 0.84); }
.figure.build-small .fig-body { transform: scale(0.88, 0.78); }
.figure.build-slender .fig-body { transform: scale(0.93, 1.02); }
.figure .skin > * { fill: url(#fig-skin); stroke: rgba(255, 255, 255, 0.10); stroke-width: 1; }
.figure .part { fill: none; stroke: none; opacity: 0; transition: opacity 0.15s, filter 0.15s; }
.figure .part.on {
  opacity: 1; fill: rgba(240, 184, 74, 0.22); stroke: rgba(247, 210, 126, 0.85); stroke-width: 1.4; stroke-linejoin: round;
}
.figure .part.on.magic { fill: rgba(96, 165, 250, 0.22); stroke: rgba(147, 197, 253, 0.9); }
.figure .part-back.on { fill: rgba(240, 184, 74, 0.10); }
.figure .part-back.on.magic { fill: rgba(96, 165, 250, 0.10); }
.figure path.part[fill="none"].on, .figure path.part-ranged.on, .figure path.part-neck[fill="none"].on { fill: none; stroke-width: 2; }
/* hovering / focusing / pinning a slot highlights its piece; empty slots show a dashed outline */
.equip-grid:has(.slot-ear1:hover) .part-ear1, .equip-grid:has(.slot-ear1:focus-within) .part-ear1, .equip-grid:has(.slot-ear1.pinned) .part-ear1,
.equip-grid:has(.slot-ear2:hover) .part-ear2, .equip-grid:has(.slot-ear2:focus-within) .part-ear2, .equip-grid:has(.slot-ear2.pinned) .part-ear2,
.equip-grid:has(.slot-neck:hover) .part-neck, .equip-grid:has(.slot-neck:focus-within) .part-neck, .equip-grid:has(.slot-neck.pinned) .part-neck,
.equip-grid:has(.slot-head:hover) .part-head, .equip-grid:has(.slot-head:focus-within) .part-head, .equip-grid:has(.slot-head.pinned) .part-head,
.equip-grid:has(.slot-face:hover) .part-face, .equip-grid:has(.slot-face:focus-within) .part-face, .equip-grid:has(.slot-face.pinned) .part-face,
.equip-grid:has(.slot-chest:hover) .part-chest, .equip-grid:has(.slot-chest:focus-within) .part-chest, .equip-grid:has(.slot-chest.pinned) .part-chest,
.equip-grid:has(.slot-shirt:hover) .part-shirt, .equip-grid:has(.slot-shirt:focus-within) .part-shirt, .equip-grid:has(.slot-shirt.pinned) .part-shirt,
.equip-grid:has(.slot-wrist1:hover) .part-wrist1, .equip-grid:has(.slot-wrist1:focus-within) .part-wrist1, .equip-grid:has(.slot-wrist1.pinned) .part-wrist1,
.equip-grid:has(.slot-wrist2:hover) .part-wrist2, .equip-grid:has(.slot-wrist2:focus-within) .part-wrist2, .equip-grid:has(.slot-wrist2.pinned) .part-wrist2,
.equip-grid:has(.slot-waist:hover) .part-waist, .equip-grid:has(.slot-waist:focus-within) .part-waist, .equip-grid:has(.slot-waist.pinned) .part-waist,
.equip-grid:has(.slot-finger1:hover) .part-finger1, .equip-grid:has(.slot-finger1:focus-within) .part-finger1, .equip-grid:has(.slot-finger1.pinned) .part-finger1,
.equip-grid:has(.slot-finger2:hover) .part-finger2, .equip-grid:has(.slot-finger2:focus-within) .part-finger2, .equip-grid:has(.slot-finger2.pinned) .part-finger2,
.equip-grid:has(.slot-legs:hover) .part-legs, .equip-grid:has(.slot-legs:focus-within) .part-legs, .equip-grid:has(.slot-legs.pinned) .part-legs,
.equip-grid:has(.slot-back:hover) .part-back, .equip-grid:has(.slot-back:focus-within) .part-back, .equip-grid:has(.slot-back.pinned) .part-back,
.equip-grid:has(.slot-shoulders:hover) .part-shoulders, .equip-grid:has(.slot-shoulders:focus-within) .part-shoulders, .equip-grid:has(.slot-shoulders.pinned) .part-shoulders,
.equip-grid:has(.slot-hands:hover) .part-hands, .equip-grid:has(.slot-hands:focus-within) .part-hands, .equip-grid:has(.slot-hands.pinned) .part-hands,
.equip-grid:has(.slot-feet:hover) .part-feet, .equip-grid:has(.slot-feet:focus-within) .part-feet, .equip-grid:has(.slot-feet.pinned) .part-feet,
.equip-grid:has(.slot-primary:hover) .part-primary, .equip-grid:has(.slot-primary:focus-within) .part-primary, .equip-grid:has(.slot-primary.pinned) .part-primary,
.equip-grid:has(.slot-offhand:hover) .part-offhand, .equip-grid:has(.slot-offhand:focus-within) .part-offhand, .equip-grid:has(.slot-offhand.pinned) .part-offhand,
.equip-grid:has(.slot-ranged:hover) .part-ranged, .equip-grid:has(.slot-ranged:focus-within) .part-ranged, .equip-grid:has(.slot-ranged.pinned) .part-ranged,
.equip-grid:has(.slot-ammo:hover) .part-ammo, .equip-grid:has(.slot-ammo:focus-within) .part-ammo, .equip-grid:has(.slot-ammo.pinned) .part-ammo {
  opacity: 1; stroke: var(--accent); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(240, 184, 74, 0.8));
}
.equip-grid .part:not(.on) { stroke-dasharray: 3 3; }
.doll-center { justify-content: flex-start; gap: 10px; padding-top: 20px; }
.doll-center .figure-wrap { position: relative; display: grid; place-items: center; width: 100%; }
.doll-center .figure-wrap .medallion { position: absolute; top: 0; left: 14px; --size: 48px; }
.doll-center .figure-wrap .medallion .lvl { font-size: 0.66rem; min-width: 22px; padding: 0 5px; bottom: -5px; }
@media (max-width: 760px) { .figure { width: 170px; } }

/* ---------- race models (original art; proportions/colours from the race line-up) ---------- */
.figure { width: min(100%, 250px); }
.figure .fig-body { transform-box: view-box; transform-origin: 100px 268px; }
.figure .fig-head { transform-box: view-box; transform-origin: 100px 66px; }
.figure .skin > *, .figure .skin-fill { fill: var(--skin); stroke: rgba(0, 0, 0, 0.45); stroke-width: 1; vector-effect: non-scaling-stroke; }
.figure .shade, .figure .shade > * { fill: url(#fig-shade); pointer-events: none; }
.figure .eye { fill: #14161b; }
.figure .eye-glow { filter: drop-shadow(0 0 3px currentColor); }
.figure .eye-glow.yellow { fill: #fde68a; color: #facc15; }
.figure .eye-glow.blue { fill: #93c5fd; color: #3b82f6; }
.figure .eye-glow.pale { fill: #e5e7eb; color: #e5e7eb; }
.figure .eye-glow.amber { fill: #fbbf24; color: #f59e0b; }
.figure .hair { fill: #5a3a24; stroke: rgba(0, 0, 0, 0.4); stroke-width: 1; vector-effect: non-scaling-stroke; }
.figure .hair.light { fill: #ece9e2; }
.figure .hair.dark { fill: #1d1f24; }
.figure .beard { fill: #5b3a22; }
.figure .tusk { fill: #f3ead2; stroke: rgba(0, 0, 0, 0.4); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.figure .crest { fill: #2f6a2a; stroke: rgba(0, 0, 0, 0.4); vector-effect: non-scaling-stroke; }
.figure .stone-lines { stroke: rgba(0, 0, 0, 0.55); stroke-width: 2; vector-effect: non-scaling-stroke; }
.figure .lizard-nostrils { stroke: rgba(0, 0, 0, 0.6); stroke-width: 1.5; }
.figure .nose { stroke: rgba(0, 0, 0, 0.35); }
/* gear: solid pieces over the skin (gold trim = normal, blue = magic) */
.figure .part.on { opacity: 1; fill: #3a3128; stroke: #f7d27e; stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.figure .part.on.magic { fill: #22324d; stroke: #93c5fd; }
.figure .part.on.cloth { fill: #4a4236; }
.figure .part.on.cloth.magic { fill: #26385a; }
.figure .part-back.on { fill: #43281f; }
.figure .part-back.on.magic { fill: #233457; }
.figure .part.on.trim, .figure path.part[fill="none"].on { fill: none; }
.figure.race-human { --skin: #c4946c; }
.figure.race-human .fig-body { transform: scale(1.0, 1.0); }
.figure.race-human .fig-head { transform: scale(1.000, 1.000); }
.figure.race-highelf { --skin: #ebe6dd; }
.figure.race-highelf .fig-body { transform: scale(0.92, 1.06); }
.figure.race-highelf .fig-head { transform: scale(1.065, 0.925); }
.figure.race-woodelf { --skin: #7f7a49; }
.figure.race-woodelf .fig-body { transform: scale(0.92, 1.0); }
.figure.race-woodelf .fig-head { transform: scale(1.054, 0.970); }
.figure.race-deepelf { --skin: #34363f; }
.figure.race-deepelf .fig-body { transform: scale(0.86, 0.98); }
.figure.race-deepelf .fig-head { transform: scale(1.070, 0.939); }
.figure.race-ogre { --skin: #c58a52; }
.figure.race-ogre .fig-body { transform: scale(1.45, 1.32); }
.figure.race-ogre .fig-head { transform: scale(0.793, 0.871); }
.figure.race-troll { --skin: #557141; }
.figure.race-troll .fig-body { transform: scale(1.42, 1.34); }
.figure.race-troll .fig-head { transform: scale(0.845, 0.896); }
.figure.race-dwarf { --skin: #a46a48; }
.figure.race-dwarf .fig-body { transform: scale(1.18, 0.68); }
.figure.race-dwarf .fig-head { transform: scale(0.805, 1.397); }
.figure.race-deepdwarf { --skin: #4a4e56; }
.figure.race-deepdwarf .fig-body { transform: scale(1.38, 0.78); }
.figure.race-deepdwarf .fig-head { transform: scale(0.725, 1.282); }
.figure.race-halfling { --skin: #d2a57c; }
.figure.race-halfling .fig-body { transform: scale(0.86, 0.6); }
.figure.race-halfling .fig-head { transform: scale(0.953, 1.367); }
.figure.race-gnome { --skin: #b79d8a; }
.figure.race-gnome .fig-body { transform: scale(0.8, 0.52); }
.figure.race-gnome .fig-head { transform: scale(1.000, 1.538); }
.figure.race-deepgnome { --skin: #4c5768; }
.figure.race-deepgnome .fig-body { transform: scale(0.8, 0.52); }
.figure.race-deepgnome .fig-head { transform: scale(1.000, 1.538); }
.figure.race-goblin { --skin: #75803d; }
.figure.race-goblin .fig-body { transform: scale(0.78, 0.58); }
.figure.race-goblin .fig-head { transform: scale(1.000, 1.345); }
.figure.race-lizardman { --skin: #4f8f3c; }
.figure.race-lizardman .fig-body { transform: scale(0.95, 1.05); }
.figure.race-lizardman .fig-head { transform: scale(1.053, 0.952); }

/* hunched races: head sits low and forward on the shoulders */
.figure.race-troll .fig-head { transform: translate(0, 9px) scale(0.845, 0.896); }
.figure.race-goblin .fig-head { transform: translate(0, 7px) scale(1.000, 1.345); }

/* ---------- official race sketches (brown ink on transparent -> tinted gold for the dark UI) ---------- */
.race-art-wrap { position: relative; width: 100%; height: 300px; display: flex; align-items: flex-end; justify-content: center; }
.race-art-wrap::after { content: ""; position: absolute; bottom: -4px; left: 50%; width: 220px; height: 18px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(240, 184, 74, 0.35), transparent); }
.race-art { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; position: relative; z-index: 1;
  filter: brightness(0) invert(1) sepia(1) saturate(2.4) hue-rotate(-12deg) brightness(0.98) drop-shadow(0 0 10px rgba(240, 184, 74, 0.25)); }
/* small races are drawn small in the line-up; keep them readable but still smaller */
.race-art-wrap.race-gnome .race-art, .race-art-wrap.race-deepgnome .race-art,
.race-art-wrap.race-goblin .race-art, .race-art-wrap.race-halfling .race-art { max-height: 74%; }
.race-art-wrap.race-dwarf .race-art, .race-art-wrap.race-deepdwarf .race-art { max-height: 82%; }
@media (max-width: 760px) { .race-art-wrap { height: 220px; } }

/* ---------- upgrades by camp level ---------- */
.con-unknown { color: #1a1306; background: var(--warn); border-color: var(--warn); }
.raid-badge { display: inline-flex; align-items: center; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 5px; color: #fecaca; background: rgba(220, 38, 38, 0.22); border: 1px solid rgba(248, 113, 113, 0.5); }
.legend .con { margin-right: 2px; }
.brackets { display: grid; gap: 10px; }
.bracket { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); }
.bracket > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; cursor: pointer; list-style: none; }
.bracket > summary::-webkit-details-marker { display: none; }
.bracket > summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
.bracket[open] > summary::before { transform: rotate(90deg); }
.bracket-title { font-weight: 700; letter-spacing: -0.01em; }
.bracket-count { margin-left: auto; font-size: 0.78rem; color: var(--muted); }
.bracket-current { border-color: rgba(240, 184, 74, 0.45); box-shadow: 0 0 0 3px var(--accent-soft); }
.bracket-below > summary .bracket-title, .bracket-out > summary .bracket-title { color: var(--text-2); }
.bracket-raid { border-color: rgba(248, 113, 113, 0.35); }
.bracket-unknown { border-color: rgba(251, 146, 60, 0.45); background: linear-gradient(180deg, rgba(251, 146, 60, 0.06), transparent), var(--bg-2); }
.bracket-unknown .bracket-title { color: var(--warn); }
.bracket-note { padding: 0 16px 6px; }
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; padding: 4px 16px 16px; }
.camp { border: 1px solid var(--border-2); border-radius: 12px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); overflow: visible; }
.camp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.camp-title { font-weight: 650; font-size: 0.92rem; display: grid; gap: 1px; }
.camp-title a { color: var(--text); text-decoration: underline dotted rgba(255, 255, 255, 0.3); text-underline-offset: 3px; }
.camp-zone { font-size: 0.72rem; font-weight: 500; color: var(--muted); }
.camp-badges { display: flex; gap: 6px; align-items: center; flex: none; }
.camp-unknown { border-color: rgba(251, 146, 60, 0.55); }
.camp-unknown .camp-title, .camp-unknown .camp-title a { color: var(--warn); }
.camp-raid { border-color: rgba(248, 113, 113, 0.45); }
.up-row { display: flex; gap: 10px; padding: 10px 12px; }
.up-row + .up-row { border-top: 1px solid var(--border); }
.up-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text-2); }
.up-icon img { width: 34px; height: 34px; border-radius: 6px; }
.up-icon .icon { width: 20px; height: 20px; opacity: 0.7; }
.up-main { min-width: 0; flex: 1; display: grid; gap: 4px; }
.up-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.up-name { font-weight: 600; font-size: 0.88rem; }
.up-sub { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 0.72rem; }
.slot-chip { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text-2); }
.slot-chip .icon { width: 12px; height: 12px; color: var(--accent); }
.diffs { display: flex; flex-wrap: wrap; gap: 4px; }
.diff-chip { font-size: 0.68rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.diff-chip.up { color: var(--good); background: var(--good-soft); }
.diff-chip.down { color: var(--bad); background: var(--bad-soft); }
.camp:hover { position: relative; z-index: 6; }

/* ---------- slot groups inside brackets ---------- */
.slot-groups { display: grid; gap: 8px; padding: 4px 14px 14px; }
.slot-group { border: 1px solid var(--border-2); border-radius: 11px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.slot-group > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; cursor: pointer; list-style: none; }
.slot-group > summary::-webkit-details-marker { display: none; }
.slot-group > summary::before { content: "▸"; color: var(--muted); font-size: 0.8rem; transition: transform 0.15s; }
.slot-group[open] > summary::before { transform: rotate(90deg); }
.sg-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.86rem; }
.sg-title .slot-icon { width: 15px; height: 15px; color: var(--accent); }
.sg-replaces { font-size: 0.74rem; color: var(--muted); }
.sg-replaces strong { color: var(--text-2); font-weight: 600; }
.sg-count { margin-left: auto; font-size: 0.7rem; font-weight: 800; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); padding: 0 7px; border-radius: 999px; }
.empty-pill { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 1px 6px; border-radius: 5px; }
.pair-note { margin: 0 12px 6px; font-size: 0.74rem; color: var(--muted); }
.pair-note.warn { color: #fed7aa; background: var(--warn-soft); border: 1px solid rgba(251, 146, 60, 0.3); padding: 6px 10px; border-radius: 8px; }
.sg-rows { border-top: 1px solid var(--border); }
.src-line { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.src-line a { color: var(--text-2); text-decoration: underline dotted rgba(255, 255, 255, 0.3); text-underline-offset: 2px; }
.src-unknown, .src-unknown a { color: var(--warn); }
.diff-chip.note { color: var(--warn); background: var(--warn-soft); }
.up-equip { align-self: center; }

/* ---------- slot page ---------- */
.slot-open {
  position: absolute; top: 6px; right: 34px; z-index: 3; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 7px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border-2);
  opacity: 0; transition: opacity 0.12s, color 0.12s, border-color 0.12s;
}
.slot-open .icon { width: 13px; height: 13px; }
.slot:hover .slot-open, .slot.pinned .slot-open, .slot-open:focus { opacity: 1; }
.slot:not(.filled) .slot-open { right: 6px; }
.slot-open:hover { color: var(--accent-2); border-color: var(--accent); }
.slot:focus-within .slot-open:not(:focus) { display: none; }
@media (hover: none) { .slot .slot-open { opacity: 0.85; } }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.back-link .icon { width: 14px; height: 14px; }
.slot-title { display: flex; align-items: center; gap: 10px; }
.title-slot-icon { width: 28px; height: 28px; color: var(--accent); }
.h-icon { width: 17px; height: 17px; margin-right: 6px; color: var(--accent); }
.slot-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .slot-layout { grid-template-columns: minmax(0, 1fr); } }
.equipped-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.up-icon.big { width: 54px; height: 54px; }
.up-icon.big img { width: 48px; height: 48px; }
.tip-static .tip { position: static; opacity: 1; visibility: visible; transform: none; width: auto; pointer-events: auto; box-shadow: none; }
.tip-static .tip::before { display: none; }
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 200px; }
.result-list { border: 1px solid var(--border); border-radius: 12px; overflow: visible; background: var(--bg-2); max-height: 640px; overflow-y: auto; }
.up-row.is-worn { background: var(--accent-soft); }
.loss { font-size: 0.78rem; font-weight: 700; color: var(--bad); background: var(--bad-soft); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }

/* ---------- plan / weights / share / alerts / tables ---------- */
.link-btn { background: none; border: 0; box-shadow: none; padding: 2px 6px; font-size: 0.74rem; font-weight: 600; color: var(--text-2); border-radius: 6px; cursor: pointer; text-decoration: none; }
.link-btn:hover { color: var(--accent-2); background: var(--surface-3); filter: none; }
.row-actions { display: flex; gap: 4px; margin-top: 2px; }
.twoh-note { font-size: 0.72rem; color: var(--warn); }
.src-line .ext { font-size: 0.72rem; text-decoration: none; color: var(--muted); }
.chip-good { color: var(--good); background: var(--good-soft); border-color: rgba(74, 222, 128, 0.3); }
.plan-list { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.plan-row { display: flex; gap: 10px; padding: 10px 12px; align-items: flex-start; }
.plan-row + .plan-row { border-top: 1px solid var(--border); }
.plan-row.done { opacity: 0.7; }
.plan-totals { margin-top: 12px; display: grid; gap: 6px; }
.alert-card { border-color: rgba(129, 140, 248, 0.4); background: linear-gradient(180deg, rgba(129, 140, 248, 0.08), transparent), var(--surface); }
.alert-list { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.alert-list .up-row + .up-row { border-top: 1px solid var(--border); }
.weights-form { display: grid; gap: 12px; }
.preset-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.preset-row label { margin: 0; min-width: 200px; }
.weight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.weight-grid label.stat { margin: 0; }
.weights-form > button { justify-self: start; }
.share-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .share-grid { grid-template-columns: minmax(0, 1fr); } }
.sub-h { font-size: 0.9rem; margin-bottom: 4px; }
.share-url { margin: 8px 0; font-family: var(--mono); font-size: 0.8rem; }
.score-tip { width: 360px; left: 0; transform: translate(0, 4px); }
.has-tip.hstat-score:hover .tip, .has-tip.hstat-score:focus .tip { transform: translate(0, 0); }
.hstat-score { cursor: help; }
.score-rows { display: grid; gap: 4px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.score-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--border); }
.sr-slot { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.sr-item { color: var(--text); font-size: 0.78rem; }
.sr-item small { display: block; color: var(--muted); font-size: 0.68rem; }
.score-row b { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table th { text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border-2); }
.data-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.data-table tr.total td { font-weight: 700; border-top: 1px solid var(--border-2); }
.data-table a { color: var(--text); text-decoration: underline dotted rgba(255, 255, 255, 0.3); text-underline-offset: 3px; }
.filter-form, .compare-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-form label, .compare-form label { margin: 0; min-width: 150px; flex: 1; }
.compare-form button, .filter-form button { flex: none; }
.cmp-head { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.cmp-item { display: flex; gap: 12px; align-items: center; }
.cmp-score { font-size: 1.3rem; font-weight: 700; color: var(--accent-2); }
.loot-item { display: flex; gap: 10px; align-items: center; margin: 4px 0 12px; }
.member-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.stat-val { font-variant-numeric: tabular-nums; font-size: 0.9rem; padding-right: 6px; }
.vital b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* gear-score tooltip opens downward over the page */
.hero-card { overflow: visible; }
.hero-main { border-radius: 18px 18px 0 0; }
.score-tip { top: calc(100% + 6px); bottom: auto; z-index: 60; }
.hero-stats { border-radius: 0 0 18px 18px; }
.has-tip.hstat-score .tip.score-tip { top: calc(100% + 6px); bottom: auto; left: 0; width: 380px; max-width: calc(100vw - 40px); }

/* ---------- gain breakdown tooltip + slot score badges ---------- */
.gain-wrap { position: relative; cursor: help; }
.gain-wrap .tip.gain-tip { left: auto; right: 0; bottom: calc(100% + 8px); top: auto; width: 320px; transform: translate(0, 4px);
  font-weight: 400; color: var(--text-2); text-transform: none; letter-spacing: 0; }
.gain-wrap:hover .tip.gain-tip, .gain-wrap:focus .tip.gain-tip { transform: translate(0, 0); }
.gain-tip > span { display: block; }
.gt-eq { display: grid !important; gap: 2px; margin: 4px 0 8px; font-size: 0.76rem; }
.gt-eq em { font-style: normal; color: var(--text); }
.gt-eq b { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.gt-total b { color: var(--good) !important; font-size: 0.9rem; }
.gt-table { display: grid !important; gap: 2px; padding: 6px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.gt-row { display: grid; grid-template-columns: 1fr 44px 44px 52px; gap: 6px; font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.gt-row span:not(:first-child) { text-align: right; }
.gt-row small { color: var(--muted); }
.gt-headrow { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.gt-row .pos { color: var(--good); font-weight: 700; } .gt-row .neg { color: var(--bad); font-weight: 700; }
.slot-score { position: absolute; right: 6px; bottom: 6px; z-index: 2; pointer-events: auto; cursor: help;
  font-size: 0.64rem; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0 5px; border-radius: 5px;
  color: var(--accent-2); background: rgba(10, 12, 16, 0.75); border: 1px solid rgba(240, 184, 74, 0.35); }
.slot-score.unknown { color: var(--warn); border-color: rgba(251, 146, 60, 0.45); }
.slot:focus-within .slot-score { visibility: hidden; }
.data-table .gain-wrap .tip.gain-tip { right: auto; left: 0; }
.slot.has-score { padding-bottom: 24px; }
.slot.has-score .slot-score { right: auto; left: 50%; transform: translateX(-50%); bottom: 5px; }

/* ---------- guild raids ---------- */
.tabs { display: flex; gap: 4px; margin: -8px 0 20px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check-row input { width: auto; margin: 0; }
.attend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; margin-bottom: 12px; }
.attend-grid label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.attend-grid input { width: auto; margin: 0; }
.drop-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.drop-row:first-child { border-top: 0; }
.drop-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.status-chip-rot { opacity: 0.7; }
@media (max-width: 640px) { .drop-row { grid-template-columns: 34px minmax(0, 1fr); } .drop-row .row-actions { grid-column: 1 / -1; } }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.user-chip a { padding: 2px 4px; color: inherit; }
.user-chip a:hover { color: var(--text); background: none; text-decoration: underline; }
.method-list { display: grid; gap: 10px; }
.method { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.method b { display: block; }

/* ---------- Discord login ---------- */
.btn.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; text-align: center; box-shadow: none; text-shadow: none; }
.btn.btn-discord:hover { background: #4752c4; border-color: #4752c4; color: #fff; filter: none; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ---------- admin ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { display: grid; gap: 2px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
a.tile:hover { border-color: var(--accent); }
.tile b { font-size: 1.8rem; line-height: 1.1; }
.tile span { font-weight: 600; }
.tile small { color: var(--muted); font-size: 0.8rem; }
.tile-alert { border-color: var(--accent); }
.thread { display: grid; gap: 12px; }
.msg { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); }
.msg-staff { border-color: rgba(240, 184, 74, 0.45); }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

/* Raid role tag (from stat weights) */
.role-tag { display: inline-flex; align-items: baseline; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; white-space: nowrap; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); }
.role-tank { color: #7cb7ff; border-color: rgba(124, 183, 255, 0.35); }
.role-healer { color: var(--good); border-color: rgba(74, 222, 128, 0.35); }
.role-melee-dps, .role-caster-dps { color: #ff8f7a; border-color: rgba(255, 143, 122, 0.35); }
.role-hybrid { color: var(--accent-2); border-color: rgba(240, 184, 74, 0.3); }
.demo-banner { margin-bottom: 18px; }
.up-icon.icon-tip { text-decoration: none; }
.up-icon.icon-tip:hover, .up-icon.icon-tip:focus { border-color: var(--accent-2); outline: none; }

/* Upgrade size in words, and the points shown small next to the stat changes */
.fit { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; border: 1px solid var(--border); }
.fit-best { color: var(--good); background: var(--good-soft); border-color: rgba(74, 222, 128, 0.35); }
.fit-good { color: var(--accent-2); background: var(--accent-soft); border-color: rgba(240, 184, 74, 0.3); }
.fit-minor { color: var(--text-2); background: var(--surface-3); }
.gain.gain-quiet { color: var(--text-2); background: transparent; font-weight: 500; padding: 0; font-size: 0.74rem; }
.who-for { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: 0.86rem; }
.who-for .role-tag { margin-right: 4px; }
.who-for .lead { font-weight: 700; }
.fit-off { color: var(--text-2); background: transparent; border-style: dashed; }
.off-note { color: var(--accent-2); }

/* Items that drop from raid targets: red icon border (plus the Raid badge) */
.up-row.is-raid .up-icon, .best-card.is-raid .best-icon { border: 2px solid rgba(248, 113, 113, 0.85); box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.3), 0 0 10px rgba(220, 38, 38, 0.25); }
.best-card.is-raid { border-color: rgba(248, 113, 113, 0.45); background: linear-gradient(135deg, rgba(220, 38, 38, 0.10), transparent 60%), linear-gradient(180deg, var(--surface-2), var(--surface)); }
.raid-icon-key { display: inline-block; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; border-radius: 4px; border: 2px solid rgba(248, 113, 113, 0.85); background: rgba(0, 0, 0, 0.35); }

/* MnM Atlas map link */
.atlas-link { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-2); font-size: 0.74rem; text-decoration: none; vertical-align: middle; }
.atlas-link .icon { width: 16px; height: 16px; }
.atlas-link:hover { text-decoration: underline; }

/* Stat weights under the character sheet (narrow column) */
.sheet-side { display: grid; gap: 0; min-width: 0; }
.weights-card .preset-row { flex-wrap: wrap; }
.weights-card .weight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Bigger, easier map pins in tooltips and item lists */
.tip .atlas-link, .src-line .atlas-link { padding: 3px 5px; margin: -3px 0; border-radius: 6px; }
.tip .atlas-link .icon, .src-line .atlas-link .icon { width: 18px; height: 18px; }
.tip .atlas-link:hover, .src-line .atlas-link:hover { background: var(--accent-soft); text-decoration: none; }
.best-icon.icon-tip { text-decoration: none; }
.best-icon.icon-tip:hover, .best-icon.icon-tip:focus { border-color: var(--accent-2); outline: none; }
.tip-ledger { display: block; margin-top: 6px; font-size: 0.74rem; color: var(--accent-2); }

/* Screenshot tool and contact */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-card { max-width: 720px; }
.btn-lg { font-size: 1.05rem; padding: 12px 22px; }
.ledger-ready { max-width: 760px; }

/* Home feed and site directory */
.site-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-list li { line-height: 1.4; }
.site-list .chip { margin-left: 6px; font-size: 0.7rem; }
.feed-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.feed-filter a { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.8rem; text-decoration: none; color: var(--text-2); }
.feed-filter a[aria-current="page"] { color: var(--accent-2); border-color: var(--accent-2); background: var(--accent-soft); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-day { margin: 14px 0 4px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.feed-row { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--border); }
.feed-kind { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.kind-item { color: var(--accent-2); } .kind-quest { color: #b39dff; } .kind-npc { color: #ff8f7a; }
.kind-zone { color: #7cb7ff; } .kind-drop { color: var(--good); } .kind-recipe { color: #e5c07b; }
.feed-links { display: inline-flex; gap: 10px; align-items: center; white-space: nowrap; }
@media (max-width: 640px) { .feed-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.table-scroll { overflow-x: auto; }
.compare-sites td.tick { text-align: center; }
.compare-sites th { white-space: nowrap; font-size: 0.78rem; }
.compare-sites .us-row td { background: var(--accent-soft); }
.site-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.site-card .card-head h2 a { text-decoration: none; }
.site-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 0.86rem; }
.site-facts dt { color: var(--muted); }
.site-facts dd { margin: 0; }

/* Home: community sites on the left, the feed in the middle */
.hub-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.hub-side { position: sticky; top: 16px; }
.side-tool { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 5px 10px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 600; color: var(--accent-2); background: var(--accent-soft); border: 1px solid rgba(240, 184, 74, 0.25); text-decoration: none; }
.side-tool .icon { width: 14px; height: 14px; }
.side-tool:hover { border-color: var(--accent-2); }
@media (max-width: 900px) { .hub-layout { grid-template-columns: minmax(0, 1fr); } .hub-side { position: static; } }
.side-group { margin: 14px 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.side-group:first-of-type { margin-top: 0; }

/* Item / NPC pages and search */
.item-static .tip { position: static; opacity: 1; visibility: visible; transform: none; pointer-events: auto; width: auto; max-width: none; box-shadow: none; }
.elsewhere-links { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.elsewhere-links a { display: inline-block; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; font-size: 0.86rem; }
.elsewhere-links a:hover { border-color: var(--accent-2); }
.change-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.nav-search input { width: 170px; padding: 5px 10px; font-size: 0.82rem; }
@media (max-width: 700px) { .nav-search { display: none; } }
.kind-change { color: #f0a35e; }
.card-preview { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.kind-picks { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* Screenshot review / card: plain slot list */
.gear-list { list-style: none; margin: 0; padding: 0; }
.gear-row { display: grid; grid-template-columns: 40px 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.gear-row:first-child { border-top: 0; }
.gear-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text-2); }
.gear-icon img { width: 32px; height: 32px; border-radius: 5px; }
.gear-icon .icon { width: 18px; height: 18px; opacity: 0.6; }
.gear-icon.icon-tip { text-decoration: none; }
.gear-slot { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.gear-input { width: 100%; }
.gear-row.empty .gear-name { color: var(--muted); }
.gear-row.needs-check .gear-input { border-color: var(--accent-2); }
.gear-note { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: flex-end; font-size: 0.76rem; }
.gear-note .note.issue { color: var(--accent-2); }
@media (max-width: 640px) { .gear-row { grid-template-columns: 40px minmax(0, 1fr); } .gear-slot { grid-column: 2; } .gear-input, .gear-name { grid-column: 1 / -1; } .gear-note { grid-column: 1 / -1; justify-content: flex-start; } }

/* Feed kind labels on parchment cards: darker inks so they read on the sand background */
.card .kind-item { color: #8a4a12; }
.card .kind-change { color: #8a3f12; }
.card .kind-quest { color: #5b3fa0; }
.card .kind-npc { color: #a3322a; }
.card .kind-zone { color: #23558f; }
.card .kind-recipe { color: #6b5212; }
.card .kind-drop { color: #30591c; }
.card .feed-kind { font-weight: 800; }
