/* ===== CSS Variables ===== */
:root {
    --bg-deep:       #080808;
    --bg-dark:       #0c0c10;
    --bg-mid:        #111118;
    --bg-card:       #141420;
    --bg-card-hi:    #1a1a2a;
    --neon-green:    #44ff88;
    --neon-green-dim:#22aa55;
    --neon-yellow:   #ffee00;
    --neon-cyan:     #00ffff;
    --text-bright:   #d4ffd4;
    --text-muted:    #667766;
    --text-dim:      #334433;
    --border:        #1e3a1e;
    --border-hi:     #2a5a2a;
    --pixel-font:    "Press Start 2P", monospace;
    --body-font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-glow:   0 0 18px rgba(68, 255, 136, 0.18);
    --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.6);
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-bright);
    font-family: var(--body-font);
    line-height: 1.65;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    background-color: #060c06;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(68, 255, 136, 0.025) 2px,
            rgba(68, 255, 136, 0.025) 4px
        );
    padding: 5rem 2rem 4rem;
    text-align: center;
    border-bottom: 2px solid var(--neon-green);
    box-shadow: 0 0 60px rgba(68, 255, 136, 0.12) inset;
    overflow: hidden;
}

.hero-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.18) 3px,
        rgba(0,0,0,0.18) 4px
    );
    pointer-events: none;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero-frog {
    width: 72px;
    height: 72px;
    image-rendering: pixelated;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 12px var(--neon-green));
    animation: frog-bob 2s ease-in-out infinite;
}

@keyframes frog-bob {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.title {
    font-family: var(--pixel-font);
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    color: var(--neon-green);
    text-shadow:
        0 0 8px var(--neon-green),
        0 0 30px rgba(68, 255, 136, 0.5),
        3px 3px 0 #002200;
    letter-spacing: 2px;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.subtitle {
    font-family: var(--pixel-font);
    font-size: clamp(0.55rem, 1.5vw, 0.8rem);
    color: var(--neon-yellow);
    text-shadow: 0 0 8px rgba(255, 238, 0, 0.6);
    letter-spacing: 3px;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    letter-spacing: 1px;
}

.cta-btn {
    display: inline-block;
    font-family: var(--pixel-font);
    font-size: 0.7rem;
    color: var(--bg-deep);
    background: var(--neon-green);
    padding: 0.9rem 2.2rem;
    text-decoration: none;
    letter-spacing: 2px;
    box-shadow: 4px 4px 0 var(--neon-green-dim), 0 0 20px rgba(68, 255, 136, 0.4);
    transition: all 0.1s;
    animation: blink-cta 1.4s step-end infinite;
}

.cta-btn:hover {
    background: var(--neon-yellow);
    box-shadow: 4px 4px 0 #998800, 0 0 20px rgba(255, 238, 0, 0.5);
    animation: none;
}

@keyframes blink-cta {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* ===== Section Styles ===== */
section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-family: var(--pixel-font);
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: var(--neon-green);
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 3rem;
    text-shadow: 0 0 12px rgba(68, 255, 136, 0.5);
}

.section-sub {
    font-family: var(--pixel-font);
    font-size: 0.65rem;
    color: var(--neon-yellow);
    letter-spacing: 2px;
    margin: 3rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-hi);
}

section h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* ===== Game Section ===== */
.game-section {
    background-color: var(--bg-dark);
    padding: 3rem 0;
}

.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}

/* Canvas container holds the canvas + fullscreen button together */
.canvas-container {
    position: relative;
    display: inline-block;
    line-height: 0;
}

canvas {
    background-color: #ecf0f1;
    border: 3px solid var(--neon-green);
    box-shadow: 0 0 30px rgba(68, 255, 136, 0.25), var(--shadow-card);
    max-width: 100%;
    height: auto;
    cursor: pointer;
    display: block;
    image-rendering: pixelated;
}

canvas:focus {
    outline: none;
    box-shadow: 0 0 40px rgba(68, 255, 136, 0.55), var(--shadow-card);
}

