/* ============================================================
   HydroHarvest — styles
   ============================================================ */

:root {
  --bg-top: #aee9ff;
  --bg-bottom: #d8f7c9;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(34, 197, 94, 0.25);
  --ink: #1f3d2b;
  --ink-soft: #5b7a68;
  --accent: #22c55e;
  --accent-dark: #15803d;
  --coin: #f59e0b;
  --bad: #ef4444;
  --info: #3b82f6;
  --card: #ffffff;
  --shadow: 0 8px 24px rgba(31, 61, 43, 0.12);
  --radius: 16px;
}

body.night {
  --bg-top: #1e2a52;
  --bg-bottom: #35507a;
  --panel: rgba(24, 34, 48, 0.88);
  --panel-border: rgba(125, 211, 252, 0.18);
  --ink: #e6f4ea;
  --ink-soft: #9fb8c8;
  --card: #223148;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  transition: background 2s ease;
  overflow-x: hidden;
}

button { font-family: inherit; color: inherit; }
h1, h2, h3 { margin: 0.2em 0; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); font-weight: normal; font-size: 0.85em; }

#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.6rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* ---------------- top bar ---------------- */
#topbar {
  position: sticky;
  top: 0.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.logo b { color: var(--accent-dark); }
body.night .logo b { color: #4ade80; }

.stat { white-space: nowrap; font-size: 1.02rem; }
.coin-stat b { color: var(--coin); font-size: 1.15em; }

.level-wrap { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 140px; }
.level-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}
.xpbar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  overflow: hidden;
}
.xpbar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #86efac);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ---------------- buttons ---------------- */
.btn {
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--accent-dark);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn.small { padding: 0.32rem 0.6rem; font-size: 0.86rem; }
.btn.wide { width: 100%; }
.btn.big { font-size: 1.15rem; padding: 0.7rem 1.6rem; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.45);
}
.btn.danger { background: var(--bad); box-shadow: 0 3px 0 #b91c1c; }

/* ---------------- layout ---------------- */
#layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 0.8rem;
  align-items: start;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

/* ---------------- reservoir ---------------- */
#reservoir h2 { font-size: 1.05rem; }

.gauge-row { margin-top: 0.8rem; }
.gauge-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.gauge-row label b { font-weight: 800; }

.gauge {
  position: relative;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
}
.gauge i {
  display: block;
  height: 100%;
  width: 50%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.gauge.water i { background: linear-gradient(90deg, #38bdf8, #0284c7); }
.gauge.ec i { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

/* crop-range zone markers drawn over EC/pH bars */
.gauge em { display: block; }
.gauge.ec em, .gauge.ph em {
  position: absolute;
  top: -3px;
  bottom: -3px;
  border-left: 2px solid rgba(255, 255, 255, 0.95);
  border-right: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.35);
}

.gauge.ph {
  background: linear-gradient(90deg, #ef4444, #f97316, #facc15, #22c55e, #06b6d4, #3b82f6);
  height: 16px;
}
#ph-marker {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 6px;
  height: calc(100% + 8px);
  background: #111;
  border: 2px solid #fff;
  border-radius: 4px;
  transform: translateX(-50%);
  transition: left 0.3s ease;
  box-shadow: 0 0 6px rgba(0,0,0,.4);
}

.btn-duo { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.btn-duo .btn { flex: 1; }

.hint { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.35; }

.algae {
  margin-top: 0.8rem;
  padding: 0.5rem;
  border-radius: 12px;
  background: rgba(132, 204, 22, 0.18);
  border: 1px dashed #84cc16;
  font-size: 0.9rem;
  animation: shake 0.8s ease infinite alternate;
}
.algae button { margin-top: 0.35rem; }

/* ---------------- farm ---------------- */
#farm h2 { font-size: 1.05rem; }
.tutorial {
  min-height: 1.3em;
  margin: 0.2rem 0 0.7rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px dashed var(--info);
  font-size: 0.92rem;
}

#pod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.7rem;
}

.pod {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(31, 61, 43, 0.1);
  padding: 0.55rem;
  min-height: 175px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pod:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(31, 61, 43, 0.18); }
.pod.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }

.pod-head {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  gap: 0.3rem;
}

.pod-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.plant {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.25));
  animation: bob 2.6s ease-in-out infinite;
}
.pod.ready .plant { animation: bounceReady 0.9s ease-in-out infinite; }
.pod.dead .plant { filter: grayscale(1); opacity: 0.75; animation: none; }

.pbar {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  overflow: hidden;
}
.pbar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #bef264);
  transition: width 0.25s linear;
}

