/* Bitty Swamp UI - Pixel Art Swamp Interface */

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

/* Pixel Art Rendering */
* {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* CSS Variables - Pixel Art Swamp Palette */
:root {
    --swamp-deep: #2d5016;
    --swamp-murky: #1a3d2e;
    --lily-green: #4a7c3d;
    --mud-brown: #3d2817;
    --accent-frog: #7cbd4a;
    --text-light: #e8e8d8;
    --water-dark: #1a3d2e;
    --water-light: #2d5a3d;
}

body {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    background: var(--swamp-deep);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    color: var(--text-light);
}

/* Swamp Canvas Container */
.swamp-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        linear-gradient(to bottom, 
            var(--swamp-deep) 0%,
            var(--swamp-murky) 50%,
            var(--water-dark) 100%
        );
    overflow: hidden;
    cursor: default;
}

/* Pixel Art Water Effect */
.swamp-container::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: 
        repeating-linear-gradient(
            0deg,
            var(--water-dark) 0px,
            var(--water-light) 2px,
            var(--water-dark) 4px
        );
    animation: waterRipple 3s infinite ease-in-out;
    opacity: 0.6;
}

@keyframes waterRipple {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-2px);
        opacity: 0.7;
    }
}

/* Interactive Lily Pad */
.lily-pad {
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--lily-green);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 0 0 2px var(--swamp-deep),
        inset 0 -10px 0 rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.lily-pad::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: var(--accent-frog);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lily-pad:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 0 3px var(--accent-frog),
        inset 0 -10px 0 rgba(0, 0, 0, 0.3),
        0 0 20px rgba(124, 189, 74, 0.5);
}

.lily-pad:hover::before {
    opacity: 0.3;
}

.lily-pad.active {
    background: var(--accent-frog);
    box-shadow: 
        0 0 0 4px var(--accent-frog),
        inset 0 -10px 0 rgba(0, 0, 0, 0.3),
        0 0 30px rgba(124, 189, 74, 0.8);
    animation: lilyPulse 2s infinite;
}

@keyframes lilyPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 4px var(--accent-frog),
            inset 0 -10px 0 rgba(0, 0, 0, 0.3),
            0 0 30px rgba(124, 189, 74, 0.8);
    }
    50% {
        box-shadow: 
            0 0 0 6px var(--accent-frog),
            inset 0 -10px 0 rgba(0, 0, 0, 0.3),
            0 0 40px rgba(124, 189, 74, 1);
    }
}

/* Radio Element - Integrated as Swamp Element */
.radio-element {
    position: absolute;
    width: 100px;
    height: 80px;
    background: var(--mud-brown);
    border: 3px solid var(--swamp-deep);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
    box-shadow: 
        0 4px 0 rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.1);
    animation: radioIdle 6s infinite ease-in-out;
}

.radio-element::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    color: var(--accent-frog);
    text-shadow: 0 0 10px var(--accent-frog);
    transition: all 0.3s ease;
}

.radio-element::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.radio-element.playing::before {
    content: '⏸';
}

.radio-element.playing {
    animation: radioPlaying 2s infinite ease-in-out;
    border-color: var(--accent-frog);
}

@keyframes radioIdle {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
}

@keyframes radioPlaying {
    0%, 100% {
        box-shadow: 
            0 4px 0 rgba(0, 0, 0, 0.3),
            inset 0 2px 0 rgba(255, 255, 255, 0.1),
            0 0 20px rgba(124, 189, 74, 0.5);
    }
    50% {
        box-shadow: 
            0 4px 0 rgba(0, 0, 0, 0.3),
            inset 0 2px 0 rgba(255, 255, 255, 0.1),
            0 0 30px rgba(124, 189, 74, 0.8);
    }
}

.radio-element:hover {
    transform: translate(-50%, -50%) scale(1.05);
    border-color: var(--accent-frog);
    box-shadow: 
        0 4px 0 rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(124, 189, 74, 0.5);
}

.radio-element:active {
    transform: translate(-50%, -50%) scale(0.95);
    box-shadow: 
        0 2px 0 rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.1);
}

/* Pixel Art Text */
.pixel-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-light);
    text-shadow: 
        2px 2px 0 var(--swamp-deep),
        0 0 10px rgba(232, 232, 216, 0.3);
    image-rendering: pixelated;
}

/* Song Title Display - Pixel Art Style */
.song-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(26, 61, 46, 0.9);
    border: 2px solid var(--accent-frog);
    border-radius: 4px;
    z-index: 30;
    min-width: 200px;
    max-width: 80%;
    text-align: center;
    box-shadow: 
        0 0 0 1px var(--swamp-deep),
        0 4px 0 rgba(0, 0, 0, 0.3),
        0 0 15px rgba(124, 189, 74, 0.3);
    transition: all 0.3s ease;
    user-select: none;
}

.song-display:hover {
    transform: translateX(-50%) translateY(-5px);
    box-shadow: 
        0 0 0 1px var(--swamp-deep),
        0 6px 0 rgba(0, 0, 0, 0.3),
        0 0 25px rgba(124, 189, 74, 0.5);
}

.song-display:active {
    transform: translateX(-50%) translateY(-3px);
}

.song-display.generating {
    animation: generatingPulse 2s infinite;
    border-color: var(--accent-water);
}