/* ── Fullscreen button ── */
#fullscreenBtn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(12, 12, 12, 0.82);
    border: 1px solid #1e3a1e;
    border-radius: 4px;
    color: #44ff88;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
    z-index: 10;
    box-shadow: 0 0 6px rgba(68, 255, 136, 0.25);
}

#fullscreenBtn svg {
    width: 16px;
    height: 16px;
    display: block;
}

#fullscreenBtn .icon-compress { display: none; }

#fullscreenBtn:hover {
    background: rgba(20, 40, 20, 0.95);
    border-color: #44ff88;
    box-shadow: 0 0 12px rgba(68, 255, 136, 0.55);
}

/* Swap icons when fullscreen is active */
.canvas-container.is-fullscreen #fullscreenBtn .icon-expand   { display: none; }
.canvas-container.is-fullscreen #fullscreenBtn .icon-compress { display: block; }

/* Fullscreen mode: black letterbox background, canvas scales to fit */
.canvas-container:fullscreen,
.canvas-container:-webkit-full-screen {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
}

.canvas-container:fullscreen canvas,
.canvas-container:-webkit-full-screen canvas {
    border-radius: 0;
    border-color: transparent;
    /* JS sets explicit width/height; let it fill all available space */
    max-width: 100vw;
    max-height: 100vh;
}

.canvas-container:fullscreen #fullscreenBtn,
.canvas-container:-webkit-full-screen #fullscreenBtn {
    bottom: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
}

.canvas-container:fullscreen #fullscreenBtn svg,
.canvas-container:-webkit-full-screen #fullscreenBtn svg {
    width: 20px;
    height: 20px;
}

/* ===== How to Play Section ===== */
.how-to-play {
    background-color: var(--bg-mid);
}

/* ===== Pixel Card ===== */
.pixel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 3px 3px 0 var(--border), var(--shadow-card);
    padding: 2rem;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.pixel-card:hover {
    border-color: var(--neon-green-dim);
    box-shadow: 3px 3px 0 var(--neon-green-dim), var(--shadow-card);
}

.card-title {
    font-family: var(--pixel-font);
    font-size: 0.6rem;
    color: var(--neon-green);
    letter-spacing: 2px;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border-hi);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.controls-list {
    list-style: none;
    margin-top: 0.5rem;
}

.controls-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bg-card-hi);
    font-size: 0.9rem;
    color: var(--text-bright);
}

.controls-list li:last-child { border-bottom: none; }

.mechanics-list {
    list-style: none;
    margin-top: 0.5rem;
    counter-reset: none;
}

.mechanics-list li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bg-card-hi);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-bright);
}

.mechanics-list li:last-child { border-bottom: none; }

kbd {
    background: #0a160a;
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    padding: 0.2rem 0.6rem;
    font-family: var(--pixel-font);
    font-size: 0.55rem;
    letter-spacing: 1px;
    box-shadow: 2px 2px 0 var(--neon-green-dim);
    display: inline-block;
    margin-right: 0.5rem;
}

.label-chip {
    display: inline-block;
    background: #0a0a1a;
    border: 1px solid #5566ff;
    color: #aabbff;
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    padding: 0.2rem 0.5rem;
    letter-spacing: 1px;
    margin-right: 0.5rem;
    box-shadow: 2px 2px 0 #222244;
}

.step-num {
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    color: var(--neon-yellow);
    min-width: 28px;
}

.sub-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    letter-spacing: 1px;
}

/* ===== Tiles Section ===== */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

.tile-card {
    background: var(--bg-card);
    padding: 1.25rem 1rem;
    text-align: center;
    border: 2px solid color-mix(in srgb, var(--tile-color) 40%, transparent);
    box-shadow:
        0 0 10px color-mix(in srgb, var(--tile-color) 18%, transparent),
        inset 0 0 20px color-mix(in srgb, var(--tile-color) 5%, transparent);
    transition: all 0.15s;
}

.tile-card:hover {
    border-color: var(--tile-color);
    box-shadow:
        0 0 22px color-mix(in srgb, var(--tile-color) 45%, transparent),
        inset 0 0 24px color-mix(in srgb, var(--tile-color) 10%, transparent);
    transform: translateY(-4px);
}

