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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    padding: 20px;
}

header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    margin-bottom: 0.5rem;
}

nav {
    margin-bottom: 20px;
    background: #444;
    padding: 0.5rem;
    text-align: center;
}

nav ul {
    list-style: none;
}

nav ul li {
    display: inline;
    margin-right: 10px;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    padding: 5px 10px;
}

nav ul li a:hover {
    background: #555;
    border-radius: 5px;
}

main {
    max-width: 960px;
    margin: auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Sections are initially hidden */
.content-section {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    margin-bottom: 20px; /* Keep spacing consistent */
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

/* Active section is displayed */
.content-section.active-section {
    display: block;
    opacity: 1;
}

/* Ensure last section still removes border */
.content-section:last-child {
    border-bottom: none;
}

section:last-child {
    border-bottom: none;
}

h2 {
    color: #333;
    margin-bottom: 10px;
}

#skills ul, #contact ul {
    list-style: disc;
    margin-left: 20px;
}

#contact ul li {
    margin-bottom: 5px;
}

footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #666;
}

a {
    color: #007bff;
}

a:hover {
    text-decoration: underline;
}

/* Easter Egg Styles */
#easter-egg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000; /* Black background for the 3D scene */
    z-index: 1000; /* Ensure it's on top */
    overflow: hidden; /* Hide scrollbars if canvas is slightly off */
}

#easter-egg-canvas {
    display: block; /* Remove extra space below canvas */
    width: 100%;
    height: 100%;
}

#score-display {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    z-index: 1001; /* Above the canvas */
    user-select: none; /* Prevent text selection */
}

/* Class to hide main content */
.hidden-content {
    opacity: 0;
    transition: opacity 0.5s ease-out;
    pointer-events: none; /* Prevent interaction when hidden */
}

/* Shared onboarding overlays for games */
.game-instructions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    z-index: 1100;
}

.game-instructions[aria-hidden="false"] {
    display: flex;
}

.game-instructions:focus {
    outline: none;
}

.instructions-panel {
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid #00ffc6;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0, 255, 198, 0.35);
    max-width: 520px;
    width: 100%;
    padding: 28px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.instructions-panel h2 {
    margin: 0;
    font-size: 2em;
    text-align: center;
}

.instructions-panel p {
    margin: 0;
    line-height: 1.6;
    font-size: 1.05em;
}

.instructions-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.6;
    font-size: 1.05em;
}

.instructions-list li {
    margin-bottom: 8px;
}

.game-instructions .retro-button {
    align-self: center;
    min-width: 180px;
}

@media (max-width: 640px) {
    .instructions-panel {
        max-width: 90%;
        padding: 20px;
        gap: 12px;
    }

    .instructions-panel h2 {
        font-size: 1.6em;
    }

    .instructions-panel p,
    .instructions-list {
        font-size: 1em;
    }
}

/* Animation for sections on scroll */
main > section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

main > section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Game UI (Score and Lives) */
#game-ui {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px; /* Allow stretching */
    display: flex;
    justify-content: space-between; /* Pushes score left, lives right */
    z-index: 1001; /* Above the canvas */
    pointer-events: none; /* Don't interfere with mouse */
    user-select: none; /* Prevent text selection */
    color: white;
    font-size: 24px;
    font-weight: bold;
}

/* Reposition score slightly as it's now inside #game-ui */
#score-display {
    position: static; /* Remove absolute positioning */
    /* Inherits color, font-size etc from #game-ui */
}

/* Game Over Screen */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent black */
    color: white;
    display: flex; /* Use flexbox for centering */
    flex-direction: column; /* Stack items vertically */
    justify-content: center; /* Center vertically */
    align-items: center; /* Center horizontally */
    z-index: 1002; /* Above game UI */
    text-align: center;
}

#game-over-screen h2 {
    color: white; /* Override default h2 color */
    margin-bottom: 20px;
    font-size: 3em;
}

