/* style.css — GreenAcres: rich, layered farm visuals (vanilla CSS, no assets) */

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

:root {
  --panel: #20301f;
  --panel-2: #2a3d28;
  --line: #4a7a4a;
  --gold: #ffcc44;
  --ink: #e8efe0;
}

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 120% at 50% 0%, #213a22 0%, #14210f 60%, #0d160a 100%);
  color: var(--ink);
  min-height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1500px;
  margin: 0 auto;
}

/* ===================== Top bar ===================== */
#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: linear-gradient(180deg, #34532f, #243c20);
  border-bottom: 2px solid #5a8a52;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  flex-wrap: wrap;
  gap: 8px;
  z-index: 30;
}

.top-left, .top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.stat {
  font-size: 13.5px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.22);
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.stat.brand {
  background: linear-gradient(90deg, #6fae4a, #4a8a3a);
  border: none;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.stat.warn { color: #ffd24a; }

.stat.back-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  cursor: pointer;
}
.stat.back-link:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

/* sustainability meter */
.sust-meter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sust-bar {
  width: 60px; height: 8px; border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.sust-fill {
  height: 100%;
  background: linear-gradient(90deg, #b94c2c, #e0a83a, #5fce5a);
  transition: width 0.4s ease;
}

/* ===================== Main / stage ===================== */
#main-content { flex: 1; display: flex; overflow: hidden; }

#farm-stage {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* sky theming defaults (Spring day) */
  --sky-top: #8fd3f0;
  --sky-bot: #d8f0e0;
  --hill-far: #9ec98a;
  --hill-mid: #79b265;
  --foliage: #4f9a3f;
  --trunk: #6b4a2c;
  --ground-top: #6e9a4e;
  --ground-bot: #3f6a2e;
  --sun-color: #fff3c0;
  --sun-glow: rgba(255, 230, 150, 0.55);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 58%);
  transition: background 0.8s ease;
}

/* ---- seasonal sky / palette ---- */
#farm-stage.season-spring {
  --sky-top: #8ccdf0; --sky-bot: #dff3e2;
  --hill-far: #a6cf8c; --hill-mid: #7fbb63; --foliage: #57a83f; --ground-top: #74a352; --ground-bot: #3f6a2e;
}
#farm-stage.season-summer {
  --sky-top: #5fb8ee; --sky-bot: #cdeef0;
  --hill-far: #9ec977; --hill-mid: #7bb152; --foliage: #4f9a36; --ground-top: #7ba24a; --ground-bot: #4a6e2a;
  --sun-color: #fff6c8; --sun-glow: rgba(255, 235, 150, 0.7);
}
#farm-stage.season-autumn {
  --sky-top: #f2c98a; --sky-bot: #f6e6c6;
  --hill-far: #c7a85a; --hill-mid: #b07f3c; --foliage: #d07a2a; --ground-top: #9a7c3a; --ground-bot: #5e4a22;
  --sun-color: #ffe6a0; --sun-glow: rgba(255, 200, 110, 0.6);
}
#farm-stage.season-winter {
  --sky-top: #b9cfe0; --sky-bot: #eef4f8;
  --hill-far: #d8e4ec; --hill-mid: #c2d2dd; --foliage: #6f8a6a; --ground-top: #cdd8d2; --ground-bot: #8fa39a;
  --trunk: #5a4632; --sun-color: #f4f7ff; --sun-glow: rgba(220, 235, 255, 0.5);
}

/* weather can dim/recolour the sky */
#farm-stage.weather-rain   { --sky-top: #8195a0; --sky-bot: #b8c6c4; --sun-glow: rgba(200, 210, 210, 0.2); }
#farm-stage.weather-storm  { --sky-top: #3c4654; --sky-bot: #6d7886; --sun-glow: rgba(160, 170, 180, 0.15); }
#farm-stage.weather-drought{ --sky-top: #f0b96a; --sky-bot: #f6dca0; --sun-glow: rgba(255, 190, 90, 0.85); }
#farm-stage.weather-heatwave{ --sky-top: #f59b4a; --sky-bot: #f8d68a; --sun-glow: rgba(255, 150, 60, 0.85); }
#farm-stage.weather-frost  { --sky-top: #bcd0e2; --sky-bot: #eef6fb; --sun-glow: rgba(220, 235, 255, 0.5); }

