:root {
  --bg: #15110f;
  --bg2: #1e1815;
  --panel: #271f1b;
  --panel2: #30261f;
  --line: #4a3a30;
  --text: #efe6dc;
  --muted: #b3a393;
  --red: #c4281c;
  --red-hi: #e8412f;
  --gold: #e3b341;
  --green: #5fae5a;
  --radius: 10px;
}
@font-face { font-family: "Silkscreen"; font-weight: 400; src: url(/vendor/fonts/silkscreen-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Silkscreen"; font-weight: 700; src: url(/vendor/fonts/silkscreen-latin-700-normal.woff2) format("woff2"); font-display: swap; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(circle at 20% -10%, #3a1713 0, transparent 45%), radial-gradient(circle at 100% 0, #2b2210 0, transparent 40%);
  background-attachment: fixed; min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: 1.7rem; color: var(--gold); }
h3 { font-size: 1.2rem; }
a { color: var(--gold); }
a:hover { color: #fff; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 16px 60px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* header */
header.site {
  background: rgba(21, 17, 15, .92); backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--red); position: sticky; top: 0; z-index: 1000;
}
header.site .bar { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: Georgia, serif; font-size: 1.25rem; font-weight: bold; }
.brand img { height: 42px; width: auto; image-rendering: pixelated; }
nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav a { color: var(--text); text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 500; }
nav a:hover { background: var(--panel2); }
nav a.active { background: var(--red); color: #fff; }

footer.site { border-top: 1px solid var(--line); padding: 22px 16px; text-align: center; color: var(--muted); font-size: .9rem; }

/* hero */
.hero { display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: center; padding: 20px 0 30px; }
.hero .banner { width: 100%; max-height: 420px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 8px 14px #000a); }
.decree { border-left: 5px solid var(--gold); background: var(--panel); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.decree b { color: var(--gold); font-family: Georgia, serif; }
.hero .tag { font-size: 1.25rem; color: var(--muted); margin: 0 0 20px; }
.ip {
  display: inline-flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: var(--radius); font-family: ui-monospace, Consolas, monospace;
}
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* buttons & forms */
.btn {
  display: inline-block; background: var(--red); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--red-hi); color: #fff; }
.btn.alt { background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
.btn.alt:hover { background: var(--line); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.danger { background: #6b1a14; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 3px; }
input, select, textarea {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; }
textarea { min-height: 110px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pre { white-space: pre-wrap; }
.news-item + .news-item { margin-top: 16px; }
.news-item .date { color: var(--muted); font-size: .85rem; }

/* citizens */
.citizen { display: flex; gap: 14px; align-items: flex-start; }
.citizen img, .citizen .fallback { width: 56px; height: 56px; border-radius: 8px; image-rendering: pixelated; background: var(--bg2); flex: none; }
.citizen .role { color: var(--gold); font-size: .85rem; }

/* map page */
.mapwrap { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
#map { height: 640px; border-radius: var(--radius); border: 1px solid var(--line); background: #0d0b0a; }
.sidebar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; max-height: 640px; overflow: auto; }
.plot-item { border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 10px; margin-top: 8px; cursor: pointer; }
.plot-item:hover, .plot-item.sel { border-color: var(--gold); }
.plot-item b { display: block; }
.plot-item .meta { font-size: .85rem; color: var(--muted); }
.coord { font-family: ui-monospace, Consolas, monospace; color: var(--gold); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.toolbar > div { flex: 1; min-width: 120px; }
.coordbox { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: #000c; color: #fff; padding: 4px 10px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; pointer-events: none; }
.nomap { display: grid; place-items: center; height: 100%; text-align: center; padding: 30px; color: var(--muted); }

/* admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 8px 16px; border-radius: 8px; cursor: pointer; font: inherit; }
.tabs button.active { background: var(--red); border-color: var(--red); }
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .92rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--panel2); border: 1px solid var(--gold); padding: 10px 16px; border-radius: 8px; z-index: 3000; max-width: 340px; }
.toast.err { border-color: var(--red-hi); }

/* region names on the map: same look as the Discord maps (gold pixel text with a dark outline) */
.rr-label span {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font: 700 var(--rr-label, 14px) "Silkscreen", monospace; text-transform: uppercase; letter-spacing: .5px;
  text-shadow: -2px 0 #1a1208, 2px 0 #1a1208, 0 -2px #1a1208, 0 2px #1a1208, -2px -2px #1a1208, 2px 2px #1a1208, -2px 2px #1a1208, 2px -2px #1a1208;
}
.rr-drawing path.leaflet-interactive { pointer-events: none !important; }
.rr-drawing .leaflet-container, .rr-drawing.leaflet-container { cursor: crosshair; }
.rr-handle { background: #fff; border: 2px solid #111; border-radius: 2px; box-sizing: border-box; }
.rr-handle:hover { background: var(--gold); }
.rr-mid { background: #ffffffaa; border: 1px solid #111; border-radius: 50%; box-sizing: border-box; opacity: .75; }
.toolrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.toolrow .btn.on { background: var(--gold); color: #1a1208; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content a { color: var(--gold); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero .banner { max-height: 260px; }
  .mapwrap { grid-template-columns: 1fr; }
  #map { height: 480px; }
  .sidebar { max-height: none; }
  nav { margin-left: 0; }
}