#game-over-screen button {
    background-color: #0077ff;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px;
    transition: background-color 0.3s ease;
    /* Base styles removed as .retro-button will take over */
    /* Specific overrides for .retro-button within #game-over-screen if needed can be added */
}

#game-over-screen button:hover {
    /* Base styles removed as .retro-button:hover will take over */
}


/* Retro Arcade Theme (Activated on Win) */
body.retro-theme {
    background-color: #111; /* Dark background */
    color: #00ffcc; /* Bright cyan text */
    font-family: 'Courier New', Courier, monospace; /* Monospaced font */
    padding: 20px; /* Keep padding */
    transition: background-color 0.5s ease, color 0.5s ease; /* Smooth transition */
}

body.retro-theme header {
    background: #222; /* Darker header */
    color: #ff00ff; /* Magenta header text */
    border-bottom: 2px solid #00ffcc;
}

body.retro-theme nav {
    background: #1a1a1a; /* Dark nav */
    border-bottom: 1px solid #ff00ff;
}

body.retro-theme nav ul li a {
    color: #00ffcc; /* Cyan links */
    text-decoration: none;
}

body.retro-theme nav ul li a:hover {
    background: #333;
    color: #ff00ff; /* Magenta hover */
    border-radius: 0; /* Sharper edges */
}

body.retro-theme main {
    background: #252525; /* Dark main area */
    color: #00ffcc; /* Cyan text in main */
    border: 2px solid #ff00ff; /* Magenta border */
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.5); /* Magenta glow */
    border-radius: 0;
}

body.retro-theme section {
    border-bottom: 1px dashed #00ffcc; /* Dashed cyan border */
}

body.retro-theme section:last-child {
    border-bottom: none;
}

body.retro-theme h2 {
    color: #ff00ff; /* Magenta headings */
    text-shadow: 0 0 5px #ff00ff; /* Magenta glow */
}

body.retro-theme a {
    color: #39ff14; /* Lime green links */
    text-decoration: underline;
}

body.retro-theme a:hover {
    color: #ff00ff; /* Magenta link hover */
    text-decoration: none;
}

body.retro-theme footer {
    color: #aaa; /* Dimmer footer text */
    border-top: 1px solid #555;
}

/* Ensure hidden content stays hidden even in retro theme */
body.retro-theme .hidden-content {
    opacity: 0;
    pointer-events: none;
}

/* Copyright Smiley Animation */
.copyright-container {
    display: inline-block;
    width: 1em; /* Adjust size as needed */
    height: 1em;
    border: 0.15em solid currentColor; /* Initial 'C' shape */
    border-radius: 50%;
    border-right-color: transparent; /* Make it look like a C */
    position: relative; /* For positioning eyes */
    vertical-align: middle; /* Align with text */
    margin-right: 0.2em;
    transform: rotate(0deg); /* Initial rotation state */
}

.copyright-container .eye {
    display: block;
    position: absolute;
    width: 0.15em; /* Eye size */
    height: 0.15em;
    background-color: currentColor;
    border-radius: 50%;
    top: 35%; /* Position eyes vertically */
    opacity: 0; /* Eyes initially hidden */
}

.copyright-container .left-eye {
    left: 25%; /* Position left eye */
    transform: scale(1); /* Initial scale for wink */
}

.copyright-container .right-eye {
    right: 25%; /* Position right eye */
}

/* Animation Trigger Class */
.copyright-container.animate-smiley {
    /* Initial delay 3s, rotate duration 1.5s */
    animation: rotateC 1.5s ease-in-out 3s forwards,
               /* Border complete starts slightly before rotation ends */
               borderComplete 0.1s 4.4s forwards;
}

.copyright-container.animate-smiley .eye {
    /* Fade in starts after rotation: 3s delay + 1.5s rotation = 4.5s */
    animation: fadeInEyes 0.5s 4.5s ease-in forwards;
}

.copyright-container.animate-smiley .left-eye {
    /* Fade in starts at 4.5s, Wink starts after fade in: 4.5s + 0.5s = 5.0s */
    animation: fadeInEyes 0.5s 4.5s ease-in forwards,
               wink 0.3s 5.0s ease-in-out forwards;
}