@keyframes generatingPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 1px var(--swamp-deep),
            0 4px 0 rgba(0, 0, 0, 0.3),
            0 0 15px rgba(0, 170, 255, 0.4);
    }
    50% {
        box-shadow: 
            0 0 0 1px var(--swamp-deep),
            0 4px 0 rgba(0, 0, 0, 0.3),
            0 0 25px rgba(0, 170, 255, 0.8);
    }
}

.song-display .pixel-text {
    font-size: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    display: block;
}

/* Startup Overlay */
.startup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 61, 46, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

.startup-message {
    text-align: center;
    padding: 30px 40px;
    background: rgba(45, 80, 22, 0.9);
    border: 3px solid var(--accent-frog);
    border-radius: 8px;
    box-shadow: 
        0 0 0 2px var(--swamp-deep),
        0 8px 0 rgba(0, 0, 0, 0.4),
        0 0 30px rgba(124, 189, 74, 0.6);
}

.startup-message .pixel-text {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--accent-frog);
    text-shadow: 
        2px 2px 0 var(--swamp-deep),
        0 0 15px rgba(124, 189, 74, 0.8);
}

.startup-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 24px;
    color: var(--accent-frog);
}

.startup-dots span {
    animation: startupDotPulse 1.4s infinite;
    animation-delay: calc(var(--dot-index, 0) * 0.2s);
}

.startup-dots span:nth-child(1) {
    --dot-index: 0;
}

.startup-dots span:nth-child(2) {
    --dot-index: 1;
}

.startup-dots span:nth-child(3) {
    --dot-index: 2;
}

@keyframes startupDotPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Status Indicator - Pixel Art Style */
.status-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 6px 12px;
    background: rgba(26, 61, 46, 0.8);
    border: 2px solid var(--accent-frog);
    border-radius: 4px;
    z-index: 30;
    box-shadow: 
        0 0 0 1px var(--swamp-deep),
        0 2px 0 rgba(0, 0, 0, 0.3);
}

.status-indicator.online {
    border-color: var(--accent-frog);
    animation: statusPulse 2s infinite;
}

.status-indicator.offline {
    border-color: #ff4444;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 1px var(--swamp-deep),
            0 2px 0 rgba(0, 0, 0, 0.3),
            0 0 10px rgba(124, 189, 74, 0.5);
    }
    50% {
        box-shadow: 
            0 0 0 1px var(--swamp-deep),
            0 2px 0 rgba(0, 0, 0, 0.3),
            0 0 20px rgba(124, 189, 74, 0.8);
    }
}

/* Pixel Art Creature/Element */
.swamp-creature {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--accent-frog);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 15;
    box-shadow: 
        0 2px 0 rgba(0, 0, 0, 0.3),
        inset 0 -5px 0 rgba(0, 0, 0, 0.2);
    animation: creatureIdle 4s infinite ease-in-out;
}

.swamp-creature::before {
    content: '●';
    position: absolute;
    top: 30%;
    left: 30%;
    font-size: 1.5em;
    color: var(--swamp-deep);
    animation: creatureBlink 3s infinite;
}

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

@keyframes creatureBlink {
    0%, 90%, 100% {
        opacity: 1;
    }
    95% {
        opacity: 0.3;
    }
}

.swamp-creature:hover {
    transform: scale(1.2) translateY(-5px);
    animation: creatureHover 0.5s infinite ease-in-out;
    box-shadow: 
        0 4px 0 rgba(0, 0, 0, 0.3),
        inset 0 -5px 0 rgba(0, 0, 0, 0.2),
        0 0 15px rgba(124, 189, 74, 0.6);
}

@keyframes creatureHover {
    0%, 100% {
        transform: scale(1.2) translateY(-5px);
    }
    50% {
        transform: scale(1.25) translateY(-7px);
    }
}

/* Log Element */
.swamp-log {
    position: absolute;
    width: 120px;
    height: 30px;
    background: var(--mud-brown);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 12;
    box-shadow: 
        0 2px 0 rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: logFloat 5s infinite ease-in-out;
}

.swamp-log::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 10px;
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

.swamp-log::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

@keyframes logFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-2px) rotate(1deg);
    }
}

.swamp-log:hover {
    transform: translateY(-3px) rotate(-2deg);
    animation: logFloat 2s infinite ease-in-out;
    box-shadow: 
        0 4px 0 rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 10px rgba(61, 40, 23, 0.5);
}

/* Plant Element */
.swamp-plant {
    position: absolute;
    width: 20px;
    height: 60px;
    background: var(--lily-green);
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 11;
    animation: plantSway 3s infinite ease-in-out;
}

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

.swamp-plant:hover {
    transform: scale(1.1);
    animation: plantSway 1s infinite ease-in-out;
}

/* Ripple Effect on Click */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(124, 189, 74, 0.3);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
    z-index: 100;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Hidden Navigation - Revealed on Interaction */
.hidden-nav {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 25;
}

.hidden-nav.revealed {
    opacity: 1;
    pointer-events: all;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lily-pad,
    .swamp-creature,
    .swamp-log,
    .swamp-plant {
        display: none;
    }

    .radio-element {
        width: 100px;
        height: 80px;
    }

    .song-display {
        bottom: max(30px, env(safe-area-inset-bottom) + 15px);
        padding: 10px 16px;
        min-width: 150px;
        max-width: 90%;
    }

    .pixel-text {
        font-size: 12px;
    }

    .status-indicator {
        top: max(15px, env(safe-area-inset-top) + 10px);
        right: 15px;
    }
}

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

/* Pixel Art Grid Background (Optional) */
.swamp-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(124, 189, 74, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 189, 74, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
}