/* ---- sky scene band ---- */
#sky-scene {
  position: relative;
  flex: 0 0 auto;
  height: clamp(108px, 18vh, 180px);
  overflow: hidden;
}

#celestial {
  position: absolute;
  top: 16px; right: 9%;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #fffef0, var(--sun-color) 60%, #ffd86a 100%);
  box-shadow: 0 0 30px 14px var(--sun-glow), 0 0 80px 30px var(--sun-glow);
  transition: all 0.8s ease;
  animation: sunbob 9s ease-in-out infinite;
}
@keyframes sunbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.weather-storm #celestial, .weather-rain #celestial { opacity: 0.45; filter: grayscale(0.5); }

#clouds { position: absolute; inset: 0; pointer-events: none; }
.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50px;
  filter: blur(0.4px);
  opacity: 0.9;
}
.cloud::before, .cloud::after {
  content: ''; position: absolute; background: inherit; border-radius: 50%;
}
.cloud.c1 { top: 22px; width: 90px; height: 24px; animation: drift 60s linear infinite; }
.cloud.c2 { top: 54px; width: 130px; height: 30px; opacity: 0.75; animation: drift 90s linear infinite; animation-delay: -30s; }
.cloud.c3 { top: 12px; width: 70px; height: 20px; opacity: 0.65; animation: drift 75s linear infinite; animation-delay: -55s; }
.cloud.c1::before { width: 44px; height: 44px; left: 12px; top: -16px; }
.cloud.c1::after  { width: 34px; height: 34px; right: 14px; top: -12px; }
.cloud.c2::before { width: 60px; height: 60px; left: 18px; top: -24px; }
.cloud.c2::after  { width: 46px; height: 46px; right: 20px; top: -18px; }
.cloud.c3::before { width: 34px; height: 34px; left: 10px; top: -12px; }
.cloud.c3::after  { width: 28px; height: 28px; right: 10px; top: -10px; }
@keyframes drift { from { transform: translateX(-160px); } to { transform: translateX(110vw); } }
.weather-storm .cloud, .weather-rain .cloud { background: rgba(180, 188, 196, 0.92); }

#scenery { position: absolute; inset: 0; }
#scene-svg { position: absolute; bottom: -1px; left: 0; width: 100%; height: 100%; }

