@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ════════════════════════════════════════════════════
   TOKENS DE DISEÑO — CALMA DIGITAL PURPLE
════════════════════════════════════════════════════ */
:root {
    --bg-color:        #0f0a1e;
    --bg-mid:          #160d2b;
    --card-bg:         rgba(30, 16, 56, 0.72);
    --card-border:     rgba(160, 100, 255, 0.15);
    --text-main:       #f0eaff;
    --text-muted:      #a78ec0;

    --accent:          #9b5de5;
    --accent-light:    #c77dff;
    --accent-dark:     #7b2fe0;
    --accent-glow:     rgba(155, 93, 229, 0.4);

    --gold:            #f4c430;

    --shadow-soft: 0 4px 30px rgba(155, 93, 229, 0.18);
    --shadow-hover: 0 12px 40px rgba(155, 93, 229, 0.35);

    --radius-lg: 32px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --radius-pill: 999px;

    --happy:   #FFCC00;
    --sad:     #5b8dee;
    --angry:   #FF3B30;
    --scared:  #c77dff;
    --wow:     #34C759;
}

/* ════════════════════════════════════════════════════
   RESET BASE
════════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

html { height: 100%; }

body {
    min-height: 100vh;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(155, 93, 229, 0.25) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(199, 125, 255, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(123, 47, 224, 0.1) 0%, transparent 70%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* ════════════════════════════════════════════════════
   FONDO DECORATIVO (Malla sutil)
════════════════════════════════════════════════════ */
.bg-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 15%, rgba(155, 93, 229, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 85% 85%, rgba(199, 125, 255, 0.10) 0%, transparent 50%);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.7;
    animation: orbFloat 8s ease-in-out infinite alternate;
}

.bg-orb-1 {
    width: 500px; height: 500px;
    background: rgba(123, 47, 224, 0.18);
    top: -150px; left: -120px;
    animation-delay: 0s;
}

.bg-orb-2 {
    width: 350px; height: 350px;
    background: rgba(199, 125, 255, 0.14);
    bottom: -80px; right: -80px;
    animation-delay: -3s;
}

.bg-orb-3 {
    width: 280px; height: 280px;
    background: rgba(155, 93, 229, 0.10);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -5s;
}

@keyframes orbFloat {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(20px, -20px) scale(1.05); }
}

.bg-star { display: none; }

/* ════════════════════════════════════════════════════
   LOGO ESCOLAR
════════════════════════════════════════════════════ */
.school-logo {
    position: fixed;
    top: 24px;
    right: 24px;
    height: 54px;
    width: auto;
    z-index: 50;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    opacity: 0.9;
}

/* ════════════════════════════════════════════════════
   CONTENEDOR PRINCIPAL
════════════════════════════════════════════════════ */
.app-container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 460px;
    min-height: 640px;
    max-height: 92vh;

    background: var(--card-bg);
    backdrop-filter: saturate(160%) blur(48px);
    -webkit-backdrop-filter: saturate(160%) blur(48px);

    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow:
        var(--shadow-soft),
        inset 0 1px 0 rgba(199, 125, 255, 0.12);
    overflow: hidden;
}

/* ════════════════════════════════════════════════════
   PANTALLAS
════════════════════════════════════════════════════ */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 28px 28px;
    gap: 14px;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen.hidden {
    opacity: 0;
    transform: scale(0.97);
    pointer-events: none;
    z-index: 0;
}

.screen.active {
    opacity: 1;
    transform: scale(1);
    z-index: 10;
    pointer-events: all;
}

/* ════════════════════════════════════════════════════
   CALMA DIGITAL BANNER
════════════════════════════════════════════════════ */
.calma-digital-banner {
    width: 100%;
    position: relative;
    border-radius: 16px;
    padding: 12px 16px 10px;
    background: linear-gradient(135deg,
        rgba(123, 47, 224, 0.60) 0%,
        rgba(155, 93, 229, 0.50) 50%,
        rgba(199, 125, 255, 0.38) 100%);
    border: 1px solid rgba(199, 125, 255, 0.35);
    box-shadow:
        0 0 0 1px rgba(155, 93, 229, 0.2),
        0 8px 32px rgba(123, 47, 224, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    overflow: hidden;
    animation: bannerAppear 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes bannerAppear {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Shimmer sweep */
.calma-digital-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,0.08) 50%,
        transparent 70%
    );
    background-size: 200% 100%;
    animation: shimmer 3.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%   { background-position: -100% 0; }
    100% { background-position: 200% 0; }
}

