:root{
  --bg:#1A1A1A;
  --bg2:#242220;
  --gold:#C9A227;
  --gold-light:#E4C554;
  --text:#F2EFE9;
  --text-dim:#B7B2A6;
  --green:#4CAF50;
  --red:#C24C4C;
  --card:#242220;
  --border:#3a362d;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{height:100%;}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  overscroll-behavior:none;
  touch-action:manipulation;
}

#app{
  max-width:480px;
  margin:0 auto;
  min-height:100vh;
  min-height:100dvh;
  position:relative;
  background:radial-gradient(circle at 50% -10%, #262420 0%, #1A1A1A 55%);
  padding-top:env(safe-area-inset-top);
  padding-bottom:env(safe-area-inset-bottom);
  overflow:hidden;
}

.screen{display:none;min-height:100vh;min-height:100dvh;flex-direction:column;}
.screen.active{display:flex;}
.screen.overlay{
  display:none;
  position:fixed;
  inset:0;
  max-width:480px;
  margin:0 auto;
  background:rgba(10,10,10,0.88);
  z-index:50;
  align-items:center;
  justify-content:center;
  padding:20px;
}
.screen.overlay.active{display:flex;}

.watermark{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  opacity:0.05;
  z-index:0;
}
.watermark img{width:70%;max-width:340px;}

/* ---------- START SCREEN ---------- */
.start-inner{
  position:relative;
  z-index:1;
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:32px 24px;
  gap:10px;
}
.logo-badge{width:76px;height:76px;object-fit:contain;margin-bottom:6px;filter:drop-shadow(0 0 14px rgba(201,162,39,0.35));}
.title{
  font-size:2.4rem;
  letter-spacing:2px;
  margin:0;
  font-weight:800;
  color:var(--text);
}
.title .gold{color:var(--gold);display:block;font-size:1.05em;}
.subtitle{color:var(--text-dim);margin:0 0 12px;font-size:0.95rem;}

.highscore-box{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  border:1px solid var(--border);
  background:var(--card);
  border-radius:14px;
  padding:12px 28px;
  margin:8px 0 18px;
}
.hs-label{font-size:0.7rem;letter-spacing:1.5px;text-transform:uppercase;color:var(--text-dim);}
.hs-value{font-size:1.6rem;font-weight:800;color:var(--gold);}

.btn{
  width:100%;
  max-width:300px;
  padding:15px 20px;
  border-radius:14px;
  border:none;
  font-size:1rem;
  font-weight:700;
  cursor:pointer;
  margin:6px 0;
  transition:transform .08s ease, opacity .15s ease;
}
.btn:active{transform:scale(0.97);}
.btn-primary{
  background:linear-gradient(135deg,var(--gold-light),var(--gold));
  color:#1A1A1A;
  box-shadow:0 6px 18px rgba(201,162,39,0.25);
}
.btn-ghost{
  background:transparent;
  color:var(--text);
  border:1px solid var(--border);
}
.legal-note{
  margin-top:18px;
  font-size:0.68rem;
  color:var(--text-dim);
  opacity:0.7;
  max-width:280px;
  line-height:1.4;
}

/* ---------- TUTORIAL / SHEET ---------- */
.sheet{
  background:var(--bg2);
  border:1px solid var(--border);
  border-radius:20px;
  padding:24px 20px;
  width:100%;
  max-width:420px;
  max-height:85vh;
  overflow-y:auto;
}
.sheet h2{margin-top:0;color:var(--gold);font-size:1.3rem;}
.tutorial-steps{display:flex;flex-direction:column;gap:14px;margin-bottom:18px;}
.tut-row{display:flex;gap:12px;align-items:flex-start;font-size:0.88rem;line-height:1.35;color:var(--text-dim);}
.tut-row b{color:var(--text);}
.tut-ico{font-size:1.4rem;flex:0 0 auto;}