/* Keyframes */
@keyframes rotateC {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes borderComplete {
    from { border-right-color: transparent; }
    to   { border-right-color: currentColor; } /* Close the circle */
}

@keyframes fadeInEyes {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes wink {
    0%, 100% { transform: scaleY(1); } /* Eye open */
    50%      { transform: scaleY(0.1); } /* Eye closed */
}

/* Ensure animation works in retro theme too */
body.retro-theme .copyright-container {
    border-color: #00ffcc; /* Match retro text color */
    border-right-color: transparent; /* Keep C shape initially */
}
body.retro-theme .copyright-container .eye {
    background-color: #00ffcc;
}
body.retro-theme .copyright-container.animate-smiley {
     /* Apply same timing adjustments for retro theme */
     animation: rotateC 1.5s ease-in-out 3s forwards,
               borderCompleteRetro 0.1s 4.4s forwards;
}
/* Specific keyframe for retro border completion */
@keyframes borderCompleteRetro {
    from { border-right-color: transparent; }
    to   { border-right-color: #00ffcc; } /* Close the circle with retro color */
}

/* --- Disco Mode Styles --- */
body.disco-mode {
    /* Use the CSS variable set by JavaScript */
    background-color: var(--disco-bg-color, #f4f4f4); /* Default fallback */
    transition: background-color 0.1s linear; /* Fast transition for disco effect */
}

/* Optional: Make text contrast better during disco */
body.disco-mode header,
body.disco-mode nav,
body.disco-mode main {
    background-color: rgba(50, 50, 50, 0.8); /* Dark semi-transparent background */
    color: #fff; /* White text */
    transition: background-color 0.2s ease, color 0.2s ease;
}

body.disco-mode h1,
body.disco-mode h2 {
    color: #fff; /* Ensure headings are white */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

body.disco-mode a {
    color: #87CEFA; /* Light Sky Blue links */
}

body.disco-mode footer {
    color: #ddd;
}

/* Make the name trigger more obvious */
#name-trigger {
    cursor: pointer;
    transition: text-shadow 0.3s ease;
}
#name-trigger:hover {
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #ff00ff; /* Add a glow on hover */
}
/* --- End Disco Mode Styles --- */

/* --- Maze Game Styles --- */

#maze-canvas {
    border: 1px solid #555; /* Add a subtle border */
    /* CSS Scaling for responsiveness */
    max-width: 100%;
    max-height: 100%;
    width: auto;   /* Default, overridden by JS if needed for fixed aspect ratio */
    height: auto;  /* Default, overridden by JS if needed for fixed aspect ratio */
    object-fit: contain; /* Ensures aspect ratio is maintained if container is not proportional */
    display: block; /* Prevents extra space below */
    margin: auto; /* Center in flex container */
}

#maze-win-screen {
    /* Basic positioning/background already inline */
    border: 2px solid #0f0; /* Green border */
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5); /* Green glow */
}

#maze-win-screen h2 {
    color: #fff; /* White text */
    margin-bottom: 15px;
    font-size: 2.5em;
    text-shadow: 0 0 5px #0f0; /* Green text glow */
}

#maze-win-screen p {
    margin-bottom: 20px;
    font-size: 1.2em;
}

#maze-close-win-button {
    background-color: #009900; /* Darker green */
    color: white;
    border: 1px solid #0f0;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    /* Base styles removed as .retro-button will take over */
    /* Specific overrides for .retro-button for maze if needed can go here */
    /* e.g., if we want a slightly different color scheme for this retro button */
}

#maze-close-win-button:hover {
     /* Base styles removed as .retro-button:hover will take over */
}
/* --- End Maze Game Styles --- */

/* --- Pixel Bomb Styles --- */
.pixel-bomb {
    position: absolute;
    width: 15px; /* Slightly larger for visibility */
    height: 15px;
    background-color: #808080; /* Start grey */
    /* border-radius: 50%; */ /* Optional: make it round */
    z-index: 100; /* Above most content */
    pointer-events: none; /* Don't interfere with clicks */
    opacity: 1;
    /* Remove initial glow */
    box-shadow: 0 0 5px #ff00ff, 0 0 10px #ff00ff; /* Add a glow */
}