.hbar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.hbar i { display: block; height: 100%; background: #4ade80; transition: width .25s; }
.hbar.warn i { background: #f59e0b; }
.hbar.crit i { background: var(--bad); }

.ptime { font-size: 0.78rem; color: var(--ink-soft); min-height: 1em; }
.ptime.stalled { color: var(--bad); font-weight: 700; }

.pod-status { display: flex; gap: 0.25rem; min-height: 1.2em; justify-content: center; font-size: 0.9rem; }
.pod-status span { cursor: help; }

.pod-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin-top: 0.35rem; }
.pod-actions .btn { flex: 1; }

/* seed picker inside a pod */
.seed-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  max-height: 110px;
  overflow-y: auto;
  padding: 0.2rem;
}
.seed-chip {
  border: 2px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  border-radius: 10px;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.25;
  text-align: center;
}
.seed-chip b { display: block; }
.seed-chip:hover:not(:disabled) { background: rgba(34, 197, 94, 0.22); }
.seed-chip:disabled { opacity: 0.42; cursor: not-allowed; }

.pod.empty::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  pointer-events: none;
  animation: glowPulse 2.2s ease-in-out infinite;
  border: 2px solid rgba(74, 222, 128, 0.0);
}
.tutorial-stage0 .pod.empty::after {
  border-color: rgba(74, 222, 128, 0.8);
}

.pod.locked {
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.03) 0 8px, transparent 8px 16px);
  border: 2px dashed rgba(100, 116, 139, 0.4);
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-soft);
}
body.night .pod.locked { background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 8px, transparent 8px 16px); }
.lock-icon { font-size: 1.8rem; }
.lock-info { font-size: 0.8rem; line-height: 1.3; }

.pod.ready { border-color: #fde047; animation: readyGlow 1.4s ease-in-out infinite; }

/* night = grow lights */
body.night #farm {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(186, 230, 253, 0.14), transparent 45%),
    radial-gradient(ellipse at 70% 0%, rgba(253, 224, 71, 0.12), transparent 40%),
    var(--panel);
}
body.night .plant { filter: drop-shadow(0 0 8px rgba(186, 230, 253, 0.65)); }

/* ---------------- sidebar ---------------- */
#tabs { display: flex; gap: 0.3rem; margin-bottom: 0.7rem; }
.tab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.2rem;
  background: rgba(34, 197, 94, 0.1);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  position: relative;
}
.tab.active { background: var(--accent); color: #fff; }
.dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f43f5e;
  animation: pulse 1s ease infinite;
}
.tabpanel { display: none; }
.tabpanel.active { display: block; }
.tabpanel h3 { font-size: 0.98rem; margin-top: 0.9rem; }
.tabpanel h3:first-child { margin-top: 0; }

.system-card {
  background: var(--card);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.45rem;
  box-shadow: 0 2px 8px rgba(31, 61, 43, 0.08);
  font-size: 0.86rem;
  line-height: 1.35;
}
.system-card .sys-head { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; font-weight: 800; }
.system-card p { margin: 0.25rem 0; color: var(--ink-soft); }
.system-card .btn { margin-top: 0.25rem; }
.system-card.current { outline: 2px solid var(--accent); }

.statlist { list-style: none; padding: 0; margin: 0.3rem 0; font-size: 0.92rem; }
.statlist li { padding: 0.18rem 0; display: flex; justify-content: space-between; }

