/* SimCity Classic (1989) co-op — DOS/EGA look */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ega-blue: #0098f8;
  --ega-navy: #0000a8;
  --ega-cyan: #00c8c8;
  --land: #b25800;
  --p1: #4aa3ff; --p2: #ff9f43; --p3: #5cd65c; --p4: #e056fd;
}

html, body {
  width: 100%; height: 100%;
  background: #222;
  font-family: "Consolas", "Courier New", monospace;
  color: #000;
  overflow: hidden;
  user-select: none;
}

#app { width: 100%; height: 100%; display: flex; align-items: stretch; justify-content: center; }

/* ── Lobby ─────────────────────────────────────────────────────────────── */
#lobby-screen {
  margin: auto;
  width: 460px;
  background: #d0d0d0;
  border: 3px solid #000;
  box-shadow: 6px 6px 0 rgba(0,0,0,.5);
  padding: 18px 22px;
}
#lobby-sign {
  background: #004600;
  border: 3px solid #e8e8e8;
  outline: 2px solid #003000;
  padding: 14px 10px 10px;
  text-align: center;
  margin-bottom: 14px;
}
#lobby-title {
  color: #fff;
  font-size: 42px;
  font-weight: bold;
  letter-spacing: 6px;
  font-family: "Georgia", "Times New Roman", serif;
  text-shadow: 2px 2px 0 #002000;
}
#lobby-subtitle { color: #b8e0b8; font-size: 12px; margin-top: 6px; }
#connection-status { font-size: 12px; margin-bottom: 10px; }
#connection-status.connected { color: #006000; }
#connection-status.disconnected { color: #a00000; }
.lobby-section { margin-bottom: 12px; }
.lobby-section-title { font-size: 11px; font-weight: bold; text-transform: uppercase; margin-bottom: 5px; color: #333; }
.btn-row { display: flex; gap: 8px; }
#room-code-input {
  flex: 1; font-family: inherit; font-size: 18px; font-weight: bold;
  text-transform: uppercase; padding: 4px 8px;
  border: 2px solid #000; background: #fff; letter-spacing: 3px;
}
button {
  font-family: inherit; font-size: 13px; font-weight: bold;
  background: #e8e8e8; border: 2px solid #000;
  box-shadow: 2px 2px 0 #666;
  padding: 5px 12px; cursor: pointer;
}
button:active { box-shadow: none; transform: translate(2px,2px); }
button:disabled { color: #888; cursor: default; }
#btn-ready { width: 100%; padding: 9px; font-size: 16px; background: var(--ega-cyan); }
#btn-ready.readied { background: #5cd65c; }
.player-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.player-slot {
  border: 2px solid #000; background: #f4f4f4; padding: 6px 8px; font-size: 12px;
  border-left-width: 8px;
}
.player-slot.empty { opacity: .45; border-left-color: #999 !important; }
.player-slot .slot-label { font-weight: bold; }
.player-slot .slot-status { font-size: 11px; color: #444; }
#lobby-status-text { font-size: 12px; color: #333; margin-top: 4px; }
#lobby-error { font-size: 12px; color: #a00000; min-height: 16px; }

/* ── Game chrome ───────────────────────────────────────────────────────── */
#game-screen {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  background: #b8b8b8;
}

#menu-bar {
  display: flex; align-items: center;
  background: var(--ega-blue);
  color: #000; font-weight: bold; font-size: 13px;
  height: 24px; flex: 0 0 24px;
  border-bottom: 2px solid #000;
  position: relative; z-index: 30;
}
.menu-item { padding: 2px 14px; cursor: pointer; height: 100%; display: flex; align-items: center; }
.menu-item:hover, .menu-item.open { background: #000; color: var(--ega-blue); }
#city-name { flex: 1; text-align: center; letter-spacing: 1px; }
#date-display { padding: 0 12px; font-weight: bold; }

#menu-dropdown {
  position: absolute; z-index: 40;
  background: #fff; border: 2px solid #000; box-shadow: 3px 3px 0 rgba(0,0,0,.4);
  min-width: 180px; font-size: 13px;
}
#menu-dropdown .dd-item { padding: 5px 14px; cursor: pointer; }
#menu-dropdown .dd-item:hover { background: var(--ega-navy); color: #fff; }
#menu-dropdown .dd-item.disabled { color: #999; cursor: default; }
#menu-dropdown .dd-item.disabled:hover { background: #fff; color: #999; }

#info-bar {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-bottom: 2px solid #000;
  height: 24px; flex: 0 0 24px; font-size: 13px; font-weight: bold;
  padding: 0 10px;
}
#advisor-message { flex: 1; color: #a00000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#speed-control { display: flex; gap: 3px; }
#speed-control .spd {
  width: 22px; height: 18px; border: 1px solid #000; background: #e0e0e0;
  font-size: 10px; font-weight: bold; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
