/* simcity-2000 — UI chrome styled after SC2000's Win95-era look (see gdd/screenshots) */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; background: #0c0c14; overflow: hidden; font-family: "Segoe UI", Tahoma, sans-serif; color: #ddd; }
#app { width: 100%; height: 100%; }
button { cursor: pointer; }

/* ── Lobby ─────────────────────────────────────────────────────────────── */
#lobby-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; z-index: 40;
  background: radial-gradient(ellipse at 50% 30%, #23233f 0%, #0c0c14 70%);
}
#lobby-art { width: 340px; height: 8px; background: repeating-linear-gradient(90deg, #3fbfb0 0 24px, #2a6db5 24px 48px, #c8a86a 48px 72px); border-radius: 2px; }
#lobby-title { font-size: 42px; font-weight: 800; letter-spacing: 6px; color: #e8e4d0; text-shadow: 0 3px 0 #1a1a2a, 0 6px 18px #000; }
#lobby-subtitle { font-size: 13px; color: #8fa0b8; letter-spacing: 1px; }
.lobby-section { width: 480px; background: #16162a; border: 1px solid #2c2c4a; border-radius: 8px; padding: 12px; }
.lobby-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 4px 0; }
#connection-status.disconnected { color: #e05555; } #connection-status.connected { color: #5cd65c; }
#lobby-room-code { font-family: Consolas, monospace; font-size: 18px; color: #ffd35c; letter-spacing: 3px; }
#name-input { flex: 1; background: #0e0e1c; color: #eee; border: 1px solid #34345a; border-radius: 4px; padding: 7px 9px; font-size: 14px; }
#btn-copy-link { background: #26264a; color: #cfe0ff; border: 1px solid #3c3c6a; border-radius: 4px; padding: 7px 12px; }
.player-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.player-slot { border: 1px solid #2c2c4a; border-radius: 6px; padding: 8px 10px; background: #101020; min-height: 58px; }
.player-slot .slot-label { font-size: 11px; opacity: .7; }
.player-slot .slot-name { font-weight: 700; font-size: 15px; margin: 2px 0; }
.player-slot .slot-status { font-size: 11px; color: #8fa0b8; }
.player-slot.ready { border-color: #3fbf6f; box-shadow: 0 0 8px #3fbf6f33 inset; }
.player-slot.is-you { outline: 1px dashed #ffffff33; }
#btn-ready {
  width: 480px; padding: 12px; font-size: 18px; font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(#3fbf6f, #2c8f50); color: #fff; border: 0; border-radius: 8px;
}
#btn-ready:disabled { filter: grayscale(.8) brightness(.6); cursor: default; }
#btn-ready.on { background: linear-gradient(#e0a53f, #b57e28); }
#lobby-status-text { font-size: 12px; color: #8fa0b8; }
#lobby-hint { font-size: 11px; color: #5a6a80; max-width: 480px; text-align: center; }

/* ── Game wrapper / canvas ─────────────────────────────────────────────── */
#game-wrapper { position: absolute; inset: 0; display: none; }
#game-wrapper.active { display: block; }
#game-canvas {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #201410; image-rendering: pixelated;
}

/* ── Win95-ish chrome helpers ──────────────────────────────────────────── */
.bevel, #top-strip, #toolbar, #minimap-panel {
  background: #b8b4a8;
  border-top: 2px solid #f2efe4; border-left: 2px solid #f2efe4;
  border-right: 2px solid #55534a; border-bottom: 2px solid #55534a;
  color: #17150f;
}

/* ── Top strip ─────────────────────────────────────────────────────────── */
#top-strip {
  position: absolute; top: 0; left: 0; right: 0; height: 30px; z-index: 10;
  display: flex; align-items: center; gap: 14px; padding: 0 10px;
  font-size: 13px; font-weight: 700; font-family: Tahoma, sans-serif;
  user-select: none;
}
#ts-city { color: #223; } #ts-date { min-width: 66px; }
#ts-funds { color: #1d5c1d; min-width: 76px; } #ts-funds.neg { color: #a01010; }
#ts-pop { min-width: 76px; }
#ts-rci { display: flex; align-items: center; }
#ts-speed .spd {
  width: 26px; height: 20px; font-size: 9px; border: 1px solid #55534a; background: #ccc8ba; color: #333;
}
#ts-speed .spd.sel { background: #6a8fd0; color: #fff; }
#ts-speed.locked .spd { opacity: .55; cursor: default; }
#ts-tool { flex: 1; text-align: center; color: #2a2a55; }
#ts-right { margin-left: auto; display: flex; gap: 6px; }
#ts-right button { border: 1px solid #55534a; background: #ccc8ba; font-size: 10px; font-weight: 700; padding: 2px 7px; }
#ts-right button.off { color: #999; text-decoration: line-through; }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
#toolbar {
  position: absolute; left: 6px; top: 40px; z-index: 10; padding: 4px;
  display: grid; grid-template-columns: 38px 38px; gap: 3px; user-select: none;
}
.tool-btn {
  width: 38px; height: 38px; padding: 0; position: relative;
  background: #ccc8ba; border-top: 2px solid #f2efe4; border-left: 2px solid #f2efe4;
  border-right: 2px solid #6a675c; border-bottom: 2px solid #6a675c;
}
.tool-btn.sel { background: #9ab0d8; border-top-color: #55534a; border-left-color: #55534a; border-right-color: #f2efe4; border-bottom-color: #f2efe4; }
.tool-btn canvas { width: 32px; height: 32px; image-rendering: pixelated; display: block; margin: 1px auto; }
.tool-sep { grid-column: 1 / span 2; height: 3px; background: #8a8578; margin: 1px 2px; }
.tool-btn .tip {
  display: none; position: absolute; left: 44px; top: 4px; white-space: nowrap; z-index: 30;
  background: #ffffe6; color: #222; border: 1px solid #666; font-size: 11px; padding: 2px 7px; pointer-events: none;
}
.tool-btn:hover .tip { display: block; }

/* ── Minimap ───────────────────────────────────────────────────────────── */
#minimap-panel { position: absolute; right: 8px; bottom: 8px; z-index: 10; padding: 4px; }
#minimap-tabs { display: flex; gap: 2px; margin-bottom: 3px; }
#minimap-tabs button { font-size: 9px; padding: 2px 5px; border: 1px solid #6a675c; background: #ccc8ba; color: #333; font-weight: 700; }
#minimap-tabs button.sel { background: #6a8fd0; color: #fff; }
#minimap { display: block; image-rendering: pixelated; border: 1px solid #55534a; cursor: crosshair; }

/* ── Scoreboard ────────────────────────────────────────────────────────── */
#scoreboard { position: absolute; left: 8px; bottom: 8px; z-index: 10; display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.sb-chip { display: flex; align-items: center; gap: 6px; background: #000000aa; border: 1px solid #333; border-radius: 4px; padding: 3px 8px; }
.sb-dot { width: 9px; height: 9px; border-radius: 2px; }
.sb-name { font-weight: 700; }
.sb-spend { color: #9fb69f; margin-left: auto; font-family: Consolas, monospace; }

/* ── Query panel ───────────────────────────────────────────────────────── */
#query-panel {
  display: none; position: absolute; z-index: 20; min-width: 190px;
  background: #f4f0e4; color: #222; border: 2px solid #333; box-shadow: 4px 4px 0 #0008;
  font-size: 12px; padding: 8px 10px;
}
#query-panel h4 { font-size: 13px; border-bottom: 1px solid #999; margin-bottom: 4px; padding-bottom: 2px; }
#query-panel .qrow { display: flex; justify-content: space-between; gap: 12px; }

/* ── Vote toast ────────────────────────────────────────────────────────── */
#vote-toast {
  display: none; position: absolute; top: 40px; left: 50%; transform: translateX(-50%); z-index: 25;
  background: #16162acc; border: 1px solid #4a4a7a; border-radius: 8px; padding: 10px 14px; min-width: 320px;
  backdrop-filter: blur(3px); color: #eee;
}
#vote-text { font-size: 14px; font-weight: 700; margin-bottom: 8px; text-align: center; }
#vote-btns { display: flex; gap: 8px; justify-content: center; }
#vote-btns button { padding: 5px 22px; font-weight: 800; border: 0; border-radius: 5px; }
#vote-yes { background: #3fbf6f; color: #fff; } #vote-no { background: #d05050; color: #fff; }
#vote-btns button:disabled { filter: grayscale(.7) brightness(.7); }
#vote-bar { height: 4px; background: #333; border-radius: 2px; margin-top: 8px; overflow: hidden; }
#vote-bar-fill { height: 100%; width: 100%; background: #ffd35c; }

/* ── Banner ────────────────────────────────────────────────────────────── */
#banner {
  display: none; position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); z-index: 26;
  font-size: 40px; font-weight: 900; letter-spacing: 3px; text-align: center; color: #ffd35c;
  text-shadow: 0 3px 0 #000, 0 0 24px #000; pointer-events: none; white-space: pre-line;
}
#banner.bad { color: #ff6055; }