.order-card {
  background: var(--card);
  border-radius: 12px;
  padding: 0.7rem;
  box-shadow: 0 2px 10px rgba(31, 61, 43, 0.1);
  border-left: 5px solid var(--coin);
  font-size: 0.92rem;
}
.order-card.claimable { border-left-color: var(--accent); animation: pulse 1.2s ease infinite; }
.order-card .who { font-weight: 800; }
.order-card .want { margin: 0.35rem 0; font-size: 1.05rem; }
.order-progress {
  height: 10px;
  background: rgba(245, 158, 11, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.35rem 0;
}
.order-progress i { display: block; height: 100%; background: var(--coin); }
.order-reward { display: flex; gap: 0.8rem; margin: 0.3rem 0; font-weight: 700; }
.order-timer { color: var(--ink-soft); font-size: 0.8rem; }

.fact-item {
  background: var(--card);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(31, 61, 43, 0.08);
}
.fact-item b { display: block; margin-bottom: 0.15rem; }
.fact-item.mystery {
  background: transparent;
  border: 1px dashed var(--ink-soft);
  box-shadow: none;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------------- ticker ---------------- */
#ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(21, 32, 23, 0.85);
  color: #d9f7e3;
  text-align: center;
  padding: 0.35rem 1rem;
  font-size: 0.88rem;
  backdrop-filter: blur(6px);
}
#tip-text { transition: opacity 0.4s ease; }

/* ---------------- toasts & floats ---------------- */
#toast-holder {
  position: fixed;
  top: 4.2rem;
  right: 1rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 320px;
}
.toast {
  background: var(--card);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--info);
  animation: slideIn 0.25s ease;
}
.toast.good { border-left-color: var(--accent); }
.toast.bad { border-left-color: var(--bad); }
.toast.fact { border-left-color: #8b5cf6; background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
.toast.leaving { opacity: 0; transform: translateX(30px); transition: all 0.4s ease; }

#float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}
.float-text {
  position: absolute;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--coin);
  text-shadow: 0 1px 0 #fff, 0 2px 6px rgba(0, 0, 0, 0.25);
  animation: floatUp 1.2s ease-out forwards;
}
.confetti {
  position: absolute;
  font-size: 1.3rem;
  animation: confettiFall linear forwards;
}

/* ---------------- modals ---------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 30, 20, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--card);
  color: var(--ink);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 1.4rem 1.6rem;
  max-width: 520px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  animation: popIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.modal h1 { font-size: 1.5rem; }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal .story { line-height: 1.55; text-align: left; }
.howto { text-align: left; line-height: 1.7; padding-left: 1.1rem; }
.modal .btn.big { margin-top: 0.9rem; }
.close-x { box-shadow: none; font-size: 1rem; padding: 0.3rem 0.6rem; }

.academy #quiz-q { font-weight: 700; font-size: 1.08rem; line-height: 1.45; }
#quiz-choices { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.9rem 0; }
.choice-btn {
  border: 2px solid rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.07);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
}
.choice-btn:hover:not(:disabled) { background: rgba(34, 197, 94, 0.18); }
.choice-btn.correct { background: rgba(34, 197, 94, 0.35); border-color: var(--accent); font-weight: 800; }
.choice-btn.wrong { background: rgba(239, 68, 68, 0.22); border-color: var(--bad); }
#quiz-result { border-radius: 12px; padding: 0.6rem 0.8rem; margin-bottom: 0.7rem; font-size: 0.92rem; line-height: 1.45; }
#quiz-result.ok { background: rgba(34, 197, 94, 0.15); }
#quiz-result.no { background: rgba(239, 68, 68, 0.13); }
.trophy { font-size: 2.6rem; margin: 0.4rem 0; }

.levelup .big-emoji { font-size: 3rem; margin: 0; animation: bounceIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------------- lessons ---------------- */
.lesson { text-align: left; }
.lesson-icon { font-size: 2.6rem; text-align: center; margin: 0 0 0.2rem; }
.lesson h1 { text-align: center; font-size: 1.35rem; }
.lesson-page {
  min-height: 9.5em;
  line-height: 1.6;
  margin: 0.8rem 0;
  padding: 0.8rem 0.95rem;
  background: rgba(34, 197, 94, 0.07);
  border-radius: 12px;
}
.lesson-dots { display: flex; gap: 0.4rem; justify-content: center; margin-bottom: 0.8rem; }
.lesson-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(34, 197, 94, 0.25);
  transition: background 0.2s ease;
}
.lesson-dots i.on { background: var(--accent); }
.lesson-actions { display: flex; justify-content: space-between; }
.lesson-reward { text-align: center; margin-top: 0.7rem; }

