:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --accent: #c41e3a;
  --green: #2d6a4f;
  --gold: #f4d35e;
  --text: #e8eef4;
  --muted: #8ba3bc;
  --street: #3d4f5f;
  --building: #252f3d;
  --park: #1b4332;
  --water: #1d3557;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.panel {
  max-width: 420px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--panel);
  border-radius: 12px;
  border: 2px solid var(--accent);
}

.title-block h1 {
  margin: 0;
  font-size: 2.5rem;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.tagline { color: var(--accent); font-weight: 600; margin: 0.25rem 0; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }

#auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
#auth-tabs button {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
}
#auth-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
}

#auth-form label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; }
#auth-form input, #auth-form select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--muted);
  background: var(--bg);
  color: var(--text);
}

#auth-form .primary {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.error { color: #ff6b6b; font-size: 0.85rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 1rem; }
.hint kbd { background: var(--bg); padding: 0.1rem 0.35rem; border-radius: 4px; }

#game-screen { padding: 0.5rem; }

.game-layout {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

#game {
  border: 3px solid var(--accent);
  border-radius: 4px;
  background: #111;
  max-width: 100%;
  flex: 1 1 640px;
}

#hud {
  flex: 0 1 300px;
  min-width: 260px;
  max-width: 320px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--panel);
  border-radius: 8px;
  font-size: 0.82rem;
  border: 1px solid var(--muted);
}

#hud-top, #hud-season { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.5rem; }
#btn-end-season {
  margin-top: 0.5rem;
  padding: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.controls { color: var(--muted); font-size: 0.75rem; margin: 0.5rem 0 0; }

.hud-actions { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.5rem 0; }
.hud-actions .action {
  padding: 0.45rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}
.hud-actions .action.accent { background: var(--accent); }
.hud-section h3 { margin: 0.5rem 0 0.35rem; font-size: 0.85rem; color: var(--gold); }
.upgrade-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.3rem;
  padding: 0.35rem;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--muted);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}
.upgrade-btn.owned { opacity: 0.6; cursor: default; }
.tutorial-box {
  background: rgba(244, 211, 94, 0.12);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}
.tutorial-box .small {
  margin-top: 0.35rem;
  padding: 0.25rem 0.5rem;
  background: var(--gold);
  color: #1a202c;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.chat-section #chat-log {
  height: 100px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 4px;
  padding: 0.35rem;
  font-size: 0.75rem;
}
.chat-line { margin-bottom: 0.25rem; }
.chat-input-row { display: flex; gap: 0.25rem; margin-top: 0.35rem; }
.chat-input-row input {
  flex: 1;
  padding: 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--muted);
  background: var(--bg);
  color: var(--text);
}
.chat-input-row button {
  padding: 0.35rem 0.5rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.muted { color: var(--muted); font-weight: normal; }

#dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.dialog-box {
  width: min(640px, 100%);
  background: var(--panel);
  border: 4px solid var(--gold);
  border-radius: 8px 8px 4px 4px;
  padding: 1rem 1.25rem 1.25rem;
  font-family: "Courier New", monospace;
}

.dialog-name {
  color: var(--gold);
  font-weight: bold;
  margin: 0 0 0.5rem;
}

#dialog-text { margin: 0 0 1rem; line-height: 1.5; min-height: 3em; }

#dialog-choices { display: flex; flex-direction: column; gap: 0.4rem; }
#dialog-choices button {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 2px solid var(--green);
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
#dialog-choices button:hover { background: var(--green); }

#dialog-close {
  margin-top: 0.75rem;
  padding: 0.4rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 2px solid var(--gold);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  z-index: 50;
  max-width: 90%;
}

@media (max-width: 900px) {
  #game-screen { flex-direction: column; align-items: center; }
  #hud { max-width: 100%; width: 100%; }
}
