/* ============================================================
   Tutorial Guide — Mascot, Speech Bubbles, Help Buttons
   ============================================================ */

/* ── MASCOT ── */
.mascot-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.mascot-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.mascot-container {
    display: flex;
    align-items: flex-end;
    gap: 0;
    max-width: 520px;
    width: 95%;
    margin-bottom: 20px;
    transform: translateY(120%);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mascot-overlay.active .mascot-container {
    transform: translateY(0);
}

.mascot-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.4));
    animation: mascotBounce 2s ease-in-out infinite;
    margin-bottom: -8px;
}

@keyframes mascotBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes tutorialGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)) drop-shadow(0 0 50px rgba(255, 215, 0, 0.7)) brightness(1.3);
        transform: scale(1.15);
    }

    50% {
        filter: drop-shadow(0 0 40px rgba(255, 215, 0, 1)) drop-shadow(0 0 70px rgba(255, 215, 0, 0.9)) brightness(1.5);
        transform: scale(1.22);
    }
}

/* ── SPEECH BUBBLE ── */
.speech-bubble {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 255, 0.95));
    border-radius: 20px 20px 20px 4px;
    padding: 18px 22px;
    color: #1a1a2e;
    font-size: 0.92rem;
    line-height: 1.6;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(108, 92, 231, 0.3);
    flex: 1;
    min-height: 80px;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: 16px;
    left: -12px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: rgba(255, 255, 255, 0.95);
    border-left: 0;
}

.speech-title {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #6c5ce7, #e74c3c);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.speech-text {
    font-weight: 500;
    color: #333;
    min-height: 36px;
}

.speech-text .typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #6c5ce7;
    margin-left: 2px;
    animation: cursorBlink 0.8s infinite;
    vertical-align: text-bottom;
}

@keyframes cursorBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.speech-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    justify-content: flex-end;
}

.speech-actions button {
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.speech-btn-next {
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
    color: white;
    box-shadow: 0 3px 12px rgba(108, 92, 231, 0.3);
}

.speech-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(108, 92, 231, 0.4);
}

.speech-btn-skip {
    background: rgba(0, 0, 0, 0.08);
    color: #666;
}

.speech-btn-skip:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* Step dots */
.speech-steps {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
}

.speech-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.2);
    transition: all 0.3s;
}

.speech-step-dot.active {
    background: #6c5ce7;
    width: 24px;
    border-radius: 4px;
}

.speech-step-dot.done {
    background: #2ecc71;
}

/* ── HELP BUTTON ── */
.area-help-btn {
    position: fixed;
    top: 70px;
    left: 16px;
    z-index: 900;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.3);
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.5);
    animation: helpPulse 2.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.area-help-btn:hover {
    transform: scale(1.15);
    animation: none;
}

@keyframes helpPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(108, 92, 231, 0.5);
    }

    50% {
        box-shadow: 0 4px 30px rgba(108, 92, 231, 0.8), 0 0 0 8px rgba(108, 92, 231, 0.15);
    }
}

/* ── HELP MODAL ── */
.help-modal-content {
    max-height: 70vh;
    overflow-y: auto;
}

.help-section {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
}

.help-section-title {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section-text {
    font-size: 0.82rem;
    line-height: 1.6;
    opacity: 0.8;
}

.help-mascot-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(168, 85, 247, 0.05));
    border-radius: 14px;
    border: 1.5px solid rgba(108, 92, 231, 0.2);
    margin-bottom: 14px;
}

.help-mascot-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── AREA UNLOCK CELEBRATION ── */
.unlock-celebration {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.unlock-celebration.active {
    opacity: 1;
    pointer-events: all;
}

.unlock-card {
    text-align: center;
    padding: 28px 36px;
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 50, 0.98));
    border-radius: 24px;
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.15);
    transform: scale(0.7);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 340px;
}

.unlock-celebration.active .unlock-card {
    transform: scale(1);
}

.unlock-icon {
    font-size: 4rem;
    margin-bottom: 8px;
    animation: unlockBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes unlockBounce {
    0% {
        transform: scale(0) rotate(-20deg);
    }

    60% {
        transform: scale(1.2) rotate(5deg);
    }

    100% {
        transform: scale(1) rotate(0);
    }
}

.unlock-title {
    font-weight: 900;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.unlock-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
}

.unlock-mascot {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 8px auto;
    animation: mascotBounce 1.5s ease-in-out infinite;
}

/* ── CONFETTI PARTICLES ── */
.confetti-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    z-index: 10002;
    pointer-events: none;
    animation: confettiFall var(--duration, 3s) linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ── FIRST-TIME AREA INTRO ── */
.area-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.area-intro-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.area-intro-card {
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 50, 0.98));
    border-radius: 20px;
    border: 2px solid rgba(108, 92, 231, 0.3);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    color: #fff;
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.area-intro-card div {
    color: #fff;
}

.area-intro-overlay.active .area-intro-card {
    transform: translateY(0);
}