/* ═══════════════════════════════════════════════════════════════
   GEOSTRATA — Ultimate Country Simulator
   Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2236;
  --bg-card: #1e2a3a;
  --bg-hover: #253347;
  --bg-active: #2d3f54;
  --border: #2a3a4e;
  --border-light: #374a60;
  --text-primary: #e8edf5;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.15);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.15);
  --cyan: #06b6d4;
  --orange: #f97316;
  --pink: #ec4899;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --transition: all 0.2s ease;
  --sidebar-width: 200px;
  --topbar-height: 56px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.hidden { display: none !important; }
.screen { width: 100vw; height: 100vh; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══ LOADING SCREEN ═══ */
#loading-screen {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0f172a 0%, #020617 100%);
  position: fixed; inset: 0; z-index: 9999;
}
.loader-content { text-align: center; }
.globe-spinner {
  width: 80px; height: 80px; margin: 0 auto 24px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-right: 3px solid var(--cyan);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.game-title {
  font-size: 52px; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--cyan), var(--purple));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 6px; margin-bottom: 8px;
}
.game-subtitle {
  font-size: 16px; color: var(--text-secondary);
  letter-spacing: 4px; text-transform: uppercase; margin-bottom: 32px;
}
.loader-bar {
  width: 250px; height: 4px; background: var(--bg-tertiary);
  border-radius: 2px; margin: 0 auto 16px; overflow: hidden;
}
.loader-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 2px;
  animation: load-fill 2.5s ease-out forwards;
}
@keyframes load-fill { to { width: 100%; } }
.loader-status { color: var(--text-muted); font-size: 13px; }

