/* ========================================
   CYBER NINJA CHRISTMAS DEFENDER - STYLES
   Complete CSS for 2-Level System
   ======================================== */

:root {
    --neon-blue: #00f3ff;
    --neon-green: #0fff50;
    --neon-red: #ff003c;
    --neon-purple: #cc00ff;
    --dark-bg: #020b14;
    --grid-color: rgba(0, 243, 255, 0.1);
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    box-sizing: border-box;
    touch-action: manipulation; /* Essential for mobile */
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Share Tech Mono', monospace;
    background-color: var(--dark-bg);
    background-image: url('assets/images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Dark overlay for better readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 11, 20, 0.85);
    z-index: 0;
}

/* Ensure content is above overlay */
body > * {
    position: relative;
    z-index: 1;
}

.hidden {
    display: none !important;
}

/* ========================================
   CYBER TREE BACKGROUND
   ======================================== */
.cyber-tree-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        linear-gradient(transparent 95%, var(--grid-color) 96%, transparent 97%),
        linear-gradient(90deg, transparent 95%, var(--grid-color) 96%, transparent 97%),
        radial-gradient(circle at 50% 100%, rgba(0, 255, 0, 0.1) 0%, transparent 60%);
    background-size: 50px 50px, 50px 50px, 100% 100%;
}

/* Stylized tree triangle effect */
.cyber-tree-bg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 300px solid transparent;
    border-right: 300px solid transparent;
    border-bottom: 500px solid rgba(15, 255, 80, 0.05);
    pointer-events: none;
}

/* ========================================
   BINARY SNOWFLAKES
   ======================================== */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: var(--neon-blue);
    font-size: 1.5em;
    animation: fall linear infinite;
    font-family: 'Share Tech Mono', monospace;
}

.snowflake:nth-child(1) { left: 10%; animation-duration: 8s; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 30%; animation-duration: 10s; animation-delay: 2s; }
.snowflake:nth-child(3) { left: 50%; animation-duration: 7s; animation-delay: 4s; }
.snowflake:nth-child(4) { left: 70%; animation-duration: 9s; animation-delay: 1s; }
.snowflake:nth-child(5) { left: 85%; animation-duration: 11s; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 15%; animation-duration: 8.5s; animation-delay: 5s; }

@keyframes fall {
    to { transform: translateY(100vh); }
}

/* ========================================
   GAME CONTAINER
   ======================================== */
#game-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
}

/* ========================================
   CANVAS
   ======================================== */
canvas {
    background: rgba(2, 11, 20, 0.75);
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    transition: border 0.1s, box-shadow 0.1s, transform 0.1s;
    position: relative;
    z-index: 1;
}

/* ========================================
   FLASH VISUAL FEEDBACK
   ======================================== */
.flash-success {
    border-color: var(--neon-green) !important;
    box-shadow: 0 0 30px var(--neon-green) !important;
}

.flash-fail {
    border-color: var(--neon-red) !important;
    box-shadow: 0 0 30px var(--neon-red) !important;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========================================
   HUD (Heads-Up Display)
   ======================================== */
.hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    text-shadow: 0 0 5px var(--neon-blue);
}

.hud-item {
    padding: 5px 10px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-blue);
    border-radius: 5px;
}

/* ========================================
   CHRISTMAS DECORATIONS - IN GAME
   ======================================== */
.christmas-decorations {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 2rem;
    z-index: 100;
    pointer-events: none;
}

.decoration {
    animation: float 3s ease-in-out infinite;
}

.decoration.right {
    animation-delay: 1.5s;
}

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

/* ========================================
   NINJA CAT HELPER BOX - Below Alert Display
   ======================================== */
#ninja-helper-box {
    width: 100%;
    max-width: 600px;
    margin-bottom: 10px;
    padding: 12px 15px;
    background: rgba(0, 243, 255, 0.1);
    border: 2px solid var(--neon-green);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(15, 255, 80, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
}

.ninja-cat-helper {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 8px var(--neon-green));
    animation: wiggle 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.ninja-message-box {
    flex: 1;
}

.ninja-speech-helper {
    font-size: 1rem;
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 5px rgba(15, 255, 80, 0.5);
    line-height: 1.3;
}

/* Enhanced Level Info in HUD */
.level-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#level-name {
    font-size: 0.9rem;
    color: var(--neon-green);
}

.progress {
    font-size: 0.8rem;
    color: var(--neon-blue);
    background: rgba(0, 243, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ========================================
   ALERT NAME DISPLAY - Large & Visible
   ======================================== */
#alert-display {
    width: 100%;
    max-width: 600px;
    margin-bottom: 10px;
    padding: 15px;
    background: rgba(255, 23, 68, 0.15);
    border: 2px solid var(--neon-red);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 23, 68, 0.3);
}

