/* ===== VARIABLES ===== */
:root {
  --pink: #FF6FB7;
  --purple: #7B5EA7;
  --orange: #FF9F1C;
  --teal: #2EC4B6;
  --green: #06D6A0;
  --red: #E76F51;
  --bg: #FFF9F0;
  --card-bg: #ffffff;
  --text: #2D2D2D;
  --radius: 20px;
  --shadow: 0 8px 32px rgba(0,0,0,0.10);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Nunito', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
.hidden { display: none !important; }

/* ===== HEADER ===== */
.header { display:flex; align-items:center; justify-content:space-between; padding:14px 20px; background:white; box-shadow:0 2px 12px rgba(255,111,183,0.15); position:sticky; top:0; z-index:100; }
.header-logo { display:flex; align-items:center; gap:10px; }
.logo-icon { font-size:2rem; }
.logo-title { font-family:'Fredoka One',cursive; font-size:1.3rem; color:var(--pink); line-height:1; }
.logo-sub { font-size:0.65rem; color:#999; }
.header-stars { font-size:1.1rem; font-weight:800; color:var(--orange); }

/* ===== BG ===== */
.bg-art { position:fixed; inset:0; z-index:0; pointer-events:none; background: radial-gradient(circle at 15% 20%,rgba(255,111,183,.13) 0%,transparent 40%), radial-gradient(circle at 85% 70%,rgba(123,94,167,.13) 0%,transparent 40%), radial-gradient(circle at 50% 90%,rgba(46,196,182,.10) 0%,transparent 40%); animation:bgPulse 8s ease-in-out infinite alternate; }
@keyframes bgPulse { 0%{opacity:.7} 100%{opacity:1} }

/* ===== MAIN ===== */
.main { position:relative; z-index:1; padding:24px 16px 40px; max-width:600px; margin:0 auto; }

/* ===== HERO ===== */
.hero-section { display:flex; flex-direction:column; align-items:center; gap:16px; margin-bottom:32px; }
.hero-title { font-family:'Fredoka One',cursive; font-size:2rem; color:var(--purple); text-align:center; animation:bounceIn .6s ease; }
@keyframes bounceIn { 0%{transform:scale(.7);opacity:0} 80%{transform:scale(1.05)} 100%{transform:scale(1);opacity:1} }
.camera-btn { width:160px; height:160px; border-radius:50%; border:none; cursor:pointer; background:linear-gradient(135deg,var(--pink),var(--purple)); box-shadow:0 0 0 12px rgba(255,111,183,.18),0 8px 32px rgba(255,111,183,.4); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; transition:transform .15s,box-shadow .15s; animation:pulse 2.5s ease-in-out infinite; }
.camera-btn:hover { transform:scale(1.07); }
.camera-btn:active { transform:scale(.96); }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 12px rgba(255,111,183,.18),0 8px 32px rgba(255,111,183,.4)} 50%{box-shadow:0 0 0 22px rgba(255,111,183,.09),0 8px 32px rgba(255,111,183,.4)} }
.camera-icon { font-size:3rem; }
.camera-text { font-family:'Fredoka One',cursive; font-size:1rem; color:white; }

/* ===== MODULES GRID ===== */
.modules-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; margin-bottom:40px; }
.module-card { background:var(--card-bg); border-radius:var(--radius); padding:22px 14px; text-align:center; cursor:pointer; box-shadow:var(--shadow); transition:transform .15s,box-shadow .15s; border-top:4px solid var(--c); }
.module-card:hover { transform:translateY(-4px); box-shadow:0 16px 40px rgba(0,0,0,.13); }
.module-card:active { transform:scale(.96); }
.module-icon { font-size:2.2rem; margin-bottom:8px; }
.module-name { font-weight:800; font-size:.95rem; }

