:root {
  color-scheme: dark;
  --ink: #efe5cf;
  --muted: #aaa08f;
  --gold: #cbaa68;
  --gold-bright: #e0c58e;
  --panel: #171411;
  --line: #4d4234;
  --alliance: #6fa979;
  --enemy: #c75c52;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #100e0c;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: radial-gradient(circle at 15% -10%, #4a38233b, transparent 35rem), linear-gradient(180deg, #15120f 0%, #0e0c0a 100%);
  line-height: 1.6;
}
a { color: inherit; }
.masthead {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 74px;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  gap: 2.5rem;
  border-bottom: 1px solid #574936aa;
  background: #100e0ce8;
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 46px;
  color: #17120b;
  font-weight: 800;
  font-size: 1.25rem;
  background: linear-gradient(#dfc48b, #9b753c);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
}
.brand strong, .brand small { display: block; line-height: 1; }
.brand strong { font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; }
.brand small { margin-top: .3rem; color: var(--muted); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
nav { display: flex; gap: 1.6rem; margin-left: auto; }
nav a { color: var(--muted); font-size: .82rem; letter-spacing: .13em; text-decoration: none; text-transform: uppercase; }
nav a:hover, nav a[aria-current="page"] { color: var(--gold-bright); }
nav a[aria-current="page"] { border-bottom: 1px solid var(--gold); }
.server-address { padding: .65rem .9rem; border: 1px solid var(--line); color: var(--gold-bright); font: .78rem ui-monospace, monospace; }
main { width: min(1520px, 92vw); margin: 0 auto; }
.intro {
  min-height: 430px;
  padding: 7rem 3vw 5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .65fr);
  align-items: end;
  gap: 4rem;
  border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 .8rem; color: var(--gold); font-size: .75rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h1 { max-width: 950px; font-size: clamp(3.1rem, 7vw, 7.2rem); line-height: .92; letter-spacing: -.045em; }
h2 { font-size: clamp(2.2rem, 4vw, 4rem); letter-spacing: -.025em; }
h3 { font-size: 1.75rem; }
.intro-copy { max-width: 500px; margin: 0; color: #c4b9a6; font-size: 1.15rem; line-height: 1.75; }
section { padding: 5rem 0; }
.section-heading { margin-bottom: 1.8rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.map-actions, .legend { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.status, .secondary-button { border: 1px solid var(--line); background: #17130f; }
.status { padding: .7rem .9rem; color: var(--muted); font: .76rem ui-sans-serif, system-ui, sans-serif; letter-spacing: .04em; }
.status i { display: inline-block; width: 8px; height: 8px; margin-right: .55rem; border-radius: 50%; background: #a18b65; box-shadow: 0 0 0 4px #a18b651b; }
.status.online i { background: var(--alliance); box-shadow: 0 0 0 4px #6fa9791f; }
.status.error i { background: var(--enemy); }
.secondary-button { padding: .65rem 1rem; color: var(--gold-bright); font-size: .78rem; letter-spacing: .08em; text-decoration: none; text-transform: uppercase; }
.secondary-button:hover { border-color: var(--gold); }
.map-frame { position: relative; height: min(72vh, 820px); min-height: 520px; overflow: hidden; border: 1px solid #6f5c3f; background: #0b0a09; box-shadow: 0 35px 90px #0008; }
.map-frame::before { content: ""; position: absolute; z-index: 2; inset: 0; pointer-events: none; box-shadow: inset 0 0 50px #0009; }
.map-frame iframe { width: 100%; height: 100%; border: 0; background: #101010; }
.map-note { margin: 1rem 0 0; color: var(--muted); font-size: .9rem; }
.diplomacy-section, .houses-section { border-top: 1px solid var(--line); }
.legend { color: var(--muted); font: .8rem ui-sans-serif, system-ui, sans-serif; }
.legend span { display: flex; align-items: center; gap: .55rem; }
.legend i { width: 30px; height: 3px; display: inline-block; }
.alliance-line { background: var(--alliance); }
.enemy-line { background: var(--enemy); }
.diplomacy-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 430px; border: 1px solid var(--line); background: var(--panel); }
.graph-panel { position: relative; min-height: 430px; overflow: hidden; background: radial-gradient(circle, #29231c 0 1px, transparent 1.5px) 0 0 / 28px 28px; }
#relations-graph { display: block; width: 100%; height: 100%; min-height: 430px; }
#relations-graph .relation { fill: none; stroke-width: 3; opacity: .82; }
#relations-graph .relation.alliance { stroke: var(--alliance); }
#relations-graph .relation.enemy { stroke: var(--enemy); stroke-dasharray: 9 6; }
#relations-graph .node-circle { stroke: #e5d6ba; stroke-width: 2; }
#relations-graph .node-label { fill: var(--ink); font: 600 14px Inter, "Segoe UI", system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #0f0d0b; stroke-width: 4px; stroke-linejoin: round; }
.graph-panel > .empty-message { position: absolute; inset: 50% auto auto 50%; width: min(360px, 80%); margin: 0; transform: translate(-50%, -50%); text-align: center; }
.chronicle { padding: 2rem; border-left: 1px solid var(--line); background: #1d1813; }
.chronicle dl { margin: 2.2rem 0; }
.chronicle dl div { padding: .85rem 0; display: flex; justify-content: space-between; border-bottom: 1px solid #3b3228; }
.chronicle dt { color: var(--muted); }
.chronicle dd { margin: 0; color: var(--gold-bright); font-size: 1.15rem; }
.last-update { color: #817767; font: .74rem/1.5 ui-sans-serif, system-ui, sans-serif; }
.colony-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.colony-card { position: relative; padding: 1.5rem; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(135deg, #211c17, #171411); }
.colony-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--house-color, var(--gold)); }
.colony-card header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.colony-card h3 { font-size: 1.5rem; }
.colony-card .owner { margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }
.attack-badge { padding: .35rem .55rem; border: 1px solid #9f4a43; color: #f0a39d; font: .68rem ui-sans-serif, system-ui, sans-serif; text-transform: uppercase; }
.colony-stats { margin: 1.35rem 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.colony-stats div { padding: .8rem; background: #0f0d0ba8; }
.colony-stats strong, .colony-stats small { display: block; }
.colony-stats strong { color: var(--gold-bright); font-size: 1.12rem; }
.colony-stats small { margin-top: .2rem; color: #817767; font: .68rem ui-sans-serif, system-ui, sans-serif; text-transform: uppercase; }
.relation-summary { margin: .5rem 0 0; color: #b8ad9a; font-size: .88rem; line-height: 1.6; }
.relation-summary b { color: var(--ink); font-weight: 500; }
.empty-message { color: var(--muted); line-height: 1.6; }
footer { width: min(1520px, 92vw); margin: 0 auto; padding: 2rem 0 3rem; display: flex; justify-content: space-between; gap: 2rem; border-top: 1px solid var(--line); color: #817767; font-size: .78rem; }
footer a { color: var(--gold); text-underline-offset: .2em; }

/* Wiki */
.wiki-shell { width: min(1320px, 92vw); }
.wiki-hero {
  min-height: 520px;
  padding: 8rem 3vw 6rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 75% 30%, #99733921, transparent 25rem);
}
.wiki-hero h1 { max-width: 1100px; font-size: clamp(3.2rem, 7vw, 7rem); }
.wiki-lead { max-width: 820px; margin: 2rem 0 0; color: #c8bdab; font-size: clamp(1.05rem, 1.7vw, 1.3rem); line-height: 1.75; }
.hero-actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .8rem; }
.primary-button, .hero-actions .secondary-button { padding: .8rem 1.1rem; text-decoration: none; }
.primary-button { border: 1px solid #d9b875; color: #16110b; background: linear-gradient(#dfc48b, #b48a49); font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.primary-button:hover { background: var(--gold-bright); }
.wiki-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(2rem, 5vw, 6rem); }
.wiki-toc { position: sticky; top: 100px; height: fit-content; padding: 4.5rem 0; }
.wiki-toc nav { margin: 0; display: grid; gap: 0; }
.wiki-toc nav a { padding: .65rem 0; border-bottom: 1px solid #332b23; color: var(--muted); font-size: .75rem; letter-spacing: .07em; line-height: 1.4; text-transform: uppercase; }
.wiki-toc nav a:hover { color: var(--gold-bright); }
.wiki-content { min-width: 0; }
.wiki-section { padding: 5rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.wiki-section:last-child { border-bottom: 0; }
.wiki-section > h2 { margin-bottom: 1.5rem; }
.wiki-section > p:not(.eyebrow):not(.section-intro) { max-width: 900px; color: #c0b5a3; font-size: 1rem; line-height: 1.8; }
.section-intro { max-width: 850px; margin: 0 0 2rem; color: #c0b5a3; font-size: 1.05rem; line-height: 1.8; }
.notice { margin-top: 2rem; padding: 1.25rem 1.4rem; display: grid; gap: .35rem; border: 1px solid #705d3d; border-left: 4px solid var(--gold); background: #1d1812; }
.notice strong { color: var(--gold-bright); }
.notice span { color: #b9ae9c; }
.notice.subdued { border-color: #4b4438; border-left-color: #8e826e; }
.notice.subdued strong { color: var(--ink); }
.notice.danger { border-color: #6f3f39; border-left-color: var(--enemy); background: #251411; }
.notice.danger strong { color: #eda79f; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.feature-card { min-height: 255px; padding: 1.6rem; background: linear-gradient(145deg, #1f1a15, #15120f); }
.feature-card h3 { margin-top: 2.4rem; font-size: 1.25rem; }
.feature-card p { margin-bottom: 0; color: var(--muted); font-size: .92rem; line-height: 1.7; }
.feature-number { color: var(--gold); font: 700 .72rem ui-monospace, monospace; letter-spacing: .12em; }
.steps { margin: 2.5rem 0 0; padding: 0; display: grid; list-style: none; }
.steps > li { padding: 1.3rem 0; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 1rem; border-top: 1px solid #3a3127; }
.steps > li:last-child { border-bottom: 1px solid #3a3127; }
.steps li > span { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #665538; border-radius: 50%; color: var(--gold-bright); font: 700 .75rem ui-monospace, monospace; }
.steps strong { color: var(--ink); font-size: 1.05rem; }
.steps p { margin: .3rem 0 0; color: var(--muted); line-height: 1.7; }
.steps ul { margin: .8rem 0; padding-left: 1.3rem; color: var(--muted); line-height: 1.8; }
.steps.compact { margin-top: 1.5rem; }
code { padding: .16rem .38rem; border: 1px solid #4b4031; border-radius: 3px; color: #efcf90; background: #0e0c0a; font: .86em/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; overflow-wrap: anywhere; }
.command-groups { display: grid; gap: 1.2rem; }
.command-group { border: 1px solid var(--line); background: var(--panel); }
.command-heading { padding: 1.1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); background: #211b15; }
.command-heading h3 { font-size: 1.15rem; }
.role-badge { padding: .3rem .55rem; border: 1px solid #78643f; color: #ddbf82; font-size: .64rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.role-badge.officer { border-color: #6c5541; color: #d0a77e; }
.role-badge.resident { border-color: #46634d; color: #8dc399; }
.role-badge.merchant { border-color: #4f6074; color: #9ebadc; }
.command-list { margin: 0; }
.command-list > div { padding: .9rem 1.25rem; display: grid; grid-template-columns: minmax(280px, .9fr) 1fr; gap: 1.2rem; border-bottom: 1px solid #332b23; }
.command-list > div:last-child { border-bottom: 0; }
.command-list dt, .command-list dd { margin: 0; }
.command-list dd { color: var(--muted); line-height: 1.6; }
.split-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.split-panel > div { padding: 1.7rem; background: var(--panel); }
.split-panel h3 { margin-bottom: 1rem; font-size: 1.25rem; }
.split-panel p { color: var(--muted); line-height: 1.75; }
.rules-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.rules-list article { min-height: 190px; padding: 1.4rem; display: grid; grid-template-columns: 42px 1fr; gap: .75rem; background: #171411; }
.rules-list article > span { color: var(--gold); font: 700 .72rem ui-monospace, monospace; letter-spacing: .08em; }
.rules-list h3 { font-size: 1.1rem; }
.rules-list p { margin: .55rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.resource-grid a { min-height: 150px; padding: 1.35rem; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); background: linear-gradient(145deg, #1f1a15, #15120f); text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.resource-grid a:hover { border-color: var(--gold); transform: translateY(-2px); }
.resource-grid span { color: var(--gold); font-size: .66rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.resource-grid strong { margin-top: .65rem; font-size: 1.15rem; }
.resource-grid small { margin-top: auto; padding-top: 1rem; color: var(--muted); line-height: 1.5; }
@media (max-width: 900px) {
  .masthead { padding-top: .65rem; flex-wrap: wrap; }
  .masthead > nav { order: 3; width: 100%; margin: -.1rem 0 .65rem; justify-content: center; gap: 1.1rem; }
  .server-address { margin-left: auto; }
  .intro { min-height: 360px; padding-top: 5rem; grid-template-columns: 1fr; gap: 2rem; }
  .diplomacy-grid { grid-template-columns: 1fr; }
  .chronicle { border-top: 1px solid var(--line); border-left: 0; }
  .wiki-layout { grid-template-columns: 1fr; }
  .wiki-toc { position: static; padding: 2rem 0 0; }
  .wiki-toc nav { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .masthead { padding: 0 1rem; }
  .server-address { display: none; }
  main { width: min(100% - 1.5rem, 1520px); }
  h1, .wiki-hero h1 { font-size: 3.05rem; }
  section { padding: 3.5rem 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .map-frame { min-height: 480px; }
  footer { width: calc(100% - 1.5rem); flex-direction: column; }
  .masthead > nav { justify-content: flex-start; overflow-x: auto; white-space: nowrap; }
  .wiki-shell { width: calc(100% - 1.5rem); }
  .wiki-hero { min-height: 430px; padding: 5rem 0 4rem; }
  .wiki-toc nav, .feature-grid, .split-panel, .rules-list, .resource-grid { grid-template-columns: 1fr; }
  .command-list > div { grid-template-columns: 1fr; gap: .55rem; }
  .command-heading { align-items: flex-start; }
}
