/* ============================================================
   Isopolis — UI styling
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --glass-bg: rgba(16, 22, 38, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --txt: #eef2fa;
  --txt-dim: #9aa6bf;
  --accent: #6fd0ff;
  --good: #6fd98a;
  --bad: #ff7878;
  --warn: #ffd166;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  color: var(--txt);
  background: #0b1026;
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* ---------------- top bar ---------------- */
#topbar {
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 20;
}
#topbar > * { pointer-events: auto; }

.tb-left { padding: 8px 16px; min-width: 150px; }
.city-name { font-weight: 700; font-size: 17px; letter-spacing: 0.4px; }
.city-date { font-size: 12px; color: var(--txt-dim); margin-top: 1px; }

.tb-center { padding: 6px 14px; }
.rci { display: flex; gap: 10px; align-items: flex-end; }
.rci-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rci-col span { font-size: 10px; font-weight: 700; color: var(--txt-dim); }
.rci-bar {
  position: relative;
  width: 9px; height: 34px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 5px;
  overflow: hidden;
}
.rci-bar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}
.rci-fill { position: absolute; left: 0; right: 0; border-radius: 4px; }
.rci-fill.rci-r { background: linear-gradient(#7ce8a2, #34c46a); }
.rci-fill.rci-c { background: linear-gradient(#7cc4ff, #2f8fe8); }
.rci-fill.rci-i { background: linear-gradient(#ffd97c, #e8a52f); }
.rci-fill.neg { filter: saturate(0.4) brightness(0.65); }

.tb-right { display: flex; gap: 8px; align-items: center; }
.stat {
  padding: 8px 13px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.stat-ico { font-size: 13px; }
.stat.danger { border-color: rgba(255, 100, 100, 0.6); color: #ffb0b0; animation: pulse-red 1.6s infinite; }
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
  50% { box-shadow: 0 0 18px rgba(255, 80, 80, 0.55); }
}

.speed { display: flex; padding: 4px; gap: 2px; }
.speed button {
  background: transparent;
  border: none;
  color: var(--txt-dim);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.speed button:hover { color: var(--txt); background: rgba(255,255,255,0.08); }
.speed button.active { background: rgba(111, 208, 255, 0.22); color: var(--accent); }

.panel-btn {
  font-size: 16px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--txt);
  transition: transform 0.15s;
}
.panel-btn:hover { transform: scale(1.08); }

/* ---------------- toolbar ---------------- */
#toolbar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 200px);
}
.toolbar-inner {
  display: flex;
  gap: 14px;
  padding: 9px 14px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tool-group { display: flex; flex-direction: column; gap: 4px; }
.tool-group-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--txt-dim);
  text-align: center;
}
.tool-row { display: flex; gap: 4px; }
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 56px;
  padding: 6px 2px 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--txt);
  cursor: pointer;
  transition: all 0.13s;
}
.tool-btn:hover { background: rgba(255, 255, 255, 0.13); transform: translateY(-2px); }
.tool-btn.active {
  background: rgba(111, 208, 255, 0.20);
  border-color: rgba(111, 208, 255, 0.65);
  box-shadow: 0 0 14px rgba(111, 208, 255, 0.3);
}
.tool-btn.locked { opacity: 0.38; filter: grayscale(0.8); }
.tool-ico { font-size: 19px; line-height: 1; }
.tool-name { font-size: 8.5px; color: var(--txt-dim); white-space: nowrap; }
.tool-btn.active .tool-name { color: var(--accent); }

/* ---------------- side panel ---------------- */
#sidepanel {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 19;
  transform: translateX(calc(100% + 30px));
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
#sidepanel.open { transform: translateX(0); }
.panel { width: 284px; padding: 10px; }
.panel-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.panel-tabs button {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 9px;
  color: var(--txt-dim);
  font-size: 11px;
  padding: 7px 4px;
  cursor: pointer;
  font-family: inherit;
}
.panel-tabs button.active { background: rgba(111, 208, 255, 0.2); color: var(--accent); }

.panel-body { display: flex; flex-direction: column; gap: 10px; }
.panel-section { display: flex; flex-direction: column; gap: 7px; }
.prow { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.plabel { width: 78px; color: var(--txt-dim); flex-shrink: 0; }
.pbar {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.09);
  border-radius: 4px;
  overflow: hidden;
}
.pfill { height: 100%; border-radius: 4px; transition: width 0.4s; }
.pval { width: 38px; text-align: right; font-weight: 600; font-size: 11.5px; }

.panel-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.panel-kv > div {
  background: rgba(255,255,255,0.05);
  border-radius: 9px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.panel-kv span { font-size: 10px; color: var(--txt-dim); text-transform: uppercase; letter-spacing: 0.6px; }
.panel-kv b { font-size: 14px; font-variant-numeric: tabular-nums; }
.good { color: var(--good); }
.bad { color: var(--bad); }

.panel-note {
  font-size: 11px;
  color: var(--txt-dim);
  line-height: 1.5;
  background: rgba(255,255,255,0.04);
  padding: 8px 10px;
  border-radius: 9px;
}
.chart-label { font-size: 9px; color: var(--txt-dim); text-transform: uppercase; letter-spacing: 1px; text-align: center; margin-top: -4px; }
#chart-pop, #chart-cash { background: rgba(0,0,0,0.18); border-radius: 9px; }

.view-list { display: flex; flex-direction: column; gap: 5px; }
.view-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--txt);
  text-align: left;
  font-size: 12.5px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
}
.view-btn:hover { background: rgba(255,255,255,0.11); }
.view-btn.active { border-color: rgba(111,208,255,0.6); background: rgba(111,208,255,0.16); color: var(--accent); }

.mini-btn {
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--txt);
  font-size: 11.5px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
}
.mini-btn:hover { background: rgba(255,255,255,0.16); }
.mini-btn.danger { border-color: rgba(255,100,100,0.4); color: #ffb0b0; }
.mini-btn.danger:hover { background: rgba(255,80,80,0.15); }

input[type="text"] {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--txt);
  font-size: 12.5px;
  padding: 6px 9px;
  font-family: inherit;
  width: 100%;
}
input[type="range"] { flex: 1; accent-color: var(--accent); }

/* ---------------- minimap ---------------- */
#minimap-wrap {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 18;
  padding: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}
