:root {
  --bg: #0f2a33;
  --panel: #163b47;
  --panel2: #1d4a58;
  --text: #eef6f4;
  --muted: #9fc1c0;
  --accent: #f4b942;
  --good: #6fd38f;
  --bad: #ff7a6b;
  --water: #2a8bb5;
  --water2: #237aa0;
  --grass: #7cbf5a;
  --forest: #3f8a3f;
  --hill: #a8916b;
  --ai: #d76fd3;
  --me: #f4b942;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid #2d6476; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.active { background: var(--accent); color: #222; border-color: var(--accent); }
button.secondary { background: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }

header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid #2d6476; flex-wrap: wrap; }
.date { font-size: 18px; font-weight: 600; }
.date small { color: var(--muted); font-weight: 400; font-size: 13px; }
.speed { display: flex; gap: 4px; margin-left: auto; }

main { display: grid; grid-template-columns: 240px 1fr 330px; gap: 14px; padding: 14px; align-items: start; }
@media (max-width: 1100px) { main { grid-template-columns: 1fr; } }
aside { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--panel); border-radius: 10px; padding: 12px; }

#tools { display: flex; flex-direction: column; gap: 4px; }
.tool { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; text-align: left; gap: 6px; padding: 6px 8px; }
.tool .ico { font-size: 20px; }
.tool .cost { color: var(--accent); font-variant-numeric: tabular-nums; }
.tool .sub { display: block; color: var(--muted); font-size: 11px; }
.tool.active .sub, .tool.active .cost { color: #333; }
.hover { min-height: 110px; font-size: 13px; line-height: 1.45; }
.hover b { color: var(--accent); }

.center { display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; }
.scores { display: flex; gap: 12px; width: 100%; max-width: 640px; }
.score { flex: 1; background: var(--panel); border-radius: 10px; padding: 10px 14px; border-left: 4px solid var(--me); }
.score.ai { border-left-color: var(--ai); }
.score .money { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score .meta { color: var(--muted); font-size: 12px; }
.score.leading .money::after { content: " 👑"; font-size: 18px; }

.grid { display: grid; gap: 1px; background: var(--water2); padding: 1px; border-radius: 8px; user-select: none; }
.tile { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; font-size: 22px; position: relative; cursor: pointer; }
.mini .tile { width: 16px; height: 16px; font-size: 10px; cursor: default; }
.t-water { background: var(--water); }
.t-grass { background: var(--grass); }
.t-forest { background: var(--forest); }
.t-hill { background: var(--hill); }
.t-forest:not(.has-b)::before { content: "🌴"; opacity: .9; }
.t-hill:not(.has-b)::before { content: "⛰️"; opacity: .8; }
.mini .t-forest:not(.has-b)::before, .mini .t-hill:not(.has-b)::before { font-size: 9px; }
.tile.building { background-image: linear-gradient(rgba(255,255,255,.18), rgba(255,255,255,.18)); }
.tile.construction { opacity: .55; }
.tile.construction::after { content: "🚧"; position: absolute; right: 0; bottom: 0; font-size: 12px; }
.tile.understaffed::after { content: "⚠"; position: absolute; right: 1px; top: 0; font-size: 11px; color: #ffd84d; text-shadow: 0 0 2px #000; }
.mini .tile::after { display: none; }
.tile.ok { outline: 2px solid rgba(255,255,255,.75); outline-offset: -2px; }
.tile.no { filter: brightness(.7); }
.tile:hover { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
td { padding: 3px 4px; }
td.num { text-align: right; }
.up { color: var(--good); }
.down { color: var(--bad); }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
#report div { display: flex; justify-content: space-between; padding: 2px 0; }
#report .total { border-top: 1px solid #2d6476; margin-top: 4px; padding-top: 4px; font-weight: 700; }
#report .warn { color: var(--bad); display: block; }
#log { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; font-size: 12px; }
#log li { padding: 3px 0; border-bottom: 1px solid #1f4c5a; }
#log .t { color: var(--muted); margin-right: 4px; }
#log .ai { color: #f1b4ef; }
#log .news { color: var(--accent); }

.toast { position: absolute; bottom: -8px; transform: translateY(100%); background: var(--bad); color: #fff; padding: 6px 12px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 10; }
.overlay.hidden { display: none; }
.card.big { padding: 28px 36px; text-align: center; max-width: 460px; }
.card.big h2 { font-size: 26px; color: var(--text); text-transform: none; letter-spacing: 0; }
.card.big p { line-height: 1.5; }
