/* Site palette: aliases onto the UI-kit tokens (ui.css). */
:root {
  --bg: var(--ui-bg);
  --surface: var(--ui-panel);
  --surface-2: var(--ui-panel-2);
  --border: var(--ui-gold-dark);
  --text: var(--ui-text);
  --muted: var(--ui-muted);
  --accent: var(--ui-gold);
  --green: #6a9a55;
  --amber: var(--ui-amber);
  --red: #c25a50;
  --blue: #6f8fc0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

header {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(var(--ui-panel-2), var(--ui-panel));
  border-bottom: 1px solid var(--ui-gold-dim);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.brand {
  font-family: var(--ui-display-font);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

h1,
h2 {
  font-family: var(--ui-display-font);
  letter-spacing: 0.04em;
}

nav a {
  color: var(--text);
  text-decoration: none;
  margin-right: 1rem;
}

nav a:hover {
  color: var(--accent);
}

main {
  width: 100%;
  padding: 1.5rem;
}

h1 {
  color: var(--accent);
  font-size: 1.6rem;
}

h2 {
  color: var(--accent);
  font-size: 1.15rem;
  margin-top: 2rem;
}

.lede {
  color: var(--text);
  max-width: 48rem;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

a {
  color: var(--accent);
}

/* Breadcrumbs */

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs span {
  margin: 0 0.25rem;
}

/* Category card grid */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  display: block;
  background: var(--ui-panel);
  border: 12px solid transparent;
  border-image: url("../ui/panel.svg") 28 / 12px stretch;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.card:hover {
  box-shadow: var(--ui-glow);
  background: var(--ui-panel-2);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.card p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

/* Subcategory rows */

.rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.row-card {
  display: block;
  background: var(--ui-panel);
  border: 12px solid transparent;
  border-image: url("../ui/panel.svg") 28 / 12px stretch;
  padding: 0.35rem 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.row-card:hover {
  box-shadow: var(--ui-glow);
  background: var(--ui-panel-2);
}

.row-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: var(--accent);
}

.row-card p {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

/* Badges */

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  vertical-align: middle;
}

.badge.st-planned { color: var(--muted); }
.badge.st-sample { color: var(--amber); border-color: var(--amber); }
.badge.st-imported { color: var(--green); border-color: var(--green); }

.badge.src-alive { color: var(--green); border-color: var(--green); }
.badge.src-fragile { color: var(--amber); border-color: var(--amber); }
.badge.src-archive-only { color: var(--blue); border-color: var(--blue); }
.badge.src-dead { color: var(--red); border-color: var(--red); }
.badge.src-not-applicable { color: var(--muted); }

.badge.role-primary { color: var(--green); border-color: var(--green); }
.badge.role-secondary { color: var(--blue); border-color: var(--blue); }
.badge.role-reference { color: var(--muted); }

.star {
  color: var(--accent);
  margin-left: 0.25rem;
}

/* Buttons */

.button,
.filters button,
.pager a {
  display: inline-block;
  padding: 0.42rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--ui-text);
  background: linear-gradient(#262630, #101016);
  border: 1px solid var(--ui-gold-dim);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
              0 1px 3px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  text-decoration: none;
}

.button:hover,
.filters button:hover,
.pager a:hover {
  border-color: var(--ui-gold);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--ui-glow);
}

.button {
  background: linear-gradient(#c39a3a, #6e5518);
  border-color: var(--ui-gold-bright);
  color: #171106;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.button:hover {
  color: #000;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
}

th,
td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:last-child td {
  border-bottom: none;
}

td.nowrap {
  white-space: nowrap;
}

th.sortable a {
  color: var(--muted);
  text-decoration: none;
}

th.sortable a:hover {
  color: var(--accent);
}

th.sortable.sorted a {
  color: var(--accent);
}

th .arrow {
  font-size: 0.7em;
}

/* Client-side sorted tables (sorttable.js) */

table.js-sort th.sortable {
  color: var(--muted);
  user-select: none;
}

table.js-sort th.sortable:hover {
  color: var(--accent);
}

table.js-sort th.sorted {
  color: var(--accent);
}

table.js-sort th.sorted-desc::after {
  content: " \25BC";
  font-size: 0.7em;
}

table.js-sort th.sorted-asc::after {
  content: " \25B2";
  font-size: 0.7em;
}

/* Equipment browser table: one wide descriptive column, tight numeric
   columns. Zebra rows, sorted-column tint, sticky header. */

.equiptable {
  margin-top: 0.75rem;
}

table.equipment th,
table.equipment td {
  padding: 0.4rem 0.6rem;
  border-bottom: none;
}

table.equipment thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

th.num-h,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
}

table.equipment tbody tr:nth-child(even) {
  background: var(--surface-2);
}

td.sorted-col,
table.equipment th.sorted {
  background: rgba(212, 175, 83, 0.09);
}

.item-cell a {
  font-weight: 600;
}

.item-sub {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  margin-top: 1px;
}

.item-sub .badge {
  font-size: 0.6rem;
  padding: 0 0.3rem;
  vertical-align: baseline;
}

td.does {
  font-size: 0.82rem;
  max-width: 24rem;
}

code {
  color: var(--accent);
  font-size: 0.9em;
}

/* Header search */

header {
  flex-wrap: wrap;
}

.scopebadge {
  margin-left: auto;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: center;
}

.headsearch input,
.filters input,
.filters select {
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  box-shadow: var(--ui-inset-shadow);
}

.filters select {
  appearance: none;
  padding-right: 1.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d4af53' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}

.headsearch input {
  width: 16rem;
}

.headsearch input:focus,
.filters input:focus,
.filters select:focus,
.homesearch input:focus,
.bslot input:focus {
  outline: none;
  border-color: var(--ui-gold);
  box-shadow: var(--ui-inset-shadow), var(--ui-glow);
}

/* List filters */

.filters {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

/* .filters button styling lives with .button in the Buttons section. */

/* Entity stat card */

.statcard {
  background: var(--ui-panel);
  border: 14px solid transparent;
  border-image: url("../ui/panel-ornate.svg") 36 / 14px stretch;
  padding: 0.4rem 0.8rem;
  margin: 1rem 0;
  max-width: 34rem;
  line-height: 1.7;
}

.statcard .muted {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

/* Era addendum box */

.addendum {
  background: var(--surface-2);
  border: 1px solid var(--amber);
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  margin: 1rem 0;
  max-width: 34rem;
}

.addendum h3 {
  margin: 0 0 0.4rem;
  color: var(--amber);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.addendum ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

/* Book / lore text */

.booktext {
  background: var(--ui-panel);
  border: 12px solid transparent;
  border-image: url("../ui/panel.svg") 28 / 12px stretch;
  padding: 0.6rem 0.9rem;
  max-width: 40rem;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

/* Zone map widget */

.zonemap {
  margin: 1rem 0;
}

.zonemap h3 {
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.4rem;
}

.zonemap canvas {
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 100%;
}

/* Spell effect list */

.spelldesc {
  font-style: italic;
}

.fxlist {
  background: var(--ui-panel);
  border: 12px solid transparent;
  border-image: url("../ui/panel.svg") 28 / 12px stretch;
  padding: 0.5rem 0.9rem 0.5rem 2.2rem;
  max-width: 34rem;
  margin: 0.5rem 0;
}

.fxlist li {
  padding: 0.1rem 0;
}

/* Character builder */

.builder-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.builder-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  flex: 1;
}

.bslot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  position: relative;
}

.bslot-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.bslot-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bslot-remove {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.2rem;
}

.bslot-item {
  min-height: 2.4rem;
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.bslot-item .item-sub {
  font-size: 0.75rem;
}

.bslot input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

.bslot input:focus {
  outline: none;
  border-color: var(--accent);
}

.bslot-results {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 100%;
  z-index: 10;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 4px;
  max-height: 16rem;
  overflow-y: auto;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.bslot-result {
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.bslot-result:hover {
  background: var(--surface);
}

.bslot-result strong {
  display: block;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.bslot-result .muted {
  font-size: 0.72rem;
}

.builder-totals {
  position: sticky;
  top: 1rem;
  background: var(--ui-panel);
  border: 14px solid transparent;
  border-image: url("../ui/panel-ornate.svg") 36 / 14px stretch;
  padding: 0.4rem 0.8rem;
  min-width: 15rem;
}

.builder-totals h3 {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.builder-totals table {
  border: none;
  background: none;
  width: 100%;
}

.builder-totals td {
  border: none;
  padding: 0.15rem 0.4rem 0.15rem 0;
  font-size: 0.9rem;
}

.builder-totals td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* EQ item hover tooltip */

.eq-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  max-width: 420px;   /* two stat columns need more room than one list */
}

.eq-card {
  background: rgba(8, 10, 20, 0.97);
  border: 1px solid var(--ui-gold);
  outline: 1px solid var(--ui-gold-dark);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #e8e4d6;
}

/* Laid out like the in-game item window: icon beside the header block,
   then two aligned label/value columns. See _item_card.html. */
.eq-card .eq-head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.eq-card .eq-head .eqicon {
  flex: none;
  margin: 2px 0 0;
}

.eq-card .eq-headtext {
  min-width: 0;
}

.eq-card .eq-name {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.eq-card .eq-flags {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.eq-card .eq-stats {
  display: flex;
  gap: 1.6rem;
  margin-top: 0.6rem;
}

.eq-card .eq-col {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 0.7rem;
  align-content: start;
}

.eq-card .eq-col .k {
  color: var(--muted);
}

/* Values right-aligned so the numbers form a column, the way the game
   window reads. */
.eq-card .eq-col .v {
  text-align: right;
  white-space: nowrap;
}

.eq-card .eq-foot {
  margin-top: 0.5rem;
  color: var(--ui-gold-dim);
}

.eq-card .eq-effect {
  color: #b8d4e8;
}

/* Pager */

.pager {
  display: flex;
  gap: 1.5rem;
  margin: 1rem 0;
}

/* Home stat strip */

.statstrip {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.statstrip strong {
  color: var(--accent);
  font-weight: 600;
}

.homesearch {
  margin: 1.5rem 0;
}

.homesearch input {
  width: 100%;
  max-width: 34rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
}

.homesearch input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Collapsible data sections (static/js/collapse.js) */
.collapse-h {
  cursor: pointer;
  user-select: none;
}

.collapse-h::before {
  content: "\25B8";
  display: inline-block;
  width: 1em;
  color: var(--accent);
  transition: transform 0.12s ease;
}

.collapse-h[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.collapse-h:hover {
  color: var(--accent);
}

/* Zone connections strip: always visible, sits above the map, no
 * heading element so collapse.js leaves it alone. */
.connections {
  background: var(--ui-panel);
  border: 14px solid transparent;
  border-image: url("../ui/panel-ornate.svg") 36 / 14px stretch;
  padding: 0.5rem 0.8rem;
  margin: 1rem 0;
}

.conn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.conn-row + .conn-row {
  margin-top: 0.55rem;
}

.conn-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-right: 0.35rem;
}

.conn-chip {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
}

.conn-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.conn-chip.conn-in {
  opacity: 0.75;
}

/* Builder exaltation planner */
.builder-exalts {
  margin-top: 1.5rem;
}

.bx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin: 0.6rem 0;
}

.bx-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.bx-row {
  margin: 0.25rem 0;
  line-height: 1.6;
}

/* ===================================================================
   Redesign pass (docs/everbase-ux-strategy.md + everbase-zone-mockup)
   Centered container, grouped nav with typeahead, zone hero, and the
   two-column detail layout with a persistent right rail.
   =================================================================== */

header {
  display: block;
  padding: 0;
}

.hwrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

/* ---- grouped nav ---- */

.navtoggle {
  display: none;
  background: none;
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  color: var(--ui-gold);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

nav {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.navgroup {
  position: relative;
}

.navgroup-btn {
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.3rem 0.65rem;
  border-radius: 3px;
  cursor: pointer;
}

.navgroup-btn small {
  color: var(--muted);
  font-size: 0.65rem;
  vertical-align: 2px;
  margin-left: 2px;
}

.navgroup-btn:hover,
.navgroup.open .navgroup-btn {
  color: var(--accent);
}

.navgroup.active .navgroup-btn {
  color: var(--accent);
  background: rgba(212, 175, 83, 0.09);
  box-shadow: inset 0 -2px 0 var(--ui-gold-dim);
}

.navmenu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 13rem;
  z-index: 60;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-gold);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  padding: 0.25rem;
}

.navgroup.open .navmenu {
  display: block;
}

.navmenu a {
  display: block;
  padding: 0.35rem 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 3px;
}

.navmenu a:hover {
  background: var(--ui-panel);
  color: var(--accent);
}

/* ---- header search + typeahead ---- */

.headsearch {
  position: relative;
}

/* Home page: the search box is the page. */
.homehero {
  max-width: 40rem;
  margin: 0 auto;
  padding: 14vh 1rem 0;
  text-align: center;
}

.homehero h1 {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  letter-spacing: 0.06em;
  margin: 0;
}

.homehero .muted {
  margin: 0.2rem 0 2rem;
}

.headsearch.homebox input {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
}

.headsearch.homebox .typeahead {
  text-align: left;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .homehero {
    padding-top: 8vh;
  }
}

.typeahead {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 20rem;
  z-index: 60;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-gold);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  font-size: 0.85rem;
  max-height: 70vh;
  overflow-y: auto;
}

.ta-group {
  padding: 0.25rem 0.6rem;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--ui-inset);
}

.typeahead a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.32rem 0.6rem;
  color: var(--text);
  text-decoration: none;
}

.typeahead a:hover,
.typeahead a.sel {
  background: var(--ui-panel);
}

.typeahead a b {
  color: var(--accent);
  font-weight: 600;
}

.typeahead a span {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* ---- zone hero ---- */

.hero {
  background: var(--ui-panel);
  border: 14px solid transparent;
  border-image: url("../ui/panel-ornate.svg") 36 / 14px stretch;
  padding: 1rem 1.4rem;
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.hero h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.04em;
}

.hero .sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.hero .sub code {
  color: var(--accent);
  font-size: 0.9em;
}

.hero .stats {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.hero .stat {
  min-width: 7rem;
}

.hero .stat .k {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero .stat .v {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.lvlbar {
  height: 10px;
  width: 10rem;
  margin-top: 0.3rem;
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.lvlbar span {
  display: block;
  height: 100%;
  background: linear-gradient(#c39a3a, #6e5518);
}

/* ---- two-column detail layout ---- */

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.5rem;
  align-items: start;
}

.cols > div > section {
  margin: 0 0 1.5rem;
}

.rail > div {
  background: var(--ui-panel);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.1rem;
}

.rail h3 {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.rail .conn-chip {
  font-size: 0.82rem;
}

.fac {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.85rem;
  padding: 0.2rem 0;
}

.fac .pos {
  color: var(--ui-green);
  font-variant-numeric: tabular-nums;
}

.fac .neg {
  color: var(--ui-red);
  font-variant-numeric: tabular-nums;
}

.note {
  font-size: 0.78rem;
  color: var(--muted);
  border-left: 2px solid var(--amber);
  padding-left: 0.6rem;
}

/* ---- table affordances ---- */

.showall {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.45rem;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-gold-dark);
  border-top: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.showall:hover {
  color: var(--ui-gold-bright);
  box-shadow: var(--ui-glow);
}

.dropbar {
  display: inline-block;
  vertical-align: middle;
  width: 5.5rem;
  height: 7px;
  margin-right: 0.4rem;
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 2px;
  overflow: hidden;
}

.dropbar span {
  display: block;
  height: 100%;
  background: linear-gradient(#4f77c2, #223d6e);
}

/* ---- responsive ---- */

@media (max-width: 900px) {
  .cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero .stats {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .hwrap {
    padding: 0.6rem 0.9rem;
    gap: 0.7rem;
  }

  .navtoggle {
    display: block;
    order: 2;
    margin-left: auto;
  }

  .scopebadge {
    order: 3;
  }

  nav {
    order: 5;
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
  }

  nav.open {
    display: flex;
  }

  .navgroup-btn {
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.4rem;
  }

  .navmenu {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--ui-gold-dark);
    border-radius: 0;
    margin: 0 0 0.4rem 0.6rem;
    background: none;
  }

  .headsearch {
    order: 4;
    width: 100%;
  }

  .headsearch input {
    width: 100%;
  }

  main {
    padding: 1rem 0.9rem 2.5rem;
  }

  .hero {
    border-width: 10px;
    border-image-width: 10px;
    padding: 0.8rem;
    gap: 1rem;
  }

  .hero h1 {
    font-size: 1.4rem;
  }

  .hero .stats {
    gap: 1.1rem;
  }

  .statcard,
  .connections {
    max-width: none;
  }
}

/* ---- phase 2: sticky headers, sticky rail, item-quality colour ---- */

/* Sticky table headers site-wide. .table-wrap only becomes a scroll
   container on small screens, because a scroll container would anchor
   sticky headers to itself instead of the viewport. */
.table-wrap {
  overflow-x: visible;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--border);
}

.rail-sticky {
  position: sticky;
  top: 1rem;
}

.rail .eq-card {
  width: 100%;
  min-width: 0;
  position: static;
}

/* Item quality: magic items read differently in lists, as in-game. */
a.q-magic {
  color: #b8d4e8;
}

/* NPC kill card: resist row reads as a grid, not a sentence. */
.killgrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(3.2rem, 1fr));
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.killgrid div {
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  padding: 0.15rem 0.35rem;
  text-align: center;
}

.killgrid .k {
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.killgrid .v {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .table-wrap {
    overflow-x: auto;
  }

  thead th {
    position: static;
  }

  .rail-sticky {
    position: static;
  }
}

/* Live-filter forms keep their submit button as a no-JS fallback, but
   it stops being the primary affordance once JS is running. */
.filters button.visually-optional {
  opacity: 0.65;
}

.filters button.visually-optional:hover {
  opacity: 1;
}

/* ===================================================================
   Phase 3 — realize the fantasy kit
   =================================================================== */

.icon-sprite {
  display: none;
}

.ico {
  width: 17px;
  height: 17px;
  vertical-align: -3px;
  margin-right: 0.4rem;
  fill: var(--ui-gold-dim);
  stroke: var(--ui-gold-dim);
  stroke-width: 0.5;
  flex: none;
}

tr:hover .ico {
  fill: var(--accent);
  stroke: var(--accent);
}

.ico-bow,
.ico-scroll {
  stroke: var(--ui-gold-dim);
}

/* Item quality colouring, EQ-style. */
a.q-magic { color: #b8d4e8; }
a.q-lore  { color: #c9a6e8; }
a.q-magic:hover,
a.q-lore:hover { color: var(--ui-gold-bright); }

/* Ornamental divider between page sections. */
main h2 {
  position: relative;
}

.cols h2::after,
main > h2::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.3rem;
  height: 1px;
  background: linear-gradient(90deg,
    var(--ui-gold-dark), transparent 65%);
}

/* Unlock trackers on the achievement pages. */
.trackbar {
  max-width: 26rem;
  margin: 0.2rem 0 0.4rem;
}

.ui-check {
  accent-color: var(--ui-gold-dim);
  width: 15px;
  height: 15px;
}

/* Illustrated category banners on the home grid. */
.cards .card {
  position: relative;
  padding-left: 3.6rem;
  border-image: url("../ui/panel.svg") 28 / 12px stretch;
}

.cards .card::before {
  content: "";
  position: absolute;
  left: 0.9rem;
  top: 1rem;
  width: 26px;
  height: 26px;
  background: linear-gradient(160deg, var(--ui-gold-dim), transparent 70%);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7);
}

.cards .card:hover::before {
  background: linear-gradient(160deg, var(--accent), transparent 70%);
}

/* ---- accessibility / polish sweep ---- */

/* --ui-muted (#978e78) on the panel background sits near 5.0:1, but it
   is used for small 0.68-0.8rem label text; nudge it brighter so the
   smallest type clears 4.5:1 comfortably. */
:root {
  --ui-muted: #a99f86;
}

caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0 0 0.3rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Skeleton rows while the builder's async searches resolve. */
.skeleton {
  padding: 0.4rem 0.6rem;
}

.skeleton span {
  display: block;
  height: 0.7rem;
  margin: 0.35rem 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ui-panel-2),
    var(--ui-gold-dark), var(--ui-panel-2));
  background-size: 200% 100%;
  animation: skeleton-sweep 1.1s ease-in-out infinite;
}

.skeleton span:nth-child(2) { width: 70%; }
.skeleton span:nth-child(3) { width: 45%; }

@keyframes skeleton-sweep {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .skeleton span {
    background: var(--ui-panel-2);
  }
}

/* Map point labels: dots on the canvas, name on hover (zonemap.js). */
.zonemap {
  position: relative;
}

.maptip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  max-width: 16rem;
  padding: 0.15rem 0.45rem;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-gold);
  border-radius: 3px;
  color: var(--ui-text);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.maptip.marker {
  border-color: #b3161b;
  color: #e8a9a5;
}

/* Full-screen map overlay (zonemap.js). Clicking the map opens it;
   clicking the margin outside the panel, the close button, or Escape
   closes it. */
.zonemap canvas {
  cursor: zoom-in;
}

body.modal-open {
  overflow: hidden;
}

.mapmodal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  padding: 2.5rem;
  background: rgba(4, 4, 8, 0.82);
}

.mapmodal-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  background: var(--ui-panel);
  border: 1px solid var(--ui-gold-dim);
  border-radius: 4px;
  padding: 0.7rem 0.8rem 0.8rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.mapmodal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.1rem 0.2rem 0.5rem;
  color: var(--accent);
  font-family: var(--ui-display-font);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
}

/* Floor picker in the map overlay. Only rendered for zones whose map
   geometry actually separates into levels (everbase/maps.py). */
/* In-game item icons, cut from the client's dragitem sheets into one
   sprite by importers/item_icons.py. The file is absent unless built,
   so nothing here applies on a fresh checkout. */
.eqicon {
  display: inline-block;
  width: 40px;
  height: 40px;
  margin: -6px 0.35rem -12px 0;
  vertical-align: middle;
  background-image: url("../img/item-icons.png");
  background-repeat: no-repeat;
  image-rendering: -webkit-optimize-contrast;
}

/* Your data page: backup tools and the revision list. */
.datatools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}

.datatools label {
  cursor: pointer;
}

#import-status.bad {
  color: var(--danger, #b3161b);
}

.histline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.25rem 0;
  border-top: 1px solid var(--ui-gold-dark);
  font-size: 0.8rem;
}

.histline code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

/* "Drops in" chips on the equipment browser. Each links to the zone and
   hovers the mobs there that drop that item (game.item_droppers). */
.dropzones {
  white-space: normal;
  max-width: 18rem;
}

/* A zone name never breaks across lines - "Accursed Temple of
   CazicThule" wrapping to three lines triples the row height. Two
   chips stack at worst. */
.zonechip {
  display: inline-block;
  white-space: nowrap;
  margin: 0 0.2rem 0.15rem 0;
  padding: 0.05rem 0.35rem;
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  font-size: 0.76rem;
  line-height: 1.5;
  text-decoration: none;
}

.zonechip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.eq-chance {
  float: right;
  margin-left: 1rem;
  color: var(--ui-gold);
}

.mapfloors {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
  margin-right: 0.6rem;
}

.mapfloors button {
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  color: var(--ui-text);
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  min-width: 2rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.mapfloors button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mapfloors button.on {
  background: var(--ui-gold-dark);
  border-color: var(--ui-gold);
  color: var(--ui-gold-bright);
}

.mapmodal-close {
  background: none;
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.05rem 0.5rem 0.2rem;
  cursor: pointer;
}

.mapmodal-close:hover {
  color: var(--ui-gold-bright);
  border-color: var(--accent);
  box-shadow: var(--ui-glow);
}

.mapmodal-body {
  flex: 1;
  min-height: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mapmodal-body canvas {
  cursor: default;
  border: none;
  border-radius: 4px;
}

@media (max-width: 720px) {
  .mapmodal {
    padding: 1rem;
  }

  .mapmodal-panel {
    padding: 0.5rem;
  }
}

/* ---- world atlas (static/js/atlas.js) ---- */

.atlas {
  position: relative;
  margin: 1rem 0;
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 4px;
  overflow: hidden;
}

.atlas canvas {
  display: block;
  width: 100%;
  cursor: grab;
  touch-action: none;
}

.atlas-controls {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.atlas-controls button {
  background: linear-gradient(#262630, #101016);
  border: 1px solid var(--ui-gold-dim);
  border-radius: 3px;
  color: var(--ui-text);
  font: inherit;
  font-size: 0.85rem;
  min-width: 1.9rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.atlas-controls button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.atlas-find {
  background: var(--ui-inset);
  border: 1px solid var(--ui-gold-dark);
  border-radius: 3px;
  color: var(--ui-text);
  padding: 0.25rem 0.55rem;
  font-size: 0.85rem;
  width: 11rem;
}

.atlas-find:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ui-glow);
}

.atlas-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 0.25rem 0.55rem;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-gold);
  border-radius: 3px;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.atlas-tip b {
  display: block;
  color: var(--accent);
}

.atlas-tip span {
  color: var(--muted);
  font-size: 0.75rem;
}

.atlas-legend {
  position: absolute;
  left: 0.7rem;
  bottom: 0.6rem;
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(8, 8, 12, 0.72);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
}

.atlas-legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 0.3rem;
  vertical-align: -1px;
  border-radius: 2px;
}

.atlas-legend .sw-over {
  background: #1d2436;
  border: 1px solid #4a6a92;
}

.atlas-legend .sw-dung {
  background: #2a1f2e;
  border: 1px solid #8a5a72;
}

.atlas-legend .sw-npc {
  width: 9px;
  height: 9px;
  background: #b3161b;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
}

.atlas-legend .sw-line {
  height: 0;
  border-top: 2px solid #8a6f33;
  border-radius: 0;
  vertical-align: 3px;
}

@media (max-width: 720px) {
  .atlas-legend .atlas-hint {
    display: none;
  }

  .atlas-find {
    width: 7rem;
  }
}

/* Map points that name an NPC are clickable in the expanded overlay. */
.maptip.npc {
  border-color: var(--ui-gold-bright);
  color: var(--ui-gold-bright);
}

/* ---- what you own -----------------------------------------------------

   Inventory counts appear beside items all over the site (item cards,
   the race-unlock shopping list, the Sky planner), so the count itself
   is one class used everywhere rather than a variant per page. */

.owned {
  color: var(--green);
  font-weight: 600;
}

/* Only the inline "x3" mark holds itself together; the block-level uses
   of .owned carry a sentence and have to wrap like one. */
span.owned {
  white-space: nowrap;
}

/* Sky quest planner */

.skycls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem 0.15rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  font-size: 0.85rem;
  cursor: pointer;
}

.skycls:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
}

.sky-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.sky-short {
  color: var(--red);
  font-weight: 600;
}

.sky-held {
  color: var(--green);
}

.sky-done td {
  opacity: 0.45;
}

/* Character import, on the data page */

.charlist {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

.charlist li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.charlist .who {
  font-weight: 600;
}

.charlist .active-mark {
  color: var(--green);
}

/* Builder profiles */

.bprofiles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.bslot.from-inventory {
  border-color: var(--green);
}

.bslot-owned {
  font-size: 0.75rem;
  color: var(--green);
}

/* Dragging an inventory export anywhere on the page imports it. */
body.dropping {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

/* Count marks are injected next to item links after the page renders
   (static/js/inventory.js), so they need to sit tight against the link
   rather than participate in the surrounding layout. */
a + .owned {
  margin-left: 0.25rem;
  font-size: 0.85em;
}

/* Import confirmation for a drop that happened away from the data page.
   Above the map overlay (200), since you can drop a file onto the site
   while it is open; below the hover tooltip (1000), which is transient
   and follows the cursor. */
#inv-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 300;
  max-width: min(40rem, 92vw);
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface-2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  font-size: 0.9rem;
}

#inv-toast.bad {
  border-color: var(--red);
  color: var(--red);
}

/* ---- quests -----------------------------------------------------------

   Trade rows hold several item links per cell, so each one stays whole
   rather than breaking mid-name across a line. */

table.quests td {
  vertical-align: top;
}

.qitem {
  display: inline-block;
  white-space: normal;
}

table.quests td:last-child {
  color: var(--accent);
}

table.quests td:last-child .muted {
  color: var(--muted);
}

/* Required quantity on a turn-in, kept distinct from the green owned
   mark that inventory.js appends on the other side of the name. */
.qty {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