/* ═══ WELCOME SCREEN ═══ */
#welcome-screen {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(139,92,246,0.06) 0%, transparent 50%),
              var(--bg-primary);
}
.welcome-container { max-width: 480px; width: 100%; padding: 20px; }
.welcome-header { text-align: center; margin-bottom: 40px; }
.welcome-header h1 {
  font-size: 42px; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.welcome-header p { color: var(--text-secondary); font-size: 16px; }
.create-form {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  box-shadow: var(--shadow-lg);
}
.create-form h2 { font-size: 20px; margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  transition: var(--transition);
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* ═══ BUTTONS ═══ */
.btn-primary, .btn-secondary, .btn-accent, .btn-warning, .btn-danger, .btn-small, .btn-icon {
  border: none; cursor: pointer; font-family: inherit; font-weight: 600;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: white; padding: 10px 20px; font-size: 14px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-large { width: 100%; padding: 14px; font-size: 16px; margin-top: 8px; }
.btn-secondary {
  background: var(--bg-tertiary); color: var(--text-secondary);
  padding: 8px 16px; font-size: 13px; border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white; padding: 8px 16px; font-size: 13px;
}
.btn-accent:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-warning {
  background: var(--yellow-dim); color: var(--yellow);
  padding: 8px 16px; font-size: 13px; border: 1px solid rgba(245,158,11,0.3);
  margin-bottom: 8px; display: block; width: 100%;
}
.btn-warning:hover { background: rgba(245,158,11,0.25); }
.btn-danger {
  background: var(--red-dim); color: var(--red);
  padding: 8px 16px; font-size: 13px; border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-small {
  background: var(--bg-tertiary); color: var(--text-secondary);
  padding: 5px 12px; font-size: 12px;
}
.btn-small:hover, .btn-small.active {
  background: var(--accent); color: white;
}
.btn-icon {
  background: none; color: var(--text-secondary); padding: 6px 10px;
  font-size: 16px; position: relative;
}
.btn-icon:hover { color: var(--text-primary); }
#notif-count {
  position: absolute; top: 0; right: 0;
  background: var(--red); color: white; font-size: 10px;
  border-radius: 50%; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ═══ TOP BAR ═══ */
#top-bar {
  height: var(--topbar-height); display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  position: relative; z-index: 100;
}
.top-left { display: flex; align-items: center; gap: 16px; }
.game-logo { font-weight: 800; font-size: 16px; letter-spacing: 2px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.country-badge {
  background: var(--bg-tertiary); padding: 4px 12px; border-radius: 20px;
  font-size: 13px; border: 1px solid var(--border);
}
.top-center { flex: 1; display: flex; justify-content: center; }
.resource-bar { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.res {
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
  white-space: nowrap;
}
.res span { color: var(--text-primary); font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.top-right { display: flex; align-items: center; gap: 8px; }

/* ═══ MAIN CONTENT ═══ */
#main-content {
  display: flex;
  height: calc(100vh - var(--topbar-height));
}

/* ═══ SIDEBAR ═══ */
#sidebar {
  width: var(--sidebar-width); background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 8px;
  overflow-y: auto; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; background: none;
  border: none; color: var(--text-secondary); font-size: 13px;
  font-family: inherit; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); text-align: left;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn.active {
  background: var(--accent); color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ═══ PANELS ═══ */
#panel-area {
  flex: 1; overflow-y: auto; padding: 24px;
  background: var(--bg-primary);
}
.panel { display: none; animation: fadeIn 0.2s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.panel-header h2 { font-size: 22px; font-weight: 700; }

/* ═══ OVERVIEW ═══ */
.overview-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.overview-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: var(--transition);
}
.overview-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.overview-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.card-economy { border-left: 3px solid var(--green); }
.card-population { border-left: 3px solid var(--accent); }
.card-military { border-left: 3px solid var(--red); }
.card-politics { border-left: 3px solid var(--purple); }
.card-tech { border-left: 3px solid var(--cyan); }
.card-climate { border-left: 3px solid var(--green); }
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-row span:first-child { color: var(--text-secondary); }
.stat-row span:last-child { font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.overview-news { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.overview-news h3 { margin-bottom: 12px; font-size: 15px; }
#overview-news-feed { max-height: 200px; overflow-y: auto; }
.news-item {
  padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border);
  color: var(--text-secondary); line-height: 1.5;
}
.news-item:last-child { border-bottom: none; }
.news-time { font-size: 11px; color: var(--text-muted); margin-left: 8px; }

/* ═══ MAP ═══ */
.map-container {
  position: relative; background: #050a15;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; min-height: 500px;
}
#world-map-canvas {
  width: 100%; height: 500px; display: block;
  image-rendering: pixelated; cursor: crosshair;
}
.map-tooltip {
  position: absolute; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px;
  pointer-events: none; z-index: 10; box-shadow: var(--shadow);
}
.map-controls { display: flex; gap: 4px; }
.map-legend {
  display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-secondary);
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-color { width: 12px; height: 12px; border-radius: 2px; }

/* ═══ CITIES ═══ */
.cities-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.city-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: var(--transition);
}
.city-card:hover { border-color: var(--accent); }
.city-card h4 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.city-capital { color: var(--yellow); font-size: 12px; }
.city-megacity { color: var(--purple); font-size: 12px; }
.city-buildings {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px;
}
.building-tag {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 12px; font-size: 11px; color: var(--text-secondary);
}
.city-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ═══ ECONOMY ═══ */
.economy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.econ-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.econ-card h3 { font-size: 15px; margin-bottom: 14px; }
.policy-controls { margin-top: 16px; }
.policy-controls label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.policy-controls input[type="range"] {
  width: 100%; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--bg-tertiary); border-radius: 2px; margin: 8px 0;
}
.policy-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
}

/* ═══ RESOURCES ═══ */
.resources-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
}
.resource-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
  transition: var(--transition);
}
.resource-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.resource-icon { font-size: 28px; margin-bottom: 8px; }
.resource-name { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.resource-amount { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.resource-bar-container { width: 100%; height: 4px; background: var(--bg-tertiary); border-radius: 2px; margin-top: 8px; }
.resource-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }

/* ═══ TECH TREE ═══ */
.tech-current {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.tech-tree-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.tech-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: var(--transition); position: relative;
}
.tech-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tech-card.researched { border-color: var(--green); background: var(--green-dim); }
.tech-card.researching { border-color: var(--yellow); background: var(--yellow-dim); animation: pulse 2s infinite; }
.tech-card.locked { opacity: 0.4; cursor: not-allowed; }
@keyframes pulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 12px var(--yellow-dim); } }
.tech-card h4 { font-size: 13px; margin-bottom: 6px; }
.tech-branch {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 8px;
}
.tech-cost { font-size: 12px; color: var(--yellow); }
.tech-effects { font-size: 11px; color: var(--text-secondary); margin-top: 6px; }
.tech-requires { font-size: 11px; color: var(--red); margin-top: 4px; }
.tech-filters { display: flex; gap: 4px; flex-wrap: wrap; }

/* ═══ POPULATION ═══ */
.pop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 16px;
}
.pop-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.pop-card h3 { font-size: 15px; margin-bottom: 14px; }
.demo-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.demo-bar:last-child { border-bottom: none; }
.demo-label { width: 100px; font-size: 13px; color: var(--text-secondary); }
.demo-fill-container { flex: 1; height: 16px; background: var(--bg-tertiary); border-radius: 8px; overflow: hidden; }
.demo-fill { height: 100%; border-radius: 8px; transition: width 0.4s ease; }
.demo-pct { width: 45px; text-align: right; font-size: 13px; font-family: 'JetBrains Mono', monospace; }

/* ═══ POLITICS ═══ */
.politics-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.pol-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.pol-card h3 { font-size: 15px; margin-bottom: 14px; }
.party-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.party-item.ruling { background: var(--accent-glow); border-radius: var(--radius-sm); }
.party-support { font-family: 'JetBrains Mono', monospace; }
.ideology-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px;
}
.ideology-btn {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; cursor: pointer;
  text-align: center; font-size: 12px; color: var(--text-secondary);
  transition: var(--transition); font-family: inherit;
}
.ideology-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.ideology-btn.active { border-color: var(--accent); background: var(--accent-glow); color: var(--text-primary); }