.alert-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#alert-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--neon-red);
    text-shadow: 0 0 10px rgba(255, 23, 68, 0.8);
    line-height: 1.4;
    min-height: 1.8rem;
}

/* ========================================
   HINT BOX
   ======================================== */
#hint-box {
    width: 100%;
    max-width: 600px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--neon-green);
    border-radius: 5px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--neon-green);
}

/* ========================================
   MOBILE TOUCH CONTROLS
   ======================================== */
#mobile-controls {
    display: none; /* Hidden on desktop */
    width: 100%;
    max-width: 600px;
    justify-content: space-between;
    margin-top: 15px;
    gap: 10px;
}

.touch-btn {
    flex: 1;
    padding: 20px 10px;
    background: rgba(0, 243, 255, 0.1);
    border: 2px solid var(--neon-blue);
    color: white;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    transition: all 0.2s;
}

.touch-btn:active {
    background: rgba(0, 243, 255, 0.4);
    transform: scale(0.95);
}

.touch-btn.action {
    border-color: var(--neon-green);
    color: var(--neon-green);
}

/* ========================================
   AUDIO CONTROL BUTTON
   ======================================== */
.audio-control {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--neon-blue);
    color: white;
    font-size: 1.5rem;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
}

.audio-control:hover {
    background: rgba(0, 243, 255, 0.3);
    box-shadow: 0 0 10px var(--neon-blue);
}

/* ========================================
   SCREENS (Start, Game Over, New Year)
   ======================================== */
#start-screen,
#game-over-screen,
#newyear-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 20, 0.95);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    z-index: 2000;
    flex-direction: column;
    text-align: center;
    padding: 20px;
    padding-top: 40px;
    overflow-y: auto;
    overflow-x: hidden;
}

.start-container,
.game-over-container,
.newyear-container {
    max-width: 600px;
    width: 100%;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid var(--neon-blue);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.3);
    margin: auto;
}

h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--neon-blue);
}

h2 {
    font-size: 1.2rem;
    color: var(--neon-green);
    margin-bottom: 20px;
}

.ninja-cat-logo {
    width: 120px;
    height: 120px;
    margin: 20px 0;
    filter: drop-shadow(0 0 20px var(--neon-blue));
}

.ninja-cat-logo.bounce {
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-15px); }
}

.instructions {
    text-align: left;
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-left: 3px solid var(--neon-green);
    border-radius: 5px;
    line-height: 1.6;
}

.instructions p {
    margin: 8px 0;
    font-size: 0.9rem;
}

.instructions strong {
    color: var(--neon-blue);
}

/* Instructions Lists */
.instructions ul {
    text-align: left;
    margin: 10px 0 10px 20px;
    list-style: none;
}

.instructions ul li {
    margin: 5px 0;
    padding-left: 10px;
}

.instructions ul li::before {
    content: "▸ ";
    color: var(--neon-blue);
    font-weight: bold;
}

/* ========================================
   BUTTONS
   ======================================== */
.game-button {
    background: var(--neon-blue);
    color: black;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 5px;
    font-family: 'Share Tech Mono', monospace;
    width: 100%;
    text-transform: uppercase;
    border-radius: 5px;
    transition: all 0.3s;
}

.game-button:hover {
    background: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
}

.game-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--neon-blue);
}

.game-button.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.linkedin-btn {
    background: #0077b5;
    color: white;
    margin-bottom: 10px;
}

.linkedin-btn:hover {
    background: #005582;
    box-shadow: 0 0 15px #0077b5;
}

.buttons {
    margin-top: 20px;
}

/* ========================================
   STATS & SCORES
   ======================================== */
.stats {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.stats p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.final-score {
    font-size: 1.5rem !important;
    color: var(--neon-green);
}

.highlight {
    color: var(--neon-blue);
    font-weight: bold;
    font-size: 1.8rem;
}

.message {
    font-size: 1.3rem;
    color: var(--neon-green);
    margin: 15px 0;
}

.submessage {
    font-size: 1rem;
    color: var(--neon-blue);
    margin: 10px 0 20px 0;
    line-height: 1.5;
}

/* Stats Summary in New Year Screen */
.stats-summary {
    margin: 25px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--neon-blue);
    border-radius: 10px;
}

.stats-summary p {
    margin: 10px 0;
    font-size: 1.2rem;
}

/* ========================================
   CREDITS
   ======================================== */
.credits {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 243, 255, 0.3);
}

.audio-credit {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.audio-credit a {
    color: var(--neon-blue);
    text-decoration: none;
}

.audio-credit a:hover {
    text-decoration: underline;
}

/* ========================================
   LEVEL TRANSITION OVERLAY
   ======================================== */
.level-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.3s;
}

