/* ==========================================================================
   bada.city — Bioluminescent Arcade
   Color Palette:
     Void Indigo:        #0A0819
     Midnight Ink:       #161233
     Neon Pink:          #FF6EC7
     Acid Green:         #39FF14
     Electric Violet:    #7B68EE
     Pale Lavender:      #E0D7FF
     Moss Gold:          #B8A924
     Bioluminescent Cyan:#00F5D4
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0A0819;
    color: #E0D7FF;
    font-family: 'Special Elite', cursive;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Ambient Background --- */
#ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 70%, rgba(123,104,238,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(255,110,199,0.06) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: ambientDrift 20s ease-in-out infinite alternate;
}

@keyframes ambientDrift {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
    100% {
        background-position: 50% 0%;
    }
}

/* --- CRT Scan Lines --- */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
    animation: scanlineAppear 0.5s 0.3s forwards, scanlineScroll 3s linear infinite;
}

@keyframes scanlineAppear {
    to { opacity: 1; }
}

@keyframes scanlineScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* --- HUD Frame (CSS Grid) --- */
#hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: grid;
    grid-template: 48px 1fr 48px / 48px 1fr 48px;
    pointer-events: none;
    opacity: 0;
    animation: hudAppear 1.2s 0.8s forwards;
}

@keyframes hudAppear {
    0% { opacity: 0; }
    30% { opacity: 0.4; }
    50% { opacity: 1; }
    60% { opacity: 0.7; }
    70% { opacity: 1; }
    80% { opacity: 0.85; }
    100% { opacity: 1; }
}

/* HUD Corners */
.hud-corner {
    background: rgba(10, 8, 26, 0.65);
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 101;
}

#hud-top-left {
    border-bottom: 1px solid #39FF14;
    border-right: 1px solid #39FF14;
    grid-row: 1;
    grid-column: 1;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    color: #39FF14;
    padding: 4px;
    gap: 2px;
    overflow: hidden;
    white-space: nowrap;
}

#hud-top-right {
    border-bottom: 1px solid #39FF14;
    border-left: 1px solid #39FF14;
    grid-row: 1;
    grid-column: 3;
}

#hud-bottom-left {
    border-top: 1px solid #39FF14;
    border-right: 1px solid #39FF14;
    grid-row: 3;
    grid-column: 1;
}

#hud-bottom-right {
    border-top: 1px solid #39FF14;
    border-left: 1px solid #39FF14;
    grid-row: 3;
    grid-column: 3;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.4rem;
    color: #B8A924;
    padding: 4px;
    overflow: hidden;
    white-space: nowrap;
}

/* HUD Bars */
.hud-bar {
    position: relative;
    z-index: 101;
}

#hud-top-center {
    grid-row: 1;
    grid-column: 2;
    background: rgba(10, 8, 26, 0.65);
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    border-bottom: 1px solid #39FF14;
}

#hud-bottom-center {
    grid-row: 3;
    grid-column: 2;
    background: rgba(10, 8, 26, 0.65);
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    border-top: 1px solid #39FF14;
}

#hud-left {
    grid-row: 2;
    grid-column: 1;
    background: rgba(10, 8, 26, 0.65);
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    border-right: 1px solid #39FF14;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

#hud-right {
    grid-row: 2;
    grid-column: 3;
    background: rgba(10, 8, 26, 0.65);
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    border-left: 1px solid #39FF14;
}

/* HUD Border Lines (decorative animated lines) */
.hud-line {
    position: absolute;
    background: #39FF14;
}

.hud-line-top {
    height: 1px;
    width: 100%;
    bottom: 0;
    left: 0;
}

.hud-line-bottom {
    height: 1px;
    width: 100%;
    top: 0;
    left: 0;
}

.hud-line-left {
    width: 1px;
    height: 100%;
    right: 0;
    top: 0;
}

.hud-line-right {
    width: 1px;
    height: 100%;
    left: 0;
    top: 0;
}

/* HUD Bracket Glyphs */
.hud-bracket {
    color: #39FF14;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    animation: bracketFlicker 0.3s steps(3) infinite alternate;
}

@keyframes bracketFlicker {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.85; }
}

.hud-readout {
    color: #39FF14;
    font-family: 'Press Start 2P', monospace;
}

/* HUD Fish Icon (top right) */
#hud-fish-icon {
    animation: fishSway 4s ease-in-out infinite;
}

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

/* --- Fish Navigation --- */
#fish-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.fish-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.35;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.fish-btn:hover {
    opacity: 1;
    transform: scale(1.3);
    filter: drop-shadow(0 0 8px currentColor);
}

.fish-btn.active {
    opacity: 1;
    animation: fishPulse 2s ease-in-out infinite;
}

