/* ==========================================================================
   ABOUTYOU SPACE - 8-Bit NES / Rockman Theme Styling
   ========================================================================== */

/* --- Custom Retro Variables --- */
:root {
    --font-pixel: 'Press Start 2P', monospace;
    
    /* NES Classic Colors */
    --color-black: #000000;
    --color-white: #ffffff;
    --color-nes-blue: #0070ec;
    --color-nes-cyan: #00a8f8;
    --color-nes-sky: #3c9cf8;
    --color-nes-yellow: #f8b800;
    --color-nes-pink: #f878f8;
    --color-nes-grey: #808080;
    --color-nes-lightgrey: #c0c0c0;
    --color-nes-darkblue: #002080;

    --border-pixel-white: 4px solid var(--color-white);
    --border-pixel-black: 4px solid var(--color-black);
    --border-pixel-blue: 4px solid var(--color-nes-blue);
    
    --shadow-pixel: 6px 6px 0px var(--color-black);
    --shadow-pixel-cyan: 0 0 12px var(--color-nes-cyan);
}

/* --- Base & Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated; /* Retro pixel alignment */
}

body {
    font-family: var(--font-pixel);
    background-color: var(--color-black);
    color: var(--color-white);
    overflow-x: hidden;
    line-height: 1.8;
    font-size: 12px;
}

/* --- Starfield Background Animation --- */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle, var(--color-nes-darkblue) 0%, var(--color-black) 100%);
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: var(--color-white);
    opacity: 0.8;
}

/* --- Header HUD Panel --- */
.hud-header {
    background-color: var(--color-black);
    border-bottom: 8px double var(--color-white);
    padding: 1.5rem 0;
    position: relative;
    z-index: 100;
}

.hud-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.hud-logo {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-white);
    text-shadow: 4px 4px 0px var(--color-nes-blue);
    letter-spacing: -0.05em;
}

.hud-logo:hover {
    color: var(--color-nes-cyan);
}

.hud-navigation {
    display: flex;
    gap: 1.8rem;
}

.hud-nav-link {
    font-size: 0.75rem;
    color: var(--color-nes-grey);
    text-decoration: none;
    transition: var(--color-nes-cyan) 0.2s;
    position: relative;
}

.hud-nav-link:hover,
.hud-nav-link.active {
    color: var(--color-nes-cyan);
}

.hud-nav-link.active::before {
    content: '▶';
    position: absolute;
    left: -15px;
    color: var(--color-nes-yellow);
    font-size: 0.65rem;
    top: 1px;
}

.hud-score-board {
    display: flex;
    gap: 2.5rem;
}

.hud-score-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hud-label {
    color: var(--color-nes-grey);
    font-size: 0.65rem;
}

.hud-value {
    font-size: 1rem;
}

.text-blue {
    color: var(--color-nes-cyan);
}

.text-cyan {
    color: var(--color-nes-cyan);
}

.text-yellow {
    color: var(--color-nes-yellow);
}

.text-green {
    color: #00e550;
}

/* Sound Button HUD */
.sound-toggle {
    background-color: var(--color-black);
    color: var(--color-white);
    border: 4px solid var(--color-white);
    padding: 0.6rem 1rem;
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 4px 4px 0px var(--color-nes-blue);
    transition: transform 0.1s;
}

.sound-toggle:active {
    transform: translate(4px, 4px);
    box-shadow: none;
}

.sound-toggle:hover {
    background-color: var(--color-nes-blue);
}

.hidden {
    display: none !important;
}

/* --- Viewport Wrapper --- */
.viewport-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* --- Stage Select Section --- */
.stage-select-section {
    text-align: center;
    margin-bottom: 3.5rem;
}

.stage-select-title {
    font-size: 1.8rem;
    margin-bottom: 3rem;
    letter-spacing: 0.05em;
    text-shadow: 6px 6px 0px var(--color-nes-blue);
}

/* 3x3 Stage Grid Layout */
.stage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 2rem;
    max-width: 720px;
    margin: 0 auto;
}

.stage-cell {
    background-color: var(--color-black);
    border: 6px solid var(--color-nes-grey);
    padding: 1.5rem 1rem 1rem 1rem;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: border-color 0.2s;
}

.stage-cell.locked {
    cursor: not-allowed;
    opacity: 0.45;
}

.stage-cell.locked:hover {
    border-color: var(--color-nes-grey);
}

.stage-cell.active:hover, 
.stage-cell.upcoming:hover, 
.stage-cell.development:hover,
.stage-cell.center-profile:hover {
    border-color: var(--color-white);
    animation: flashBorder 0.4s infinite;
}

.cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.pixel-avatar {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    background-color: var(--color-black);
}

.pixel-svg {
    width: 100%;
    height: 100%;
}

.pixel-lock {
    font-size: 1.5rem;
    color: var(--color-nes-grey);
}

.stage-name {
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.4;
    word-break: break-word;
}

/* Animations for active cells */
@keyframes flashBorder {
    0% { border-color: var(--color-white); }
    50% { border-color: var(--color-nes-cyan); }
    100% { border-color: var(--color-white); }
}

.select-glowing {
    animation: pulseIcon 1.5s infinite alternate;
}

.center-avatar-glow {
    animation: pulseIconCenter 1s infinite alternate;
}

@keyframes pulseIcon {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--color-nes-cyan)); }
    100% { transform: scale(1.08); filter: drop-shadow(0 0 10px var(--color-nes-cyan)); }
}

@keyframes pulseIconCenter {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--color-nes-pink)); }
    100% { transform: scale(1.05); filter: drop-shadow(0 0 8px var(--color-nes-pink)); }
}

/* --- Retro Pixel Panel (Boss Intro Screen) --- */
.boss-intro-container {
    margin-bottom: 3.5rem;
}