/* Animation for the bomb */
@keyframes pixel-bomb-drop {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(200px) scale(0.2); /* Drop down and shrink */
    }
}

.pixel-bomb.animate {
    animation: pixel-bomb-drop 0.6s ease-in forwards;
}

/* --- Particle Styles --- */
.pixel-particle {
    position: absolute;
    width: 5px; /* Smaller particles */
    height: 5px;
    /* Background color set by JS */
    z-index: 99; /* Below bomb, above most content */
    pointer-events: none;
    opacity: 1;
    border-radius: 2px; /* Slightly rounded squares */
}

/* --- Dodging Game Styles --- */
#dodging-game-container {
    /* Basic positioning/background already inline */
    /* Ensure flex properties are set if not inline */
    display: flex; /* Use flexbox for centering */
    flex-direction: column; /* Stack UI and canvas */
    justify-content: center; /* Center vertically */
    align-items: center; /* Center horizontally */
}

#dodging-canvas {
    /* Border and background were previously inline, ensure they are here or still inline */
    border: 2px solid #00ff00;
    background-color: #222;
    image-rendering: pixelated; /* Keep pixels sharp */
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* CSS Scaling for responsiveness */
    max-width: 100%;
    max-height: 100%;
    width: auto;   /* Default, overridden by JS if needed for fixed aspect ratio */
    height: auto;  /* Default, overridden by JS if needed for fixed aspect ratio */
    object-fit: contain;
    display: block;
    margin: auto;
}

#dodging-game-ui {
    /* Positioning and basic font styles inline */
    text-shadow: 1px 1px 2px #000; /* Add shadow for readability */
}

#dodging-game-over-screen {
    /* Positioning, background, font, border inline */
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.7); /* Red glow */
}

#dodging-game-over-screen h2 {
    color: #ff0000; /* Red GAME OVER text */
    margin-bottom: 15px;
    font-size: 3em;
    text-shadow: 0 0 5px #ff0000; /* Red text glow */
}

.retro-button {
    background-color: #444; /* Dark grey background */
    color: #00ff00; /* Bright green text */
    border: 2px solid #00ff00; /* Green border */
    padding: 10px 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1em;
    text-transform: uppercase;
    cursor: pointer;
    margin: 10px;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 3px 3px 0px #008800; /* Green shadow for 3D effect */
}

.retro-button:hover {
    background-color: #555;
    color: #fff; /* White text on hover */
    box-shadow: 3px 3px 0px #00ff00; /* Brighter shadow on hover */
}

.retro-button:focus-visible {
    outline: 3px solid #00ffc6;
    outline-offset: 3px;
}

.retro-button:active {
    box-shadow: 1px 1px 0px #008800; /* Press effect */
    transform: translate(2px, 2px); /* Press effect */
}
/* --- End Dodging Game Styles --- */

/* --- Smiley Wiggle Animation --- */
#easter-egg-trigger.wiggle {
    animation: wiggle 0.3s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}
/* --- End Smiley Wiggle Animation --- */

@keyframes particle-rain {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateY(150px) translateX(var(--particle-x-offset, 0px)); /* Fall down and spread slightly */
    }
}

.pixel-particle.animate {
    /* Animation duration and delay set by JS */
    animation-name: particle-rain;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}
/* --- End Pixel Bomb Styles --- */

/* --- Responsive Design Adjustments --- */

