/* Brickmania Reloaded - Core Styles */

* {
    box-sizing: border-box;
}

/* Animated gradient for main play button */
.bg-size-200 {
    background-size: 200% 100%;
}

.animate-gradient-x {
    animation: gradient-x 3s ease infinite;
}

@keyframes gradient-x {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Subtle pulsating animation for landscape hint */
.animate-pulse-subtle {
    animation: pulse-subtle 2s ease-in-out infinite;
}

@keyframes pulse-subtle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Hide landscape hint on desktop/large screens */
@media (min-width: 900px) and (min-height: 600px) {
    .landscape-hint {
        display: none;
    }
}

/* Responsive game container */
#game-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden !important;
    /* Default: no glow on menu screens */
    box-shadow: none;
    /* Default size - will be scaled by JS */
    width: 800px;
    height: 600px;
    max-width: 100vw;
    max-height: 100vh;
    transform-origin: center center;
    /* Ensure nothing escapes the container */
    isolation: isolate;
}

#game-canvas {
    display: block;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    width: 100%;
    height: 100%;
}

/* Override display:block when hidden class is applied */
#game-canvas.hidden {
    display: none !important;
}

/* Mobile-specific adjustments */
@media (max-width: 850px), (max-height: 650px) {
    body {
        padding: 0;
        margin: 0;
    }

    #game-container {
        border-radius: 0;
        box-shadow: none;
    }
}

/* Very small screens - hide non-essential UI */
@media (max-width: 500px) {
    #level-display {
        display: none;
    }

    #combo-display {
        top: auto !important;
        bottom: 1rem;
        left: 50% !important;
    }
}

/* Main menu responsive layout */
@media (max-width: 768px) {
    #start-screen h1 {
        font-size: 3rem !important;
    }

    #start-screen h2 {
        font-size: 1.5rem !important;
    }

    /* Stack menu buttons vertically on mobile */
    #start-screen .flex.items-end {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }

    #start-screen .flex.items-end button {
        width: 200px !important;
        transform: none !important;
    }

    #start-screen .flex.items-end button:hover {
        transform: scale(1.05) !important;
    }

    #start-btn {
        padding: 1rem 3rem !important;
        font-size: 1.5rem !important;
    }
}

@media (max-width: 400px) {
    #start-screen h1 {
        font-size: 2.5rem !important;
    }

    #start-screen h2 {
        font-size: 1.25rem !important;
    }

    #start-btn {
        padding: 0.875rem 2.5rem !important;
        font-size: 1.25rem !important;
    }

    #start-screen .flex.items-end button {
        width: 180px !important;
        font-size: 0.875rem !important;
        padding: 0.625rem 1rem !important;
    }
}

/* Scanline effect for retro feel */
#game-canvas::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
}

/* ============================================
   HUD PANEL STYLES & ANIMATIONS
   ============================================ */

/* HUD Panel entrance animation */
@keyframes hud-slide-in {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#hud-panel {
    animation: hud-slide-in 0.5s ease-out forwards;
}

/* Glow effects for UI elements */
#score-value {
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}

#combo-value {
    text-shadow: 0 0 15px rgba(250, 204, 21, 0.8);
}

#level-value {
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
}

/* HUD item hover/active effects */
.hud-item {
    transition: all 0.2s ease;
}

/* Score pop animation when points are gained */
@keyframes score-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

#score-display.score-pop {
    animation: score-pop 0.2s ease;
}

#score-display.score-pop #score-value {
    color: #fff;
    text-shadow: 0 0 20px rgba(6, 182, 212, 1), 0 0 30px rgba(6, 182, 212, 0.5);
}

/* Level up animation */
@keyframes level-up {
    0% { transform: scale(1); background-color: transparent; }
    25% { transform: scale(1.2); background-color: rgba(74, 222, 128, 0.3); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); background-color: transparent; }
}

#level-display.level-up {
    animation: level-up 0.5s ease;
}

/* Life lost animation */
@keyframes life-lost {
    0% { transform: scale(1); }
    25% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

#lives-display.life-lost {
    animation: life-lost 0.4s ease;
}

/* Individual heart animations */
@keyframes heart-beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

@keyframes heart-break {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(-10deg); opacity: 0.7; }
    100% { transform: scale(0.8) rotate(0deg); opacity: 0.3; }
}

.life-heart {
    display: inline-block;
    transition: all 0.3s ease;
}

.life-heart.beat {
    animation: heart-beat 0.3s ease;
}

