:root {
    --bg-color: #f0f0f0;
    --primary-color: #ffde59;
    /* Cyber Yellow */
    --secondary-color: #5ce1e6;
    /* Aqua */
    --accent-color: #ff5757;
    /* Radical Red */
    --glass-bg: rgba(255, 255, 255, 0.2);
    --border-width: 4px;
    --hard-shadow: 8px 8px 0px #000;
    --neobrutalist-shadow: 4px 4px 0px #000;

    /* Responsive spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

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

body {
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(#000 1px, transparent 1px);
    background-size: 40px 40px;
    color: #000;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* Neo-Brutalist Utility Classes */
.neo-card {
    background: white;
    border: var(--border-width) solid #000;
    box-shadow: var(--hard-shadow);
    padding: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.neo-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0px #000;
}

.neo-btn {
    background: var(--primary-color);
    border: var(--border-width) solid #000;
    box-shadow: var(--neobrutalist-shadow);
    padding: 12px 24px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.1s;
    font-size: 1.1rem;
}

.neo-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Layout */
#site-header {
    width: 100%;
    padding: 1.5rem;
    /* Removed sticky position to prevent floating/overlap */
    position: relative;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: var(--border-width) solid #000;
    box-shadow: var(--neobrutalist-shadow);
    padding: 1rem 2rem;
}

h3 {
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: -1px;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-icon {
    width: 32px;
    height: 32px;
    transition: transform 0.2s;
}

.social-icon:hover {
    transform: rotate(15deg) scale(1.2);
}

/* Audio Pulse Button */
.pulse-circle {
    width: 24px;
    height: 24px;
    background-color: #2ecc71;
    /* Green */
    border-radius: 50%;
    border: 3px solid #000;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 0;
    flex-shrink: 0;
    outline: none;
    box-shadow: 3px 3px 0px #000;
    overflow: hidden;
}

.pulse-circle:hover {
    transform: scale(1.2);
    background-color: #27ae60;
}

.pulse-circle::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 2px solid #2ecc71;
    animation: pulse 1.5s cubic-bezier(0.24, 0, 0.38, 1) infinite;
    pointer-events: none;
}

.pulse-circle.playing {
    background-color: #e74c3c;
    /* Red when playing */
}

.pulse-circle.playing::after {
    border-color: #e74c3c;
    animation: pulse-active 0.8s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    70% {
        transform: scale(3);
        opacity: 0;
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

@keyframes pulse-active {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Game Selector */
.game-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: -4px;
    /* Align with game container border */
    z-index: 5;
    position: relative;
}

.selector-btn {
    background: #fff;
    border: var(--border-width) solid #000;
    padding: 10px 20px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.selector-btn.active {
    background: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 4px 4px 0px #000;
    padding-bottom: 14px;
}

.selector-btn:not(.active):hover {
    background: #eee;
}

/* Game Styles */
#game-container {
    margin-top: 4rem;
    position: relative;
    border: var(--border-width) solid #000;
    box-shadow: var(--hard-shadow);
    background: #000;
    overflow: hidden;
    width: 90vw;
    max-width: 900px;
}

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

#overlay-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-stat {
    background: white;
    border: 3px solid #000;
    padding: 0.5rem 1rem;
    font-weight: 900;
    box-shadow: 3px 3px 0px #000;
    pointer-events: auto;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: var(--border-width) solid #000;
    box-shadow: var(--hard-shadow);
    padding: 3rem;
    text-align: center;
    z-index: 100;
}

#game-over h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

#game-start-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: var(--border-width) solid #000;
    box-shadow: var(--hard-shadow);
    padding: 3rem;
    text-align: center;
    z-index: 150;
    width: 80%;
    max-width: 500px;
}

#game-start-overlay h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 900;
    text-transform: uppercase;
}

/* Funny Components */
#panic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 9999;
    padding: 20px;
    display: none;
}

#panic-overlay.active {
    display: block;
}

