/* genpatsu.quest - Retro Pixel-Art Nuclear Education */

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

body {
    font-family: 'Fira Sans', sans-serif;
    color: #E8E8E8;
    background: #0C0C14;
    background-image:
        repeating-linear-gradient(to right, rgba(26, 48, 64, 0.03) 0px, rgba(26, 48, 64, 0.03) 1px, transparent 1px, transparent 8px),
        repeating-linear-gradient(to bottom, rgba(26, 48, 64, 0.03) 0px, rgba(26, 48, 64, 0.03) 1px, transparent 1px, transparent 8px);
    overflow-x: hidden;
}

.section {
    width: 100%;
    position: relative;
}

/* ========== TITLE SCREEN HERO ========== */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pixel-plant {
    position: absolute;
    width: 160px;
    height: 200px;
    opacity: 0;
    transition: opacity 800ms ease;
    /* Pixel art cooling tower via box-shadow */
    background: transparent;
    box-shadow:
        /* Tower base */
        40px 180px 0 0 #39FF14, 48px 180px 0 0 #39FF14, 56px 180px 0 0 #39FF14, 64px 180px 0 0 #39FF14, 72px 180px 0 0 #39FF14, 80px 180px 0 0 #39FF14, 88px 180px 0 0 #39FF14, 96px 180px 0 0 #39FF14, 104px 180px 0 0 #39FF14, 112px 180px 0 0 #39FF14,
        /* Tower mid */
        48px 172px 0 0 #39FF14, 56px 172px 0 0 #39FF14, 64px 172px 0 0 #39FF14, 72px 172px 0 0 #39FF14, 80px 172px 0 0 #39FF14, 88px 172px 0 0 #39FF14, 96px 172px 0 0 #39FF14, 104px 172px 0 0 #39FF14,
        /* Tower narrow */
        56px 164px 0 0 #39FF14, 96px 164px 0 0 #39FF14,
        56px 156px 0 0 #39FF14, 96px 156px 0 0 #39FF14,
        56px 148px 0 0 #39FF14, 96px 148px 0 0 #39FF14,
        /* Tower widen */
        48px 140px 0 0 #39FF14, 104px 140px 0 0 #39FF14,
        44px 132px 0 0 #39FF14, 108px 132px 0 0 #39FF14,
        40px 124px 0 0 #39FF14, 112px 124px 0 0 #39FF14,
        /* Tower top */
        40px 116px 0 0 #39FF14, 48px 116px 0 0 #39FF14, 56px 116px 0 0 #39FF14, 64px 116px 0 0 #39FF14, 72px 116px 0 0 #39FF14, 80px 116px 0 0 #39FF14, 88px 116px 0 0 #39FF14, 96px 116px 0 0 #39FF14, 104px 116px 0 0 #39FF14, 112px 116px 0 0 #39FF14,
        /* Steam */
        64px 108px 0 0 #39FF14, 80px 100px 0 0 #39FF14, 72px 92px 0 0 #39FF14;
    image-rendering: pixelated;
}

.pixel-plant.visible {
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-title {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.04em;
    color: #39FF14;
    min-height: 2em;
}

.hero-title span {
    display: inline;
    opacity: 0;
}

.hero-title span.visible {
    opacity: 1;
}

.scroll-prompt {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 0.7rem;
    color: #E8E8E8;
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 300ms ease;
}

.scroll-prompt.visible {
    opacity: 1;
}

.blink-cursor {
    display: inline-block;
    width: 12px;
    height: 18px;
    background: #39FF14;
    vertical-align: text-bottom;
    margin-left: 4px;
    animation: blinkCursor 530ms step-end infinite;
}

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

/* ========== LEVEL SELECT ========== */

.level-section {
    padding: 64px 32px;
}

.pixel-heading {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 0.9rem;
    color: #FFA500;
    text-align: center;
    margin-bottom: 32px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
}

.level-hex {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #1A3040;
    aspect-ratio: 1 / 1.15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    transform: scale(0);
    transition: transform 200ms ease;
    cursor: default;
}

.level-hex.visible {
    transform: scale(1);
}

.level-hex:hover {
    box-shadow: 0 0 8px #39FF14;
}

.level-num {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: #40A0FF;
    letter-spacing: 0.05em;
    display: block;
}

.level-name {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 0.55rem;
    color: #E8E8E8;
    margin-top: 4px;
    display: block;
}

/* ========== QUEST LOG SECTIONS ========== */

.quest-section {
    padding: 32px;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quest-frame {
    max-width: 960px;
    width: 100%;
    border: 4px double #6A6A7A;
    padding: 32px;
    position: relative;
    opacity: 0;
    transition: opacity 400ms ease;
}

.quest-frame.visible {
    opacity: 1;
}

.frame-corner {
    position: absolute;
    width: 12px;
    height: 12px;
}

.frame-corner::before,
.frame-corner::after {
    content: '';
    position: absolute;
    background: #6A6A7A;
}

.frame-corner.tl { top: -2px; left: -2px; }
.frame-corner.tl::before { top: 0; left: 4px; width: 4px; height: 12px; }
.frame-corner.tl::after { top: 4px; left: 0; width: 12px; height: 4px; }

.frame-corner.tr { top: -2px; right: -2px; }
.frame-corner.tr::before { top: 0; right: 4px; width: 4px; height: 12px; }
.frame-corner.tr::after { top: 4px; right: 0; width: 12px; height: 4px; }

.frame-corner.bl { bottom: -2px; left: -2px; }
.frame-corner.bl::before { bottom: 0; left: 4px; width: 4px; height: 12px; }
.frame-corner.bl::after { bottom: 4px; left: 0; width: 12px; height: 4px; }

.frame-corner.br { bottom: -2px; right: -2px; }
.frame-corner.br::before { bottom: 0; right: 4px; width: 4px; height: 12px; }
.frame-corner.br::after { bottom: 4px; right: 0; width: 12px; height: 4px; }

.quest-content {
    opacity: 0;
    transition: opacity 300ms ease 200ms;
}

.quest-frame.visible .quest-content {
    opacity: 1;
}

.quest-header {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 0.8rem;
    color: #E8E8E8;
    margin-bottom: 24px;
}

.level-tag {
    color: #FFA500;
    margin-right: 16px;
}

.quest-body {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    color: #E8E8E8;
    margin-bottom: 16px;
}

/* ========== FOOTER ========== */

.footer {
    padding: 64px 32px;
    text-align: center;
    background: #0C0C14;
}

.footer-complete {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 1rem;
    color: #39FF14;
    margin-bottom: 16px;
}

.footer-credits {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #6A6A7A;
}

/* ========== STATUS BAR ========== */

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: #0C0C14;
    border-top: 2px solid #6A6A7A;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 400ms ease;
}

.status-bar.visible {
    transform: translateY(0);
}

.bar-label {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 0.6rem;
    color: #FF3040;
    flex-shrink: 0;
}

.hp-track {
    flex: 1;
    height: 16px;
    background: linear-gradient(90deg, #1A3040 0%, #2A4050 50%, #1A3040 100%);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
    border: 2px solid #6A6A7A;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.hp-fill {
    height: 100%;
    width: 0%;
    background: #39FF14;
    transition: width 300ms ease, background-color 300ms ease;
}

.hp-percent {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #E8E8E8;
    flex-shrink: 0;
    min-width: 40px;
    text-align: right;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quest-frame {
        padding: 24px;
    }
}
