/* =====================================================================
 * Vivero Financiero — Hoja de estilo (diseño visual libre, criterio UX).
 * Estética: invernadero botánico premium. Verdes profundos, vidrio
 * esmerilado (glassmorphism), tipografía limpia. Mobile-first.
 * ===================================================================== */

:root {
  --bg-0: #0b1f17;
  --bg-1: #102a1f;
  --bg-2: #16352a;
  --leaf: #3fae6a;
  --leaf-deep: #1f7a47;
  --leaf-bright: #7ee2a8;
  --water: #57c4e6;
  --gold: #f3c969;
  --danger: #ef5d5d;
  --warn: #f0a64a;
  --text: #eaf6ee;
  --text-dim: #a7c4b3;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(63,174,106,0.25), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(87,196,230,0.18), transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  min-height: 100%;
  overflow-x: hidden;
}

#app-root { display: block; min-height: 100vh; }

/* ---------- Utilitarios ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-dim); font-size: 0.85rem; }
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 20px; }

/* ---------- Botones ---------- */
.btn {
  appearance: none; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.08); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 0.95rem;
  cursor: pointer; transition: transform .08s ease, background .2s ease, box-shadow .2s ease;
  font-weight: 600;
}
.btn:hover { background: rgba(255,255,255,0.14); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.primary { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); border-color: transparent; }
.btn.primary:hover { box-shadow: 0 8px 24px rgba(63,174,106,0.4); }
.btn.danger { background: linear-gradient(135deg, #ff6b6b, #c0392b); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 22px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { background: transparent; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; padding: 6px 10px; border-radius: 10px; }
.icon-btn:hover { background: rgba(255,255,255,0.1); }

/* ---------- Pantallas base ---------- */
.screen { min-height: 100vh; padding: 18px; display: flex; flex-direction: column; }

/* ---------- Onboarding ---------- */
.onboarding { align-items: center; justify-content: center; }
.onboarding-card { max-width: 420px; width: 100%; text-align: center; }
.brand { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.5px; }
.brand span { background: linear-gradient(135deg, var(--leaf-bright), var(--water)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: var(--text-dim); margin-top: 6px; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; text-align: left; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-dim); }
.form input, .form select, .zucho-input-row input, .lab-row input {
  background: rgba(0,0,0,0.25); border: 1px solid var(--glass-border);
  color: var(--text); padding: 12px 14px; border-radius: 12px; font-size: 1rem; width: 100%;
}
.form input:focus, .form select:focus { outline: 2px solid var(--leaf); }
.legal { font-size: 0.72rem; color: var(--text-dim); margin-top: 18px; }

/* ---------- Zucho Intro ---------- */
.zucho-intro { align-items: center; justify-content: center; }
.intro-stage { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 900px; }
.chalkboard {
  background: linear-gradient(160deg, #1c3b2e, #143024);
  border: 10px solid #6b4a2b; border-radius: 14px; padding: 26px 28px;
  max-width: 520px; box-shadow: var(--shadow);
}
.chalkboard h2 { margin-top: 0; color: var(--leaf-bright); }
.chalkboard ul { line-height: 1.6; padding-left: 18px; }
.intro-actions { display: flex; gap: 12px; margin-top: 16px; }
.intro-zucho-slot { width: 220px; height: 320px; }

/* ---------- HUD ---------- */
.game { padding: 12px; gap: 12px; padding-bottom: 96px; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.biome-badge { font-weight: 800; font-size: 1.05rem; }
.biome-sub { font-size: 0.78rem; color: var(--text-dim); }
.hud-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat .lbl { font-size: 0.68rem; color: var(--text-dim); }
.stat .val { font-size: 1.05rem; font-weight: 700; }
.idle-meter { font-size: 0.8rem; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,0.25); }
.idle-meter.warn { background: rgba(240,166,74,0.25); color: var(--warn); font-weight: 700; }
.idle-meter.danger { background: rgba(239,93,93,0.25); color: var(--danger); font-weight: 700; }

/* ---------- Navs ---------- */
.biome-nav, .tabs { display: flex; gap: 8px; }
.chip, .tab {
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
  color: var(--text); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
}
.chip.active, .tab.active { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); border-color: transparent; }
.tabs .tab { border-radius: 12px 12px 0 0; }

/* ---------- Parcelas ---------- */
.plot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .plot-grid { grid-template-columns: repeat(3, 1fr); } }
.plot {
  position: relative; min-height: 180px; border-radius: var(--radius);
  border: 1px solid var(--glass-border); background: var(--glass);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 14px; text-align: center; overflow: hidden;
}
.plot.empty { border-style: dashed; cursor: pointer; color: var(--text-dim); }
.plot.empty:hover { background: rgba(63,174,106,0.12); color: var(--text); }
.plot .plot-num { position: absolute; top: 8px; left: 10px; font-size: 0.7rem; color: var(--text-dim); }
.plot img { width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)); }
.plot .plant-name { font-weight: 700; margin-top: 6px; font-size: 0.9rem; }
.plot .plant-val { font-size: 1.15rem; font-weight: 800; }
.plot .plant-meta { font-size: 0.72rem; color: var(--text-dim); margin: 4px 0 8px; }
.plot .delta-up { color: var(--leaf-bright); }
.plot .delta-down { color: var(--danger); }
.plot .locked { font-size: 0.7rem; color: var(--warn); }
.plot .plus { font-size: 2.4rem; line-height: 1; }

