/* CSS Custom Properties for consistent theming */
:root {
    --color-background: #0d1421;
    --color-background-alt: #131a26;
    --color-border: #1e2329;
    --color-text-primary: #ffffff;
    --color-text-secondary: #b2b5be;
    --color-text-muted: #888888;
    --color-accent: #6ee7b7; /* Mint accent from screenshot */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 15px rgba(0, 212, 255, 0.2), 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 6px 20px rgba(0, 212, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.6);
    --border-radius: 8px;
    --transition-standard: 0.3s ease;

    /* Footer height is measured in JS and injected here; default fallback keeps content safe */
    --footer-height: 64px;
}

/* Modern CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Remove default margin */
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd {
    margin: 0;
}

/* Body Styles */
body { 
    background: #15161b; /* Updated background color */
    color: var(--color-text-primary); 
    font-family: "Inter", "Segoe UI", system-ui, sans-serif; 
    text-align: center; 
    overflow-x: hidden;
    user-select: text;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    /* Use small/dynamic viewport units (with fallback) for mobile browser UI */
    min-height: 100vh;
    min-height: 100dvh;

    line-height: 1.5;

    /* Critical: reserve space for fixed footer so last section isn't overlapped */
    padding-bottom: calc(var(--footer-height) + 16px);
}

/* Tweak top spacing */
main {
    width: 100%;
    display: block;
    margin-bottom: 24px;
}

/* Provide layout rules for the wrapper used in markup */
.content-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 28px auto;
    padding: 0 12px;
}

/* Canvas Styles */
canvas { 
    display: block; 
    margin: 0 auto; 
    background: var(--color-background); 
    border: 2px solid var(--color-border); 
    border-radius: var(--border-radius); 
    box-shadow: var(--shadow-md); 
    cursor: pointer;
    max-width: 100%;
    height: auto;
    -webkit-user-select: none;
    user-select: none;
}

