/* Guildrun Wiki — taskbarhero-inspired compact database shell.
   Dark iron panels, deep red headers, gold hierarchy. No external assets. */

:root {
  --bg: #12100e;
  --bg-soft: #1a1613;
  --panel: #211c17;
  --panel-raised: #2a241d;
  --panel-deep: #0c0a08;
  --header: #6e1d1d;
  --header-deep: #521414;
  --gold: #d2a24c;
  --gold-dim: #9a7838;
  --text: #efe6d8;
  --muted: #b3a48e;
  --faint: #8a7c68;
  --line: #3d342a;
  --line-strong: #57493a;
  --term: #8fc7e8;
  --ph: #e8b34c;
  --warn-bg: #2e2413;
  --shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
  --radius: 3px;
  --font-body: "Iowan Old Style", "Palatino", "Palatino Linotype", Georgia, serif;
  --font-ui: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(110, 29, 29, 0.18), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 14px;
  background: linear-gradient(180deg, var(--header), var(--header-deep));
  border-bottom: 2px solid var(--gold-dim);
  box-shadow: var(--shadow);
}
.topbar .brand {
  display: flex;
  flex-shrink: 0;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  color: var(--text);
  white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; }
.topbar .brand .tb {
  color: var(--gold);
  font-size: 12px;
  border: 1px solid var(--gold-dim);
  padding: 1px 5px;
  border-radius: var(--radius);
  letter-spacing: 0.12em;
}
.menu-toggle {
  display: none;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}
.searchbox {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 460px;
  margin-left: auto;
}
.searchbox input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 12px;
  background: var(--panel-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}
.searchbox input::placeholder { color: var(--faint); }
.searchbox kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 5px;
  pointer-events: none;
}
.search-results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow: auto;
  background: var(--panel-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.search-results[hidden] { display: none; }
.search-results a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.search-results a:hover, .search-results a.active {
  background: var(--header-deep);
  text-decoration: none;
}
.search-results .cat {
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}
.search-results .empty {
  padding: 12px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 13px;
}
.lang-toggle {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-ui);
}
.lang-toggle button {
  min-width: 44px;
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--gold);
  color: #1c130a;
  font-weight: 700;
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  max-width: 1240px;
  margin: 18px auto;
  padding: 0 14px;
}
.sidebar {
  position: sticky;
  top: 70px;
  align-self: start;
  max-height: calc(100vh - 88px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sidebar .side-head {
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--header), var(--header-deep));
  border-bottom: 1px solid var(--gold-dim);
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
  text-transform: uppercase;
}
.sidebar nav a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 14px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.sidebar nav a:hover { background: var(--panel-raised); text-decoration: none; }
.sidebar nav a[aria-current="page"] {
  background: var(--header-deep);
  box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar nav .count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 29;
}

/* ---------- content panels ---------- */
.content { min-width: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.panel > .panel-head {
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--header), var(--header-deep));
  border-bottom: 1px solid var(--gold-dim);
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 14px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.panel > .panel-head .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}
.panel > .panel-body { padding: 14px 16px; }

.hero-title {
  margin: 0 0 6px;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.hero-title .zh { color: var(--muted); font-size: 0.55em; margin-left: 10px; }
.lede { color: var(--muted); max-width: 62ch; }

/* category cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.cards a {
  display: block;
  padding: 12px 14px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
}
.cards a:hover { border-color: var(--gold-dim); text-decoration: none; }
.cards .n {
  display: block;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--gold);
}
.cards .lbl { font-weight: 600; }
.cards .zh-lbl { color: var(--faint); font-size: 12px; margin-left: 6px; }

/* entity list rows */
.filter-row { margin-bottom: 10px; }
.filter-row input {
  width: 100%;
  max-width: 380px;
  height: 38px;
  padding: 0 12px;
  background: var(--panel-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--line); }
.rows a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 4px;
  color: var(--text);
}
.rows a:hover { background: var(--panel-raised); text-decoration: none; }
.rows .nm { min-width: 0; overflow-wrap: anywhere; }
.rows .id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}
.rows .nm .zh { color: var(--muted); margin-left: 8px; font-size: 0.92em; }
.rows .has-desc { color: var(--gold-dim); font-size: 12px; margin-left: 8px; }

/* description text from game strings */
.game-text p { margin: 0 0 10px; }
.game-text .term {
  color: var(--term);
  border-bottom: 1px dotted rgba(143, 199, 232, 0.5);
}
.game-text strong { color: var(--gold); }
.game-text .ph {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: #1c130a;
  background: var(--ph);
  border-radius: 3px;
  padding: 0 4px;
  white-space: nowrap;
}
/* resolved descVar value from the balancing sheets */
.game-text .val,
.notice .val {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

/* rarity badge on item/relic titles */
.rarity {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  padding: 2px 8px;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.32em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.rarity.r1 { color: var(--muted); border-color: var(--line-strong); }
.rarity.r2 { color: var(--term); border-color: var(--term); }
.rarity.r3 { color: #c78ce8; border-color: #c78ce8; }

/* lore subsections on hero pages */
.lore-h {
  margin: 14px 0 4px;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lore-h:first-child { margin-top: 0; }

/* guild tagline under the title */
.tagline { margin: 4px 0 0; color: var(--muted); font-style: italic; }

/* data status / honesty blocks */
.notice {
  border: 1px solid var(--gold-dim);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 13px;
}
.notice b { color: var(--gold); }
.placeholder-notice { margin-bottom: 16px; }
.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 13px;
}
.meta-table th, .meta-table td {
  text-align: left;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.meta-table th { color: var(--faint); font-weight: 600; white-space: nowrap; width: 1%; }
.meta-table td { color: var(--text); font-family: var(--font-mono); font-size: 12px; }
.coverage-table { margin-top: 12px; }
.entity-title { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.side-head a { color: inherit; }

.crumb {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 10px;
}
.crumb a { color: var(--muted); }
.footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 14px 30px;
  color: var(--faint);
  font-family: var(--font-ui);
  font-size: 12px;
}
.footer .zh { display: block; margin-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    z-index: 30;
    width: 280px;
    max-height: none;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease-out;
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; }
  body.drawer-open { overflow: hidden; }
  .topbar .brand .full { display: none; }
}
@media (max-width: 560px) {
  .searchbox kbd { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
