/* ============================================
   PARAPOWER - LEVEL SELECTION PAGE
   Modern UI with 3D Cards and Animations
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    touch-action: manipulation;
}

body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #ffffff;
    position: relative;
}

/* ============================================
   CONTAINER
   ============================================ */

.level-select-container {
    min-height: 100vh;
    width: 100%;
    position: relative;
    padding: clamp(1rem, 5vw, 2rem) clamp(0.5rem, 5vw, 1rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Background Animation */
.level-select-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(79, 195, 247, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 167, 38, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(239, 83, 80, 0.1) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
    animation: background-pulse 8s ease-in-out infinite;
}

@keyframes background-pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* ============================================
   HEADER
   ============================================ */

.level-header {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: clamp(1.5rem, 5vw, 2rem);
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: clamp(0.5rem, 2vw, 0.6rem) clamp(1rem, 4vw, 1.2rem);
    color: #ffffff;
    font-size: clamp(0.9rem, 3vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.back-icon {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    line-height: 1;
}

.page-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    font-weight: bold;
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: calc(100% - 200px);
    padding: 0 1rem;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    pointer-events: none;
    box-sizing: border-box;
}

/* ============================================
   INFO SECTION
   ============================================ */

.info-section {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 800px;
    margin-bottom: clamp(1.5rem, 5vw, 3rem);
}

.info-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: clamp(1.5rem, 5vw, 2rem);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 215, 0, 0.4);
}

.info-icon {
    font-size: clamp(2rem, 8vw, 3rem);
    margin-bottom: 1rem;
    animation: bounce-icon 2s ease-in-out infinite;
}

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

.info-text {
    font-size: clamp(1rem, 4vw, 1.2rem);
    font-weight: 600;
    color: #ffffff;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.info-subtext {
    font-size: clamp(0.85rem, 3vw, 0.95rem);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* ============================================
   DIFFICULTY CARDS
   ============================================ */

.difficulty-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1.5rem, 4vw, 2rem);
    padding: 0 1rem;
}

.difficulty-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: clamp(1.5rem, 5vw, 2rem);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.difficulty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.difficulty-card:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.difficulty-card:hover::before {
    opacity: 1;
}

.difficulty-card:active {
    transform: translateY(-5px) rotateX(2deg);
}

/* Card Glow Effect */
.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    filter: blur(30px);
}

.difficulty-card:hover .card-glow {
    opacity: 0.6;
    animation: glow-rotate 3s linear infinite;
}

@keyframes glow-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.easy-glow {
    background: radial-gradient(circle, rgba(79, 195, 247, 0.4), transparent);
}

.normal-glow {
    background: radial-gradient(circle, rgba(255, 167, 38, 0.4), transparent);
}

.hard-glow {
    background: radial-gradient(circle, rgba(239, 83, 80, 0.4), transparent);
}

/* Easy Card */
.easy-card {
    border-color: rgba(79, 195, 247, 0.3);
}

.easy-card:hover {
    border-color: rgba(79, 195, 247, 0.6);
    box-shadow: 0 20px 60px rgba(79, 195, 247, 0.3);
}

/* Normal Card */
.normal-card {
    border-color: rgba(255, 167, 38, 0.3);
}

.normal-card:hover {
    border-color: rgba(255, 167, 38, 0.6);
    box-shadow: 0 20px 60px rgba(255, 167, 38, 0.3);
}

/* Hard Card */
.hard-card {
    border-color: rgba(239, 83, 80, 0.3);
}

.hard-card:hover {
    border-color: rgba(239, 83, 80, 0.6);
    box-shadow: 0 20px 60px rgba(239, 83, 80, 0.3);
}

/* Card Header */
.card-header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.difficulty-icon {
    font-size: clamp(2.5rem, 8vw, 3rem);
    margin-bottom: 0.5rem;
    display: inline-block;
    animation: icon-bounce 2s ease-in-out infinite;
}

.easy-icon {
    filter: drop-shadow(0 0 10px rgba(79, 195, 247, 0.6));
}

.normal-icon {
    filter: drop-shadow(0 0 10px rgba(255, 167, 38, 0.6));
}

.hard-icon {
    filter: drop-shadow(0 0 10px rgba(239, 83, 80, 0.6));
}

@keyframes icon-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

.difficulty-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.easy-card .difficulty-title {
    color: #4fc3f7;
}

.normal-card .difficulty-title {
    color: #ffa726;
}

.hard-card .difficulty-title {
    color: #ef5350;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.easy-badge {
    background: rgba(79, 195, 247, 0.2);
    color: #4fc3f7;
    border: 1px solid rgba(79, 195, 247, 0.4);
}

.normal-badge {
    background: rgba(255, 167, 38, 0.2);
    color: #ffa726;
    border: 1px solid rgba(255, 167, 38, 0.4);
}

.hard-badge {
    background: rgba(239, 83, 80, 0.2);
    color: #ef5350;
    border: 1px solid rgba(239, 83, 80, 0.4);
}

/* Card Body */
.card-body {
    position: relative;
    z-index: 2;
    margin-bottom: 1.5rem;
}

.difficulty-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: clamp(0.75rem, 3vw, 1rem);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.difficulty-card:hover .stat-item {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.stat-label {
    font-size: clamp(0.65rem, 2vw, 0.75rem);
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    font-weight: bold;
    color: #ffffff;
}

.difficulty-description {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(0.85rem, 3vw, 0.95rem);
    line-height: 1.6;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

/* Card Footer */
.card-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.play-btn {
    display: inline-block;
    padding: clamp(0.7rem, 2.5vw, 0.8rem) clamp(1.5rem, 5vw, 2rem);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    font-weight: 600;
    font-size: clamp(0.9rem, 3vw, 1rem);
    color: #ffffff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.difficulty-card:hover .play-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.easy-card:hover .play-btn {
    box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
}

.normal-card:hover .play-btn {
    box-shadow: 0 4px 15px rgba(255, 167, 38, 0.4);
}

.hard-card:hover .play-btn {
    box-shadow: 0 4px 15px rgba(239, 83, 80, 0.4);
}

/* ============================================
   CHARACTER ANIMATIONS (from main.js)
   ============================================ */

.chara-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.character {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    position: absolute;
    animation: animate-character 8s linear;
    opacity: 0.3;
}

.character-1 {
    background-image: url("../images/characters/chara01.png");
}

.character-2 {
    background-image: url("../images/characters/chara03.png");
}

.character-3 {
    background-image: url("../images/characters/chara04.png");
}

@keyframes animate-character {
    0% {
        opacity: 0;
        top: 0;
        transform: rotate(0);
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        top: 100vh;
        transform: rotate(1080deg);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .difficulty-container {
        grid-template-columns: 1fr;
    }

    .level-header {
        padding: 0 0.5rem;
        min-height: 60px;
    }

    .page-title {
        width: calc(100% - 120px);
        max-width: none;
        padding: 0 0.5rem;
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }

    .back-btn {
        position: relative;
        z-index: 11;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .level-header {
        padding: 0 0.25rem;
        min-height: 55px;
    }

    .page-title {
        width: calc(100% - 100px);
        padding: 0 0.25rem;
        font-size: clamp(1rem, 4.5vw, 1.5rem);
    }

    .back-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .back-text {
        display: none;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.difficulty-card:focus {
    outline: 3px solid rgba(255, 215, 0, 0.6);
    outline-offset: 3px;
}

/* Keyboard navigation */
.difficulty-card:focus-visible {
    outline: 3px solid rgba(255, 215, 0, 0.8);
    outline-offset: 5px;
}