/* ═══════════════════════════════════════════════════════
   PENDIENTE DE NOTA — styles
   ═══════════════════════════════════════════════════════ */

:root {
  --navy:    #0B214A;
  --turq:    #00E6BC;
  --lime:    #04FFB4;
  --mint:    #C5FFDF;
  --lemon:   #FFFFAB;
  --rojo:    #E74C3C;
  --naranja: #E67E22;
  --grey:    #8899aa;
}

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  font-family: 'Baloo 2', sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

html.results, html.results body {
  overflow: auto;
}

/* ── Screen system ───────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  padding-top: env(safe-area-inset-top);
  padding-top: constant(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-bottom: constant(safe-area-inset-bottom);
}

.screen.active { display: flex; flex-direction: column; }
.screen.hidden  { display: none; }

.screen-bg {
  position: absolute;
  inset: 0;
  background: url('https://res.cloudinary.com/kampe/image/upload/v1773664966/bg_plato_i9cwql.jpg') center/cover no-repeat;
  z-index: 0;
}

/* ── Max-width wrapper ───────────────────────────────── */
.wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── HUD ─────────────────────────────────────────────── */
#hud {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 66px 10px 16px; /* 66px right for RN close button */
  background: rgba(11, 33, 74, 0.85);
  border-bottom: 2px solid var(--turq);
  flex-shrink: 0;
}

.hud-lives { display: flex; gap: 4px; }
.heart { font-size: 18px; transition: opacity 0.2s; color: var(--rojo); }
.heart.lost { opacity: 0.2; }

.hud-score {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--lemon);
  display: none;
}

.hud-round {
  font-size: 13px;
  color: var(--mint);
  white-space: nowrap;
}

/* ── Round label ─────────────────────────────────────── */
.round-label {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--turq);
  padding: 8px 16px;
  flex-shrink: 0;
}

/* ── Game area ───────────────────────────────────────── */
#game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
  padding-top: 40px;
  position: relative;
}

.pipe-label {
  font-size: 12px;
  color: var(--mint);
  opacity: 0.7;
  align-self: flex-start;
  padding-left: 20px;
}

.pipe-label-right {
  align-self: flex-end;
  padding-right: 20px;
  padding-left: 0;
}

#pipe-svg {
  width: 100%;
  max-width: 400px;
  height: auto;
  overflow: visible;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Fondo play: navy sólido, sin imagen */
#play {
  background: var(--navy);
}

#pipe-handle {
  cursor: grab;
  filter: drop-shadow(0 0 6px rgba(0, 230, 188, 0.6));
  transition: filter 0.1s;
}

#pipe-handle:active { cursor: grabbing; }

/* ── Educational question ────────────────────────────── */
.edu-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.edu-option-btn {
  background: rgba(0, 230, 188, 0.08);
  border: 2px solid var(--turq);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-family: 'Baloo 2', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
  line-height: 1.4;
}

.edu-option-btn:active   { background: rgba(0, 230, 188, 0.2); }
.edu-option-btn.correct  { border-color: var(--turq); background: rgba(0, 230, 188, 0.25); }
.edu-option-btn.wrong    { border-color: var(--rojo); background: rgba(231, 76, 60, 0.2); }
.edu-option-btn:disabled { cursor: default; }

.edu-q-feedback {
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  padding: 4px 4px 0;
  font-weight: 600;
}

/* ── Drag hint ───────────────────────────────────────── */
#drag-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  opacity: 0.65;
  font-size: 12px;
  color: var(--turq);
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: hintPulse 2s ease-in-out infinite;
}

#drag-hint .hint-arrow {
  font-size: 16px;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.85; }
}

#drag-hint.hint-step2 {
  color: var(--lemon);
  animation: none;
  opacity: 1;
}

/* ── Siphon step ─────────────────────────────────────── */
#siphon-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 12px 20px 16px;
  width: 100%;
  overflow-y: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.siphon-prompt {
  font-size: 16px;
  font-weight: 700;
  color: var(--lemon);
  text-align: center;
}

#siphon-tray {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(0,230,188,0.1);
  border: 2px solid var(--turq);
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s;
}