.excel-mockup {
    width: 100%;
    height: 100%;
    border: 1px solid #ccc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===========================================
   RESPONSIVE DESIGN - MOBILE FIRST APPROACH
   =========================================== */

/* Tablet and smaller */
@media (max-width: 768px) {
    :root {
        --border-width: 3px;
        --hard-shadow: 6px 6px 0px #000;
        --neobrutalist-shadow: 3px 3px 0px #000;
    }

    body {
        background-size: 30px 30px;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    h3 {
        font-size: 1.25rem;
        text-align: center;
    }

    .social-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }


    .social-icon {
        width: 28px;
        height: 28px;
    }

    #panic-btn {
        margin-left: 0 !important;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    #game-container {
        margin-top: 2rem;
        width: 95vw;
    }

    #overlay-ui {
        padding: 0.5rem;
    }

    .game-stat {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        border-width: 2px;
        box-shadow: 2px 2px 0px #000;
    }

    #mobile-instructions {
        background: var(--accent-color);
        color: #000;
        animation: pulse-mobile 2s ease-in-out infinite;
    }

    #game-over {
        padding: 1.5rem;
        width: 85%;
        max-width: 320px;
    }

    master #game-over h2 {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    #game-over p {
        font-size: 0.95rem;
        margin-bottom: 1rem !important;
    }

    #restart-button {
        padding: 12px 24px;
        font-size: 0.95rem;
        width: 100%;
    }

    /* Info Cards Section */
    main>section {
        margin-top: 2rem !important;
        padding: 1rem !important;
        gap: 1rem !important;
        flex-direction: column;
        align-items: center;
    }

    .neo-card {
        padding: 1.25rem;
        max-width: 100% !important;
        width: calc(100% - 2rem);
    }

    .neo-card h4 {
        font-size: 1.1rem;
    }

    .neo-card p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* Panic Overlay */
    #panic-overlay {
        padding: 10px;
    }

    .excel-mockup {
        font-size: 11px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    :root {
        --border-width: 2px;
        --hard-shadow: 4px 4px 0px #000;
        --neobrutalist-shadow: 2px 2px 0px #000;
    }

    body {
        background-size: 24px 24px;
    }

    #site-header {
        padding: 0.75rem;
    }

    .header-content {
        padding: 0.6rem 0.8rem;
        gap: 0.6rem;
    }

    h3 {
        font-size: 1.1rem;
        letter-spacing: -0.5px;
    }

    .social-links {
        gap: 0.5rem;
    }

    .social-icon {
        width: 24px;
        height: 24px;
    }

    #panic-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    #game-container {
        margin-top: 1.5rem;
        width: 98vw;
        border-width: 3px;
    }

    #overlay-ui {
        padding: 0.35rem;
    }

    .game-stat {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        border-width: 2px;
    }

    #mobile-instructions {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    #game-over {
        padding: 1.25rem;
        width: 90%;
    }

    #game-over h2 {
        font-size: 1.6rem;
    }

    #game-over p {
        font-size: 0.85rem;
    }

    #restart-button {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    main>section {
        margin-top: 1.5rem !important;
        padding: 0.75rem !important;
    }

    .neo-card {
        padding: 1rem;
        width: calc(100% - 1.5rem);
    }

    .neo-card h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem !important;
    }

    .neo-card p {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .excel-mockup table {
        font-size: 10px;
    }

    .excel-mockup th,
    .excel-mockup td {
        padding: 3px !important;
    }

    .excel-mockup p {
        font-size: 11px;
        margin-top: 15px !important;
    }
}

/* Small phones (iPhone SE, etc.) */
@media (max-width: 375px) {
    h3 {
        font-size: 1rem;
    }

    .social-icon {
        width: 22px;
        height: 22px;
    }

    #panic-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .game-stat {
        font-size: 0.65rem;
        padding: 0.25rem 0.4rem;
    }

    #game-over h2 {
        font-size: 1.4rem;
    }

    #game-over p {
        font-size: 0.8rem;
    }

    #restart-button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .neo-card h4 {
        font-size: 0.95rem;
    }

    .neo-card p {
        font-size: 0.8rem;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #site-header {
        padding: 0.5rem;
        position: relative;
    }

    .header-content {
        flex-direction: row;
        padding: 0.5rem 1rem;
        gap: 1rem;
    }

    #game-container {
        margin-top: 1rem;
        max-height: 75vh;
    }

    main>section {
        margin-top: 1rem !important;
        flex-direction: row;
    }

    .neo-card {
        max-width: 45% !important;
    }

    #game-over {
        padding: 1rem;
    }

    #game-over h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    #game-over p {
        margin-bottom: 0.75rem !important;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .neo-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .social-icon {
        min-width: 44px;
        min-height: 44px;
        padding: 6px;
    }

    .neo-card:hover {
        transform: none;
        box-shadow: var(--hard-shadow);
    }

    #restart-button {
        min-height: 48px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .floating {
        animation: none;
    }

    #mobile-instructions {
        animation: none;
    }

    .neo-card,
    .neo-btn,
    .social-icon {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-width: 3px;
    }

    .game-stat {
        border-width: 3px;
    }
}

.hidden {
    display: none !important;
}

/* Game Active State */
body.game-active #content-sections {
    display: none !important;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

#content-sections {
    transition: all 0.5s ease-in-out;
}

/* Animations */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes pulse-mobile {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 2px 2px 0px #000;
    }

    50% {
        transform: scale(1.05);
        box-shadow: 3px 3px 0px #000;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes fade-out {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.floating {
    animation: float 3s ease-in-out infinite;
}