:root {
  --bg: #05070b; --panel: rgba(10, 14, 20, .88); --line: #1f2a37; --text: #dbe4ee; --muted: #8796a8;
  --accent: #f59e0b; --bad: #ef4444; --good: #22c55e; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
canvas#globe { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; cursor: grab; }
canvas#globe.dragging { cursor: grabbing; }
canvas#globe.targeting { cursor: crosshair; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.error { color: var(--bad); min-height: 1.2em; margin: 4px 0; }
h1, h2, h3 { margin: 0; letter-spacing: .04em; }
h3 { font-size: 11px; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }

.btn { background: #16202c; color: var(--text); border: 1px solid #2a3a4d; border-radius: 6px; padding: 7px 12px;
  font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.danger { border-color: #5b2323; color: #fca5a5; }
.row { display: flex; gap: 8px; align-items: center; }

#topbar { position: fixed; top: 0; left: 0; right: 0; height: 48px; display: flex; align-items: center; gap: 18px;
  padding: 0 14px; background: linear-gradient(#05070bee, #05070b99); border-bottom: 1px solid var(--line); z-index: 5; }
.brand { font-weight: 800; letter-spacing: .25em; color: var(--accent); }
.tick { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.tick .sep { color: var(--muted); }
.tick-bar { width: 140px; height: 6px; background: #17212d; border-radius: 3px; overflow: hidden; }
#tick-fill { height: 100%; width: 0; background: var(--accent); transition: width .9s linear; }
.me { display: flex; align-items: center; gap: 10px; }
.badge { padding: 3px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; color: #0b0f14; }

.panel { position: fixed; top: 58px; bottom: 12px; width: 300px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; overflow-y: auto; z-index: 4; backdrop-filter: blur(6px); }
#left { left: 12px; }
#right { right: 12px; display: flex; flex-direction: column; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.hint { margin-top: 10px; }

.army { border: 1px solid var(--line); border-radius: 8px; padding: 9px; margin-bottom: 8px; cursor: pointer; background: #0c121a; }
.army:hover { border-color: #3a4c62; }
.army.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.army .top { display: flex; justify-content: space-between; font-weight: 700; }
.bar { height: 5px; background: #1a2532; border-radius: 3px; margin: 6px 0; overflow: hidden; }
.bar > div { height: 100%; background: var(--good); }
.army .status { font-size: 12px; color: var(--muted); }
.army .status b { color: var(--text); font-weight: 600; }
.army .status .bad { color: var(--bad); }
.army .row { margin-top: 6px; }
.empty-armies { color: var(--muted); padding: 8px 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 4px; }
.tab { flex: 1; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 6px;
  cursor: pointer; font: inherit; }
.tab.on { color: var(--text); border-color: var(--accent); }
.tab-body { flex: 1; overflow-y: auto; min-height: 0; }
#tab-chat { display: flex; flex-direction: column; }
.stand { margin-bottom: 8px; }
.stand .name { display: flex; justify-content: space-between; font-size: 13px; }
.stand .bar > div { background: currentColor; }
#top { margin: 0; padding-left: 20px; }
#top li { margin: 2px 0; }
#events { list-style: none; margin: 0; padding: 0; font-size: 12px; }
#events li { padding: 4px 0; border-bottom: 1px solid #141c26; }
#events li.capture { color: #fde68a; }
#events li.destroyed { color: #fca5a5; }
#events li.victory { color: var(--accent); font-weight: 700; }
#chat { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; font-size: 13px; }
#chat li { padding: 3px 0; word-wrap: break-word; }
#chat b { color: var(--accent); }
#chat-form { display: flex; gap: 6px; margin-top: 8px; }
#chat-input, .card input { flex: 1; background: #0b1118; border: 1px solid #2a3a4d; color: var(--text); border-radius: 6px;
  padding: 8px; font: inherit; }

#selection { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--panel);
  border: 1px solid var(--accent); border-radius: 10px; padding: 9px 14px; z-index: 6; max-width: min(560px, 92vw);
  display: flex; gap: 12px; align-items: center; }
#tooltip { position: fixed; pointer-events: none; background: #0b1118f2; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 9px; font-size: 12px; z-index: 7; max-width: 260px; }
#banner { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: #3b2a06; border: 1px solid var(--accent);
  color: #fde68a; padding: 8px 14px; border-radius: 8px; z-index: 8; }
#toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #111a24; border: 1px solid #2a3a4d;
  padding: 8px 14px; border-radius: 8px; z-index: 9; }

.overlay { position: fixed; inset: 0; background: radial-gradient(ellipse at center, #05070b99, #05070bee); display: grid;
  place-items: center; z-index: 20; padding: 16px; overflow-y: auto; }
.card { background: #0b1017; border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(460px, 100%); }
.auth-card h1 { color: var(--accent); letter-spacing: .3em; font-size: 30px; }
.tagline { margin: 6px 0 12px; font-size: 15px; }
.pitch { padding-left: 18px; color: var(--muted); margin: 0 0 16px; }
.card label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.help-card { width: min(640px, 100%); }
.help-card ol { padding-left: 20px; }
.help-card li { margin-bottom: 8px; }

#mobile-toggles { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); z-index: 6; gap: 8px; }
@media (max-width: 860px) {
  #topbar { gap: 8px; height: 44px; padding: 0 8px; }
  .brand { display: none; }
  .tick-bar, #season-label, .tick .sep, #me-stats, #tick-label, #help-btn { display: none; }
  .badge { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .panel { top: auto; bottom: 0; left: 0 !important; right: 0 !important; width: auto; max-height: 52vh; border-radius: 12px 12px 0 0; }
  .panel.collapsed { display: none !important; }
  #mobile-toggles:not(.hidden) { display: flex; }
  #selection { bottom: calc(52vh + 8px); }
}
