/* ==========================================================================
   Min lilla stad – CSS
   ========================================================================== */

:root {
  --bg: #f0fdf4;
  --surface: #ffffff;
  --text: #14532d;
  --muted: #4ade80;
  --border: #bbf7d0;
  --primary: #16a34a;
  --primary-light: #dcfce7;
  --primary-dark: #15803d;
  --road: #94a3b8;
  --grass: #86efac;
  --warning: #f59e0b;
  --radius: 20px;
  --shadow: 0 10px 25px -5px rgba(22, 163, 74, 0.1);
}

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

body.stad-page {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: #1e293b;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
  touch-action: manipulation;
}

.game-viewport {
  max-width: 860px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.game-header {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-back {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  min-height: 48px;
  padding: 8px 18px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.game-title-text {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.star-counter-badge {
  background: #fef3c7;
  border: 2px solid var(--warning);
  color: #b45309;
  font-size: 18px;
  font-weight: 900;
  padding: 6px 16px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sound {
  min-height: 44px;
  width: 44px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.game-stage-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 16px 0;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.stad-instruction {
  font-size: 19px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 6px;
}

.stad-subhint {
  font-size: 15px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 14px;
}

/* Stadsrutnät */
.city-grid-wrap {
  width: 100%;
  max-width: 620px;
  background: #ecfdf5;
  border: 3px solid #86efac;
  border-radius: 20px;
  padding: 14px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.04);
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.plot-cell {
  background: #ffffff;
  border: 2px solid #bbf7d0;
  border-radius: 14px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}

.plot-cell:hover {
  border-color: var(--primary);
  transform: translateY(-2px) scale(1.02);
  background: #f0fdf4;
}

.plot-cell.empty {
  border-style: dashed;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.plot-cell.empty::before {
  content: "＋";
  font-size: 22px;
  color: #94a3b8;
  font-weight: bold;
}

.plot-cell .plot-emoji {
  font-size: 34px;
  animation: popBuilding 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popBuilding {
  0% { transform: scale(0.2); }
  100% { transform: scale(1); }
}

.plot-cell .plot-label {
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  margin-top: 2px;
}

/* Byggnads-palett */
.palette-container {
  width: 100%;
  max-width: 700px;
  margin-top: 14px;
}

.palette-title {
  font-size: 14px;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.buildings-palette {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.building-card-btn {
  background: white;
  border: 3px solid var(--border);
  border-radius: 16px;
  padding: 8px 12px;
  min-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

.building-card-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.building-card-btn.selected {
  border-color: var(--primary);
  background: #dcfce7;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
  transform: scale(1.05);
}

.building-card-btn.locked {
  opacity: 0.55;
  filter: grayscale(0.5);
}

.building-card-btn .card-emoji {
  font-size: 28px;
}

.building-card-btn .card-name {
  font-size: 12px;
  font-weight: 800;
  color: #1e293b;
  margin: 2px 0;
}

.building-card-btn .card-cost {
  font-size: 11px;
  font-weight: 900;
  color: #b45309;
}

.feedback-banner {
  margin-top: 10px;
  padding: 8px 18px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  display: none;
}

.feedback-banner.show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feedback-banner.correct {
  background: var(--primary-light);
  border: 2px solid var(--primary);
  color: var(--primary-dark);
}

.feedback-banner.almost {
  background: #fffbeb;
  border: 2px solid var(--warning);
  color: #b45309;
}

.game-footer {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 800;
  color: #64748b;
}
