:root {
  --color-bg: #0e1116;
  --color-panel: rgba(255, 255, 255, 0.94);
  --color-text: #1d2330;
  --color-muted: #5a6478;
  --color-accent: #0056b3;
  --color-accent-dark: #003d82;
  --color-civilization: #ff7800;
  --color-city: #3388ff;
  --shadow-panel: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
}

#map {
  height: 100vh;
  width: 100%;
  position: absolute;
  inset: 0;
  z-index: 1;
}

#ui-container {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, calc(100% - 32px));
  background: var(--color-panel);
  padding: 14px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.year-display {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

button {
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 120ms ease;
}

button:hover { background: var(--color-accent-dark); }
button:focus-visible { outline: 3px solid #99c2ff; outline-offset: 2px; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

#time-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #d6dbe4;
  outline: none;
  border-radius: 4px;
}

#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

#time-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-accent);
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.city-label {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--color-city);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  font-size: 12px;
  font-weight: 700;
  color: #1d2330;
  padding: 2px 6px;
  white-space: nowrap;
}

.leaflet-tooltip.city-label::before {
  border-right-color: rgba(255, 255, 255, 0.85);
}

.status {
  font-size: 0.85rem;
  color: var(--color-muted);
  min-width: 4ch;
  text-align: right;
}

.status[data-state='error'] { color: #b00020; }

/* ---------- Admin ---------- */
.admin-shell {
  background: #f5f6f8;
  min-height: 100vh;
  font-family: var(--font);
}

.admin-nav {
  background: #1d2330;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-nav a {
  color: #e6ebf2;
  text-decoration: none;
  margin-right: 16px;
  font-weight: 500;
}

.admin-nav a:hover { color: #fff; text-decoration: underline; }

.admin-main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 24px;
}

.admin-card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

.admin-card h1, .admin-card h2 { margin-top: 0; }

table.features {
  width: 100%;
  border-collapse: collapse;
}

table.features th, table.features td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e6ebf2;
}

table.features th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); }

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.form-row label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
  padding: 8px 10px;
  border: 1px solid #c8cdd6;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-row textarea { min-height: 80px; resize: vertical; }

.form-row .error { color: #b00020; font-size: 0.85rem; margin-top: 4px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.button-secondary {
  background: #e6ebf2;
  color: var(--color-text);
}
.button-secondary:hover { background: #d6dbe4; }

.button-danger {
  background: #b00020;
  color: #fff;
}
.button-danger:hover { background: #800018; }

#admin-map {
  height: 420px;
  border-radius: 6px;
  border: 1px solid #c8cdd6;
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.alert-error { background: #fde7eb; color: #800018; border: 1px solid #f5c2cd; }
.alert-success { background: #e3f7e8; color: #0a5d2c; border: 1px solid #b6e5c2; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }

.dashboard-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.tile .num { font-size: 2.2rem; font-weight: 700; color: var(--color-accent); }
.tile .label { color: var(--color-muted); font-size: 0.9rem; }