/* scenery colours driven by --vars */
.hill-far { fill: var(--hill-far); }
.hill-mid { fill: var(--hill-mid); }
.tree .foliage { fill: var(--foliage); }
.tree .trunk { fill: var(--trunk); }
.barn-body { fill: #b5402f; }
.barn-roof { fill: #5e3326; }
.barn-door { fill: #7a2c20; }
.barn-trim { stroke: #e9d8b0; stroke-width: 2; }
.barn-window { fill: #f2d873; stroke: #e9d8b0; stroke-width: 2; }
.silo { fill: #cdd2d6; }
.silo-top { fill: #9aa1a6; }
.fence rect { fill: #d8c39a; }
.birds path { fill: none; stroke: #3a3a3a; stroke-width: 2; opacity: 0.5; }
.season-winter .barn-roof { fill: #e8eef2; }
.season-winter .silo-top { fill: #e8eef2; }

/* ===================== Farm field grid ===================== */
#field-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  position: relative;
  z-index: 2;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(0,0,0,0.05), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0,0,0,0.04) 0 18px, transparent 18px 38px),
    linear-gradient(180deg, color-mix(in srgb, var(--ground-top), #000 6%) 0%, var(--ground-bot) 100%);
  box-shadow: inset 0 14px 24px -10px rgba(0, 0, 0, 0.45);
}

#farm-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), 1fr);
  grid-template-rows: repeat(var(--rows, 5), 1fr);
  gap: 6px;
  aspect-ratio: calc(var(--cols, 6) / var(--rows, 5));
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
}

.tile {
  --soil: #7a532f;
  --moist: 0;
  position: relative;
  min-height: 0;
  border-radius: 9px;
  cursor: pointer;
  overflow: hidden;
  border: 1.5px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  user-select: none;
}

/* empty = grassy plot */
.tile-empty {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 40%),
    repeating-linear-gradient(86deg, rgba(0,0,0,0.05) 0 7px, transparent 7px 15px),
    linear-gradient(180deg, color-mix(in srgb, var(--soil), #7fae4a 70%), color-mix(in srgb, var(--soil), #3f6a2e 60%));
}
.tile-empty::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(2px 4px at 22% 70%, rgba(60,120,40,0.6), transparent),
    radial-gradient(2px 4px at 50% 80%, rgba(60,120,40,0.5), transparent),
    radial-gradient(2px 4px at 74% 66%, rgba(60,120,40,0.6), transparent),
    radial-gradient(2px 4px at 38% 50%, rgba(70,130,45,0.45), transparent),
    radial-gradient(2px 4px at 84% 84%, rgba(70,130,45,0.5), transparent);
}

/* season-tinted fallow ground */
.season-autumn .tile-empty {
  background:
    repeating-linear-gradient(86deg, rgba(0,0,0,0.05) 0 7px, transparent 7px 15px),
    linear-gradient(180deg, #b89a52, #876a32);
}
.season-autumn .tile-empty::after { filter: sepia(0.7) hue-rotate(-25deg) brightness(1.1); }
.season-winter .tile-empty {
  background:
    radial-gradient(circle at 40% 25%, rgba(255,255,255,0.5), transparent 50%),
    linear-gradient(180deg, #e2ecf0, #c2d2cc);
}
.season-winter .tile-empty::after { opacity: 0.15; }

/* tilled / planted = furrowed soil bed, tinted by health via --soil */
.tile-tilled, .tile-planted, .tile-ready, .tile-withered {
  background:
    repeating-linear-gradient(0deg,
      color-mix(in srgb, var(--soil), #000 22%) 0px,
      color-mix(in srgb, var(--soil), #000 22%) 2px,
      color-mix(in srgb, var(--soil), #fff 12%) 6px,
      color-mix(in srgb, var(--soil), #fff 12%) 9px,
      color-mix(in srgb, var(--soil), #000 8%) 13px),
    linear-gradient(180deg, color-mix(in srgb, var(--soil), #fff 10%), color-mix(in srgb, var(--soil), #000 14%));
}

/* tilled shows scattered seeds */
.tile-tilled::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(1.6px 1.6px at 28% 40%, rgba(40,26,12,0.8), transparent),
    radial-gradient(1.6px 1.6px at 62% 32%, rgba(40,26,12,0.8), transparent),
    radial-gradient(1.6px 1.6px at 44% 64%, rgba(40,26,12,0.8), transparent),
    radial-gradient(1.6px 1.6px at 76% 70%, rgba(40,26,12,0.8), transparent),
    radial-gradient(1.6px 1.6px at 18% 76%, rgba(40,26,12,0.8), transparent);
}

.tile-withered { filter: grayscale(0.55) brightness(0.82); }

/* moisture sheen overlay */
.tile .moist-sheen {
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(40,90,150,0.0), rgba(30,80,150,0.34));
  opacity: var(--moist);
  transition: opacity 0.4s ease;
}

/* crop art layer */
.crop-layer {
  position: absolute;
  left: 4%; right: 4%; bottom: 2%;
  height: 92%;
  pointer-events: none;
}
.crop-svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 2px 1px rgba(0,0,0,0.2)); }

/* greenhouse glass */
.tile.greenhouse::before {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0.04) 40%, rgba(255,255,255,0.18) 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.10) 0 1px, transparent 1px 50%);
  border: 2px solid rgba(220,245,255,0.55);
  border-radius: 9px;
  pointer-events: none;
  z-index: 5;
}
.gh-badge {
  position: absolute; top: 3px; right: 4px;
  font-size: 11px; z-index: 6;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

.tile:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 8px 14px rgba(0,0,0,0.4); z-index: 7; }
.tile:hover .tile-glow-hint { outline-color: #d8ffb0; }
.tile.selected { outline: 3px solid var(--gold); outline-offset: -1px; box-shadow: 0 0 0 2px rgba(0,0,0,0.4), 0 0 16px var(--gold); z-index: 8; }

.tile.ready-glow { animation: readyPulse 1.4s ease-in-out infinite; }
@keyframes readyPulse {
  0%,100% { box-shadow: 0 3px 6px rgba(0,0,0,0.3), 0 0 6px rgba(255,225,80,0.5); }
  50%     { box-shadow: 0 3px 6px rgba(0,0,0,0.3), 0 0 18px rgba(255,225,80,0.95); }
}
.ready-tag {
  position: absolute; top: 3px; left: 4px;
  font-size: 9px; font-weight: 700;
  background: var(--gold); color: #3a2a00;
  padding: 1px 5px; border-radius: 8px; z-index: 6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* per-tile sensor readout (Precision Sensors) */
.tile-sensor {
  position: absolute; bottom: 2px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 4px;
  font-size: 8.5px; z-index: 6; pointer-events: none;
}
.tile-sensor span {
  background: rgba(0,0,0,0.55); color: #cfe; padding: 0 3px; border-radius: 4px;
}

/* ===================== Weather FX overlay ===================== */
#weather-fx {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: hidden;
}
#weather-fx.weather-sunny {
  background: radial-gradient(120% 80% at 88% 0%, rgba(255,240,170,0.30), transparent 55%);
}
#weather-fx.weather-rain {
  background:
    repeating-linear-gradient(102deg, rgba(180,210,235,0.0) 0 6px, rgba(180,210,235,0.35) 6px 7px),
    rgba(60,80,100,0.12);
  background-size: 120px 120px, cover;
  animation: rainfall 0.5s linear infinite;
}
@keyframes rainfall { from { background-position: 0 0, 0 0; } to { background-position: -24px 120px, 0 0; } }
#weather-fx.weather-drought, #weather-fx.weather-heatwave {
  background: radial-gradient(120% 90% at 80% 0%, rgba(255,170,60,0.28), transparent 60%), rgba(255,140,40,0.06);
}
#weather-fx.weather-frost {
  background: radial-gradient(120% 120% at 50% 0%, rgba(210,235,255,0.30), transparent 60%);
  box-shadow: inset 0 0 120px rgba(150,200,255,0.45);
}
#weather-fx.weather-frost::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(2px 2px at 20% 30%, #fff, transparent),
    radial-gradient(2px 2px at 60% 50%, #fff, transparent),
    radial-gradient(2px 2px at 80% 20%, #fff, transparent),
    radial-gradient(2px 2px at 40% 70%, #fff, transparent),
    radial-gradient(2px 2px at 75% 80%, #fff, transparent);
  opacity: 0.8;
  animation: snowfall 6s linear infinite;
}
@keyframes snowfall { from { transform: translateY(-20px); } to { transform: translateY(100%); } }
#weather-fx.weather-storm {
  background: rgba(20,26,40,0.34);
}
#weather-fx.weather-storm::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.0);
  animation: lightning 7s linear infinite;
}
@keyframes lightning {
  0%, 92%, 100% { background: rgba(255,255,255,0); }
  93% { background: rgba(255,255,255,0.55); }
  94% { background: rgba(255,255,255,0.0); }
  95% { background: rgba(255,255,255,0.4); }
  96% { background: rgba(255,255,255,0); }
}
#weather-fx.weather-storm::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(100deg, transparent 0 5px, rgba(200,220,240,0.4) 5px 6px);
  background-size: 90px 90px;
  animation: rainfall 0.35s linear infinite;
}

/* ===================== Forecast strip ===================== */
#forecast-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.32), rgba(0,0,0,0.5));
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  z-index: 13;
  flex-wrap: wrap;
}
.forecast-label { color: #bcd; font-weight: 600; }
.forecast-item {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.08);
  padding: 3px 9px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}
.forecast-item .fc-when { color: #9fb; font-size: 11px; }
.forecast-item.fuzzy { opacity: 0.7; font-style: italic; }

/* ===================== Side panel ===================== */
#side-panel {
  width: 340px;
  min-width: 300px;
  background: linear-gradient(180deg, #25361f, #1c2b18);
  padding: 12px;
  overflow-y: auto;
  border-left: 2px solid #4a7a4a;
  display: flex;
  flex-direction: column;
}

.tab-bar { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tab-btn {
  padding: 6px 11px;
  background: #33502f;
  border: 1px solid #466842;
  color: #cde0c8;
  cursor: pointer;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.15s;
}
.tab-btn:hover { background: #4a7a4a; color: #fff; }
.tab-btn.active { background: #69ae49; color: #fff; border-color: #8fd06a; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }

.tab-content { flex: 1; }
.tab-content h3 { margin-bottom: 10px; font-size: 15px; color: #dceccf; }
.tab-content p { margin: 4px 0; font-size: 13px; line-height: 1.45; }

/* progress bar */
.progress-bar { height: 10px; background: rgba(0,0,0,0.4); border-radius: 5px; margin: 8px 0; overflow: hidden; border: 1px solid rgba(255,255,255,0.08); }
.progress-fill { height: 100%; background: linear-gradient(90deg, #4caf50, #b6e34a); border-radius: 5px; transition: width 0.4s; }

/* tile card */
.tile-card { background: rgba(0,0,0,0.18); border-radius: 8px; padding: 10px; border: 1px solid rgba(255,255,255,0.06); }
.stat-row { display: flex; gap: 10px; margin: 6px 0; }
.gauge { flex: 1; }
.gauge-label { font-size: 11px; color: #aac0a0; margin-bottom: 2px; }
.gauge-track { height: 9px; border-radius: 5px; background: rgba(0,0,0,0.4); overflow: hidden; }
.gauge-fill { height: 100%; transition: width 0.4s; }

/* crop list */
.crop-list { display: flex; flex-direction: column; gap: 4px; }
.crop-option {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  grid-template-areas: "emoji name cost" "emoji detail detail";
  align-items: center;
  gap: 2px 8px;
  padding: 7px 9px;
  background: rgba(255,255,255,0.04);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.crop-option:hover { background: rgba(255,255,255,0.09); transform: translateX(2px); }
.crop-option.selected { background: #3c6a30; border-color: #8fd06a; box-shadow: 0 0 0 1px #8fd06a inset; }
.crop-option.in-season { box-shadow: -3px 0 0 #6cce4a inset; }
.crop-emoji { grid-area: emoji; font-size: 1.5rem; text-align: center; }
.crop-name { grid-area: name; font-size: 13px; font-weight: 600; }
.crop-cost { grid-area: cost; font-weight: bold; color: var(--gold); font-size: 13px; }
.crop-detail { grid-area: detail; color: #9fb38f; font-size: 11px; }

/* market */
.market-list, .inventory-list { display: flex; flex-direction: column; gap: 4px; }
.market-item, .inv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; background: rgba(255,255,255,0.04); border-radius: 7px; font-size: 13px;
}
.market-item .spark { margin-left: auto; font-variant-numeric: tabular-nums; }
.up { color: #6cce4a; } .down { color: #e0664a; } .flat { color: #aaa; }
.inv-qty { font-weight: bold; color: var(--gold); }
.inv-price { color: #9fb38f; margin-left: auto; }

.sell-btn {
  padding: 4px 11px; background: linear-gradient(180deg, #e58a2a, #c46a16);
  border: none; color: #fff; cursor: pointer; border-radius: 6px; font-size: 12px;
  transition: filter 0.15s;
}
.sell-btn:hover { filter: brightness(1.12); }

/* ===================== Bottom bar ===================== */
#bottom-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: linear-gradient(0deg, #34532f, #243c20);
  border-top: 2px solid #5a8a52;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.4);
  gap: 12px;
  z-index: 20;
}
#actions { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn {
  padding: 9px 16px;
  background: linear-gradient(180deg, #5a9a4a, #3f6f34);
  border: 1px solid #6fb35a; color: #fff; cursor: pointer;
  border-radius: 8px; font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: all 0.12s;
}
.action-btn:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.action-btn:disabled { opacity: 0.32; cursor: not-allowed; box-shadow: none; }

.advance-btn {
  padding: 11px 28px;
  background: linear-gradient(180deg, #f2a838, #d4860f);
  border: none; color: #fff; cursor: pointer;
  border-radius: 9px; font-size: 16px; font-weight: bold;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  transition: all 0.12s;
}
.advance-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ===================== Message bar ===================== */
#message-bar {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: rgba(20,28,18,0.96); color: #ffe070;
  padding: 11px 28px; border-radius: 10px; display: none; z-index: 1000;
  font-size: 14px; text-align: center; max-width: 80%; pointer-events: none;
  border: 1px solid #6a5a20; box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  animation: msgIn 0.25s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===================== Small buttons ===================== */
.small-btn {
  padding: 5px 9px; background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.12); color: var(--ink);
  border-radius: 6px; cursor: pointer; font-size: 13px; transition: background 0.15s;
}
.small-btn:hover { background: rgba(255,255,255,0.12); }

/* ===================== How-to-play & overlay ===================== */
#how-to-play {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #2a3d28, #1d2c1a);
  border: 2px solid #5a8a52; border-radius: 14px; padding: 26px;
  max-width: 540px; width: 92%; z-index: 2000; display: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7); max-height: 86vh; overflow-y: auto;
}
#how-to-play.visible { display: block; }
#how-to-play h3 { margin-bottom: 12px; color: #dceccf; }
#how-to-play p { margin: 7px 0; font-size: 13px; line-height: 1.5; }

#overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  z-index: 1500; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
#overlay.visible { display: flex; }
.overlay-content {
  background: linear-gradient(180deg, #2a3d28, #1d2c1a);
  border: 2px solid #5a8a52; border-radius: 14px; padding: 32px;
  text-align: center; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  animation: msgIn 0.3s ease;
}
.overlay-content.win { border-color: var(--gold); }
.overlay-content.lose { border-color: #e0664a; }
.overlay-content h2 { font-size: 30px; margin-bottom: 12px; }
.overlay-content ul { list-style: none; text-align: left; margin: 14px auto; max-width: 240px; }
.overlay-content li { margin: 5px 0; font-size: 14px; }

/* ===================== Tech tab ===================== */
.tech-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 9px; background: rgba(255,255,255,0.04); border-radius: 8px; margin-bottom: 6px;
  border: 1px solid rgba(255,255,255,0.05);
}
.tech-item.owned { opacity: 0.6; border-color: #6cce4a; }
.tech-emoji { font-size: 1.5rem; width: 30px; text-align: center; }
.tech-name { flex: 1; font-size: 13px; font-weight: bold; }
.tech-cost { font-size: 13px; color: var(--gold); }
.tech-desc { width: 100%; font-size: 11px; color: #9fb38f; margin: 2px 0; }
.buy-tech-btn {
  padding: 5px 13px; background: linear-gradient(180deg, #5a9a4a, #3f6f34);
  border: none; color: #fff; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.buy-tech-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================== Fertiliser & misc ===================== */
.fert-section { margin-top: 12px; padding: 10px; background: rgba(255,255,255,0.04); border-radius: 8px; font-size: 12px; }
.fert-section label { display: block; margin: 4px 0; cursor: pointer; }
.fert-section input[type="radio"] { margin-right: 5px; }

.demand-notice {
  color: #ffd24a; font-weight: bold; font-size: 13px; padding: 8px;
  background: rgba(255,200,60,0.12); border: 1px solid rgba(255,200,60,0.3);
  border-radius: 8px; margin-bottom: 8px; animation: pulse 1.2s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: 0.75; } to { opacity: 1; } }

.hint { color: #93a88a; font-style: italic; font-size: 12px; }

/* ===================== Responsive ===================== */
@media (max-width: 820px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  #main-content { flex-direction: column; }
  #farm-stage { min-height: 60vh; }
  #field-wrap { min-height: 46vh; }
  #side-panel { width: 100%; border-left: none; border-top: 2px solid #4a7a4a; max-height: 50vh; }
  #sky-scene { height: 100px; }
}