/* ---------------- grow guide ---------------- */
.guide .guide-sub { text-align: center; color: var(--ink-soft); margin: 0.1rem 0 0.8rem; }
.guide-table { width: 100%; border-collapse: collapse; margin-bottom: 0.7rem; }
.guide-table td {
  padding: 0.38rem 0.5rem;
  border-bottom: 1px dashed rgba(100, 116, 139, 0.3);
  font-size: 0.9rem;
}
.guide-table td:first-child { color: var(--ink-soft); width: 42%; }
.guide-table td b.green { color: var(--accent-dark); }
body.night .guide-table td b.green { color: #4ade80; }

/* ---------------- info button on pods ---------------- */
.info-btn {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  opacity: 0.75;
}
.info-btn:hover { opacity: 1; transform: scale(1.15); }

/* ---------------- ad slots ----------------
   Reserved space = stable layout (no CLS). Replace placeholders
   with a real provider via window.HYDRO_AD_PROVIDER (see js/ads.js). */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 1px dashed rgba(100, 116, 139, 0.45);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.25);
  color: var(--ink-soft);
  overflow: hidden;
}
body.night .ad-slot { background: rgba(0, 0, 0, 0.18); }
.ad-slot.filled { border-style: solid; background: transparent; }
.ad-tag {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
  white-space: nowrap;
}
.ad-placeholder { font-size: 0.78rem; white-space: nowrap; }

.ad-leaderboard { min-height: 74px; }
.ad-banner { min-height: 56px; }
.ad-inmodal { min-height: 60px; margin-top: 0.9rem; }

@media (max-width: 640px) {
  .ad-leaderboard { min-height: 52px; }
}

/* ---------------- guided tutorial ---------------- */
#tour-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none; /* let players actually play during the tour */
}
#tour-layer.hidden { display: none; }
#tour-card { pointer-events: auto; }

#tour-spot {
  position: fixed;
  display: none;
  pointer-events: none;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.9), 0 0 0 9999px rgba(10, 22, 14, 0.62);
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

#tour-card {
  position: fixed;
  width: min(340px, calc(100vw - 24px));
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  border-top: 5px solid var(--accent);
  padding: 0.85rem 1rem 0.75rem;
  animation: popIn 0.25s ease;
}
#tour-title { margin: 0.15rem 0 0.35rem; font-size: 1.08rem; }
#tour-text { font-size: 0.92rem; line-height: 1.55; margin: 0 0 0.6rem; }
.tour-step-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 700;
}
#tour-dots { display: flex; gap: 0.35rem; justify-content: center; margin-bottom: 0.6rem; }
#tour-dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(34, 197, 94, 0.25);
}
#tour-dots i.on { background: var(--accent); }
.tour-actions { display: flex; align-items: center; gap: 0.4rem; }
.flex-fill { flex: 1; }

/* ---------------- animations ---------------- */
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-4px) rotate(1.5deg); }
}
@keyframes bounceReady {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-7px) scale(1.06); }
}
@keyframes floatUp {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-70px); opacity: 0; }
}
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes bounceIn {
  0% { transform: scale(0.3); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes readyGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(253, 224, 71, 0.55); }
  50% { box-shadow: 0 0 20px rgba(253, 224, 71, 0.95); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(74, 222, 128, 0); }
  50% { box-shadow: inset 0 0 24px 2px rgba(74, 222, 128, 0.35); }
}
@keyframes shake {
  from { transform: rotate(-0.6deg); }
  to { transform: rotate(0.6deg); }
}
@keyframes confettiFall {
  from { transform: translateY(-10vh) rotate(0turn); opacity: 1; }
  to { transform: translateY(105vh) rotate(1.5turn); opacity: 0.9; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 1020px) {
  #layout { grid-template-columns: 1fr 1fr; }
  #reservoir { grid-column: 1 / -1; order: 2; }
  #farm { grid-column: 1 / -1; order: 1; }
  #sidebar { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 640px) {
  #layout { grid-template-columns: 1fr; }
  #topbar { flex-wrap: wrap; gap: 0.5rem; }
  .level-wrap { order: 5; flex-basis: 100%; }
  #app { padding-bottom: 3.4rem; }
}
.term { font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px dashed currentColor; cursor: help; padding: 2px 0; text-align: left; }
.term:hover, .term:focus-visible { color: #166534; background: #dcfce7; outline-offset: 4px; }
.term-action { padding: 12px; border-left: 3px solid var(--accent); background: #f0fdf4; color: #1f3d2b; line-height: 1.6; }
.quiz-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
#quiz-prep { padding: 14px; border-radius: 12px; background: #f0fdf4; color: #1f3d2b; line-height: 1.7; }
#lesson-library { display: grid; gap: 6px; margin: 12px 0; }
.tour-actions { flex-wrap: wrap; }
@media (max-width: 759px) {
  body #tour-layer { position: relative; inset: auto; z-index: 1; padding: 12px; }
  body #tour-spot { display: none !important; }
  body #tour-card { position: static; width: 100%; box-sizing: border-box; }
}