.tile-sprite {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    display: block;
    margin: 0 auto 0.75rem;
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tile-color) 70%, transparent));
}

.tile-card h4 {
    font-family: var(--pixel-font);
    font-size: 0.45rem;
    color: var(--tile-color);
    letter-spacing: 2px;
    margin-bottom: 0.6rem;
    text-shadow: 0 0 8px color-mix(in srgb, var(--tile-color) 60%, transparent);
}

.tile-card p {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.objective-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--neon-yellow);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-card);
}

.objective-card p {
    color: var(--text-bright);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ===== About Section ===== */
.about-section {
    background-color: var(--bg-dark);
}

.project-overview {
    border-left: 3px solid var(--neon-green) !important;
    margin-bottom: 0;
}

.lead {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-bright);
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 3rem;
}

.tech-card {
    background: var(--bg-card);
    padding: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: 3px 3px 0 var(--border), var(--shadow-card);
    transition: all 0.15s;
}

.tech-card:hover {
    border-color: var(--neon-green-dim);
    box-shadow: 3px 3px 0 var(--neon-green-dim), var(--shadow-card);
    transform: translateY(-3px);
}

.tech-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.tech-card h4 {
    font-family: var(--pixel-font);
    font-size: 0.55rem;
    color: var(--neon-green);
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.tech-card p {
    color: #9aaa9a;
    line-height: 1.7;
    font-size: 0.9rem;
}

code {
    background-color: #0a1a0a;
    padding: 0.15rem 0.45rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: var(--neon-green);
    border: 1px solid var(--border);
}

/* ===== Learning Outcomes ===== */
.learning-outcomes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.outcome-category {
    background: linear-gradient(135deg, var(--background-card) 0%, var(--background-medium) 100%);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow);
    border-top: 3px solid var(--primary-green);
}

.outcome-category h4 {
    color: var(--primary-green);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.outcome-category ul {
    list-style: none;
}

.outcome-category li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-gray);
}

.outcome-category li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--primary-green);
    font-weight: bold;
}

.outcome-category strong {
    color: var(--text-light);
}

/* ===== Features List ===== */
.features-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.features-list li {
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--neon-green);
    box-shadow: var(--shadow-card);
    font-size: 0.9rem;
    color: var(--text-bright);
    transition: all 0.15s;
}

.features-list li:hover {
    border-left-color: var(--neon-yellow);
    transform: translateX(4px);
}

.features-list strong {
    color: var(--neon-green);
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    letter-spacing: 1px;
}

/* ===== Footer ===== */
footer {
    background-color: var(--bg-deep);
    padding: 3rem 2rem;
    text-align: center;
    border-top: 2px solid var(--neon-green);
    box-shadow: 0 -4px 30px rgba(68, 255, 136, 0.08) inset;
}

.footer-stack {
    font-family: var(--pixel-font);
    font-size: 0.5rem;
    color: var(--text-dim);
    letter-spacing: 3px;
    margin-bottom: 1.5rem;
}

.footer-links a {
    font-family: var(--pixel-font);
    font-size: 0.6rem;
    color: var(--neon-green);
    text-decoration: none;
    letter-spacing: 2px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--neon-green);
    transition: all 0.15s;
    box-shadow: 2px 2px 0 var(--neon-green-dim);
}

.footer-links a:hover {
    background: var(--neon-green);
    color: var(--bg-deep);
    box-shadow: 2px 2px 0 #007722;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .section-title {
        font-size: 0.65rem;
    }

    .section-sub {
        font-size: 0.55rem;
    }

    .content-grid,
    .tech-grid,
    .learning-outcomes {
        grid-template-columns: 1fr;
    }

    .tiles-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .features-list {
        grid-template-columns: 1fr;
    }

    canvas {
        width: 100%;
        height: auto;
    }

    .container {
        padding: 0 1rem;
    }

    section {
        padding: 2.5rem 0;
    }

    .hero {
        padding: 3.5rem 1rem 3rem;
    }

    .hero-frog {
        width: 52px;
        height: 52px;
    }
}

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

    .hero {
        padding: 2.5rem 1rem;
    }

    .features-list {
        grid-template-columns: 1fr;
    }
}