:root {
  --bg: #15170f;
  --panel: #1f2218;
  --panel2: #2a2e21;
  --line: #3b402d;
  --text: #ece6cf;
  --muted: #a9a48a;
  --gold: #d6b14e;
  --red: #b3271d;
  --our: #e07a6c;
  --enemy: #9fb0c2;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body { display: flex; flex-direction: column; overflow: hidden; }

#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #10120b;
  border-bottom: 2px solid var(--gold);
  flex-wrap: wrap;
}
.brand { font-weight: 800; letter-spacing: .06em; color: var(--gold); text-transform: uppercase; font-size: 13px; }
.info { color: var(--muted); white-space: nowrap; }
.info b { color: var(--text); }
.gold b { color: var(--gold); }
.spacer { flex: 1; }

button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #7d2018; border-color: #a9382b; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #922a20; }

main { flex: 1; display: flex; min-height: 0; }
#mapwrap { flex: 1; overflow: auto; background: #0e100a; }
#map { display: block; cursor: pointer; }

#panel {
  width: 330px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#panel section:empty { display: none; }
#panel h3 { margin: 0 0 2px; font-size: 16px; }
#panel h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stars { color: #f2c230; letter-spacing: 1px; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 13px; }
.stats span:nth-child(odd) { color: var(--muted); }
.stats span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: #393d2c; border-radius: 3px; overflow: hidden; margin: 2px 0 8px; }
.bar i { display: block; height: 100%; background: #7fa650; }
.bar.low i { background: #c0602c; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.actions button { font-size: 13px; padding: 5px 9px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.general { color: var(--gold); font-size: 12.5px; margin: 2px 0 6px; }
#panel .actions + h4, #panel .stats + h4, #panel .hint + h4 { margin-top: 12px; }
#weather[title]:not([title=""]) { cursor: help; }

#forecast { background: #2b2116; border: 1px solid #6a4a25; border-radius: 8px; padding: 10px; }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; text-align: center; }
.duel .loss { font-size: 22px; font-weight: 800; }
.duel .our { color: var(--our); }
.duel .enemy { color: var(--enemy); }
.warn { color: #f0b354; font-size: 12px; margin-top: 6px; }

#log { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; max-height: 320px; overflow: auto; }
#log div { padding: 2px 0; border-bottom: 1px solid #2a2d20; }
#log .turn { color: var(--gold); border: 0; margin-top: 4px; }
#log .our { color: #f0c2b9; }
#log .enemy { color: #c5d0dc; }
#log .kill { font-weight: 700; }
#log .capture { color: var(--gold); font-weight: 600; }

#banner {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 18, 11, .92);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
}
#banner[hidden] { display: none; }

#modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 3, .74);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#modal[hidden] { display: none; }
.box {
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 22px 26px;
  max-width: 680px;
  width: calc(100% - 32px);
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.box h1 { margin: 0 0 4px; color: var(--gold); font-size: 26px; letter-spacing: .03em; }
.box h2 { margin: 0 0 4px; color: var(--gold); }
.box .lead { color: var(--muted); margin-top: 0; }
.box ul { padding-left: 20px; }
.box li { margin: 4px 0; }
.objectives { background: #2b2116; border-left: 3px solid var(--gold); padding: 8px 12px; margin: 12px 0; }
.menu-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.menu-buttons button { padding: 9px 16px; font-size: 15px; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 12px; }
.shop button { text-align: left; padding: 9px 11px; }
.shop .price { color: var(--gold); font-weight: 700; float: right; }
.shop .line { color: var(--muted); font-size: 12px; display: block; margin-top: 3px; }

@media (max-width: 900px) {
  main { flex-direction: column; }
  #panel { width: auto; max-height: 38vh; border-left: 0; border-top: 1px solid var(--line); }
}