#minimap { display: block; border-radius: 9px; cursor: pointer; }

/* ---------------- toasts ---------------- */
#toasts {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 9px 18px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(-12px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-width: 440px;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.warn { border-color: rgba(255, 209, 102, 0.5); }
.toast.good { border-color: rgba(111, 217, 138, 0.5); }
.toast.milestone {
  border-color: rgba(255, 209, 102, 0.75);
  background: linear-gradient(135deg, rgba(60, 45, 12, 0.85), rgba(16, 22, 38, 0.85));
  padding: 13px 26px;
}
.ms-title { font-size: 17px; font-weight: 800; color: var(--warn); }
.ms-msg { font-size: 12.5px; color: var(--txt); margin-top: 3px; }

/* ---------------- tooltip & inspect ---------------- */
#tooltip {
  position: fixed;
  display: none;
  z-index: 50;
  background: rgba(10, 14, 28, 0.92);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  max-width: 230px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.kbd {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.tip-desc { color: var(--txt-dim); font-size: 11px; }
.tip-bad { color: var(--bad); }
.tip-lock { color: var(--warn); }

#inspect {
  position: fixed;
  display: none;
  z-index: 45;
  width: 250px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 13px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 11px 13px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.5);
  font-size: 12.5px;
}
.ins-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 14px; }
.ins-close {
  background: none; border: none; color: var(--txt-dim);
  cursor: pointer; font-size: 13px; padding: 2px 5px;
}
.ins-close:hover { color: var(--txt); }
.ins-line { color: var(--txt); padding: 2.5px 0; line-height: 1.4; }
.ins-doze { margin-top: 8px; width: 100%; }

/* ---------------- title screen ---------------- */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(60, 90, 180, 0.35), transparent 60%),
    radial-gradient(ellipse at 75% 80%, rgba(140, 80, 200, 0.25), transparent 55%),
    linear-gradient(180deg, #0b1026 0%, #141b3d 60%, #1d2030 100%);
  transition: opacity 0.8s;
}
#title-screen.hidden { opacity: 0; pointer-events: none; }
.title-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 40px;
  animation: title-in 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes title-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.title-logo {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 14px;
  margin-right: -14px;
  background: linear-gradient(135deg, #8fd8ff 0%, #c9a0ff 50%, #ffb8d0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(140, 180, 255, 0.35);
}
.title-sub {
  font-size: 14px;
  color: var(--txt-dim);
  letter-spacing: 3px;
  margin-top: -12px;
}
#city-name-input {
  width: 280px;
  text-align: center;
  font-size: 16px;
  padding: 10px;
  font-weight: 600;
}
.title-buttons { display: flex; gap: 12px; }
.big-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 28px;
  border-radius: 13px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.08);
  color: var(--txt);
  cursor: pointer;
  transition: all 0.2s;
}
.big-btn:hover { background: rgba(255,255,255,0.16); transform: translateY(-2px); }
.big-btn.primary {
  background: linear-gradient(135deg, #3b82d6, #7c5fd0);
  border-color: rgba(160, 190, 255, 0.5);
  box-shadow: 0 6px 24px rgba(80, 110, 230, 0.45);
}
.big-btn.primary:hover { box-shadow: 0 8px 32px rgba(80, 110, 230, 0.65); }
.title-hint { font-size: 11.5px; color: var(--txt-dim); letter-spacing: 0.5px; }

/* scrollbars */
::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }
