:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #191b1d;
  --panel-soft: #222528;
  --line: #34383d;
  --text: #f1eee7;
  --muted: #b6aea3;
  --gold: #d2a74e;
  --red: #9f3f3b;
  --green: #4fa36b;
  --blue: #608fb8;
  --shadow: 0 18px 42px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 0 32px;
  background: rgba(16, 17, 18, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  gap: 2px;
  min-width: 160px;
}

.brand span,
.eyebrow,
.panel-title span,
.mini-stats span,
.admin-card span,
.status-panel span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.brand strong {
  color: var(--gold);
  font-size: 20px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav a {
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--muted);
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.screen {
  display: none;
  scroll-margin-top: var(--topbar-height, 72px);
  min-height: calc(100vh - 72px);
}

.screen.active {
  display: grid;
}

.hero {
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: end;
  gap: 36px;
  padding: 64px 48px;
  background:
    linear-gradient(90deg, rgba(16, 17, 18, .92), rgba(16, 17, 18, .55)),
    url("/assets/portal-background.jpg") center/cover;
}

.hero-content {
  max-width: 760px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(48px, 7vw, 92px);
  line-height: .95;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 58px);
}

h3 {
  margin-bottom: 18px;
  font-size: 26px;
}

h4 {
  margin: 24px 0 12px;
  color: var(--gold);
}