.life-heart.lost {
    animation: heart-break 0.4s ease forwards;
    filter: grayscale(100%);
}

/* Combo active state */
#combo-display.active {
    opacity: 1 !important;
    transform: scale(1) !important;
}

@keyframes combo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

#combo-display.combo-pulse {
    animation: combo-pulse 0.3s ease;
}

/* Fever mode HUD glow */
#hud-panel.fever {
    border-color: rgba(236, 72, 153, 0.6);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.4), 0 0 40px rgba(147, 51, 234, 0.2);
}

/* Mobile responsive HUD */
@media (max-width: 600px) {
    #hud-panel {
        padding: 0.375rem 0.5rem;
        gap: 0.25rem;
    }

    .hud-item {
        padding: 0.25rem 0.5rem !important;
    }

    #score-value, #level-value, #combo-value {
        font-size: 1rem !important;
    }

    .hud-item .text-lg {
        font-size: 0.875rem !important;
    }

    .life-heart {
        font-size: 0.875rem !important;
    }

    /* Hide text labels on very small screens */
    .hud-item .text-\\[10px\\] {
        display: none;
    }
}

@media (max-width: 450px) {
    #hud-panel {
        padding: 0.25rem 0.375rem;
    }

    #score-display {
        min-width: auto !important;
    }

    .w-px {
        display: none;
    }
}

/* ============================================
   IN-GAME MENU STYLES
   ============================================ */

#ingame-menu-btn {
    transition: opacity 0.3s ease, transform 0.2s ease;
}

#ingame-menu-btn:hover {
    transform: scale(1.1);
}

#ingame-menu {
    animation: menu-slide-in 0.15s ease-out;
}

@keyframes menu-slide-in {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

#ingame-menu button {
    box-shadow: none;
    text-shadow: none;
}

#ingame-menu button:active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Screen transitions */
#start-screen,
#pause-screen,
#gameover-screen,
#level-complete-screen {
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

/* Button hover effects */
button {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

button:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

/* Combo animation */
@keyframes combo-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.2); }
}

#combo-display.active {
    animation: combo-pulse 0.3s ease;
}

/* Screen shake animations - multiple intensities */
@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-5px, 2px); }
    50% { transform: translate(3px, -3px); }
    75% { transform: translate(5px, 1px); }
}

@keyframes shake-medium {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-8px, 4px); }
    40% { transform: translate(6px, -6px); }
    60% { transform: translate(-4px, 8px); }
    80% { transform: translate(8px, -2px); }
}

@keyframes shake-heavy {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-12px, 6px); }
    20% { transform: translate(10px, -10px); }
    30% { transform: translate(-8px, 12px); }
    40% { transform: translate(12px, -4px); }
    50% { transform: translate(-10px, 8px); }
    60% { transform: translate(8px, -12px); }
    70% { transform: translate(-12px, 10px); }
    80% { transform: translate(10px, -6px); }
    90% { transform: translate(-6px, 12px); }
}

#game-container.shake {
    animation: shake 0.1s ease;
}

#game-container.shake-medium {
    animation: shake-medium 0.15s ease;
}

#game-container.shake-heavy {
    animation: shake-heavy 0.2s ease;
}

/* Game container glow - only shown during gameplay */
#game-container.playing {
    box-shadow:
        0 0 60px rgba(6, 182, 212, 0.3),
        0 0 100px rgba(236, 72, 153, 0.2),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
}

/* Fever mode glow effect */
@keyframes fever-glow {
    0%, 100% {
        box-shadow:
            0 0 60px rgba(255, 0, 255, 0.5),
            0 0 120px rgba(255, 0, 255, 0.3),
            inset 0 0 60px rgba(255, 0, 255, 0.1);
    }
    50% {
        box-shadow:
            0 0 80px rgba(0, 255, 255, 0.5),
            0 0 150px rgba(0, 255, 255, 0.3),
            inset 0 0 80px rgba(0, 255, 255, 0.1);
    }
}

#game-container.fever {
    animation: fever-glow 0.5s ease infinite;
}

/* Hide scrollbar */
body::-webkit-scrollbar {
    display: none;
}

body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Mobile/Desktop hint visibility */
.mobile-hint {
    display: none;
}
.desktop-hint {
    display: inline;
}

/* Touch device detection - JS will add .touch-device class */
.touch-device .mobile-hint {
    display: inline;
}
.touch-device .desktop-hint {
    display: none;
}

/* Mobile pause button */
#mobile-pause-btn {
    display: none;
}
.touch-device #mobile-pause-btn {
    display: flex;
}