/* ---------- Laboratorio ---------- */
.lab { display: grid; gap: 12px; }
@media (min-width: 720px) { .lab { grid-template-columns: 1fr 1fr; } }
.lab-card h3 { margin-top: 0; }
.lab-row { display: flex; gap: 8px; margin-top: 10px; }
.sparkline { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 10px 0; }
.sparkline .bar { flex: 1; background: linear-gradient(180deg, var(--leaf-bright), var(--leaf-deep)); border-radius: 3px 3px 0 0; min-height: 2px; }
.history-list { list-style: none; padding: 0; margin: 0; max-height: 160px; overflow-y: auto; font-size: 0.82rem; }
.history-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }

/* ---------- Barra de acción ---------- */
.action-bar {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; z-index: 50;
}
.drag-hint { font-size: 0.82rem; color: var(--text-dim); }

/* ---------- Overlays / Modales ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { max-width: 460px; width: 100%; padding: 22px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Drawer de mercado */
.drawer-overlay { justify-content: flex-end; padding: 0; }
.drawer { width: min(440px, 100%); height: 100%; border-radius: 0; padding: 18px; overflow-y: auto; animation: slidein .25s ease; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.shop-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.shop-item { display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,0.22); border: 1px solid var(--glass-border); }
.shop-item img { width: 64px; height: 64px; object-fit: contain; }
.shop-item .si-body { flex: 1; }
.shop-item .si-name { font-weight: 700; }
.shop-item .si-desc { font-size: 0.78rem; color: var(--text-dim); margin: 4px 0; }
.shop-item .si-tags { font-size: 0.7rem; display: flex; gap: 8px; flex-wrap: wrap; }
.shop-item .tag { background: rgba(255,255,255,0.08); padding: 2px 8px; border-radius: 999px; }
.shop-item .si-buy { display: flex; gap: 6px; margin-top: 8px; }
.shop-item .si-buy input { width: 110px; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); color: var(--text); border-radius: 8px; padding: 6px 8px; }
.shop-item.disabled { opacity: 0.45; }

/* Reporte de turno */
.report-climate { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; text-align: center; }
.report-body { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.report-body .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.report-body .neg { color: var(--danger); }
.report-body .pos { color: var(--leaf-bright); }
.report-wealth { text-align: center; margin: 14px 0; font-size: 1.1rem; font-weight: 800; }
.report-wealth .up { color: var(--leaf-bright); }
.report-wealth .down { color: var(--danger); }

/* Quiz */
.quiz-question { font-size: 1.05rem; font-weight: 600; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.quiz-options .btn { text-align: left; }
.quiz-options .btn.correct { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); }
.quiz-options .btn.wrong { background: linear-gradient(135deg, #ff6b6b, #c0392b); }
.quiz-feedback { font-weight: 700; text-align: center; min-height: 1.4em; }

/* Santa Rosa */
.santa-rosa { background: rgba(120,10,10,0.78); }
.santa-card { text-align: center; max-width: 520px; padding: 30px; animation: shake 0.5s infinite alternate; }
.santa-card h1 { font-size: clamp(1.4rem, 6vw, 2.4rem); color: #ffd5d5; text-shadow: 0 2px 18px rgba(255,0,0,0.6); }
.siren { font-size: 4rem; animation: pulse 0.6s infinite; }
.countdown { font-size: 3rem; font-weight: 900; color: #fff; margin: 10px 0; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.6; } }
@keyframes shake { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
.warn p { line-height: 1.5; }

/* ============================================================
   Zucho avatar (único elemento gráfico especificado)
   ============================================================ */
#zucho-avatar {
  position: fixed; bottom: 92px; right: 16px; width: 200px; height: 300px;
  z-index: 150; cursor: grab; user-select: none; touch-action: none;
  animation: zuchoIntroFloat 4s ease-in-out infinite;
}
#zucho-avatar.dragging { cursor: grabbing; animation: none; }
#zucho-avatar.using-3d canvas { display: block; }
@keyframes zuchoIntroFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

#zucho-bubble {
  position: absolute; bottom: 78%; right: 60%; min-width: 180px; max-width: 240px;
  background: #fff; color: #173a29; padding: 12px 14px; border-radius: 14px;
  font-size: 0.84rem; line-height: 1.35; box-shadow: var(--shadow); z-index: 2;
}
#zucho-bubble::after {
  content: ''; position: absolute; bottom: -8px; right: 22px;
  border: 8px solid transparent; border-top-color: #fff; border-bottom: 0;
}

/* Chat modal de Zucho */
.zucho-chat { display: flex; flex-direction: column; }
.zucho-chat-history { background: rgba(0,0,0,0.25); border-radius: 12px; padding: 12px; height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.zucho-chat-history p { margin: 0; padding: 8px 12px; border-radius: 12px; max-width: 85%; font-size: 0.88rem; line-height: 1.4; }
.zucho-message { background: rgba(63,174,106,0.2); align-self: flex-start; }
.user-message { background: rgba(87,196,230,0.22); align-self: flex-end; }
.zucho-quota { font-size: 0.72rem; color: var(--text-dim); text-align: right; margin: 8px 2px; }
.zucho-input-row { display: flex; gap: 8px; }
.zucho-input-row input { flex: 1; }