@keyframes fishPulse {
    0%, 100% {
        filter: drop-shadow(0 0 6px var(--fish-glow, #FF6EC7));
    }
    50% {
        filter: drop-shadow(0 0 12px var(--fish-glow, #FF6EC7));
    }
}

.fish-btn[data-district="0"] { --fish-glow: #FF6EC7; color: #FF6EC7; }
.fish-btn[data-district="1"] { --fish-glow: #39FF14; color: #39FF14; }
.fish-btn[data-district="2"] { --fish-glow: #7B68EE; color: #7B68EE; }
.fish-btn[data-district="3"] { --fish-glow: #00F5D4; color: #00F5D4; }
.fish-btn[data-district="4"] { --fish-glow: #B8A924; color: #B8A924; }

/* --- Moss Clusters --- */
.moss-cluster {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    width: 30px;
}

.moss-cluster-right {
    justify-content: flex-end;
}

.moss-dot {
    display: block;
    width: var(--size, 4px);
    height: var(--size, 4px);
    border-radius: 50%;
    background: var(--color, #B8A924);
    opacity: var(--opacity, 0.5);
    animation: mossGrow 10s ease-in-out infinite alternate;
}

@keyframes mossGrow {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

/* --- Main Content Zone --- */
#content-zone {
    position: relative;
    z-index: 50;
    padding: 48px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    scroll-snap-type: y proximity;
}

/* --- Districts --- */
.district {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px 40px;
    scroll-snap-align: start;
}

.district-inner {
    max-width: 900px;
    width: 100%;
    position: relative;
}

.district-title {
    font-family: 'Bungee Shade', cursive;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    color: #FF6EC7;
    text-shadow:
        3px 3px 0 #39FF14,
        -1px -1px 0 #7B68EE;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 40px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.district.in-view .district-title {
    opacity: 1;
    transform: scale(1);
}

.district-body {
    font-family: 'Special Elite', cursive;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.75;
    color: #E0D7FF;
    margin-bottom: 50px;
    max-width: 700px;
}

/* Typewriter effect container */
.typewriter-text {
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typewriter-text.typing {
    opacity: 1;
}

.typewriter-text.revealed {
    opacity: 1;
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #00F5D4;
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: cursorBlink 0.7s steps(1) infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- District Transition (blur/fade) --- */
.district.fading-out .district-inner {
    opacity: 0.3;
    filter: blur(4px);
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.district .district-inner {
    transition: opacity 0.4s ease, filter 0.4s ease;
}

/* --- Glassmorphic Cards --- */
.glass-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    position: relative;
}

.glass-card {
    flex: 1 1 280px;
    max-width: 380px;
    background: rgba(22, 18, 51, 0.4);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 110, 199, 0.2);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    transform: rotate(var(--card-rotate, 0deg)) translateY(20px);
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 8px 32px rgba(123, 104, 238, 0.15);
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(
        135deg,
        #FF6EC7,
        #7B68EE,
        #39FF14,
        #FF6EC7
    );
    background-size: 300% 300%;
    animation: gradientBorder 12s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
}

@keyframes gradientBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.glass-card.card-visible {
    opacity: 1;
    transform: rotate(0deg) translateY(0);
}

.glass-card:hover {
    transform: translateY(-4px) rotate(0deg);
    border-color: rgba(255, 110, 199, 0.5);
    box-shadow: 0 12px 40px rgba(123, 104, 238, 0.25);
}

/* Card Color Tints */
.card-pink {
    border-color: rgba(255, 110, 199, 0.25);
}

.card-green {
    border-color: rgba(57, 255, 20, 0.2);
}

.card-violet {
    border-color: rgba(123, 104, 238, 0.25);
}

.card-cyan {
    border-color: rgba(0, 245, 212, 0.2);
}

.card-gold {
    border-color: rgba(184, 169, 36, 0.25);
}

.card-title {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    color: #39FF14;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.card-body {
    font-family: 'Special Elite', cursive;
    font-size: clamp(0.9rem, 1.3vw, 1.05rem);
    line-height: 1.7;
    color: #E0D7FF;
    margin-bottom: 16px;
}

.card-timestamp {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    color: #B8A924;
    letter-spacing: 0.1em;
    margin-top: 8px;
}

/* --- Watermark Fish --- */
.watermark-fish {
    position: absolute;
    width: 300px;
    height: auto;
    opacity: 0.04;
    transform: rotate(var(--wm-rotate, 0deg));
    left: var(--wm-x, 50%);
    top: var(--wm-y, 50%);
    pointer-events: none;
    z-index: -1;
}

/* --- Chromatic Aberration on District Titles --- */
.district-title {
    position: relative;
}

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

    .typewriter-text {
        opacity: 1 !important;
    }

    .district-title {
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    .glass-card {
        opacity: 1 !important;
        transform: rotate(0deg) translateY(0) !important;
    }

    #scanlines {
        opacity: 1 !important;
    }

    #hud-frame {
        opacity: 1 !important;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #hud-frame {
        grid-template: 36px 1fr 36px / 36px 1fr 36px;
    }

    #content-zone {
        padding: 36px;
    }

    .district {
        padding: 30px 16px;
    }

    .district-title {
        font-size: clamp(1.8rem, 6vw, 3rem);
    }

    #fish-nav {
        gap: 8px;
    }

    .fish-btn svg {
        width: 24px;
        height: 24px;
    }

    .glass-cards {
        flex-direction: column;
    }

    .glass-card {
        max-width: 100%;
    }

    #hud-top-left {
        font-size: 0.3rem;
    }

    #hud-bottom-right {
        font-size: 0.3rem;
    }

    .watermark-fish {
        width: 150px;
    }
}

@media (max-width: 480px) {
    #hud-frame {
        grid-template: 28px 1fr 28px / 28px 1fr 28px;
    }

    #content-zone {
        padding: 28px;
    }

    .district {
        padding: 20px 8px;
    }

    .district-title {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
        text-shadow:
            2px 2px 0 #39FF14,
            -1px -1px 0 #7B68EE;
    }

    .card-title {
        font-size: 0.7rem;
    }

    .fish-btn svg {
        width: 20px;
        height: 20px;
    }
}