.pixel-panel {
    background-color: var(--color-black);
    border: 6px solid var(--color-white);
    outline: 6px solid var(--color-black);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-pixel);
    padding: 2.2rem;
    position: relative;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.panel-decor-lines {
    flex-grow: 1;
    height: 12px;
    background: repeating-linear-gradient(
        to bottom,
        var(--color-white),
        var(--color-white) 4px,
        transparent 4px,
        transparent 8px
    );
}

.panel-title {
    font-size: 1.2rem;
    text-align: center;
    color: var(--color-nes-yellow);
    white-space: nowrap;
}

.panel-body {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 2.5rem;
    align-items: flex-start;
}

/* Energy Bars (Retro Vertical Health Bar) */
.status-bars {
    display: flex;
    gap: 1.8rem;
}

.energy-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.energy-label {
    font-size: 0.6rem;
    font-weight: bold;
    color: var(--color-white);
}

.energy-bar {
    width: 22px;
    height: 140px;
    border: 3px solid var(--color-white);
    background-color: var(--color-black);
    display: flex;
    flex-direction: column-reverse;
    padding: 2px;
    gap: 2px;
}

.bar-chunk {
    width: 100%;
    height: 6px;
    background-color: var(--color-black);
}

.bar-chunk.active {
    background-color: var(--color-nes-yellow);
}

.bar-chunk.active.cyan {
    background-color: var(--color-nes-cyan);
}

/* Stage Information Details */
.stage-info-content {
    font-size: 0.85rem;
    line-height: 2;
    color: var(--color-nes-lightgrey);
    min-height: 120px;
}

.stage-info-content h3 {
    color: var(--color-white);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.stage-tech-list {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.retro-tag {
    background-color: var(--color-nes-darkblue);
    border: 2px solid var(--color-nes-cyan);
    padding: 0.4rem 0.8rem;
    font-size: 0.65rem;
    color: var(--color-white);
}

.panel-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
    border-top: 4px dashed var(--color-nes-grey);
    padding-top: 1.5rem;
}

/* Retro Play / CTA Button */
.btn-pixel {
    background-color: var(--color-nes-blue);
    color: var(--color-white);
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    padding: 0.8rem 1.6rem;
    border: 4px solid var(--color-white);
    box-shadow: 4px 4px 0px var(--color-black);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
}

.btn-pixel:hover {
    background-color: var(--color-nes-cyan);
}

.btn-pixel:active {
    transform: translate(4px, 4px);
    box-shadow: none;
}

.btn-pixel-disabled {
    background-color: var(--color-nes-grey);
    color: var(--color-nes-lightgrey);
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    padding: 0.8rem 1.6rem;
    border: 4px solid var(--color-nes-lightgrey);
    box-shadow: 4px 4px 0px var(--color-black);
    cursor: not-allowed;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

/* --- Retro Console Shell Section --- */
.retro-console-section {
    margin-bottom: 2rem;
}

.console-box {
    border: 4px solid var(--color-nes-blue);
    background-color: var(--color-black);
}

.console-box-header {
    background-color: var(--color-nes-blue);
    color: var(--color-white);
    padding: 0.6rem 1rem;
    font-size: 0.7rem;
    display: flex;
    justify-content: space-between;
}

.console-box-body {
    padding: 1.25rem;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.console-line {
    margin-bottom: 0.6rem;
    color: var(--color-nes-lightgrey);
}

.prompt {
    color: var(--color-nes-yellow);
    margin-right: 0.4rem;
}

.blink {
    animation: blinkText 1s infinite;
}

.cursor-blink {
    animation: blinkText 0.8s infinite steps(2);
}

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

/* --- AI Operators Section & Grid --- */
.operators-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 1.5rem;
    max-width: 480px; /* Restrict grid width to match NES Stage Select proportions */
    margin: 3rem auto;
}

.operator-card {
    background-color: var(--color-black);
    border: 6px solid var(--color-nes-grey);
    padding: 1.5rem 1rem 1.25rem 1rem;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: border-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.operator-card:hover {
    border-color: var(--color-white);
    animation: flashBorder 0.4s infinite;
}

.operator-avatar {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background-color: var(--color-black);
}

.operator-role {
    font-size: 0.55rem; /* Very compact retro text for positions */
    color: var(--color-nes-grey);
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.4;
    word-break: break-word;
}

.back-action-container {
    text-align: center;
    margin-top: 3.5rem;
}

/* --- Footer NES Style --- */
.nes-footer {
    border-top: 8px double var(--color-white);
    background-color: var(--color-black);
    padding: 2.5rem 0;
    margin-top: 4rem;
}

.footer-retro-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-copyright {
    font-size: 0.65rem;
    color: var(--color-nes-grey);
}

.footer-links-retro {
    display: flex;
    gap: 2rem;
}

.retro-link {
    font-size: 0.7rem;
    color: var(--color-nes-cyan);
    text-decoration: underline;
}

.retro-link:hover {
    color: var(--color-white);
}

/* --- Responsive Layout Adjustments --- */
@media (max-width: 800px) {
    .stage-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .panel-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .status-bars {
        justify-content: center;
    }

    .operators-grid {
        grid-template-columns: 1fr;
        max-width: 260px; /* Stack single column neatly on mobile */
    }
}

@media (max-width: 600px) {
    html {
        font-size: 11px;
    }
    
    .hud-container {
        flex-direction: column;
        text-align: center;
    }
    
    .hud-navigation {
        justify-content: center;
        width: 100%;
        margin-top: 0.5rem;
    }

    .footer-retro-container {
        flex-direction: column;
        text-align: center;
        gap: 1.25rem;
    }
}