#siphon-tray:active { background: rgba(0,230,188,0.25); }
#siphon-asset { width: 60px; height: auto; }
.siphon-label { font-size: 12px; color: var(--turq); font-weight: 700; }

.siphon-target {
  width: 80px;
  height: 80px;
  border: 2px dashed var(--turq);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  font-size: 11px;
  color: var(--turq);
  text-align: center;
}

.siphon-target.filled {
  opacity: 1;
  border-style: solid;
  background: rgba(0,230,188,0.15);
}

/* ── Pablo character ─────────────────────────────────── */
#pablo-container {
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 8px 8px 0;
  pointer-events: none;
}

#pablo-avatar {
  width: 100px;
  height: auto;
  opacity: 1;
  transition: opacity 0.3s;
}

.gameplay-bubble {
  position: relative;
  max-width: 160px;
  margin-bottom: 40px;
  font-size: 12px;
}

/* ── Speech bubbles ──────────────────────────────────── */
.speech-bubble {
  background: rgba(11, 33, 74, 0.95);
  border: 2px solid var(--turq);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
  z-index: 60;
}

/* ── ASMR canvas ─────────────────────────────────────── */
#asmr-canvas {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

/* ── Overlays ────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 33, 74, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: env(safe-area-inset-top);
}

.overlay.hidden { display: none; }

/* ── Edu overlay ─────────────────────────────────────── */
.edu-card {
  background: var(--navy);
  border: 2px solid var(--rojo);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edu-avatar {
  width: 80px;
  height: auto;
  align-self: center;
}

.edu-content { display: flex; flex-direction: column; gap: 10px; }

.edu-row { display: flex; flex-direction: column; gap: 2px; }

.edu-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--turq);
  text-transform: uppercase;
}

.edu-row p { font-size: 13px; line-height: 1.5; color: #dde; }

.edu-rule .edu-label { color: var(--lemon); }
.edu-rule p { color: var(--lemon); font-weight: 600; }


/* ── Intro screen ────────────────────────────────────── */
.intro-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 16px 20px 20px;
  text-align: center;
}

.game-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--lemon);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.intro-avatar img {
  width: 160px;
  height: auto;
}

.intro-bubble { max-width: 320px; }

/* ── Results screen ──────────────────────────────────── */
.results-wrapper {
  overflow-y: auto;
}

.results-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  text-align: center;
  min-height: 100%;
}

.results-avatar { width: 180px; height: auto; }

.results-card {
  background: rgba(11, 33, 74, 0.92);
  border: 2px solid var(--turq);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.results-score {
  font-size: 52px;
  font-weight: 800;
  color: var(--lemon);
  animation: popIn 0.35s ease-out;
  line-height: 1;
}

.results-record {
  font-size: 14px;
  color: var(--turq);
  font-weight: 600;
}

.results-msg {
  font-size: 15px;
  line-height: 1.6;
  color: #dde;
}

/* ── Tutorial modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(11, 33, 74, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--navy);
  border: 2px solid var(--turq);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--lemon);
  text-align: center;
}

.tutorial-steps { display: flex; flex-direction: column; gap: 12px; }

.tutorial-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tut-icon { font-size: 24px; flex-shrink: 0; }
.tutorial-step p { font-size: 13px; line-height: 1.5; color: #dde; }

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  background: var(--turq);
  color: var(--navy);
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  align-self: center;
  transition: transform 0.1s, background 0.1s;
}

.btn-primary:active {
  transform: scale(0.97);
  background: var(--lime);
}

/* ── Utility ─────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Animations ──────────────────────────────────────── */
@keyframes popIn {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes siphonSnap {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes smellRise {
  0%   { transform: translateY(0); opacity: 0.8; }
  60%  { transform: translateY(-40px); opacity: 0.6; }
  100% { transform: translateY(-60px); opacity: 0; }
}

.shake { animation: shake 0.4s ease; }

/* ── Water particle animation ────────────────────────── */
.water-bubble {
  animation: waterFlow 1.5s ease-in-out forwards;
}

@keyframes waterFlow {
  0%   { opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { opacity: 0; }
}