/* Mobile First - General adjustments for smaller screens */
@media (max-width: 768px) {
    body {
        padding: 10px; /* Reduce body padding */
    }

    header {
        padding: 0.8rem 0;
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 1.8em; /* Slightly smaller heading */
    }
    header p {
        font-size: 0.9em;
    }

    nav {
        padding: 0.5rem;
        margin-bottom: 15px;
    }

    nav ul li {
        display: block; /* Stack navigation links */
        margin-right: 0;
        margin-bottom: 8px; /* Add some space between stacked links */
    }

    nav ul li:last-child {
        margin-bottom: 0;
    }

    nav ul li a {
        display: block; /* Make the whole area clickable */
        padding: 8px 10px;
    }

    main {
        padding: 15px; /* Reduce padding inside main content */
        margin-left: 5px; /* Ensure some margin if body padding is very small */
        margin-right: 5px;
    }

    h2 {
        font-size: 1.5em; /* Adjust section headings */
    }

    #skills ul, #contact ul {
        margin-left: 15px; /* Reduce indent for lists */
    }

    footer {
        margin-top: 15px;
        padding: 8px;
        font-size: 0.9em;
    }

    /* Game related UI adjustments for smaller screens */
    #game-ui {
        font-size: 18px; /* Smaller score/lives text */
        top: 5px;
        left: 5px;
        right: 5px;
    }

    #game-over-screen h2 {
        font-size: 2em; /* Smaller game over heading */
    }
    #game-over-screen button {
        padding: 12px 20px;
        font-size: 1em;
    }

    #maze-win-screen h2 {
        font-size: 2em;
    }
    #maze-win-screen p {
        font-size: 1em;
    }
    #maze-close-win-button {
        padding: 10px 20px;
        font-size: 1em;
    }

    #dodging-game-over-screen h2 {
        font-size: 2.5em;
    }
    .retro-button { /* For dodging game buttons */
        padding: 8px 15px;
        font-size: 1em;
        margin: 8px;
    }
    #dodging-game-ui {
        font-size: 1.2em; /* Smaller score for dodging game */
    }

}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }
    header p {
        font-size: 0.8em;
    }

    h2 {
        font-size: 1.3em;
    }

    /* Further reduce font size for very small screens if necessary */
    body {
        font-size: 14px; /* Adjust base font size for small devices */
        line-height: 1.5;
    }

    main {
        padding: 10px;
    }
}

/* Tablet and larger screens - current styles are mostly fine, but we can ensure consistency */
@media (min-width: 769px) {
    /* Styles for tablets and desktops - most are already default */
    /* Example: ensure nav items are inline if they were changed for mobile */
    nav ul li {
        display: inline;
        margin-right: 10px;
        margin-bottom: 0; /* Reset bottom margin if added for stacked view */
    }
nav ul li a {
        display: inline-block; /* Revert if changed to block */
        padding: 5px 10px;
    }
}
/* --- End Responsive Design Adjustments --- */

/* Wormhole Canvas Styles */
body.no-js #wormhole-canvas {
    display: none;
}


body.no-js .content-section {
    display: block;
    opacity: 1;
}

body.no-js .hidden-content {
    opacity: 1;
    pointer-events: auto;
}

body.no-js #game-replay-panel {
    display: none;
}

#wormhole-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s ease-out;
    transform: scale(0.05);
    border-radius: 50%;
    transform-origin: center;
    animation: wormholeZoomIn 1.5s forwards;
}

#wormhole-canvas.fade-out {
    opacity: 0;
}

@keyframes wormholeZoomIn {
    from {
        transform: scale(0.05);
        border-radius: 50%;
        background: white;
    }
    to {
        transform: scale(1);
        border-radius: 0;
        background: black;
    }
}

/* --- Game Replay Panel Styles --- */
#game-replay-panel {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 30px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    z-index: 1500;
    transition: width 0.3s ease;
}

#game-replay-panel.expanded {
    width: 200px;
}

#game-replay-toggle {
    cursor: pointer;
    text-align: center;
    padding: 5px;
    user-select: none;
}

#found-games-list {
    list-style: none;
    margin: 0;
    padding: 10px;
    display: none;
}

#game-replay-panel.expanded #found-games-list {
    display: block;
}

#found-games-list li {
    padding: 4px 0;
    cursor: pointer;
    border-bottom: 1px solid #444;
}

#found-games-list li:hover {
    background: #333;
}