/* ── Disaster newspaper banner (non-modal, loop 1 finding 9) ───────────── */
#news-banner {
  position: absolute; top: 34px; left: 50%; z-index: 27;
  /* park it fully above the viewport when hidden (top 34px + own height) */
  transform: translate(-50%, calc(-100% - 44px)); opacity: 0;
  display: flex; align-items: center; gap: 10px;
  background: #f4f0e4; color: #1a1812; border: 2px solid #17150f; border-radius: 3px;
  padding: 7px 12px; box-shadow: 0 4px 14px #000c;
  transition: transform .3s ease-out, opacity .3s ease-out; pointer-events: none;
}
#news-banner.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#news-banner-tag {
  font-family: Georgia, serif; font-weight: 900; font-size: 12px; letter-spacing: 2px;
  background: #a22; color: #f4f0e4; padding: 2px 6px;
}
#news-banner-headline { font-family: Georgia, serif; font-weight: 800; font-size: 16px; max-width: 520px; }
#news-banner-read {
  background: #17150f; color: #f4f0e4; border: 0; border-radius: 3px;
  padding: 4px 12px; font-weight: 700; font-size: 12px;
}
#news-banner-x { background: none; border: 0; font-size: 18px; font-weight: 900; color: #1a1812; padding: 0 2px; }

