/* City Builder: a planner's desk over a real map */
:root { --bg: #14202e; --bg2: #1c2a3c; --bg3: #26384e; --line: #36506a; --fg: #eef4fa; --fg2: #a8bccc; --hot: #ffb340; --ok: #7ce38b; --bad: #ff6a5a; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font: 15px/1.4 Nunito, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; -webkit-user-select: none; user-select: none; }
button, input, select { font: inherit; color: inherit; } button { cursor: pointer; }
#app { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; touch-action: none; display: block; }
.btn { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; white-space: nowrap; }
.btn:hover { border-color: var(--hot); } .btn.hot { background: linear-gradient(90deg, #ff9a3a, #ff5a7a); border-color: transparent; font-weight: 800; }
.big { padding: 12px 28px; border: 0; border-radius: 14px; background: linear-gradient(90deg, #ff9a3a, #ff5a7a); font-weight: 900; font-size: 18px; color: #fff; }
.ck { display: flex; align-items: center; gap: 6px; }
.dim { color: var(--fg2); font-size: 13px; }

/* title */
.title { position: absolute; inset: 0; overflow-y: auto; background: radial-gradient(ellipse at top, #24405e, #10182a 70%); display: flex; justify-content: center; padding: 24px 16px; }
.tbox { max-width: 860px; width: 100%; text-align: center; }
.title h1 { margin: 8px 0 0; font-size: clamp(36px, 7vw, 60px); font-weight: 900; background: linear-gradient(90deg, #ffd04a, #ff8a5a, #5ec8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { margin: 0 0 8px; letter-spacing: .4em; color: var(--fg2); }
.maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 16px 0; }
.map { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border-radius: 18px; background: var(--bg2); border: 2px solid var(--line); text-align: left; }
.map.on { border-color: var(--hot); box-shadow: 0 0 0 3px rgba(255, 179, 64, .25); }
.map canvas { width: 200px; height: 200px; border-radius: 12px; } .map b { font-size: 22px; } .map small { color: var(--fg2); font-size: 13px; } .map i { font-style: normal; font-size: 12px; color: var(--hot); }
.opts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin: 8px 0 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { background: var(--bg2); border: 0; padding: 8px 12px; display: flex; flex-direction: column; align-items: center; } .seg button.on { background: var(--hot); color: #1a1a1a; } .seg button small { font-size: 11px; opacity: .85; max-width: 200px; }
.go { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.src { color: var(--fg2); font-size: 11px; margin-top: 18px; }

/* the game */
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 10px; background: linear-gradient(rgba(14, 22, 34, .92), rgba(14, 22, 34, .75)); border-bottom: 1px solid var(--line); z-index: 5; }
.hud .city { font-size: 17px; font-weight: 900; color: var(--hot); }
.pill { background: var(--bg3); border-radius: 999px; padding: 3px 10px; font-weight: 800; font-size: 14px; } .pill.bad { color: var(--bad); }
.rci { position: relative; display: inline-block; width: 40px; height: 30px; background: var(--bg3); border-radius: 6px; }
.rci i { position: absolute; width: 8px; border-radius: 2px; } .rci i:nth-child(1) { left: 5px; background: #60c46e; } .rci i:nth-child(2) { left: 16px; background: #5696e2; } .rci i:nth-child(3) { left: 27px; background: #e2be46; } .rci i.neg { opacity: .45; }
.hud .sp button { padding: 3px 9px; } .hud select { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.tools { position: absolute; left: 6px; top: 50px; bottom: 6px; width: 74px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; z-index: 5; scrollbar-width: thin; }
.tools button { display: flex; flex-direction: column; align-items: center; padding: 4px 2px; border-radius: 10px; border: 1px solid var(--line); background: rgba(28, 42, 60, .9); flex: none; }
.tools button span { font-size: 20px; line-height: 1.1; } .tools button small { font-size: 10px; color: var(--fg2); line-height: 1.1; text-align: center; }
.tools button.on { background: var(--hot); border-color: var(--hot); } .tools button.on small { color: #222; }
.tools hr { border: 0; border-top: 1px solid var(--line); margin: 2px 4px; width: auto; flex: none; }
.info { position: absolute; left: 88px; bottom: 8px; max-width: min(420px, calc(100vw - 100px)); background: rgba(14, 22, 34, .9); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; z-index: 5; font-size: 13px; }
.info b { font-size: 15px; } .info span { color: var(--hot); font-weight: 800; margin-left: 6px; } .info small { display: block; color: var(--fg2); }
.news { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 4px; z-index: 6; pointer-events: none; align-items: center; }
.news div { background: rgba(255, 179, 64, .95); color: #1a1a1a; font-weight: 800; padding: 6px 14px; border-radius: 999px; transition: opacity 1s; box-shadow: 0 3px 12px rgba(0, 0, 0, .3); }
.news div.out { opacity: 0; }

/* dialogs */
dialog { background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(4, 8, 16, .6); }
dialog .x { position: absolute; right: 10px; top: 8px; background: none; border: 0; font-size: 24px; color: var(--fg2); }
dialog h3 { margin: 0 0 10px; } dialog h4 { margin: 14px 0 6px; } dialog label { display: block; margin: 10px 0; } dialog input[type=range] { width: 100%; accent-color: var(--hot); }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; background: var(--bg); border-radius: 12px; padding: 10px; } .sum b { text-align: right; }
#chart { width: 100%; height: auto; border-radius: 10px; }
.col { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 640px) { .hud { font-size: 12px; } .pill { font-size: 12px; padding: 2px 7px; } .tools { width: 60px; } .tools button small { display: none; } .info { left: 70px; } }