/* Ensure game container clips overflow */
#game-container {
    contain: layout;
}

/* ============================================
   RESPONSIVE DESIGN FOR MOBILE DEVICES
   ============================================ */

/* Tablet portrait mode */
@media (max-width: 850px) and (orientation: portrait) {
    /* Level select grid - 3 columns instead of 5 */
    #level-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* World tabs - smaller on portrait */
    .world-tab {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }

    /* Start screen title scaling */
    #start-screen h1 {
        font-size: 3rem !important;
    }
    #start-screen h2 {
        font-size: 1.5rem !important;
        margin-bottom: 2rem !important;
    }

    /* Menu buttons - slightly smaller */
    #start-screen button {
        padding: 0.875rem 2rem !important;
        font-size: 1.25rem !important;
    }
}

/* Phone portrait mode */
@media (max-width: 500px) and (orientation: portrait) {
    /* Level select grid - 3 columns, smaller */
    #level-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
        padding: 0 0.5rem !important;
    }

    /* Level buttons smaller */
    #level-grid button {
        width: 5rem !important;
        height: 6rem !important;
    }

    /* World tabs - wrap if needed */
    #world-tabs {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem !important;
    }
    .world-tab {
        padding: 0.375rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    /* Start screen adjustments */
    #start-screen h1 {
        font-size: 2.25rem !important;
    }
    #start-screen h2 {
        font-size: 1.125rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Menu buttons - stack better */
    #start-screen .flex.flex-col {
        gap: 0.75rem !important;
    }
    #start-screen button {
        padding: 0.75rem 1.5rem !important;
        font-size: 1.125rem !important;
    }

    /* Preview modal - smaller */
    #level-preview-modal > div {
        padding: 1rem !important;
        max-width: 90% !important;
    }
    #preview-canvas {
        width: 280px !important;
        height: 175px !important;
    }

    /* Achievements grid - 2 columns */
    #achievements-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    #start-screen h1 {
        font-size: 1.875rem !important;
    }

    #level-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    #level-grid button {
        width: 4.5rem !important;
        height: 5.5rem !important;
    }
}

/* Landscape mode on phones */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce vertical spacing */
    #start-screen {
        padding: 1rem !important;
    }
    #start-screen h1 {
        font-size: 2.5rem !important;
        margin-bottom: 0.25rem !important;
    }
    #start-screen h2 {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }
    #start-screen .flex.flex-col {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem !important;
    }
    #start-screen button {
        padding: 0.5rem 1rem !important;
        font-size: 1rem !important;
    }
    #start-screen p {
        margin-top: 0.5rem !important;
        font-size: 0.75rem !important;
    }

    /* Level select - horizontal scroll or smaller */
    #level-select-screen {
        padding: 0.5rem !important;
    }
    #level-select-screen h2 {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }
    #world-tabs {
        margin-bottom: 0.5rem !important;
    }
    #level-grid {
        gap: 0.5rem !important;
    }
    #level-grid button {
        width: 5rem !important;
        height: 5.5rem !important;
    }

    /* Pause screen - horizontal buttons */
    #pause-screen .flex.flex-col {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }
    #pause-screen h2 {
        font-size: 2.5rem !important;
        margin-bottom: 1rem !important;
    }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    #game-container {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* Prevent text selection on mobile */
#game-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Prevent pull-to-refresh on mobile */
html, body {
    overscroll-behavior: none;
}

/* Touch action for game canvas */
#game-canvas {
    touch-action: none;
}

/* Remove tap delay on buttons for mobile */
button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Ensure buttons are clickable on touch devices */
#start-screen button,
#pause-screen button,
#gameover-screen button,
#level-complete-screen button,
#level-select-screen button,
#settings-overlay button,
#guide-overlay button,
#achievements-overlay button {
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

/* ============================================
   SETTINGS SCREEN STYLES
   ============================================ */

/* Toggle button styles */
.toggle-on {
    background: linear-gradient(to right, #22c55e, #16a34a);
    color: white;
}
.toggle-off {
    background: linear-gradient(to right, #6b7280, #4b5563);
    color: #9ca3af;
}

/* Range slider custom styling */
input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #374151;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: currentColor;
    cursor: pointer;
    border: 2px solid white;
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: currentColor;
    cursor: pointer;
    border: 2px solid white;
}

/* Select dropdown styling */
#settings-screen select {
    cursor: pointer;
    border: 1px solid #4b5563;
}
#settings-screen select:focus {
    outline: none;
    border-color: #06b6d4;
}