/* ── Modals & Win95 windows ────────────────────────────────────────────── */
.modal { display: none; position: absolute; inset: 0; z-index: 30; background: #00000066; }
.modal.open { display: flex; align-items: center; justify-content: center; }
.win95 {
  width: 560px; background: #b8b4a8; color: #17150f;
  border-top: 2px solid #f2efe4; border-left: 2px solid #f2efe4;
  border-right: 2px solid #55534a; border-bottom: 2px solid #55534a;
  box-shadow: 6px 6px 0 #0006;
}
.win95.narrow { width: 260px; }
.win95-title {
  background: linear-gradient(90deg, #24247a, #4848b0); color: #fff; font-weight: 700; font-size: 13px;
  padding: 4px 8px; display: flex; justify-content: space-between; align-items: center;
}
.win-x { background: #ccc8ba; border: 1px solid #55534a; width: 18px; height: 16px; line-height: 12px; font-size: 12px; padding: 0; }
.win95-body { padding: 12px; font-size: 13px; font-family: Tahoma, sans-serif; }

/* budget content */
.bud-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px dotted #8a8578; }
.bud-row label { flex: 1; }
.bud-row .bud-val { width: 84px; text-align: right; font-family: Consolas, monospace; }
.bud-row input[type=range] { width: 130px; }
.bud-row .pct { width: 44px; text-align: right; font-family: Consolas, monospace; }
.bud-head { font-weight: 800; margin: 8px 0 2px; border-bottom: 2px solid #55534a; }
.bud-total { font-weight: 800; }
.ord-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.ord-row .bud-val { margin-left: auto; font-family: Consolas, monospace; }
.menu-item { display: block; width: 100%; text-align: left; padding: 6px 10px; background: #ccc8ba; border: 1px solid #6a675c; margin-bottom: 4px; font-size: 13px; }
.menu-item:hover { background: #9ab0d8; }
.menu-note { font-size: 10px; color: #555; margin-top: 6px; }
.bud-note { font-size: 10px; color: #555; margin-top: 8px; }

/* ── Newspaper ─────────────────────────────────────────────────────────── */
#news-modal.open { animation: newsin .33s ease-out; }
@keyframes newsin { from { transform: scale(.06) rotate(-12deg); opacity: .3; } to { transform: scale(1) rotate(0); opacity: 1; } }
#newspaper {
  position: relative; width: 860px; max-width: 92vw; max-height: 86vh; overflow: hidden;
  background: #f4f0e4; color: #171310; border: 2px solid #222; box-shadow: 8px 8px 0 #000a;
  padding: 18px 26px 26px;
  font-family: Georgia, "Times New Roman", serif;
}
#news-x { position: absolute; right: 10px; top: 8px; background: none; border: 1px solid #999; width: 22px; height: 22px; font-size: 14px; }
#news-masthead {
  text-align: center; font-size: 44px; font-weight: 700; letter-spacing: 1px; font-variant: small-caps;
  border-bottom: 3px double #222; padding-bottom: 4px;
}
#news-dateline { display: flex; justify-content: space-between; font-size: 12px; font-style: italic; border-bottom: 1px solid #222; padding: 3px 2px; margin-bottom: 10px; }
#news-headline { font-size: 34px; font-weight: 700; text-align: center; line-height: 1.1; margin: 6px 0 12px; }
#news-cols { display: flex; gap: 16px; }
.news-col { flex: 1; font-size: 12.5px; line-height: 1.45; text-align: justify; }
.news-col.wide { flex: 1.35; }
.news-col h3 { font-size: 16px; text-align: center; font-weight: 700; margin-bottom: 6px; }
.news-photo { width: 100%; height: 130px; background: #888; border: 1px solid #222; margin-bottom: 6px; image-rendering: pixelated; }
.news-caption { font-size: 10.5px; text-align: center; font-style: italic; margin-bottom: 8px; }
.news-bars .bar { height: 5px; background: #b6b0a2; margin: 4px 0; }
.news-bars .bar.short { width: 62%; }
.news-weather { border: 1px solid #222; padding: 6px 8px; font-size: 11.5px; margin-top: 10px; }

/* ── Overlays ──────────────────────────────────────────────────────────── */
#countdown-overlay { display: none; position: absolute; inset: 0; z-index: 35; align-items: center; justify-content: center; background: #00000088; }
#countdown-overlay.active { display: flex; }
#countdown-number { font-size: 110px; font-weight: 900; color: #ffd35c; text-shadow: 0 4px 0 #000; }
#disconnected-overlay { display: none; position: absolute; inset: 0; z-index: 50; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #000000cc; }
#disconnected-overlay.active { display: flex; }
#btn-reconnect { padding: 10px 26px; font-size: 15px; font-weight: 700; background: #3fbf6f; border: 0; border-radius: 6px; color: #fff; }

#toast-area { position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%); z-index: 24; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: #000000cc; color: #ffe9a8; border: 1px solid #444; border-radius: 5px; padding: 5px 14px; font-size: 13px; animation: toastin .2s ease-out; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── portrait rotate prompt (mobile) — same approach as simcity-snes:
     pure CSS media query, shows only on portrait + coarse pointer, so the
     letterboxed sliver-of-map problem gets an honest "rotate me" instead ── */
#rotate-overlay {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  background: #0c0c14;
  z-index: 60;
  text-align: center;
}
#rotate-phone {
  width: 42px; height: 72px;
  border: 4px solid #e8e4d0;
  border-radius: 8px;
  animation: rotate-hint 1.8s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 25%  { transform: rotate(0deg); }
  60%, 90% { transform: rotate(-90deg); }
  100%     { transform: rotate(-90deg); }
}
#rotate-text { font-size: 20px; font-weight: bold; letter-spacing: 2px; color: #e8e4d0; }
#rotate-sub  { font-size: 12px; color: #8fa0b8; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate-overlay { display: flex; }
}