.calma-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.calma-particle {
    position: absolute;
    color: rgba(244, 196, 48, 0.6);
    font-size: 0.55rem;
    animation: particleFloat 4s ease-in-out infinite;
}

.calma-particle:nth-child(1) { top: 20%; left: 8%;  animation-delay: 0s; }
.calma-particle:nth-child(2) { top: 60%; left: 50%; animation-delay: -1.5s; }
.calma-particle:nth-child(3) { top: 25%; left: 85%; animation-delay: -2.8s; }

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) scale(1);   opacity: 0.6; }
    50%       { transform: translateY(-6px) scale(1.2); opacity: 1; }
}

.calma-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calma-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%       { transform: scale(1.1) rotate(5deg); }
}

.calma-text-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calma-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fff;
    text-shadow:
        0 0 20px rgba(199, 125, 255, 0.8),
        0 0 40px rgba(155, 93, 229, 0.5);
    line-height: 1;
    background: linear-gradient(90deg, #fff 0%, #e0c3ff 40%, #c77dff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: brightness(1);   }
    to   { filter: brightness(1.15); }
}

.calma-subtitle {
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(224, 195, 255, 0.8);
    line-height: 1;
}

.calma-sound-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(199, 125, 255, 0.4);
    background: rgba(155, 93, 229, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s;
    font-size: 1.1rem;
}

.calma-sound-btn:hover {
    background: rgba(155, 93, 229, 0.5);
    border-color: rgba(199, 125, 255, 0.7);
    transform: scale(1.1);
    box-shadow: 0 0 16px rgba(155, 93, 229, 0.6);
}

.calma-sound-btn.speaking {
    animation: speakPulse 0.6s ease-in-out infinite alternate;
}

@keyframes speakPulse {
    from { box-shadow: 0 0 8px rgba(155, 93, 229, 0.5);  transform: scale(1); }
    to   { box-shadow: 0 0 24px rgba(199, 125, 255, 0.9); transform: scale(1.12); }
}

/* ════════════════════════════════════════════════════
   PANTALLA INICIO
════════════════════════════════════════════════════ */
.school-header {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.school-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(155, 93, 229, 0.12);
    border: 1px solid rgba(155, 93, 229, 0.2);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
}

.school-badge-icon {
    font-size: 1rem;
    opacity: 0.85;
}

.school-name-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.school-location-text {
    display: none;
}

.hero-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2px 0;
}

.hero-glow { display: none; }

.chasqui-img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow:
        var(--shadow-soft),
        0 0 0 3px rgba(155, 93, 229, 0.25),
        0 0 20px rgba(155, 93, 229, 0.3);
    border: 2px solid rgba(199, 125, 255, 0.3);
}

.main-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.title-highlight {
    background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.input-wrap {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.input-icon { display: none; }

#player-name {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(155, 93, 229, 0.08);
    border: 1px solid rgba(155, 93, 229, 0.2);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
    text-align: center;
}

#player-name::placeholder { color: var(--text-muted); }

#player-name:focus {
    background: rgba(155, 93, 229, 0.14);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.2);
}

#player-name.incorrect {
    animation: shake 0.4s;
    background: rgba(255, 59, 48, 0.08);
    border-color: var(--angry);
}

.btn-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.btn-jugar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 60%, var(--accent-light) 100%);
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 20px rgba(155, 93, 229, 0.45);
    letter-spacing: 0.5px;
}

.btn-jugar:hover {
    transform: scale(1.03) translateY(-2px);
    box-shadow: 0 8px 30px rgba(155, 93, 229, 0.6);
}

.btn-jugar:active {
    transform: scale(0.98);
}

.btn-jugar-icon { display: none; }

.btn-saludos-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    text-decoration: none;
    border-radius: var(--radius-pill);
    background: rgba(155, 93, 229, 0.1);
    border: 1px solid rgba(155, 93, 229, 0.2);
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
}

.btn-saludos-link:hover {
    background: rgba(155, 93, 229, 0.2);
    border-color: rgba(155, 93, 229, 0.4);
}