/* ═══ MILITARY ═══ */
.military-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.mil-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.mil-card h3 { font-size: 15px; margin-bottom: 14px; }
.unit-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border);
}
.unit-row:last-child { border-bottom: none; }
.unit-icon { margin-right: 6px; }

/* ═══ DIPLOMACY ═══ */
.diplomacy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.dip-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.dip-card h3 { font-size: 15px; margin-bottom: 14px; }
.country-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.country-item:last-child { border-bottom: none; }
.country-actions { display: flex; gap: 4px; }
.treaty-item {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.treaty-type {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; margin-right: 8px;
}
.treaty-type.trade_agreement { background: var(--green-dim); color: var(--green); }
.treaty-type.defense_pact { background: var(--red-dim); color: var(--red); }
.treaty-type.open_borders { background: var(--purple-dim); color: var(--purple); }

/* ═══ TRADE ═══ */
.trade-grid { display: grid; gap: 16px; }
.trade-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.trade-card h3 { font-size: 15px; margin-bottom: 14px; }
.listing-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: var(--bg-tertiary);
}
.listing-details { font-size: 13px; }
.listing-exchange { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.listing-arrow { color: var(--accent); font-weight: 700; }

/* ═══ ALLIANCES ═══ */
.alliances-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.alliance-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.alliance-card h4 { font-size: 16px; margin-bottom: 12px; }
.alliance-members {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.member-tag {
  background: var(--bg-tertiary); padding: 3px 8px; border-radius: 12px;
  font-size: 11px;
}

/* ═══ SATELLITES ═══ */
.space-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.space-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.space-card h3 { font-size: 15px; margin-bottom: 14px; }
.sat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.sat-btn {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
  text-align: center; font-family: inherit; color: var(--text-primary);
  transition: var(--transition);
}
.sat-btn:hover { border-color: var(--cyan); }
.sat-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.sat-name { font-size: 12px; font-weight: 600; }
.sat-cost { font-size: 11px; color: var(--yellow); }

/* ═══ CLIMATE ═══ */
.climate-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 16px;
}
.climate-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.climate-card h3 { font-size: 15px; margin-bottom: 14px; }
.climate-meter {
  margin-bottom: 16px;
}
.meter-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.meter-bar { width: 100%; height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.meter-fill.danger { background: linear-gradient(90deg, var(--yellow), var(--red)); }
.meter-fill.good { background: linear-gradient(90deg, var(--green), var(--cyan)); }

/* ═══ LEADERBOARD ═══ */
.lb-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.lb-table { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lb-row {
  display: flex; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:nth-child(1) { background: rgba(245, 158, 11, 0.1); }
.lb-row:nth-child(2) { background: rgba(148, 163, 184, 0.08); }
.lb-row:nth-child(3) { background: rgba(180, 83, 9, 0.08); }
.lb-rank { width: 40px; font-weight: 700; font-size: 16px; }
.lb-rank-1 { color: #fbbf24; }
.lb-rank-2 { color: #94a3b8; }
.lb-rank-3 { color: #b45309; }
.lb-flag { margin-right: 8px; }
.lb-name { flex: 1; font-weight: 600; }
.lb-value { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--accent); }

/* ═══ ACHIEVEMENTS ═══ */
.achievements-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.achievement-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
  transition: var(--transition);
}
.achievement-card.unlocked { border-color: var(--yellow); background: var(--yellow-dim); }
.achievement-card.locked { opacity: 0.5; }
.ach-icon { font-size: 32px; margin-bottom: 8px; }
.ach-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.ach-desc { font-size: 11px; color: var(--text-secondary); }

/* ═══ NEWS ═══ */
.news-feed {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

/* ═══ MODAL ═══ */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-content h3 { font-size: 18px; margin-bottom: 16px; }

/* ═══ BUILDING GRID ═══ */
.building-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.build-option {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
  transition: var(--transition); font-family: inherit; color: var(--text-primary);
  text-align: left;
}
.build-option:hover { border-color: var(--accent); }
.build-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.build-cost { font-size: 11px; color: var(--yellow); }
.build-effects { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ═══ TOAST ═══ */
#toast-container {
  position: fixed; top: 70px; right: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 13px; box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
  max-width: 350px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(100%); } }

/* ═══ EVENT MODAL ═══ */
.event-modal-content {
  text-align: center;
}
.event-modal-content h3 { font-size: 22px; margin-bottom: 12px; }
.event-modal-content p { color: var(--text-secondary); margin-bottom: 16px; }
#event-effects {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 20px;
}
.effect-tag {
  padding: 4px 10px; border-radius: 12px; font-size: 12px;
}
.effect-positive { background: var(--green-dim); color: var(--green); }
.effect-negative { background: var(--red-dim); color: var(--red); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  :root { --sidebar-width: 50px; }
  .nav-btn { font-size: 16px; justify-content: center; padding: 10px; }
  .nav-btn::after { content: none; }
  /* Hide text in nav buttons on mobile, show only emoji */
  .resource-bar { gap: 8px; }
  .res { font-size: 11px; }
  #panel-area { padding: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .top-center { display: none; }
}
