* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    overflow: hidden;
    width: 1200px;
    height: 1024px;
    margin: 0 auto;
    position: relative;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.starfield-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Menu Styles */
.menu-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.game-title {
    font-size: 48px;
    margin-bottom: 40px;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.menu-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: 1100px;
}

.menu-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.menu-video-container {
    width: 512px;
    height: 912px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.menu-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.level-selection {
    width: 100%;
    max-width: 700px;
}

.level-selection h2 {
    font-size: 24px;
    margin-bottom: 15px;
    text-align: center;
    color: #e0e0e0;
}

.level-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
    padding: 15px;
}

.level-card {
    aspect-ratio: 1;
    min-height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    padding: 10px;
}

.level-card:hover:not(.locked) {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
}

.level-card.locked {
    background: linear-gradient(135deg, #333 0%, #222 100%);
    cursor: not-allowed;
    opacity: 0.5;
    border-color: rgba(255, 255, 255, 0.1);
}

.level-card.completed {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.level-card-number {
    font-size: 42px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.level-card-status {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 28px;
}

.powerup-info-card {
    width: 100%;
    max-width: 700px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 10px;
    padding: 12px;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.powerup-info-card h2 {
    font-size: 16px;
    margin-bottom: 8px;
    text-align: center;
    color: #e0e0e0;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.powerup-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.powerup-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.powerup-info-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.powerup-info-icon {
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

.powerup-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.powerup-info-text strong {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.powerup-info-text span {
    color: rgba(224, 224, 224, 0.7);
    font-size: 10px;
}

/* Game Screen Styles */
.game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px 15px 30px;
    background: rgba(20, 20, 20, 0.9);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    overflow: visible;
    position: relative;
    z-index: 100;
}

.game-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    min-width: 0;
}

.lives-display, .level-display {
    font-size: 18px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.powerup-display {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.2);
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.powerup-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.powerup-label {
    font-weight: bold;
    color: #e0e0e0;
    font-size: 11px;
    white-space: nowrap;
}

.powerup-key {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 2px;
    flex-shrink: 0;
}

/* Powerup Collection Animation Styles */
.powerup-collection-effect {
    position: fixed;
    font-size: 40px;
    z-index: 2000;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.8));
    transition: all 0.3s ease-out;
}

.powerup-collection-effect.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
    animation: powerupCollectionPulse 0.5s ease-out forwards;
}

@keyframes powerupCollectionPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

.powerup-flying-icon {
    position: fixed;
    font-size: 32px;
    z-index: 2001;
    pointer-events: none;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 15px rgba(102, 126, 234, 1)) drop-shadow(0 0 30px rgba(102, 126, 234, 0.6));
    animation: powerupFlyingGlow 0.6s ease-in-out infinite alternate;
    opacity: 1;
}

@keyframes powerupFlyingGlow {
    0% {
        filter: drop-shadow(0 0 15px rgba(102, 126, 234, 1)) drop-shadow(0 0 30px rgba(102, 126, 234, 0.6));
    }
    100% {
        filter: drop-shadow(0 0 25px rgba(102, 126, 234, 1)) drop-shadow(0 0 50px rgba(102, 126, 234, 0.8));
    }
}

.powerup-indicator-highlight {
    animation: powerupIndicatorHighlight 0.5s ease-out;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 40px rgba(102, 126, 234, 0.4) !important;
    border-color: rgba(102, 126, 234, 1) !important;
    background: rgba(102, 126, 234, 0.4) !important;
}

@keyframes powerupIndicatorHighlight {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

.powerup-indicator-enter {
    animation: powerupIndicatorEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes powerupIndicatorEnter {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    60% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.progress-container {
    width: 250px;
    flex-shrink: 1;
    min-width: 200px;
    overflow: visible;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    position: relative;
    overflow: visible;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71 0%, #27ae60 100%);
    border-radius: 15px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.progress-star {
    position: absolute;
    top: -8px;
    transform: translateX(-50%);
    font-size: 24px;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.5s ease;
    pointer-events: none;
    z-index: 10;
    overflow: visible;
    line-height: 1;
}

.progress-star.reached {
    filter: grayscale(0%);
    opacity: 1;
    transform: translateX(-50%) scale(1.5);
    animation: starPulse 0.6s ease;
}

@keyframes starPulse {
    0% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.8);
    }
    100% {
        transform: translateX(-50%) scale(1.5);
    }
}

.life-gain-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    color: #2ecc71;
    text-shadow: 0 0 30px #2ecc71, 0 0 60px #2ecc71;
    z-index: 2000;
    pointer-events: none;
    animation: lifeGain 2s ease-out forwards;
}

@keyframes lifeGain {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.game-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    width: 512px;
    height: 100%;
    position: relative;
    background: #000;
    overflow: hidden;
}

.game-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.stones-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.right-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f0f0f;
    position: relative;
    overflow: hidden;
}

.game-canvas {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

/* Button Styles */
.btn-primary, .btn-secondary, .btn-icon {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    padding: 10px 15px;
    font-size: 24px;
    border-radius: 5px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

/* Level Complete Modal - 90% of screen */
#levelCompleteModal .modal-content {
    width: 90%;
    height: 90%;
    max-width: none;
    max-height: none;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

/* Level Complete Modal header */
#levelCompleteModal .modal-header {
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 28px;
    color: #fff;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 0, 0, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Level Complete Modal body */
#levelCompleteModal .modal-body {
    flex: 1;
    min-height: 0;
}

.level-video {
    width: 100%;
    max-height: 400px;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* Level Complete Modal video - full size */
#levelCompleteModal .level-video {
    width: 100%;
    height: 100%;
    flex: 1;
    max-height: none;
    object-fit: contain;
    min-height: 0;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

/* Level Complete Modal buttons */
#levelCompleteModal .modal-buttons {
    flex-shrink: 0;
}

/* Slideshow Controls */
.video-container {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 0;
}

.video-container .level-video {
    flex: 1;
    max-width: calc(100% - 200px); /* Leave space for buttons */
}

.btn-slideshow {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(102, 126, 234, 0.8);
    color: white;
    backdrop-filter: blur(5px);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
}

.btn-slideshow:hover {
    background: rgba(102, 126, 234, 1);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.btn-slideshow:active {
    transform: translateY(0);
}

.btn-slideshow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(102, 126, 234, 0.5);
}

/* Options Modal Styles */
.options-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.options-section:last-child {
    border-bottom: none;
}

.options-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #fff;
}

.option-item {
    margin-bottom: 15px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #e0e0e0;
    cursor: pointer;
}

.option-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: #e0e0e0;
    font-size: 16px;
    cursor: pointer;
}

.option-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

.option-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.option-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

/* Fireworks Container */
#fireworksContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: firework 1s ease-out forwards;
}

@keyframes firework {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