.lead,
.page-head p {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.button.primary {
  border-color: #b88a32;
  background: var(--gold);
  color: #18130a;
  font-weight: 700;
}

.button.ghost {
  background: rgba(25, 27, 29, .55);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
}

.status-panel,
.panel,
.table-wrap,
.latest-news,
.news-card,
.admin-card,
.vote-card,
.boss-card {
  background: rgba(25, 27, 29, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-panel {
  display: grid;
  gap: 1px;
  overflow: hidden;
}

.status-panel article,
.mini-stats article,
.admin-card {
  padding: 20px;
  background: rgba(34, 37, 40, .72);
}

.status-panel strong,
.mini-stats strong,
.admin-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.page {
  padding: 48px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head.row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111315;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

select {
  max-width: 240px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 24px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.mini-stats,
.admin-grid,
.payment-grid,
.vote-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.boss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.boss-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: rgba(34, 37, 40, .78);
}

.boss-card.ready {
  border-color: rgba(79, 163, 107, .62);
}

.boss-card.dead {
  border-color: rgba(159, 63, 59, .72);
}

.boss-card.fighting {
  border-color: rgba(210, 167, 78, .82);
}

.boss-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.boss-card-head span,
.boss-meta span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.boss-card-head strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.boss-meta {
  display: grid;
  gap: 5px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111315;
  color: var(--muted);
  font-size: 12px;
}

.status-pill.ready {
  border-color: rgba(79, 163, 107, .65);
  color: #9de0b2;
}

.status-pill.dead {
  border-color: rgba(159, 63, 59, .75);
  color: #ffaca7;
}

.status-pill.fighting {
  border-color: rgba(210, 167, 78, .85);
  color: #f0ce82;
}

.character-list,
.news-list {
  display: grid;
  gap: 10px;
}

.character-row,
.news-card {
  display: grid;
  gap: 16px;
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.character-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.character-row span,
.news-card p,
.latest-news p,
.vote-card span,
.payment-option span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.payment-option,
.vote-card {
  min-height: 110px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.latest-news {
  padding: 28px;
  margin-bottom: 16px;
  cursor: pointer;
}

.news-card {
  display: block;
}

.news-card span {
  color: var(--gold);
}

.admin-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--gold);
}

.hidden {
  display: none !important;
}

.download {
  align-items: end;
  padding: 48px;
  background:
    linear-gradient(90deg, rgba(16, 17, 18, .9), rgba(16, 17, 18, .35)),
    url("/assets/portal-background.jpg") center/cover;
}

.download-copy {
  max-width: 640px;
}

/* Wiki shares the portal palette while keeping long catalogs easy to scan. */
.wiki-page { align-content: start; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.wiki-page > *, .wiki-rules-grid > *, .wiki-mob-panel { min-width: 0; }
.wiki-page .page-head, .wiki-page .message { margin-bottom: 0; }
.wiki-notice { border-left: 3px solid var(--gold); background: #242119; color: #d4c7ad; padding: 16px 20px; line-height: 1.6; }
.wiki-stage-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.wiki-stage-list { display: grid; gap: 6px; max-height: 690px; overflow-y: auto; padding-right: 10px; }
.wiki-stage-button { display: flex; gap: 14px; text-align: left; color: var(--muted); border: 1px solid transparent; border-radius: 7px; background: var(--panel); cursor: pointer; padding: 14px; font: inherit; }
.wiki-stage-button.selected { color: var(--text); border-color: var(--gold); background: #29251c; }
.wiki-stage-button:hover { background: var(--panel-soft); }
.wiki-stage-button strong { font-size: 14px; display: block; line-height: 1.4; }
.wiki-stage-button small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 5px; }
.wiki-stage-index { color: var(--gold); font-size: 18px; min-width: 24px; }
.wiki-stage-detail { min-height: 500px; overflow: hidden; position: relative; border-top: 2px solid var(--gold); }
.wiki-stage-detail h3 { font-size: clamp(26px, 3.5vw, 43px); max-width: 85%; line-height: 1.15; }
.wiki-stage-number { color: var(--gold); opacity: .28; font-size: 14px; font-weight: bold; letter-spacing: .12em; text-align: right; margin-bottom: 24px; }
.wiki-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.wiki-badges span, .wiki-grade { border: 1px solid #5b4d30; background: #28231a; color: #e4c37d; padding: 5px 9px; border-radius: 4px; font-size: 12px; }
.wiki-stage-description { font-size: 19px; line-height: 1.7; color: #ddd6ca; margin-top: 26px; }
.wiki-activities { padding-left: 20px; color: var(--muted); line-height: 1.8; }
.wiki-stage-footer { display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; padding-top: 26px; margin-top: 26px; border-top: 1px solid var(--line); color: var(--muted); }
.wiki-stage-footer strong { color: var(--text); }
.wiki-future p, .wiki-explainer p, .wiki-rules-grid p { color: var(--muted); line-height: 1.7; max-width: 100ch; }
.wiki-future a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.wiki-filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.wiki-filters label { flex: 1 1 130px; min-width: 0; color: var(--muted); font-size: 13px; display: grid; gap: 7px; }
.wiki-filters label:first-child { flex: 1.5 1 200px; }
.wiki-filters select, .wiki-filters input { width: 100%; min-width: 0; max-width: none; }
.wiki-filters label.wiki-check { display: flex; align-items: center; justify-content: flex-start; align-self: center; gap: 10px; flex: 1 1 200px; }
.wiki-check input { width: 18px; height: 18px; accent-color: var(--gold); }
.wiki-recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.wiki-recipe-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.wiki-recipe-card { min-width: 0; padding: 22px; }
.wiki-recipe-card h3 { font-size: 21px; line-height: 1.35; margin-bottom: 10px; overflow-wrap: anywhere; }
.wiki-card-meta { font-size: 12px; color: var(--muted); line-height: 1.6; }
.wiki-collection { color: #d6c49e; font-size: 14px; line-height: 1.5; }
.wiki-collection small { display: block; color: var(--muted); margin-top: 5px; }
.wiki-recipe-card h4 { font-size: 14px; margin: 22px 0 10px; }
.wiki-ingredients, .wiki-output-list ul { padding: 0; list-style: none; margin: 0; }
.wiki-ingredients li, .wiki-output-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wiki-ingredients li > strong, .wiki-output-list li > span:last-child { white-space: nowrap; color: #dfc48b; }
.wiki-ingredients small, .wiki-output-list small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 5px; }
.wiki-output-list { margin-top: 18px; }
.wiki-output-list summary, .wiki-explainer summary { color: var(--gold); cursor: pointer; line-height: 1.5; }
.wiki-output-list ul { margin-top: 12px; max-height: 330px; overflow-y: auto; padding-right: 6px; }
.wiki-prototype-note { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 16px 0 0; }
.wiki-explainer p:first-of-type { margin-top: 18px; }
.wiki-pagination { display: flex; gap: 16px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.wiki-pagination button:disabled { opacity: .35; cursor: default; }
.wiki-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.wiki-metrics article { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.wiki-metrics article > span { color: var(--muted); font-size: 13px; }
.wiki-metrics article > strong { color: var(--gold); font-size: 24px; line-height: 1.2; }
.wiki-metrics article > small { color: var(--muted); line-height: 1.5; }
.wiki-drop-table caption { text-align: left; padding: 16px 18px; color: var(--muted); font-size: 13px; }
.wiki-drop-table td { font-size: 14px; }
.wiki-drop-table td small, .wiki-mob-panel td small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.wiki-family-label { display: block; margin-bottom: 12px; color: var(--gold); font-size: 14px; }
.wiki-rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.wiki-rules-grid h3, .wiki-future h3 { font-size: 22px; }
.wiki-mob-panel > label { display: grid; gap: 8px; max-width: 440px; color: var(--muted); }
.wiki-mob-panel .table-wrap { margin: 20px 0; max-width: 100%; }
.wiki-page button:focus-visible, .wiki-page summary:focus-visible, .wiki-page input:focus-visible, .wiki-page select:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

@media (max-width: 1150px) {
  .wiki-recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiki-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .wiki-stage-layout, .wiki-recipe-grid, .wiki-rules-grid { grid-template-columns: 1fr; }
  .wiki-stage-list { max-height: 280px; }
  .wiki-stage-detail { min-height: 0; padding: 22px; }
  .wiki-stage-detail h3 { max-width: none; }
  .wiki-stage-footer .button { width: 100%; }
  .wiki-metrics { gap: 10px; }
  .wiki-metrics article { padding: 16px; }
  .wiki-metrics article > strong { font-size: 19px; }
  .wiki-filters { padding: 16px; }
  .wiki-filters label { flex-basis: 130px; }
  .wiki-filters label:first-child { flex-basis: 100%; }
  .wiki-page > .table-wrap { max-width: calc(100vw - 36px); }
  .wiki-drop-table { min-width: 670px; }
  .wiki-pagination { gap: 12px; }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .screen {
    min-height: calc(100vh - 139px);
  }

  .hero,
  .account-layout {
    grid-template-columns: 1fr;
  }

  .hero,
  .page,
  .download {
    padding: 32px 18px;
  }

  .page-head.row {
    align-items: stretch;
    flex-direction: column;
  }

  select {
    max-width: none;
  }

  .mini-stats,
  .admin-grid,
  .payment-grid,
  .vote-grid,
  .boss-grid {
    grid-template-columns: 1fr;
  }

  .character-main {
    flex-direction: column;
  }
}
:root { --wiki-accent: #cbb27c; }
.balance-tabs { display:flex; flex-wrap:wrap; gap:8px; margin:20px 0; }
.balance-tabs button { border:1px solid #67593f; border-radius:6px; padding:10px 18px; background:#191b1d; color:#eee; cursor:pointer; }
.balance-tabs button[aria-pressed="true"] { background:var(--wiki-accent); color:#141414; }
.balance-filters { display:flex; flex-wrap:wrap; gap:16px; margin-bottom:20px; }
.balance-filters label { flex:1 1 180px; min-width:0; }
.balance-filters label[hidden] { display:none; }
.balance-filters input,.balance-filters select { width:100%; min-width:0; }
.balance-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr)); gap:16px; }
.balance-card { min-width:0; overflow-wrap:anywhere; }
.balance-card p,.balance-card li { line-height:1.65; }
.balance-card summary { cursor:pointer; color:var(--wiki-accent); }
.balance-status { color:var(--wiki-accent); }
.balance-table { max-width:100%; overflow-x:auto; margin:18px 0; }
.balance-table table { width:100%; border-collapse:collapse; }
.balance-compact table { min-width:0; }
.balance-compact td,.balance-compact th { overflow-wrap:anywhere; }
.balance-compact td:not(:first-child) { white-space:nowrap; overflow-wrap:normal; }
.balance-population table { min-width:960px; }
.balance-population td,.balance-population th { overflow-wrap:normal; }
.balance-population td:first-child,.balance-population th:first-child { min-width:120px; }
.balance-hp table { min-width:560px; }
.balance-hp td,.balance-hp th { overflow-wrap:normal; }
.balance-hp td:first-child,.balance-hp th:first-child { min-width:160px; }
.balance-table td,.balance-table th { text-align:left; padding:12px; border-bottom:1px solid #333; vertical-align:top; }
#wiki { min-width:0; grid-template-columns:minmax(0,1fr); }
#wiki > * { min-width:0; }
#wiki button:focus-visible,#wiki a:focus-visible { outline:2px solid var(--wiki-accent); outline-offset:3px; }