#speed-control .spd.active { background: var(--ega-navy); color: #fff; }
#speed-control.locked .spd { cursor: default; opacity: .7; }

#main-row { display: flex; flex: 1; min-height: 0; }

#left-panel {
  flex: 0 0 148px;
  background: #c8c8c8; border-right: 2px solid #000;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 4px; gap: 6px;
  overflow-y: auto;
}
#tool-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tool-btn {
  width: 62px; height: 40px;
  background: #e8e8e8; border: 2px solid #555;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; padding: 1px;
}
.tool-btn canvas { image-rendering: pixelated; }
.tool-btn .tool-label { font-size: 8px; font-weight: bold; color: #222; line-height: 1; margin-top: 1px; }
.tool-btn:hover { border-color: #000; }
.tool-btn.selected { border: 2px solid #f8d800; background: #fff; box-shadow: 0 0 0 1px #000; }
#rci-gauge { background: #fff; border: 2px solid #000; }
#overlay-row { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
#overlay-row .ov-btn {
  font-size: 9px; font-weight: bold; border: 1px solid #000; background: #e0e0e0;
  padding: 2px 4px; cursor: pointer;
}
#overlay-row .ov-btn.active { background: var(--ega-navy); color: #fff; }
#minimap { border: 2px solid #000; image-rendering: pixelated; width: 132px; height: 110px; background: #000; }

#canvas-wrap { position: relative; flex: 1; min-width: 0; background: #000; overflow: hidden; }
#game-canvas { display: block; image-rendering: pixelated; cursor: crosshair; }

#status-bar {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-top: 2px solid #000;
  height: 22px; flex: 0 0 22px; font-size: 12px; font-weight: bold; padding: 0 10px;
}
#scoreboard { flex: 1; display: flex; gap: 8px; justify-content: center; }
.score-chip {
  font-size: 11px; padding: 0 8px; border: 1px solid #000; background: #eee;
  border-left-width: 6px; white-space: nowrap;
}
.score-chip.gone { opacity: .45; }
#room-display { color: #333; }

/* ── Toasts / votes / banner ───────────────────────────────────────────── */
#toasts {
  position: absolute; top: 8px; right: 8px; z-index: 20;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: #fff; border: 2px solid #000; box-shadow: 2px 2px 0 rgba(0,0,0,.5);
  font-size: 12px; font-weight: bold; padding: 5px 10px;
  animation: toast-in .18s ease-out;
  max-width: 340px;
}
.toast.warn { background: #ffe9c0; }
.toast.bad { background: #ffd0d0; }
.toast.good { background: #d2ffd2; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

#vote-box {
  /* must float ABOVE #window-layer (z 50) so players can vote while the
     January budget window is open (verify-loop-1 finding 1) */
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: #fff; border: 2px solid #000; box-shadow: 3px 3px 0 rgba(0,0,0,.5);
  padding: 10px 14px; font-size: 13px; text-align: center; min-width: 300px;
}
#vote-box .vote-title { font-weight: bold; color: var(--ega-navy); margin-bottom: 6px; }
#vote-box .vote-count { font-size: 12px; margin: 4px 0; }
#vote-box .btn-row { justify-content: center; margin-top: 6px; }
#vote-box button.yes { background: #b8f0b8; }
#vote-box button.no { background: #f0b8b8; }

#banner {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%,-50%); z-index: 26;
  background: #fff; border: 3px solid #000; box-shadow: 5px 5px 0 rgba(0,0,0,.55);
  padding: 18px 34px; text-align: center;
}
#banner .banner-title { font-size: 26px; font-weight: bold; color: var(--ega-navy); letter-spacing: 2px; }
#banner .banner-sub { font-size: 13px; margin-top: 6px; }
/* the METROPOLIS win holds a bigger banner with a scale-in pop (loop 3 f7) */
#banner.big { border-color: var(--ega-navy); animation: banner-pop .45s cubic-bezier(.2, 1.5, .4, 1); }
#banner.big .banner-title { font-size: 36px; }
#banner.big .banner-sub { font-size: 14px; margin-top: 8px; }
@keyframes banner-pop {
  from { transform: translate(-50%, -50%) scale(.25); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ── DOS-style windows (budget / evaluation / query) ───────────────────── */
#window-layer {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
}
#game-window {
  background: #fff; border: 3px solid #000; box-shadow: 6px 6px 0 rgba(0,0,0,.5);
  min-width: 380px; max-width: 560px;
  font-size: 14px;
}
#game-window .win-title {
  /* blue title + labels throughout, matching the reference budget window at
     2x (verify-loop-3 finding 8; GDD §6 blue-accent window chrome) */
  text-align: center; font-weight: bold; color: var(--ega-navy);
  border-bottom: 2px solid var(--ega-navy);
  margin: 8px 22px 10px; padding-bottom: 4px; font-size: 16px;
}
#game-window .win-body { padding: 0 22px 16px; }
.budget-row { display: flex; justify-content: space-between; align-items: center; margin: 5px 0; font-weight: bold; color: var(--ega-navy); }
.budget-table {
  background: var(--ega-navy); color: #fff; padding: 8px 10px; margin: 10px 0;
  font-size: 13px;
}
.budget-table .bt-head { display: grid; grid-template-columns: 70px 1fr 1fr 1fr; font-weight: bold; margin-bottom: 6px; text-align: right; }
.budget-table .bt-row { display: grid; grid-template-columns: 70px 1fr 1fr 1fr; margin: 4px 0; text-align: right; align-items: center; }
.budget-table .bt-row > :first-child, .budget-table .bt-head > :first-child { text-align: left; }
.budget-note {
  margin: 8px 0 0; padding: 4px 8px; font-size: 12px; font-weight: bold;
  background: #ffe9c0; border: 1px solid #000; text-align: center; color: #000;
}
.arrow-btn {
  display: inline-block; width: 18px; height: 16px; line-height: 14px;
  background: var(--ega-cyan); color: #000; border: 1px solid #000;
  font-size: 10px; text-align: center; cursor: pointer; font-weight: bold;
  padding: 0; box-shadow: none;
}
.arrow-btn:active { transform: none; background: #fff; }
.win-btn {
  display: block; margin: 10px auto 0; background: var(--ega-cyan);
  border: 2px solid #000; font-size: 14px; padding: 6px 18px;
}
.eval-cols { display: flex; gap: 14px; }
.eval-col { flex: 1; border: 2px solid var(--ega-navy); padding: 8px; font-size: 12px; }
.eval-col h4 { background: #fff; color: var(--ega-navy); border: 1px solid var(--ega-navy); text-align: center; margin: -18px auto 8px; width: fit-content; padding: 1px 8px; font-size: 12px; }
.eval-col table { width: 100%; border-collapse: collapse; }
.eval-col td { padding: 2px 0; }
.eval-col td:last-child { text-align: right; font-weight: bold; }

#query-window {
  position: absolute; z-index: 45;
  background: #fff; border: 2px solid #000; box-shadow: 3px 3px 0 rgba(0,0,0,.5);
  font-size: 12px; min-width: 190px;
}
#query-window .win-title { font-weight: bold; text-align: center; border-bottom: 2px solid var(--ega-navy); padding: 3px 8px; font-size: 13px; }
#query-window table { width: 100%; border-collapse: collapse; padding: 4px; }
#query-window td { padding: 2px 8px; }
#query-window td:last-child { text-align: right; font-weight: bold; }

/* ── Overlays ──────────────────────────────────────────────────────────── */
#countdown-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
#countdown-number { font-size: 90px; color: #fff; font-weight: bold; text-shadow: 4px 4px 0 #000; }

#disconnected-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.65);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; gap: 10px;
}