/* ===== MODULE SCREENS ===== */
.module-screen { position:fixed; inset:0; z-index:200; background:var(--bg); overflow-y:auto; padding:72px 16px 60px; animation:slideUp .3s ease; }
@keyframes slideUp { from{transform:translateY(40px);opacity:0} to{transform:translateY(0);opacity:1} }
.back-btn { position:fixed; top:16px; left:16px; z-index:300; background:white; border:2px solid var(--pink); color:var(--pink); font-weight:800; font-size:.95rem; border-radius:50px; padding:8px 18px; cursor:pointer; transition:background .15s,color .15s; }
.back-btn:hover { background:var(--pink); color:white; }
.module-title { font-family:'Fredoka One',cursive; font-size:1.8rem; color:var(--purple); text-align:center; margin-bottom:16px; }
.module-desc { text-align:center; color:#777; margin-bottom:16px; }

/* ===== CAMERA ===== */
.tm-info-banner { display:flex; justify-content:space-between; align-items:center; background:#f4f0ff; border-radius:12px; padding:10px 14px; margin-bottom:12px; font-size:.85rem; font-weight:700; color:var(--purple); }
.tm-help-btn { background:var(--purple); color:white; border:none; border-radius:50px; padding:6px 14px; font-size:.8rem; font-weight:700; cursor:pointer; }
.camera-container { width:100%; max-width:360px; margin:0 auto 16px; border-radius:var(--radius); overflow:hidden; background:#111; box-shadow:var(--shadow); aspect-ratio:4/3; position:relative; }
#video-cam, #preview-img { width:100%; height:100%; object-fit:cover; display:block; }
.tm-overlay { position:absolute; inset:0; background:rgba(0,0,0,.65); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; }
.tm-scanning { color:white; font-weight:800; font-size:1.1rem; animation:flash 1s ease-in-out infinite; }
@keyframes flash { 0%,100%{opacity:1} 50%{opacity:.4} }
.tm-bars { width:80%; display:flex; flex-direction:column; gap:6px; }
.tm-bar-row { display:flex; align-items:center; gap:8px; }
.tm-bar-label { color:white; font-size:.75rem; width:70px; text-align:right; }
.tm-bar-track { flex:1; height:10px; background:rgba(255,255,255,.2); border-radius:999px; overflow:hidden; }
.tm-bar-fill { height:100%; border-radius:999px; background:linear-gradient(90deg,var(--pink),var(--purple)); transition:width .4s ease; }
.tm-result-banner { margin:0 auto 14px; max-width:360px; background:linear-gradient(135deg,#f4f0ff,#ffe8f5); border-radius:16px; padding:14px 18px; text-align:center; font-weight:800; color:var(--purple); font-size:1.05rem; box-shadow:var(--shadow); animation:bounceIn .4s ease; }
.style-selector { margin-bottom:16px; }
.style-label { font-weight:700; margin-bottom:8px; color:var(--purple); text-align:center; }
.styles-row { display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; }
.style-btn { white-space:nowrap; padding:8px 14px; border-radius:50px; border:2px solid #ddd; background:white; font-weight:700; font-size:.8rem; cursor:pointer; transition:all .15s; }
.style-btn.active { border-color:var(--pink); background:var(--pink); color:white; }
.camera-actions { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
.action-btn { padding:14px 28px; border-radius:50px; border:none; cursor:pointer; font-family:'Fredoka One',cursive; font-size:1.05rem; color:white; transition:transform .15s; box-shadow:0 4px 16px rgba(0,0,0,.15); }
.action-btn:hover { transform:scale(1.05); }
.action-btn:active { transform:scale(.97); }
.action-btn.pink { background:linear-gradient(135deg,var(--pink),#e0569a); }
.action-btn.purple { background:linear-gradient(135deg,var(--purple),#5a3e8e); }
.action-btn.green { background:linear-gradient(135deg,var(--green),#04a87a); }
.action-btn.orange { background:linear-gradient(135deg,var(--orange),#e08000); }
.ai-result { margin-top:20px; text-align:center; }
.ai-result-title { font-family:'Fredoka One',cursive; font-size:1.3rem; color:var(--purple); margin-bottom:12px; }
#result-canvas { max-width:100%; border-radius:var(--radius); box-shadow:var(--shadow); }

/* TM GUIDE */
.tm-guide { position:fixed; inset:0; z-index:500; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; padding:20px; }
.tm-guide-content { background:white; border-radius:var(--radius); padding:28px 24px; max-width:420px; width:100%; position:relative; max-height:90vh; overflow-y:auto; }
.tm-guide-content h3 { font-family:'Fredoka One',cursive; color:var(--purple); margin-bottom:16px; font-size:1.3rem; }
.tm-steps { display:flex; flex-direction:column; gap:10px; margin-bottom:16px; }
.tm-step { display:flex; align-items:center; gap:10px; font-size:.9rem; }
.tm-step-num { width:28px; height:28px; border-radius:50%; background:var(--purple); color:white; display:flex; align-items:center; justify-content:center; font-weight:800; flex-shrink:0; }
.tm-url-input { width:100%; padding:12px 14px; border:2px solid #e0d0ff; border-radius:12px; font-size:.9rem; margin-bottom:12px; outline:none; }
.tm-url-input:focus { border-color:var(--purple); }
.tm-status { text-align:center; font-weight:700; padding:8px; }

/* ===== DRAWING ===== */
#drawing-canvas { display:block; margin:0 auto 16px; border-radius:var(--radius); box-shadow:var(--shadow); background:white; cursor:crosshair; touch-action:none; max-width:100%; }
.draw-tools { display:flex; justify-content:center; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.tool-btn { width:42px; height:42px; border-radius:50%; border:3px solid white; box-shadow:var(--shadow); cursor:pointer; font-size:1.1rem; display:flex; align-items:center; justify-content:center; transition:transform .15s; }
.tool-btn:hover { transform:scale(1.15); }
.tool-btn.erase { background:#f0f0f0; }
.brush-size { text-align:center; margin-bottom:14px; color:var(--purple); font-weight:700; }
.brush-size input { margin-left:8px; vertical-align:middle; accent-color:var(--purple); }
.detection-result { margin-top:16px; padding:18px; background:white; border-radius:var(--radius); text-align:center; box-shadow:var(--shadow); font-size:1.1rem; font-weight:700; }

/* ===== MUSEO ===== */
.museo-gallery { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.obra-card { background:white; border-radius:var(--radius); overflow:hidden; cursor:pointer; box-shadow:var(--shadow); transition:transform .15s; }
.obra-card:hover { transform:translateY(-4px); }
.obra-img { height:120px; display:flex; align-items:center; justify-content:center; font-size:3rem; }
.obra-info { padding:12px; font-size:.82rem; color:#555; line-height:1.5; }
.obra-info strong { color:var(--purple); }
.obra-modal { position:fixed; inset:0; z-index:400; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; padding:20px; }
.obra-modal-content { background:white; border-radius:var(--radius); padding:28px; max-width:400px; width:100%; position:relative; }
.close-modal { position:absolute; top:14px; right:14px; background:none; border:none; font-size:1.4rem; cursor:pointer; }
#obra-detail { text-align:center; }
#obra-detail .obra-art { font-size:5rem; margin-bottom:12px; }
#obra-detail h3 { font-family:'Fredoka One',cursive; font-size:1.4rem; color:var(--purple); margin-bottom:8px; }
#obra-detail p { color:#666; line-height:1.6; }

/* ===== GAMES ===== */
.games-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:20px; }
.game-card { background:var(--card-bg); border-radius:var(--radius); padding:24px 14px; text-align:center; cursor:pointer; box-shadow:var(--shadow); border-top:4px solid var(--gc); transition:transform .15s; }
.game-card:hover { transform:translateY(-4px); }
.game-icon { font-size:2rem; margin-bottom:8px; }
.game-name { font-weight:800; margin-bottom:4px; }
.game-desc { font-size:.8rem; color:#888; }
.game-container { background:white; border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.game-question { font-family:'Fredoka One',cursive; font-size:1.2rem; color:var(--purple); text-align:center; margin-bottom:16px; }
.game-art { font-size:4rem; text-align:center; margin-bottom:16px; }
.game-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.game-opt { padding:14px; border-radius:14px; border:2px solid #e0d0ff; background:white; cursor:pointer; font-weight:700; font-size:.9rem; text-align:center; transition:all .15s; }
.game-opt:hover { background:#f4f0ff; border-color:var(--purple); }
.game-opt.correct { background:var(--green); color:white; border-color:var(--green); }
.game-opt.wrong { background:var(--red); color:white; border-color:var(--red); }
.game-score { text-align:center; font-weight:800; font-size:1.1rem; color:var(--orange); margin-top:12px; }

/* MEMORIA */
.memoria-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.mem-card { aspect-ratio:1; border-radius:12px; background:var(--purple); display:flex; align-items:center; justify-content:center; font-size:0; cursor:pointer; transition:transform .3s,background .2s; box-shadow:0 2px 8px rgba(0,0,0,.12); overflow:hidden; }
.mem-card img { width:100%; height:100%; object-fit:cover; display:none; }
.mem-card.flipped { background:white; font-size:1.6rem; }
.mem-card.flipped img { display:block; }
.mem-card.matched { background:var(--green); opacity:.8; }

/* AHORCADO */
.ahorcado-word { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin:16px 0; }
.ahorcado-letter { width:36px; height:40px; border-bottom:3px solid var(--purple); display:flex; align-items:center; justify-content:center; font-family:'Fredoka One',cursive; font-size:1.4rem; color:var(--purple); }
.ahorcado-keyboard { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin:14px 0; }
.key-btn { width:36px; height:36px; border-radius:8px; border:2px solid var(--purple); background:white; color:var(--purple); font-weight:800; font-size:.9rem; cursor:pointer; transition:all .15s; }
.key-btn:hover { background:var(--purple); color:white; }
.key-btn:disabled { opacity:.3; cursor:default; }
.ahorcado-lives { text-align:center; font-size:1.2rem; margin:8px 0; }
.ahorcado-hint { text-align:center; color:#888; font-size:.85rem; margin-bottom:10px; }

/* PUZZLE */
.puzzle-grid { display:grid; gap:4px; margin:0 auto 16px; width:fit-content; }
.puzzle-piece { width:80px; height:80px; border-radius:8px; border:3px solid white; display:flex; align-items:center; justify-content:center; font-size:1.8rem; cursor:pointer; box-shadow:0 2px 8px rgba(0,0,0,.1); transition:transform .15s; user-select:none; }
.puzzle-piece:hover { transform:scale(1.05); }
.puzzle-piece.selected { border-color:var(--pink); box-shadow:0 0 0 3px var(--pink); }
.puzzle-piece.correct-pos { border-color:var(--green); }

/* COLOR MIXER */
.color-display { width:100px; height:100px; border-radius:50%; margin:16px auto; border:4px solid white; box-shadow:var(--shadow); transition:background .4s; }
.color-btns { display:flex; justify-content:center; gap:10px; flex-wrap:wrap; margin:12px 0; }
.color-mix-btn { width:48px; height:48px; border-radius:50%; border:3px solid white; cursor:pointer; box-shadow:var(--shadow); transition:transform .15s; }
.color-mix-btn:hover { transform:scale(1.15); }
.color-mixer { text-align:center; }

/* ===== CHAT ===== */
.chat-container { background:white; border-radius:var(--radius); padding:16px; height:340px; overflow-y:auto; display:flex; flex-direction:column; gap:12px; box-shadow:var(--shadow); margin-bottom:12px; }
.chat-msg { display:flex; gap:10px; align-items:flex-end; }
.chat-msg.user { flex-direction:row-reverse; }
.chat-avatar { font-size:1.5rem; flex-shrink:0; }
.chat-bubble { background:#f4f0ff; border-radius:18px 18px 18px 4px; padding:10px 14px; font-size:.9rem; max-width:75%; line-height:1.5; }
.chat-msg.user .chat-bubble { background:var(--pink); color:white; border-radius:18px 18px 4px 18px; }
.chat-suggestions { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.suggestion-btn { background:white; border:2px solid var(--purple); color:var(--purple); border-radius:50px; padding:6px 14px; font-size:.8rem; font-weight:700; cursor:pointer; transition:all .15s; }
.suggestion-btn:hover { background:var(--purple); color:white; }
.chat-input-row { display:flex; gap:8px; }
.chat-input { flex:1; padding:12px 16px; border:2px solid #e0d0ff; border-radius:50px; font-family:'Nunito',sans-serif; font-size:.95rem; outline:none; }
.chat-input:focus { border-color:var(--purple); }
.chat-send { width:48px; height:48px; border-radius:50%; background:linear-gradient(135deg,var(--pink),var(--purple)); border:none; color:white; font-size:1.2rem; cursor:pointer; transition:transform .15s; }
.chat-send:hover { transform:scale(1.1); }

/* ===== GALLERY ===== */
.gallery-empty { text-align:center; padding:48px 20px; color:#aaa; }
.empty-icon { font-size:4rem; margin-bottom:12px; }
.gallery-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.gallery-item { border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); }
.gallery-item img { width:100%; display:block; }

/* ===== MEDALS ===== */
.medals-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.medal-card { background:white; border-radius:var(--radius); padding:20px; text-align:center; box-shadow:var(--shadow); transition:transform .2s; }
.medal-card.locked { opacity:.4; filter:grayscale(1); }
.medal-card:not(.locked):hover { transform:scale(1.04); }
.medal-icon { font-size:2.5rem; margin-bottom:8px; }
.medal-name { font-weight:800; font-size:.9rem; margin-bottom:4px; }
.medal-desc { font-size:.75rem; color:#888; }

/* ===== QUIÉNES SOMOS ===== */
.quienes-somos { margin-top:48px; }
.qs-header { display:flex; align-items:center; gap:12px; margin-bottom:24px; }
.qs-line { flex:1; height:2px; background:linear-gradient(90deg,transparent,var(--pink),transparent); }
.qs-title { font-family:'Fredoka One',cursive; font-size:1.5rem; color:var(--purple); white-space:nowrap; }
.qs-cards { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:28px; }
.qs-card { background:white; border-radius:var(--radius); padding:20px 16px; text-align:center; box-shadow:var(--shadow); transition:transform .25s, box-shadow .25s; opacity:0; transform:translateY(30px); }
.qs-card.visible { opacity:1; transform:translateY(0); transition:opacity .6s ease, transform .6s ease; }
.qs-card:hover { transform:translateY(-4px); box-shadow:0 16px 40px rgba(0,0,0,.13); }
.museo-card { border-top:4px solid var(--pink); }
.mision-card { border-top:4px solid var(--purple); }
.vision-card { border-top:4px solid var(--teal); }
.valores-card { border-top:4px solid var(--orange); }
.qs-icon { font-size:2rem; margin-bottom:10px; }
.qs-card h3 { font-family:'Fredoka One',cursive; font-size:1.05rem; color:var(--purple); margin-bottom:8px; }
.qs-card p { font-size:.82rem; color:#666; line-height:1.6; }

/* TEAM */
.team-section { margin-bottom:28px; }
.team-title { font-family:'Fredoka One',cursive; font-size:1.2rem; color:var(--purple); text-align:center; margin-bottom:16px; }
.team-cards { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.team-card { background:white; border-radius:var(--radius); padding:22px 16px; text-align:center; box-shadow:var(--shadow); opacity:0; transform:scale(.9); transition:opacity .6s ease, transform .6s ease; }
.team-card.visible { opacity:1; transform:scale(1); }
.dev-card { background:linear-gradient(135deg,#f4f0ff,#ffe8f5); border:2px solid var(--pink); }
.museo-team-card { background:linear-gradient(135deg,#f0fff8,#e8f5ff); border:2px solid var(--teal); }
.team-avatar { font-size:2.8rem; margin-bottom:10px; }
.team-name { font-family:'Fredoka One',cursive; font-size:1.1rem; color:var(--purple); margin-bottom:4px; }
.team-role { font-size:.8rem; font-weight:800; color:var(--pink); margin-bottom:6px; }
.team-desc { font-size:.78rem; color:#777; margin-bottom:10px; }
.team-badge { display:inline-block; background:var(--purple); color:white; border-radius:50px; padding:4px 12px; font-size:.75rem; font-weight:800; }
.dev-card .team-badge { background:linear-gradient(135deg,var(--pink),var(--purple)); }
.museo-team-card .team-badge { background:linear-gradient(135deg,var(--teal),var(--green)); }

/* FOOTER */
.qs-footer { background:linear-gradient(135deg,var(--purple),#5a3e8e); border-radius:var(--radius); padding:20px; text-align:center; color:white; opacity:0; transform:translateY(20px); transition:opacity .6s ease, transform .6s ease; }
.qs-footer.visible { opacity:1; transform:translateY(0); }
.qs-footer-text { font-size:.85rem; line-height:1.6; margin-bottom:6px; }
.qs-footer-city { font-size:.8rem; opacity:.8; }

/* ===== MASCOTA ===== */
.mascota { position:fixed; bottom:20px; right:16px; z-index:500; display:flex; flex-direction:column; align-items:flex-end; gap:8px; cursor:pointer; }
.mascota-body { font-size:2.5rem; animation:float 3s ease-in-out infinite; filter:drop-shadow(0 4px 12px rgba(255,111,183,.4)); }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.mascota-bubble { background:white; border-radius:16px 16px 0 16px; padding:10px 14px; font-size:.8rem; font-weight:700; box-shadow:var(--shadow); max-width:200px; text-align:right; }

/* SPINNER */
.spinner { display:inline-block; width:32px; height:32px; border:4px solid #f0e0ff; border-top-color:var(--purple); border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* RESPONSIVE */
@media (min-width:600px) {
  .modules-grid { grid-template-columns:repeat(3,1fr); }
  .qs-cards, .team-cards { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:380px) {
  .camera-btn { width:130px; height:130px; }
  .hero-title { font-size:1.6rem; }
  .memoria-grid { grid-template-columns:repeat(4,1fr); }
}
