/* ============================================
   KAMET0 ADVENTURES - Styles (Improved)
   KC Edition - Karmine Corp themed
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    background: #070b14;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 960px;
    height: 540px;
    border: 3px solid #1B2838;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 0 30px rgba(74, 144, 217, 0.2),
        0 0 60px rgba(74, 144, 217, 0.1),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ========== HUD ========== */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.3) 70%, transparent 100%);
    color: #fff;
    font-size: 10px;
    z-index: 10;
    pointer-events: none;
}

.hud-left,
.hud-center,
.hud-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-center {
    align-items: center;
}

.hud-right {
    align-items: flex-end;
}

#hud-score {
    color: #ffd700;
    text-shadow: 1px 1px 0 #000, 0 0 8px rgba(255, 215, 0, 0.3);
}

#hud-coins {
    color: #ffaa00;
    text-shadow: 1px 1px 0 #000;
}

#hud-level {
    color: #4A90D9;
    font-size: 12px;
    text-shadow: 2px 2px 0 #000, 0 0 10px rgba(74, 144, 217, 0.4);
    letter-spacing: 2px;
}

.level-name {
    color: #89CFF0;
    font-size: 7px;
    text-shadow: 1px 1px 0 #000;
}

#hud-lives {
    font-size: 14px;
    text-shadow: 1px 1px 0 #000;
}

#hud-timer {
    color: #aff;
    text-shadow: 1px 1px 0 #000;
}

/* ========== COMMON ========== */
.hidden {
    display: none !important;
}

/* ========== MAIN MENU ========== */
#main-menu {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    overflow: hidden;
}

#menuCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.menu-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 1;
    position: relative;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.game-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.title-kameto {
    font-size: 44px;
    background: linear-gradient(180deg, #4A90D9 0%, #89CFF0 40%, #4A90D9 60%, #2a5a8a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(3px 3px 0 #000) drop-shadow(-1px -1px 0 #1B2838);
    animation: titlePulse 3s ease-in-out infinite;
    letter-spacing: 6px;
}

.title-adventures {
    font-size: 16px;
    color: #ffd700;
    text-shadow: 2px 2px 0 #000, 0 0 15px rgba(255, 215, 0, 0.4);
    letter-spacing: 10px;
}

.title-subtitle {
    font-size: 8px;
    color: #4A90D9;
    letter-spacing: 6px;
    text-shadow: 0 0 10px rgba(74, 144, 217, 0.5);
    opacity: 0.8;
}

@keyframes titlePulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(3px 3px 0 #000) drop-shadow(-1px -1px 0 #1B2838);
    }

    50% {
        transform: scale(1.02);
        filter: drop-shadow(3px 3px 0 #000) drop-shadow(-1px -1px 0 #1B2838) drop-shadow(0 0 10px rgba(74, 144, 217, 0.3));
    }
}

.menu-character {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #1B2838, #2a3f54);
    border-radius: 50%;
    border: 3px solid #4A90D9;
    box-shadow: 0 0 25px rgba(74, 144, 217, 0.4), inset 0 0 15px rgba(74, 144, 217, 0.2);
    position: relative;
    animation: characterBob 2.5s ease-in-out infinite;
}

.menu-character::after {
    content: 'K0';
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    color: #4A90D9;
    text-shadow: 2px 2px 0 #000, 0 0 10px rgba(74, 144, 217, 0.5);
    font-family: 'Press Start 2P', monospace;
}

.menu-char-shadow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 8px;
    background: rgba(74, 144, 217, 0.15);
    border-radius: 50%;
    animation: shadowBob 2.5s ease-in-out infinite;
}

@keyframes characterBob {

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

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

@keyframes shadowBob {

    0%,
    100% {
        width: 50px;
        opacity: 1;
    }

    50% {
        width: 35px;
        opacity: 0.5;
    }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    min-width: 260px;
    position: relative;
    overflow: hidden;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn.primary {
    background: linear-gradient(180deg, #4A90D9 0%, #2a6ab0 100%);
    border-bottom: 4px solid #1B4F8A;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.menu-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 144, 217, 0.5);
    filter: brightness(1.1);
}

.menu-btn.primary:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

.menu-btn.secondary {
    background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
    border-bottom: 3px solid #0a0a1a;
    font-size: 10px;
}

.menu-btn.secondary:hover {
    box-shadow: 0 4px 15px rgba(100, 100, 150, 0.3);
    transform: translateY(-2px);
}

.menu-btn.secondary:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

#controls-panel {
    background: rgba(0, 0, 0, 0.6);
    padding: 14px 20px;
    border-radius: 8px;
    border: 1px solid rgba(74, 144, 217, 0.3);
    backdrop-filter: blur(4px);
}

#controls-panel p {
    color: #89CFF0;
    font-size: 8px;
    line-height: 2.4;
}

.menu-footer {
    font-size: 6px;
    color: rgba(74, 144, 217, 0.4);
    letter-spacing: 2px;
}

/* ========== OVERLAYS ========== */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.88);
    z-index: 50;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px 40px;
    background: linear-gradient(180deg, rgba(27, 40, 56, 0.95) 0%, rgba(15, 25, 35, 0.95) 100%);
    border-radius: 16px;
    border: 2px solid rgba(74, 144, 217, 0.3);
    box-shadow: 0 0 40px rgba(74, 144, 217, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.overlay-content h2 {
    color: #4A90D9;
    font-size: 22px;
    text-shadow: 2px 2px 0 #000, 0 0 15px rgba(74, 144, 217, 0.3);
}

.overlay-content p {
    color: #89CFF0;
    font-size: 10px;
    line-height: 2;
}

.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    width: 100%;
}

.score-divider {
    border: none;
    border-top: 1px solid rgba(74, 144, 217, 0.3);
    margin: 4px 0;
}

.total-score {
    color: #ffd700 !important;
    font-size: 13px !important;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.stars {
    font-size: 30px;
    letter-spacing: 8px;
    animation: starsAppear 0.5s ease;
}

@keyframes starsAppear {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.game-over-content h2 {
    color: #ff4444 !important;
    text-shadow: 2px 2px 0 #000, 0 0 15px rgba(255, 68, 68, 0.3) !important;
}

.victory-content h2 {
    color: #ffd700 !important;
    animation: titlePulse 1.5s ease-in-out infinite;
    text-shadow: 2px 2px 0 #000, 0 0 20px rgba(255, 215, 0, 0.4) !important;
}

.victory-text {
    color: #89CFF0 !important;
    font-size: 12px !important;
}

.victory-big-stars {
    font-size: 36px;
    letter-spacing: 10px;
    animation: starsAppear 0.8s ease;
}

/* Level Intro */
.level-intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: levelIntroAnim 0.5s ease;
}

.level-intro-num {
    font-size: 28px;
    color: #4A90D9;
    text-shadow: 3px 3px 0 #000, 0 0 20px rgba(74, 144, 217, 0.5);
    letter-spacing: 4px;
}

.level-intro-name {
    font-size: 16px;
    color: #ffd700;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 6px;
}

@keyframes levelIntroAnim {
    from {
        transform: scale(1.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 980px) {
    #game-container {
        width: 100vw;
        height: 56.25vw;
        border: none;
        border-radius: 0;
    }

    .title-kameto {
        font-size: 28px;
    }

    .title-adventures {
        font-size: 12px;
    }

    .menu-btn {
        min-width: 200px;
        font-size: 11px;
        padding: 12px 24px;
    }
}