/* Botones de nav principal eliminados — reemplazados por btn-main */
.btn-saludos-icon, .btn-saludos-sub, .btn-saludos-arrow { display: none; }
.btn-saludos-label { font-size: 1rem; }

/* ════════════════════════════════════════════════════
   BOTONES PRINCIPALES DE INICIO
════════════════════════════════════════════════════ */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-main {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid rgba(199, 125, 255, 0.25);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2,0.8,0.2,1);
    background: rgba(155, 93, 229, 0.1);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.btn-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(199,125,255,0.06) 100%);
    opacity: 0;
    transition: opacity 0.25s;
}

.btn-main:hover {
    background: rgba(155, 93, 229, 0.22);
    border-color: rgba(199, 125, 255, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(155, 93, 229, 0.3);
}

.btn-main:hover::before { opacity: 1; }
.btn-main:active { transform: scale(0.98); }

.btn-herramientas {
    background: linear-gradient(135deg,
        rgba(123, 47, 224, 0.22) 0%,
        rgba(155, 93, 229, 0.12) 100%);
}

.btn-sonidos {
    background: linear-gradient(135deg,
        rgba(29, 209, 161, 0.14) 0%,
        rgba(155, 93, 229, 0.08) 100%);
    border-color: rgba(29, 209, 161, 0.25);
}

.btn-sonidos:hover {
    border-color: rgba(29, 209, 161, 0.5);
    box-shadow: 0 8px 28px rgba(29, 209, 161, 0.2);
}

.btn-main-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.btn-main-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-main-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.2px;
}

.btn-main-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.btn-main-arrow {
    font-size: 1.6rem;
    color: var(--accent-light);
    line-height: 1;
    opacity: 0.7;
    transition: transform 0.2s;
}

.btn-main:hover .btn-main-arrow { transform: translateX(4px); }

/* ════════════════════════════════════════════════════
   INPUT NOMBRE
════════════════════════════════════════════════════ */
.input-wrap {
    position: relative;
    width: 100%;
}

.input-emoji {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
}

#player-name {
    width: 100%;
    padding: 13px 14px 13px 40px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    background: rgba(155, 93, 229, 0.08);
    border: 1px solid rgba(155, 93, 229, 0.2);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
}

#player-name::placeholder { color: var(--text-muted); }

#player-name:focus {
    background: rgba(155, 93, 229, 0.14);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.2);
}

#player-name.incorrect {
    animation: shake 0.4s;
    border-color: var(--angry);
    background: rgba(255, 59, 48, 0.08);
}



/* ════════════════════════════════════════════════════
   TOP BAR — TODAS LAS PANTALLAS INTERNAS
════════════════════════════════════════════════════ */
.top-bar {
    position: absolute;
    top: 20px; left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}

.btn-icon {
    background: rgba(155, 93, 229, 0.12);
    color: var(--text-main);
    border: 1px solid rgba(155, 93, 229, 0.2);
    font-size: 1.2rem;
    width: 44px; height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(155, 93, 229, 0.28);
    border-color: rgba(155, 93, 229, 0.45);
    transform: scale(1.1) rotate(5deg);
}

.screen-badge {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    box-shadow: 0 4px 12px rgba(155, 93, 229, 0.3);
}

