:root {
  --bg: #04110a;
  --bg2: #061a0f;
  --land: #0e2a1a;
  --land-stroke: #1f6b3f;
  --ink: #d7ffe8;
  --muted: #6f9a80;
  --accent: #37d67a;
  --gold: #f5c542;
  --panel: rgba(6, 22, 14, 0.82);
  --panel-line: rgba(55, 214, 122, 0.22);
  --font: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--panel-line);
  background: linear-gradient(180deg, rgba(4,17,10,.96), rgba(4,17,10,.7));
  z-index: 5;
}
.brand { font-weight: 800; letter-spacing: 1px; font-size: 20px; }
.brand span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
.stats { display: flex; gap: 16px; font-size: 12px; color: var(--muted); letter-spacing: 1px; flex-wrap: wrap; }
.stats b { color: var(--ink); }
.viewtoggle { margin-left: auto; display: flex; border: 1px solid var(--panel-line); border-radius: 999px; overflow: hidden; }
.viewtoggle button { background: transparent; color: var(--muted); border: 0; padding: 7px 16px; font-family: var(--font); cursor: pointer; letter-spacing: 1px; }
.viewtoggle button.active { background: rgba(55,214,122,.16); color: var(--ink); }
.conquer {
  background: linear-gradient(180deg, #14351f, #0c2415); color: var(--gold);
  border: 1px solid rgba(245,197,66,.5); border-radius: 999px; padding: 8px 18px;
  font-family: var(--font); letter-spacing: 1px; cursor: pointer; font-weight: 700;
}
.conquer:hover { box-shadow: 0 0 0 2px rgba(245,197,66,.2); }

.stage { position: relative; flex: 1; display: grid; grid-template-columns: 300px 1fr 300px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--panel-line); margin: 12px; border-radius: 12px; display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 12px 14px; font-size: 12px; letter-spacing: 2px; color: var(--accent); border-bottom: 1px solid var(--panel-line); display:flex; align-items:center; justify-content:space-between; }
.panel-toggle { background:rgba(55,214,122,.1); border:1px solid var(--panel-line); border-radius:5px; color:var(--ink); font:inherit; font-size:16px; line-height:22px; width:26px; height:26px; cursor:pointer; }
.panel.collapsed .panel-body { display:none; }
.panel.collapsed { min-height:0; height:auto; }
.panel-head::before { content: "● "; color: var(--accent); }
.panel-body { padding: 12px 14px; overflow: auto; font-size: 13px; }
.muted { color: var(--muted); text-align: center; line-height: 1.6; }

.mapwrap { position: relative; overflow: hidden; }
#map { width: 100%; height: 100%; display: block; cursor: grab; background: radial-gradient(1200px 700px at 50% 40%, #06210f, #030d07 70%); }
#map:active { cursor: grabbing; }
.country { fill: var(--land); stroke: var(--land-stroke); stroke-width: .4px; transition: fill .15s; }
.country:hover { fill: #164a2c; }
.country.claimed { stroke-width: .6px; }
.marker text { font-size: 12px; }
.mapfoot { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.zoom { position: absolute; right: 14px; bottom: 34px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--panel-line); background: var(--panel); color: var(--ink); font-size: 16px; cursor: pointer; }
.command-reopen { position:absolute; right:14px; top:14px; z-index:8; border:1px solid var(--panel-line); background:var(--panel); color:var(--accent); border-radius:999px; padding:8px 14px; font:inherit; font-size:11px; letter-spacing:1px; cursor:pointer; }

.feed-item { padding: 8px 0; border-bottom: 1px dashed var(--panel-line); line-height: 1.5; }
.feed-item .who { color: var(--ink); }
.feed-item .amt { color: var(--gold); }
.power-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--panel-line); }
.power-swatch { width: 12px; height: 12px; border-radius: 3px; }
.power-item .cnt { margin-left: auto; color: var(--muted); }

/* Drawer */
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 92vw); background: var(--panel); backdrop-filter: blur(6px); border-left: 1px solid var(--panel-line); z-index: 40; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.5); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--panel-line); letter-spacing: 2px; font-size: 12px; color: var(--accent); }
.drawer-body { padding: 16px; overflow: auto; }
.country-title { display: flex; align-items: center; gap: 10px; }
.country-title h2 { margin: 0; font-size: 26px; }
.country-meta { display:flex; gap:12px; color:var(--muted); font-size:11px; margin:8px 0 2px; }
.flag { font-size: 26px; }
.lbl { display: block; margin: 16px 0 6px; font-size: 11px; letter-spacing: 1.5px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
.hint b { color: var(--gold); }
input[type=text], input[type=number] { width: 100%; background: rgba(0,0,0,.35); border: 1px solid var(--panel-line); color: var(--ink); padding: 12px; border-radius: 8px; font-family: var(--font); font-size: 15px; }
.bidrow { display: flex; gap: 8px; align-items: stretch; }
.bidfield { flex: 1; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.35); border: 1px solid var(--panel-line); border-radius: 8px; padding: 0 12px; font-size: 20px; }
.bidfield input { border: 0; background: transparent; padding: 12px 0; font-size: 20px; }
.mini { background: rgba(55,214,122,.12); border: 1px solid var(--panel-line); color: var(--ink); border-radius: 8px; padding: 0 14px; cursor: pointer; font-family: var(--font); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: #fff; }
.claim { width: 100%; margin-top: 18px; padding: 16px; border: 0; border-radius: 10px; background: var(--accent); color: #04110a; font-weight: 800; letter-spacing: 1px; font-size: 16px; cursor: pointer; font-family: var(--font); }
.claim:hover { filter: brightness(1.06); }
.fineprint { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 12px; }
.x { background: transparent; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }

/* Modal */
/* World-conquest overlay is intentionally disabled. Claims happen in the
   right-side COMMAND drawer after selecting a country on the map. The
   !important guard also prevents stale browser scripts from re-opening it. */
.modal { display: none !important; }
.modal-card { position: relative; width: min(440px, 92vw); background: var(--bg2); border: 1px solid var(--panel-line); border-radius: 14px; padding: 24px; }
.modal-card h2 { margin-top: 0; }
.modal-card .x { position: absolute; top: 12px; right: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #0c2415; border: 1px solid var(--panel-line); color: var(--ink); padding: 12px 18px; border-radius: 10px; z-index: 60; }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .panel.warreport, .panel.hotland { position: absolute; z-index: 6; width: 240px; }
  .panel.warreport { top: 8px; left: 8px; max-height: 40vh; }
  .panel.hotland { top: 8px; right: 8px; max-height: 40vh; }
  .stats { display: none; }
}