/* Settings screen responsive */
@media (max-width: 500px) {
    #settings-screen h2 {
        font-size: 2rem !important;
    }
    #settings-screen .bg-gray-800\/50 {
        padding: 0.75rem !important;
    }
    #settings-screen h3 {
        font-size: 1rem !important;
    }
    #settings-screen label {
        font-size: 0.875rem !important;
    }
    #settings-screen input[type="range"] {
        width: 5rem !important;
    }
}

/* Scanlines toggle support */
#game-canvas.no-scanlines::after {
    display: none !important;
}

/* High contrast mode */
.high-contrast #game-canvas {
    filter: contrast(1.2) saturate(1.3);
}

/* Reduced motion */
.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Tile introduction modal animation */
@keyframes modal-pop {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

#tile-intro-modal > div {
    animation: modal-pop 0.3s ease-out forwards;
}

/* Guide screen responsive */
@media (max-width: 500px) {
    #guide-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    .guide-tab {
        font-size: 0.875rem !important;
        padding: 0.375rem 0.75rem !important;
    }
    #guide-screen h2 {
        font-size: 2rem !important;
    }
}

/* ============================================
   VICTORY / LEVEL COMPLETE SCREEN
   ============================================ */

#level-complete-screen {
    background: radial-gradient(ellipse at center, rgba(17, 24, 39, 0.85) 0%, rgba(17, 24, 39, 0.95) 100%) !important;
    backdrop-filter: blur(6px);
    z-index: 40;
}

/* Animated background rays */
.victory-rays {
    position: absolute;
    inset: 0;
    background: conic-gradient(from 0deg at 50% 50%,
        transparent 0deg,
        rgba(250, 204, 21, 0.1) 10deg,
        transparent 20deg,
        transparent 40deg,
        rgba(34, 197, 94, 0.1) 50deg,
        transparent 60deg,
        transparent 80deg,
        rgba(6, 182, 212, 0.1) 90deg,
        transparent 100deg
    );
    animation: rotate-rays 20s linear infinite;
    pointer-events: none;
}

@keyframes rotate-rays {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Trophy animation */
.victory-trophy {
    position: relative;
    margin-bottom: 0.5rem;
    animation: trophy-entrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: scale(0) rotate(-20deg);
}

.victory-trophy.animate {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

@keyframes trophy-entrance {
    0% { opacity: 0; transform: scale(0) rotate(-20deg); }
    60% { opacity: 1; transform: scale(1.3) rotate(5deg); }
    80% { transform: scale(0.9) rotate(-3deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.trophy-icon {
    font-size: 3.5rem;
    display: block;
    filter: drop-shadow(0 0 20px rgba(250, 204, 21, 0.6));
    animation: trophy-glow 2s ease-in-out infinite;
}

@keyframes trophy-glow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(250, 204, 21, 0.6)); }
    50% { filter: drop-shadow(0 0 40px rgba(250, 204, 21, 0.9)); }
}

.trophy-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(250, 204, 21, 0.4) 0%, transparent 70%);
    animation: burst-pulse 1.5s ease-out infinite;
    pointer-events: none;
}

@keyframes burst-pulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Victory title animation */
.victory-title {
    animation: title-entrance 0.6s ease-out 0.3s forwards;
    opacity: 0;
    transform: translateY(-30px);
    text-shadow: 0 4px 30px rgba(34, 197, 94, 0.5);
}

.victory-title.animate {
    opacity: 1;
    transform: translateY(0);
}