/* ════════════════════════════════════════════════════
   SALUDO PERSONALIZADO
════════════════════════════════════════════════════ */
.personal-greeting {
    margin-top: 70px;
    text-align: center;
    animation: fadeSlideIn 0.5s ease both;
    margin-bottom: 20px;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

.greeting-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.greeting-name {
    background: linear-gradient(90deg, #ff9ff3 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.greeting-sub {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ════════════════════════════════════════════════════
   GRID DE HERRAMIENTAS
════════════════════════════════════════════════════ */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    padding: 0 10px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 14px;
    background: linear-gradient(135deg, rgba(155, 93, 229, 0.15), rgba(155, 93, 229, 0.05));
    border: 2px solid rgba(199, 125, 255, 0.3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-main);
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.tool-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tool-card:hover {
    background: linear-gradient(135deg, rgba(155, 93, 229, 0.25), rgba(155, 93, 229, 0.15));
    border-color: #ff9ff3;
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 28px rgba(155, 93, 229, 0.4);
}

.tool-card:hover::after { opacity: 1; }
.tool-card:active { transform: scale(0.95); }

.tool-custom-icon {
    width: 6rem;
    height: 6rem;
    object-fit: contain;
    animation: iconPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.tool-emoji {
    font-size: 3rem;
    line-height: 1;
    animation: iconPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.tool-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
}

.tool-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ════════════════════════════════════════════════════
   PANEL DE HERRAMIENTA ACTIVA
════════════════════════════════════════════════════ */
.tool-panel {
    position: fixed; /* Antes absolute, ahora fixed para abarcar toda la pantalla */
    inset: 0;
    z-index: 9999; /* Asegurar que cubra todo */
    background: rgba(15, 10, 30, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px; /* Reducido para móviles */
    gap: 20px;
    animation: fadeSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tool-panel.hidden { display: none; }

.tool-panel-inner {
    width: 100%;
    max-width: 900px; /* Límite para escritorio, en móviles será 100% */
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(199, 125, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    overflow-y: auto; /* Por si el contenido excede la pantalla */
}

.tool-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tool-intro {
    font-size: 1rem;
    color: #e0e0e0;
    text-align: center;
    font-weight: 500;
}

.btn-tool-action {
    padding: 14px 32px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #1dd1a1, #0fb9b1);
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 20px rgba(29, 209, 161, 0.4);
}

.btn-tool-action:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 28px rgba(29, 209, 161, 0.6);
}

.btn-close-tool {
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 59, 48, 0.8);
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.btn-close-tool:hover {
    background: #ff3b30;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 59, 48, 0.5);
}

/* ── Respiración ── */
.breath-tool { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.breath-ring-wrap {
    position: relative;
    width: 160px; height: 160px;
    display: flex; align-items: center; justify-content: center;
    margin: 10px 0;
}

.breath-ring {
    width: 130px; height: 130px;
    border-radius: 50%;
    border: 6px solid #54a0ff;
    display: flex; align-items: center; justify-content: center;
    transition: all 4s ease-in-out;
    box-shadow: 0 0 20px rgba(84, 160, 255, 0.5);
    background: rgba(84, 160, 255, 0.1);
}

.breath-ring.expand {
    transform: scale(1.5);
    border-color: #1dd1a1;
    background: rgba(29, 209, 161, 0.1);
    box-shadow: 0 0 0 20px rgba(29, 209, 161, 0.2), 0 0 40px rgba(29, 209, 161, 0.5);
}

.breath-ring.hold {
    transform: scale(1.5);
    border-color: #feca57;
    background: rgba(254, 202, 87, 0.1);
    box-shadow: 0 0 30px rgba(254, 202, 87, 0.5);
    transition: all 0.5s;
}

.breath-ring.shrink {
    transform: scale(1);
    border-color: #54a0ff;
    background: rgba(84, 160, 255, 0.1);
    box-shadow: 0 0 20px rgba(84, 160, 255, 0.5);
    transition: all 4s ease-in-out;
}

.breath-ring.rest {
    transform: scale(1);
    transition: all 0.5s;
}

.breath-label {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.breath-instruction {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
}

/* ── Afirmación ── */
.afirmacion-tool { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; }

.afirmacion-card {
    width: 100%;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(254, 202, 87, 0.3), rgba(255, 159, 243, 0.3));
    border: 2px solid #feca57;
    border-radius: var(--radius-lg);
    text-align: center;
    min-height: 120px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(254, 202, 87, 0.3);
}

.afirmacion-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.4;
    transition: opacity 0.25s;
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ── Mariposa Abrazo ── */
.abrazo-tool { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.mariposa-visual {
    background: rgba(255, 159, 243, 0.15);
    border: 2px solid #ff9ff3;
    border-radius: var(--radius-lg);
    padding: 16px;
    font-size: 0.9rem;
    color: #fff;
    line-height: 1.8;
    text-align: center;
    width: 100%;
    font-weight: 500;
}

.mariposa-body { font-size: 3rem; margin-bottom: 8px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }

.mariposa-anim {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 2.5rem;
    margin: 10px 0;
}

.ala { transition: transform 0.35s ease; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.corazon-center { font-size: 2.2rem; animation: iconPulse 1.4s ease-in-out infinite; filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.6)); }

.mariposa-anim.beat-left  .ala-izq { transform: rotate(-40deg) scale(1.1); }
.mariposa-anim.beat-right .ala-der { transform: rotate(40deg) scale(1.1); }

/* ── Dibujo Libre ── */
.dibujo-tool { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; height: 100%; min-height: 50vh; }

#dibujo-canvas {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1), 0 4px 12px rgba(155, 93, 229, 0.2);
    cursor: crosshair;
    border: 3px solid rgba(199, 125, 255, 0.6);
    touch-action: none; /* Prevenir scroll en móviles al dibujar */
    width: 100%;
    height: 100%;
    display: block;
}

.pizarra-container {
    width: 100%;
    flex: 1; /* Ocupa el espacio restante */
    display: flex;
    justify-content: center;
    align-items: stretch; /* Estira el canvas para ocupar la altura */
    min-height: 300px;
}

.tool-icons, .shape-icons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.tool-btn, .shape-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid rgba(199, 125, 255, 0.4);
    background: #fff;
    font-size: 1.5rem; /* Tamaño grande para el emoji */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.tool-btn.active, .shape-btn.active {
    background: rgba(199, 125, 255, 0.2);
    border-color: rgba(155, 93, 229, 0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(155, 93, 229, 0.3);
}

.tool-btn:hover, .shape-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.dibujo-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 8px;
}

.color-picker {
    width: 44px; height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-picker:hover { transform: scale(1.1); }

.size-slider {
    flex: 1;
    max-width: 120px;
    accent-color: var(--accent);
    cursor: pointer;
}

.btn-sm { padding: 10px 20px; font-size: 0.95rem; }

/* ════════════════════════════════════════════════════
   GRID DE SONIDOS
════════════════════════════════════════════════════ */
.sounds-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    padding: 0 10px;
}

.sound-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 10px;
    background: linear-gradient(135deg, rgba(29, 209, 161, 0.15), rgba(29, 209, 161, 0.05));
    border: 2px solid rgba(29, 209, 161, 0.3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-main);
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.sound-card:hover {
    background: linear-gradient(135deg, rgba(29, 209, 161, 0.25), rgba(29, 209, 161, 0.15));
    border-color: #1dd1a1;
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 28px rgba(29, 209, 161, 0.3);
}

.sound-card.playing {
    background: linear-gradient(135deg, rgba(254, 202, 87, 0.3), rgba(254, 202, 87, 0.15));
    border-color: #feca57;
    box-shadow: 0 0 0 4px rgba(254, 202, 87, 0.3), 0 10px 30px rgba(254, 202, 87, 0.4);
    transform: scale(1.05);
}

.sound-emoji {
    font-size: 2.8rem;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.sound-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    font-family: 'Outfit', sans-serif;
}

.sound-wave {
    font-size: 1.1rem;
    color: var(--accent-light);
    margin-top: 4px;
}
.sound-card.playing .sound-wave {
    color: #feca57;
    animation: iconPulse 1s ease-in-out infinite;
}

/* ── Now Playing Bar ── */
.now-playing {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(90deg, rgba(155, 93, 229, 0.25), rgba(84, 160, 255, 0.25));
    border: 2px solid rgba(199, 125, 255, 0.4);
    border-radius: var(--radius-pill);
    animation: fadeSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    margin-top: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.now-playing.hidden { display: none; }

.now-playing-anim {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
}

.now-playing-anim span {
    display: inline-block;
    width: 4px;
    background: #1dd1a1;
    border-radius: 2px;
    animation: soundBar 0.8s ease-in-out infinite alternate;
}

.now-playing-anim span:nth-child(1) { height: 10px;  animation-delay: 0s; }
.now-playing-anim span:nth-child(2) { height: 20px; animation-delay: 0.15s; }
.now-playing-anim span:nth-child(3) { height: 14px; animation-delay: 0.3s; }
.now-playing-anim span:nth-child(4) { height: 24px; animation-delay: 0.45s; }

@keyframes soundBar {
    from { transform: scaleY(0.4); opacity: 0.6; }
    to   { transform: scaleY(1);   opacity: 1; }
}

#now-playing-label {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Outfit', sans-serif;
}

.btn-stop-sound {
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    background: #ff6b6b;
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.btn-stop-sound:hover {
    background: #ff4757;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.6);
}

/* Logo escolar */
.school-logo {
    position: fixed;
    top: 24px; right: 24px;
    height: 54px; width: auto;
    z-index: 50;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    opacity: 0.9;
    filter: drop-shadow(0 0 10px rgba(155, 93, 229, 0.3));
}

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