/* ---------- STRAIN SELECT SCREEN ---------- */
.strain-select-inner{
  position:relative;z-index:1;
  padding:16px 16px 24px;
  display:flex;flex-direction:column;
  min-height:100vh;min-height:100dvh;
}
.strain-select-head{display:flex;align-items:center;gap:12px;margin-bottom:2px;}
.strain-select-head h2{margin:0;color:var(--gold);font-size:1.2rem;}
.strain-select-sub{color:var(--text-dim);font-size:0.82rem;margin:4px 0 14px;}
.strain-list{display:flex;flex-direction:column;gap:12px;padding-bottom:8px;}
.strain-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
}
.strain-card-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;flex-wrap:wrap;}
.strain-card-head h3{margin:0;color:var(--text);font-size:1rem;}
.strain-breeder{font-size:0.7rem;color:var(--text-dim);}
.strain-blurb{font-size:0.8rem;color:var(--text-dim);line-height:1.4;margin:8px 0 12px;}
.strain-stats{display:flex;flex-direction:column;gap:6px;margin-bottom:10px;}
.strain-stat-row{display:flex;align-items:center;gap:8px;}
.strain-stat-label{font-size:0.68rem;color:var(--text-dim);width:110px;flex:0 0 auto;}
.strain-stat-track{flex:1;height:6px;background:#000;border-radius:4px;overflow:hidden;border:1px solid var(--border);}
.strain-stat-fill{height:100%;background:linear-gradient(90deg,var(--gold),var(--gold-light));border-radius:4px;}
.strain-meta{font-size:0.72rem;color:var(--gold-light);margin-bottom:10px;}
.strain-select-btn{width:100%;max-width:none;margin:0;padding:12px;font-size:0.88rem;}

/* ---------- GAME SCREEN ---------- */
#screen-game{padding:14px 16px 20px;position:relative;z-index:1;}
.hud{margin-bottom:6px;}
.hud-top{display:flex;align-items:center;gap:8px;justify-content:space-between;margin-bottom:10px;}
.phase-pill{
  background:var(--card);
  border:1px solid var(--gold);
  color:var(--gold);
  padding:6px 16px;
  border-radius:999px;
  font-weight:700;
  font-size:0.8rem;
  letter-spacing:0.5px;
}
.strain-pill{
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:0.72rem;
  color:var(--text-dim);
  text-align:center;
}
.icon-btn{
  width:32px;height:32px;border-radius:50%;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text-dim);
  font-weight:700;
  cursor:pointer;
  flex:0 0 auto;
}
.bars{display:flex;flex-direction:column;gap:6px;}
.bar-row{display:flex;align-items:center;gap:8px;}
.bar-label{font-size:0.7rem;color:var(--text-dim);width:88px;flex:0 0 auto;}
.bar-track{flex:1;height:9px;background:#000;border-radius:6px;overflow:hidden;border:1px solid var(--border);}
.bar-fill{height:100%;border-radius:6px;transition:width .3s ease;}
.bar-fill.health{background:linear-gradient(90deg,#7a3,#4CAF50);}
.bar-fill.progress{background:linear-gradient(90deg,var(--gold),var(--gold-light));}

.stage{
  display:flex;
  align-items:center;
  justify-content:center;
  margin:6px 0;
  position:relative;
}
.plant-photo{
  width:100%;max-width:260px;height:200px;
  object-fit:cover;
  border-radius:16px;
  border:1px solid var(--border);
  box-shadow:0 8px 24px rgba(0,0,0,0.4);
  cursor:pointer;
  transition:filter .4s ease;
}
.plant-photo.grow-pulse{animation:grow-pulse .5s ease;}
@keyframes grow-pulse{
  0%{transform:scale(0.94);opacity:0.55;}
  100%{transform:scale(1);opacity:1;}
}
.plant-check-bubble{
  position:absolute;
  bottom:8px;left:50%;
  transform:translate(-50%,8px);
  background:rgba(10,10,10,0.92);
  border:1px solid var(--gold);
  color:var(--gold-light);
  font-size:0.72rem;
  font-weight:700;
  padding:6px 12px;
  border-radius:999px;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
}
.plant-check-bubble.show{opacity:1;transform:translate(-50%,0);}

.event-panel{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:10px;
  min-height:120px;
}
.event-title{font-weight:800;color:var(--gold);font-size:1.05rem;margin:0 0 2px;text-align:center;}
.event-prompt{font-size:0.88rem;color:var(--text-dim);text-align:center;margin:0 0 10px;line-height:1.4;}
.option-btn{
  display:block;
  width:100%;
  text-align:left;
  padding:13px 16px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  font-size:0.88rem;
  margin-bottom:8px;
  cursor:pointer;
}
.option-btn:active{transform:scale(0.98);}
.option-btn.correct{border-color:var(--green);background:rgba(76,175,80,0.15);}
.option-btn.wrong{border-color:var(--red);background:rgba(194,76,76,0.15);}
.training-btn{display:flex;flex-direction:column;gap:3px;}
.training-btn-label{font-weight:700;color:var(--text);font-size:0.92rem;}
.training-btn-desc{font-size:0.74rem;color:var(--text-dim);}
.event-explain{
  font-size:0.78rem;
  color:var(--text-dim);
  text-align:center;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  margin-top:6px;
}
.btn-continue{margin:12px auto 0;}

/* ---------- MINIGAME ---------- */
.minigame-sheet{max-height:92vh;}
.mg-instructions{color:var(--text-dim);font-size:0.85rem;line-height:1.4;margin-top:-6px;}
.mg-timer-track{height:6px;background:#000;border-radius:4px;overflow:hidden;border:1px solid var(--border);margin:10px 0 16px;}
.mg-timer-fill{height:100%;width:100%;background:linear-gradient(90deg,var(--gold),var(--gold-light));transition:width .1s linear;}
.mg-body{display:flex;flex-direction:column;align-items:center;gap:14px;min-height:220px;justify-content:center;}
.mg-result{text-align:center;font-weight:700;color:var(--gold);min-height:24px;}

/* water minigame */
.water-track{
  position:relative;
  width:64px;height:220px;
  background:#000;
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
}
.water-zone{position:absolute;left:0;right:0;background:rgba(76,175,80,0.35);border-top:1px solid var(--green);border-bottom:1px solid var(--green);}
.water-fill{position:absolute;left:0;right:0;bottom:0;background:linear-gradient(180deg,#3a7bd5,#2a5aa0);}
.water-marker{position:absolute;left:-4px;right:-4px;height:4px;background:var(--gold-light);box-shadow:0 0 8px var(--gold);}
.mg-tap-btn{
  padding:16px 40px;
  border-radius:50px;
  border:none;
  background:linear-gradient(135deg,var(--gold-light),var(--gold));
  color:#1A1A1A;
  font-weight:800;
  font-size:1rem;
  cursor:pointer;
}
.mg-tap-btn:active{transform:scale(0.95);}

/* pest minigame */
.pest-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;width:100%;max-width:280px;}
.pest-cell{
  aspect-ratio:1;
  border-radius:10px;
  background:#1e2a1a;
  border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  font-size:1.4rem;
  cursor:pointer;
  position:relative;
  overflow:hidden;
}
.pest-cell.infected{background:#3a2418;border-color:var(--red);animation:pulse-red .5s infinite alternate;}
@keyframes pulse-red{from{box-shadow:0 0 0 rgba(194,76,76,0.4);}to{box-shadow:0 0 14px rgba(194,76,76,0.7);}}
.pest-cell.hit{background:rgba(76,175,80,0.3);border-color:var(--green);}
.pest-stats{font-size:0.78rem;color:var(--text-dim);}

/* fertilizer minigame */
.npk-row{width:100%;max-width:280px;}
.npk-row label{display:flex;justify-content:space-between;font-size:0.8rem;color:var(--text-dim);margin-bottom:2px;}
.npk-row input[type=range]{width:100%;accent-color:var(--gold);}
.npk-hint{font-size:0.78rem;color:var(--gold-light);text-align:center;}

/* LST minigame */
.lst-wrap{position:relative;width:260px;height:220px;}
.lst-target{
  position:absolute;
  width:38px;height:38px;
  border-radius:50%;
  background:rgba(201,162,39,0.18);
  border:2px solid var(--gold);
  transform:translate(-50%,-50%);
  cursor:pointer;
}
.lst-target.wrong-flash{background:rgba(194,76,76,0.4);border-color:var(--red);}
.lst-target.correct-flash{background:rgba(76,175,80,0.5);border-color:var(--green);}

/* ---------- SCORE SCREEN ---------- */
.score-inner{
  position:relative;z-index:1;
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:32px 24px;gap:8px;
}
.harvest-title{margin:0 0 6px;color:var(--text);}
.score-strain-label{font-size:0.78rem;color:var(--text-dim);margin-bottom:10px;}
.quality-badge{
  color:var(--gold);
  font-weight:800;
  font-size:1.1rem;
  border:1px solid var(--gold);
  border-radius:999px;
  padding:6px 20px;
  margin-bottom:16px;
}
.score-grid{display:flex;gap:14px;margin-bottom:16px;}
.score-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px 22px;
  display:flex;flex-direction:column;align-items:center;
  min-width:110px;
}
.score-num{font-size:2rem;font-weight:800;color:var(--gold);}
.score-unit{font-size:0.72rem;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.5px;}

@media (max-height:680px){
  .plant-photo{max-width:220px;height:160px;}
  .logo-badge{width:56px;height:56px;}
  .title{font-size:2rem;}
}