.transition-content {
    text-align: center;
    padding: 40px;
    background: rgba(0, 20, 40, 0.9);
    border: 3px solid var(--neon-green);
    border-radius: 20px;
    box-shadow: 0 0 40px var(--neon-green);
    max-width: 500px;
}

.transition-content h1 {
    font-size: 2.5rem;
    color: var(--neon-green);
    margin-bottom: 20px;
    animation: pulse 1s ease infinite;
}

.transition-content h2 {
    font-size: 1.5rem;
    color: var(--neon-blue);
    margin: 15px 0;
}

.transition-content p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.defender-list {
    font-size: 0.9rem !important;
    color: var(--neon-blue);
    margin-top: 15px !important;
}

.countdown {
    font-size: 1.8rem !important;
    color: var(--neon-green);
    margin-top: 20px !important;
    animation: glow 1s ease infinite;
}

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

@keyframes glow {
    0%, 100% { text-shadow: 0 0 10px var(--neon-green); }
    50% { text-shadow: 0 0 20px var(--neon-green), 0 0 30px var(--neon-green); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    #mobile-controls {
        display: flex;
    }

    .cyber-tree-bg::after {
        border-left-width: 150px;
        border-right-width: 150px;
        border-bottom-width: 300px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .ninja-cat-logo {
        width: 100px;
        height: 100px;
    }

    .instructions {
        font-size: 0.85rem;
        padding: 15px;
    }

    .hud {
        font-size: 0.9rem;
    }

    .game-button {
        font-size: 1rem;
        padding: 12px 20px;
    }

    .level-info {
        font-size: 0.8rem;
    }

    #level-name {
        font-size: 0.75rem;
    }

    .progress {
        font-size: 0.7rem;
    }

    .transition-content h1 {
        font-size: 1.8rem;
    }

    .transition-content h2 {
        font-size: 1.2rem;
    }

    /* Alert display responsive */
    #alert-display {
        padding: 10px;
    }

    .alert-label {
        font-size: 0.7rem;
    }

    #alert-name {
        font-size: 1rem;
    }

    /* Christmas decorations responsive */
    .christmas-decorations {
        font-size: 1.5rem;
    }

    .decoration-emoji {
        font-size: 2rem;
    }

    /* Ninja helper box responsive */
    #ninja-helper-box {
        padding: 10px 12px;
        gap: 10px;
    }

    .ninja-cat-helper {
        width: 40px;
        height: 40px;
    }

    .ninja-speech-helper {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.3rem;
    }

    .touch-btn {
        padding: 15px 5px;
        font-size: 0.9rem;
    }

    .hud {
        font-size: 0.8rem;
    }

    #hint-box {
        font-size: 0.8rem;
    }

    #alert-name {
        font-size: 0.9rem;
    }

    /* Start screen mobile fix */
    #start-screen,
    #game-over-screen,
    #newyear-screen {
        padding: 15px 10px;
        padding-top: 15px;
        justify-content: flex-start;
    }

    .start-container,
    .game-over-container,
    .newyear-container {
        padding: 20px 15px;
        margin: 0;
    }

    .ninja-cat-logo {
        width: 80px;
        height: 80px;
        margin: 15px 0;
    }

    .instructions {
        padding: 15px;
        font-size: 0.8rem;
    }

    .disclaimer {
        font-size: 0.7rem;
        padding: 15px;
    }

    /* Ninja helper box small mobile */
    #ninja-helper-box {
        padding: 8px 10px;
        gap: 8px;
    }

    .ninja-cat-helper {
        width: 35px;
        height: 35px;
    }

    .ninja-speech-helper {
        font-size: 0.75rem;
    }
}

/* ========================================
   CHRISTMAS THEME - GAME OVER
   ======================================== */
.christmas-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.decoration-emoji {
    font-size: 2.5rem;
    animation: rotate-decoration 4s ease-in-out infinite;
}

@keyframes rotate-decoration {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.ninja-cat-logo.sad-cat {
    filter: grayscale(30%) drop-shadow(0 0 20px var(--neon-red));
    animation: shake-head 1s ease-in-out 2;
}

@keyframes shake-head {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.ninja-message {
    font-size: 1.1rem;
    color: var(--neon-green);
    margin: 20px 0;
    font-style: italic;
}

.christmas-footer {
    margin-top: 30px;
    font-size: 1rem;
    color: var(--neon-green);
    border-top: 1px solid rgba(0, 243, 255, 0.3);
    padding-top: 15px;
}

/* ========================================
   DISCLAIMER
   ======================================== */
.disclaimer {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.5);
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
}

.disclaimer strong {
    color: #FFA500;
    display: block;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.disclaimer p {
    margin: 8px 0;
}

.disclaimer p:last-child {
    text-align: center;
    color: var(--neon-green);
    font-weight: bold;
    margin-top: 15px;
    font-size: 0.9rem;
}