/* Header Styles */
header {
    width: 100%;
    background: #1b1d27;
    color: var(--color-accent);
    font-size: 2rem;
    font-weight: bold;
    padding: 18px 0 12px 0;
    letter-spacing: 1px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    z-index: 10;
    position: relative;
    /* Subtle gradient and glowing underline */
    background: linear-gradient(90deg, #1b1d27 80%, #23243a 100%);
}
header::after {
    content: "";
    display: block;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, var(--color-accent) 0%, #34d399 100%);
    box-shadow: 0 0 8px rgba(110, 231, 183, 0.5);
    position: absolute;
    left: 0;
    bottom: 0;
    opacity: 0.7;
    border-radius: 2px;
}

/* Add gap below header */
header {
    margin-bottom: 12px;
}

/* Footer Styles */
footer {
    width: 100%;
    background: var(--color-background-alt);
    color: var(--color-text-secondary);
    font-size: 14px;
    padding: 14px 0 10px 0;
    position: fixed;
    bottom: 0;
    left: 0;
    text-align: center;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    background: linear-gradient(90deg, #131a26 80%, #23243a 100%);

    /* Optional: stabilize height across platforms while still allowing JS to measure accurately */
    /* min-height aligns with default --footer-height fallback */
    min-height: 48px;

    border-top: 2px solid rgba(110, 231, 183, 0.27);
}
footer::before {
    content: "";
    display: block;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, #34d399 0%, var(--color-accent) 100%);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0.5;
    border-radius: 2px;
}

/* Instructions Section */
.instructions {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    color: var(--color-text-muted);
    font-size: 12px;
    margin-top: 16px;
    text-align: center;
    display: inline-block;
    background: linear-gradient(90deg, #23243a 60%, rgba(110, 231, 183, 0.13) 100%);
    padding: 10px 32px;
    border-radius: 32px;
    box-shadow: 0 4px 16px 0 rgba(110, 231, 183, 0.13);
    animation: pill-bounce 2.5s infinite cubic-bezier(.4,1.6,.6,1);
    border: 1.5px solid rgba(110, 231, 183, 0.27);
}
@keyframes pill-bounce {
    0%, 100% { transform: translateY(0);}
    50% { transform: translateY(-8px);}
}

/* Character Selection */
.character-select {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}
.character-option {
    width: 60px;
    height: 60px;
    border: 2px solid #1e2329;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.character-option:focus,
.character-option:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
.character-option:active {
    transform: scale(0.95);
}
.character-option.selected {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

/* Game Container - revert to simple card style */
.game-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, #1e2329, #131a26);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2), 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: none;
    border: none;
    position: relative;
    overflow: visible;
    /* Removed: glassmorphism, blur, animated border, extra padding, border-radius, etc. */
}
.game-container:hover {
    transform: none;
    box-shadow: none;
}
.game-container > * {
    position: static;
    z-index: auto;
}

/* Info Container - Card with colored border and fade-in */
.info-container {
    width: 100%;
    max-width: 800px;
    margin: 28px auto 0;
    background: linear-gradient(120deg, #181c24 80%, #23243a 100%);
    border-radius: 18px;
    padding: 24px 32px 24px 20px;
    box-shadow: 0 4px 32px 0 rgba(0, 212, 255, 0.10), 0 2px 8px rgba(0, 0, 0, 0.25);
    border-left: 6px solid var(--color-accent);
    animation: info-fadein 1.2s cubic-bezier(.4,2,.6,1);
    transition: box-shadow 0.3s, border-color 0.3s;
}
@keyframes info-fadein {
    from { opacity: 0; transform: translateX(-40px);}
    to   { opacity: 1; transform: none;}
}
.info-container:hover {
    box-shadow: none;
    border-left: 6px solid #a7f3d0; /* lighter mint on hover */
}
.info-container h2 {
    color: var(--color-accent);
    margin-top: 0;
    letter-spacing: 1px;
}

/* Remove glow behind specified containers */
.info-container,
.mission-container,
.about-container,
.contact-container,
.bugs-container {
    box-shadow: none;
}

/* Roadmap Container - Timeline Step */
.roadmap-container {
    width: 100%;
    max-width: 800px;
    margin: 32px auto 0;
    background: linear-gradient(120deg, #181c24 80%, #23243a 100%);
    border-radius: 16px;
    padding: 28px 32px 28px 56px;
    box-shadow: 0 2px 16px 0 rgba(255, 215, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.18);
    position: relative;
    border-left: 6px solid var(--color-accent);
    animation: roadmap-fadein 1.2s cubic-bezier(.4,2,.6,1);
    transition: box-shadow 0.3s, border-color 0.3s;
}
.roadmap-container:nth-of-type(even) {
    background: linear-gradient(120deg, #23243a 80%, #181c24 100%);
    border-left: 6px solid #34d399; /* darker mint alternate */
}
.roadmap-container::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 32px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, #a7f3d0 60%, #34d399 100%); /* mint dot */
    box-shadow: 0 0 8px rgba(110, 231, 183, 0.5);
    z-index: 2;
}
.roadmap-container:nth-of-type(even)::before {
    background: radial-gradient(circle, #34d399 60%, #a7f3d0 100%);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}
.roadmap-container h2 {
    color: var(--color-accent);
    margin-top: 0;
    letter-spacing: 1px;
}
.roadmap-container:nth-of-type(even) h2 {
    color: var(--color-accent);
}
@keyframes roadmap-fadein {
    from { opacity: 0; transform: translateY(40px);}
    to   { opacity: 1; transform: none;}
}

/* Add vertical spacing between "Roadmap" heading and phase grid */
.roadmap-container > h2 {
    margin-bottom: 22px;
}

/* Enhance roadmap grid with counter for phases */
.roadmap-container .roadmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    counter-reset: phase;
}

/* Make roadmap items number-aware and decorative */
.roadmap-container .roadmap-item {
    background: linear-gradient(120deg, #181c24 80%, #23243a 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-standard), box-shadow var(--transition-standard);
    position: relative;
    overflow: hidden;
    counter-increment: phase;
    padding-top: 28px; /* room for the badge */
}

/* Circular glowing phase badge (top-left) */
.roadmap-container .roadmap-item::before {
    content: counter(phase);
    position: absolute;
    top: -16px;
    left: -16px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(60% 60% at 40% 40%, #a7f3d0 0%, #34d399 70%, rgba(52,211,153,0.85) 100%);
    border: 2px solid rgba(110, 231, 183, 0.55);
    box-shadow: 0 8px 24px rgba(52, 211, 153, 0.35), inset 0 2px 6px rgba(0,0,0,0.35);
    color: #0b101a;
    font-weight: 900;
    font-size: 26px;
    display: grid;
    place-items: center;
    text-shadow: 0 1px 0 rgba(255,255,255,0.35);
    pointer-events: none;
}

/* Large translucent numeral watermark (bottom-right) */
.roadmap-container .roadmap-item::after {
    content: counter(phase);
    position: absolute;
    right: -6px;
    bottom: -22px;
    font-size: 92px;
    font-weight: 900;
    line-height: 1;
    color: rgba(110, 231, 183, 0.08);
    letter-spacing: -2px;
    pointer-events: none;
    user-select: none;
}

/* Tighten content spacing knowing the badge exists */
.roadmap-container .roadmap-content h3 {
    color: var(--color-accent);
    margin-bottom: 8px;
    font-size: 1.4rem;
    margin-top: 2px;
}

/* If any legacy icon markup remains, hide it */
.roadmap-container .roadmap-icon,
.roadmap-container .roadmap-icon img {
    display: none !important;
}

/* Optional container heading for an alternative roadmap wrapper (kept, non-conflicting) */
.roadmap-container-new {
    width: 100%;
    max-width: 900px;
    margin: 40px auto;
    background: var(--color-background-alt);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-md);
    animation: roadmap-fadein 1.2s cubic-bezier(.4,2,.6,1);
}
.roadmap-container-new h2 {
    color: var(--color-accent);
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.8rem;
}

/* Link styling: use mint accent and a deeper green on hover/focus */
a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    text-decoration-color: rgba(110, 231, 183, 0.7);
}
a:visited {
    color: var(--color-accent);
    text-decoration-color: rgba(110, 231, 183, 0.55);
}
a:hover,
a:focus-visible {
    color: #34d399; /* deeper mint used elsewhere in theme */
    text-decoration-color: currentColor;
    outline: none;
}

/* Section cards: Mission, About, Contact, Bugs (restore intended styling) */
.mission-container,
.about-container,
.contact-container,
.bugs-container {
    width: 100%;
    max-width: 800px;
    margin: 28px auto 0;
    background: linear-gradient(120deg, #181c24 80%, #23243a 100%);
    border-radius: 16px;
    padding: 24px 32px 24px 20px;
    border-left: 6px solid var(--color-accent);
    box-shadow: var(--shadow-sm); /* override earlier box-shadow: none */
    animation: info-fadein 1.2s cubic-bezier(.4,2,.6,1);
}
.mission-container h2,
.about-container h2,
.contact-container h2,
.bugs-container h2 {
    color: #ffffff; /* white headings */
}

/* Override: headings white, body text light gray for mission/about/contact/bugs */
.mission-container,
.about-container,
.contact-container,
.bugs-container {
    color: #d4d9e2; /* very light gray text */
}

/* Responsive Adjustments */
@media (max-width: 840px) {
    canvas {
        width: 100%;
        height: auto;
    }
    .game-container, .info-container, .roadmap-container,
    .mission-container, .about-container, .contact-container, .bugs-container {
        padding: 15px;
    }
    .info-container, .roadmap-container,
    .mission-container, .about-container, .contact-container, .bugs-container {
        padding-left: 24px;
        padding-right: 18px;
    }
    .roadmap-container {
        padding-left: 38px;
    }
    .content-container {
        padding: 0 10px;
        margin-bottom: 20px;
    }
}

@media (max-width: 600px) {
    header {
        font-size: 1.5rem;
        padding: 12px 0 8px 0;
    }
    .character-select {
        gap: 10px;
    }
    .character-option {
        width: 50px;
        height: 50px;
    }
    .info-container h2,
    .roadmap-container h2 {
        font-size: 1.4rem;
    }
    .info-container, 
    .roadmap-container,
    .mission-container, .about-container, .contact-container, .bugs-container {
        font-size: 0.9rem;
    }
    .info-container, .roadmap-container,
    .mission-container, .about-container, .contact-container, .bugs-container {
        padding-left: 12px;
        padding-right: 8px;
    }
    .roadmap-container {
        padding-left: 24px;
    }
}