/* Onboarding Overlay Styles */

#onboarding-container,
#training-method-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    z-index: 200000; /* Ensure it covers everything including header (100000) */
    background: #0f172a;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden; /* Prevent container scroll */
}

#onboarding-container *,
#training-method-popup * {
    box-sizing: border-box;
}

/* ... (middle content same) ... */

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .onboarding-slide {
        padding: 1rem;
        justify-content: center; /* Ensure vertical centering */
    }

    .slide-icon-wrapper {
        width: 64px;
        height: 64px;
        margin-bottom: 1rem;
    }

    .slide-icon {
        width: 28px !important;
        height: 28px !important;
    }

    .slide-title {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .slide-description {
        font-size: 0.9rem;
        line-height: 1.5;
        max-width: 100%;
    }

    .slide-nav-btn {
        width: auto; /* Don't force full width */
        min-width: 200px; /* But keep it touch-friendly */
        max-width: 100%; /* Prevent overflow */
        justify-content: center;
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }
}

#onboarding-container.visible,
#training-method-popup.visible {
    display: flex;
    opacity: 1;
}

/* Slide Close Button (Popup only) */
.slide-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
    pointer-events: auto;
}

.slide-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.slide-close-btn i {
    width: 24px;
    height: 24px;
    color: white;
}

/* Popup Main Title */
.popup-main-title {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: none;
    font-family: 'Noto Sans JP', sans-serif;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

/* Slide Container */
.onboarding-slide {
    width: 100%;
    height: 100%;
    /* Deep, rich background */
    background: radial-gradient(circle at top right, #2d1b69, #1a1a2e);
    padding: 2rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 15vh;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: scale(0.95);
}

.onboarding-slide.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 2;
}

/* Background Image Layer */
.onboarding-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.85;
    filter: brightness(1.1);
    transition: transform 10s ease;
    z-index: 0;
}

/* Gradient Overlay for Readability */
.onboarding-slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(15, 23, 42, 0.1) 0%, 
        rgba(15, 23, 42, 0.6) 60%, 
        rgba(15, 23, 42, 0.8) 100%);
    z-index: 0;
}

/* Slide Specific Backgrounds */
.slide-bg-1::before {
    /* Piano / Abstract */
    background-image: url('https://images.unsplash.com/photo-1520523839897-bd0b52f945a0?q=80&w=2070&auto=format&fit=crop');
    opacity: 0.85;
    filter: brightness(1.2);
}
.slide-bg-2::before {
    /* Connection / Network */
    background-image: url('https://images.unsplash.com/photo-1529156069898-49953e39b3ac?q=80&w=2076&auto=format&fit=crop');
}
.slide-bg-3::before {
    /* Focus / Abstract */
    background-image: url('https://images.unsplash.com/photo-1519834785169-98be25ec3f84?q=80&w=2664&auto=format&fit=crop');
}
.slide-bg-4::before {
    /* Space / Launch */
    background-image: url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?q=80&w=2072&auto=format&fit=crop');
}

.slide-icon-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(129, 140, 248, 0.4);
    position: relative;
    z-index: 1;
    animation: float 6s ease-in-out infinite;
    backdrop-filter: blur(3px);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.slide-icon {
    color: #ffffff;
    filter: drop-shadow(0 0 15px rgba(165, 180, 252, 0.8));
    width: 48px;
    height: 48px;
}

.slide-title {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.slide-description {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    max-width: 480px;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* 下部固定エリア（ドット+ボタン） */
.slide-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.slide-dots {
    display: flex;
    gap: 10px;
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot.active {
    width: 24px;
    border-radius: 4px;
    background: #818cf8;
    box-shadow: 0 0 15px rgba(129, 140, 248, 0.5);
}

.slide-nav-btn {
    padding: 1rem 2.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Noto Sans JP', sans-serif;
}

.slide-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.5);
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
}

.slide-nav-btn.start-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4);
}

.slide-nav-btn.start-btn:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

.slide-nav-btn i {
    width: 18px;
    height: 18px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .onboarding-slide {
        padding: 2rem 1.5rem;
        padding-top: 10vh;
    }

    .slide-icon-wrapper {
        width: 80px;
        height: 80px;
        margin-bottom: 1.5rem;
    }

    .slide-icon {
        width: 32px !important;
        height: 32px !important;
    }

    .slide-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .slide-description {
        font-size: 1rem;
        line-height: 1.6;
    }

    .slide-bottom {
        padding-bottom: 1.5rem;
    }

    .slide-nav-btn {
        width: 100%;
        justify-content: center;
        padding: 0.9rem;
    }
}

/* --- Mode Guide Buttons (上行・下行とは / 使い方と目標) --- */

.mode-selection-desc-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.mode-guide-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px 14px;
    color: var(--white-70, rgba(255, 255, 255, 0.7));
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.mode-guide-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white-90, rgba(255, 255, 255, 0.9));
}

.mode-guide-btn i {
    width: 14px;
    height: 14px;
}