@keyframes title-entrance {
    0% { opacity: 0; transform: translateY(-30px) scale(0.8); }
    60% { transform: translateY(5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Level badge */
.level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    border-radius: 0.75rem;
    border: 2px solid rgba(139, 92, 246, 0.5);
    animation: badge-pop 0.5s ease-out 0.5s forwards;
    opacity: 0;
    transform: scale(0);
    min-width: 70px;
}

.level-badge.animate {
    opacity: 1;
    transform: scale(1);
}

@keyframes badge-pop {
    0% { opacity: 0; transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Stats panel */
.victory-stats-panel {
    min-width: 200px;
    animation: stats-slide 0.6s ease-out 0.6s forwards;
    opacity: 0;
    transform: translateY(20px);
}

.victory-stats-panel.animate {
    opacity: 1;
    transform: translateY(0);
}

@keyframes stats-slide {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border-left: 2px solid;
    transition: transform 0.3s ease, background 0.3s ease;
}

.stat-item:hover {
    transform: translateX(4px);
    background: rgba(0, 0, 0, 0.5);
}

.stat-time { border-color: #06b6d4; }
.stat-bricks { border-color: #f97316; }
.stat-powerups { border-color: #a855f7; }
.stat-combo { border-color: #ef4444; }

.stat-icon {
    font-size: 1.1rem;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.65rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Nunito Sans', sans-serif;
}

.stat-value {
    font-size: 1rem;
    font-weight: bold;
    color: white;
    font-family: 'Russo One', sans-serif;
    letter-spacing: 1px;
}

/* Score panel */
.victory-score-panel {
    animation: score-entrance 0.5s ease-out 1s forwards;
    opacity: 0;
    transform: scale(0.9);
}

.victory-score-panel.animate {
    opacity: 1;
    transform: scale(1);
}

@keyframes score-entrance {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.score-row, .bonus-row, .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    min-width: 200px;
}

.score-label, .bonus-label, .total-label {
    font-family: 'Nunito Sans', sans-serif;
    color: #9ca3af;
    font-size: 0.75rem;
}

.score-value, .bonus-value {
    font-family: 'Russo One', sans-serif;
    font-size: 1rem;
    letter-spacing: 1px;
}

.score-value { color: #06b6d4; }
.bonus-value { color: #22c55e; }

.total-row {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.total-label {
    color: #fbbf24;
    font-weight: bold;
}

.total-value {
    font-family: 'Russo One', sans-serif;
    font-size: 1.35rem;
    color: #fbbf24;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

/* Star rating */
.star-rating {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.star-rating.animate {
    opacity: 1;
    transform: translateY(0);
}

.star {
    font-size: 1rem;
    opacity: 0.3;
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: grayscale(100%);
}

.star.earned {
    opacity: 1;
    transform: scale(1);
    filter: grayscale(0%);
    animation: star-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes star-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Victory buttons */
.victory-btn {
    transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.victory-btn.animate {
    opacity: 1;
    transform: translateY(0);
}

.victory-btn-primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.victory-btn-primary:hover {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    box-shadow: 0 6px 30px rgba(34, 197, 94, 0.6);
    transform: translateY(-2px) scale(1.05);
}

.victory-btn-secondary {
    background: linear-gradient(135deg, #4b5563, #374151);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.victory-btn-secondary:hover {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    transform: translateY(-2px) scale(1.02);
}

/* Confetti canvas */
#confetti-canvas {
    z-index: 100;
    pointer-events: none;
}

/* ============================================
   FULL-SCREEN OVERLAY SCREENS
   ============================================ */

#achievements-overlay,
#guide-overlay,
#settings-overlay,
#level-select-overlay {
    background: #111827;
    z-index: 100;
}

/* Ensure hidden overlays don't capture events */
#achievements-overlay.hidden,
#guide-overlay.hidden,
#settings-overlay.hidden,
#level-select-overlay.hidden {
    pointer-events: none !important;
}

/* Responsive overlay styles */
@media (max-width: 768px) {
    #achievements-overlay h2,
    #guide-overlay h2,
    #settings-overlay h2 {
        font-size: 2.5rem !important;
    }

    #guide-overlay-tabs {
        flex-wrap: wrap;
    }

    .guide-overlay-tab {
        font-size: 0.875rem !important;
        padding: 0.5rem 1rem !important;
    }

    #settings-overlay .grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 500px) {
    #achievements-overlay h2,
    #guide-overlay h2,
    #settings-overlay h2 {
        font-size: 2rem !important;
    }

    #achievements-overlay-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    #guide-overlay .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Overlay scroll behavior */
#achievements-overlay,
#guide-overlay,
#settings-overlay,
#level-select-overlay {
    -webkit-overflow-scrolling: touch;
}

/* Level select overlay responsive */
@media (max-width: 768px) {
    #world-overlay-tabs {
        flex-wrap: wrap;
    }

    .world-overlay-tab {
        font-size: 0.875rem !important;
        padding: 0.5rem 1rem !important;
    }

    #level-overlay-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 600px) {
    #level-select-overlay h2 {
        font-size: 2.5rem !important;
    }

    #level-overlay-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .world-overlay-tab {
        font-size: 0.75rem !important;
        padding: 0.375rem 0.75rem !important;
    }
}

@media (max-width: 400px) {
    #level-select-overlay h2 {
        font-size: 2rem !important;
    }

    #level-overlay-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
}

