.section-label {
    font-size: clamp(1.1rem, 5.5vw, 2.2rem);
    color: var(--text-primary);
    margin-top: 40px;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 10px var(--retro-cyan);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .section-label {
        white-space: normal;
    }
}
:root {
    --retro-purple: #9d4edd;
    --retro-blue: #3c096c;
    --retro-cyan: #00f5d4;
    --retro-green: #00ff41;
    --retro-dark: #0a0e27;
    --retro-darker: #050816;
    --retro-pink: #ff006e;
    --card-bg: rgba(61, 9, 108, 0.3);
    --border-color: #7b2cbf;
    --glow-color: rgba(0, 245, 212, 0.5);
    --text-primary: #00f5d4;
    --text-secondary: #9d4edd;
    --text-white: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

body {
    font-family: 'Share Tech Mono', monospace;
    line-height: 1.6;
    color: var(--text-white);
    background: var(--retro-darker);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "kern" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    word-spacing: -0.05em;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
    z-index: 9999;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(2px); }
}

#game-of-life-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.15;
}

code, .mono {
    font-family: 'Share Tech Mono', monospace;
}

h1, h2, h3, h4, h5, h6 {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "kern" 1;
    letter-spacing: 0.02em;
}

p, span, div {
    font-variant-numeric: tabular-nums;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
}

header {
    padding: 30px 0;
    background: var(--retro-dark);
    position: sticky;
    top: 0;
    z-index: 10000;
    border-bottom: 4px solid var(--border-color);
    box-shadow: 0 0 20px rgba(157, 76, 237, 0.5);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prevent header from being covered by content shadow by reserving space */
@media (max-width: 992px) {
    header { padding: 20px 0; }
}

.logo {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 
        0 0 10px var(--retro-cyan),
        0 0 20px var(--retro-cyan),
        0 0 30px var(--retro-cyan);
    animation: glitch 5s infinite;
    letter-spacing: 2px;
}

.logo.terminal-title {
    animation: none;
    letter-spacing: 1px;
}

.logo.terminal-title::before,
.logo.terminal-title::after {
    content: none !important;
    animation: none !important;
}

header .terminal-title {
    font-size: 2.2rem;
    margin: 0;
    gap: 8px;
}

@media (max-width: 768px) {
    header .terminal-title { font-size: 1.4rem; gap: 6px; }
}

.logo::before {
    content: '▓▒░';
    font-size: 24px;
    color: var(--retro-green);
    animation: pulse 2s infinite;
    text-shadow: 0 0 10px var(--retro-green);
}

.logo::after {
    content: '░▒▓';
    font-size: 24px;
    color: var(--retro-green);
    animation: pulse 2s infinite reverse;
    text-shadow: 0 0 10px var(--retro-green);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes glitch {
    0%, 90%, 100% { text-shadow: 0 0 10px var(--retro-cyan), 0 0 20px var(--retro-cyan); }
    92% { text-shadow: 0 0 10px var(--retro-pink), 2px 2px 0 var(--retro-cyan); }
    94% { text-shadow: 0 0 10px var(--retro-green), -2px -2px 0 var(--retro-pink); }
}

.hero {
    text-align: center;
    padding: 60px 20px 0px 20px;
    color: var(--text-white);
    position: relative;
    overflow: hidden;
}

.hero h1 { display: block; }

.terminal-title {
    font-size: 4.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-shadow:
        0 0 10px var(--retro-cyan),
        0 0 20px var(--retro-purple),
        0 0 30px var(--retro-purple),
        4px 4px 0px var(--retro-blue);
    line-height: 1.2;
    color: var(--text-primary);
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 12px;
    white-space: nowrap;
}

.terminal-title .prompt { margin-right: 8px; }
.terminal-title .cursor { margin-left: 8px; opacity: 0; }
.terminal-title .blink { animation: blink 1s step-end infinite; }
.terminal-title .typing { animation: none; }

.hero p {
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--retro-purple);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 0 0 10px rgba(157, 76, 237, 0.8);
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: center;
}

.hero .subtitle {
    font-size: 1.5rem;
    color: var(--text-white);
    max-width: 800px;
    margin: 0 auto 40px;
    line-height: 1.8;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.pixel-box {
    background: var(--card-bg);
    border: 4px solid var(--border-color);
    border-radius: 0;
    padding: 60px;
    margin: 60px 20px;
    box-shadow: 
        0 0 20px rgba(157, 76, 237, 0.5),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
    position: relative;
}

.pixel-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--retro-cyan);
    box-shadow: 0 0 10px var(--retro-cyan);
}

.pixel-box::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--retro-cyan);
    box-shadow: 0 0 10px var(--retro-cyan);
}

.mission {
    background: var(--card-bg);
    border: 4px solid var(--border-color);
    padding: 60px;
    margin: 60px 20px;
    text-align: center;
    box-shadow: 
        0 0 20px rgba(157, 76, 237, 0.5),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
    position: relative;
}

.mission::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--retro-cyan);
    box-shadow: 0 0 10px var(--retro-cyan);
}

.mission h2 {
    font-size: clamp(1.1rem, 5.5vw, 2.4rem);
    margin-bottom: 35px;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--retro-cyan),
        3px 3px 0px var(--retro-blue);
}

.mission p {
    font-size: 1.5rem;
    color: var(--text-white);
    max-width: 800px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

.mission .mission-text {
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 600;
    text-shadow: 0 0 10px var(--retro-cyan);
    border-left: 4px solid var(--retro-cyan);
    padding-left: 20px;
    margin: 30px auto 50px;
}

.theses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 50px 0;
}

.thesis {
    background: rgba(0, 0, 0, 0.5);
    padding: 30px;
    border: 3px solid var(--retro-purple);
    text-align: center;
    font-size: 1.3rem;
    color: var(--text-white);
    box-shadow: 
        0 0 15px rgba(157, 76, 237, 0.3),
        inset 0 0 15px rgba(0, 245, 212, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.thesis:hover {
    transform: translateY(-5px);
    border-color: var(--retro-cyan);
    box-shadow: 
        0 0 25px rgba(0, 245, 212, 0.6),
        inset 0 0 20px rgba(0, 245, 212, 0.2);
}

.thesis .mono {
    font-size: 2rem;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--retro-cyan);
    margin-bottom: 10px;
}

.thesis .mono::before {
    content: '[';
    margin-right: 5px;
    color: var(--retro-green);
}

.thesis .mono::after {
    content: ']';
    margin-left: 5px;
    color: var(--retro-green);
}

.benefits {
    padding: 80px 20px;
}

/* Prevent phantom inner scrolling in benefits section */
.benefits,
.benefits .container,
.benefits .benefits-grid {
    overflow: visible !important;
    overscroll-behavior: none;
}

.benefits h2 {
    text-align: center;
    font-size: clamp(1.1rem, 5.5vw, 2.4rem);
    margin-bottom: 60px;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--retro-cyan),
        3px 3px 0px var(--retro-blue);
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 35px;
}

.benefit-card {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    padding: 40px 30px;
    transition: all 0.4s ease;
    position: relative;
    box-shadow: 
        0 0 15px rgba(157, 76, 237, 0.3),
        inset 0 0 15px rgba(0, 245, 212, 0.05);
}

.benefit-card::before {
    content: '▓';
    position: absolute;
    top: 10px;
    left: 10px;
    color: var(--retro-green);
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--retro-green);
}

.benefit-card::after {
    content: '▓';
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: var(--retro-cyan);
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--retro-cyan);
}

.benefit-card:hover {
    transform: translateY(-10px);
    border-color: var(--retro-cyan);
    box-shadow: 
        0 0 30px rgba(0, 245, 212, 0.6),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
}

.benefit-card h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--retro-cyan);
    letter-spacing: 0.03em;
    line-height: 1.4;
}

.benefit-card h3 i {
    font-size: 2rem;
    margin-right: 10px;
    color: var(--retro-green);
    text-shadow: 0 0 10px var(--retro-green);
}

.benefit-card p {
    font-size: 1.3rem;
    color: var(--text-white);
    line-height: 1.7;
    letter-spacing: 0.01em;
}

.structure {
    background: var(--card-bg);
    border: 4px solid var(--border-color);
    padding: 60px;
    margin: 60px 20px;
    box-shadow: 
        0 0 20px rgba(157, 76, 237, 0.5),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
    position: relative;
}

.structure::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--retro-cyan);
    box-shadow: 0 0 10px var(--retro-cyan);
}

.structure h2 {
    text-align: center;
    font-size: clamp(1.1rem, 5.5vw, 2.4rem);
    margin-bottom: 40px;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--retro-cyan),
        3px 3px 0px var(--retro-blue);
}

.structure-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.9;
    color: var(--text-white);
    font-size: 1.4rem;
}

/* Lists inside content (used on rules page) */
.structure-content ol {
    padding-left: 1.4rem; /* indent first-level markers */
}
.structure-content li {
    margin: 12px 0 18px 0; /* space between first-level items */
}
.structure-content li p { margin: 8px 0; }

.structure-content p {
    margin-bottom: 25px;
}

.resources {
    padding: 80px 20px;
    text-align: center;
}

.resources h2 {
    font-size: clamp(1.1rem, 5.5vw, 2.4rem);
    margin-bottom: 60px;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--retro-cyan),
        3px 3px 0px var(--retro-blue);
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 35px;
    max-width: 1000px;
    margin: 0 auto 50px;
}

.resource-card {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    padding: 40px 25px;
    transition: all 0.3s ease;
    box-shadow: 
        0 0 15px rgba(157, 76, 237, 0.3),
        inset 0 0 15px rgba(0, 245, 212, 0.05);
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.resource-card::before {
    content: '░▒▓';
    position: absolute;
    top: 5px;
    right: 10px;
    color: var(--retro-purple);
    font-size: 1rem;
    opacity: 0.5;
}

.resource-card:hover {
    transform: translateY(-5px);
    border-color: var(--retro-cyan);
    box-shadow: 
        0 0 30px rgba(0, 245, 212, 0.6),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
    text-decoration: none;
    color: inherit;
}

.resource-card h3 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--retro-cyan);
}

.resource-card h3 i {
    margin-right: 10px;
    color: var(--retro-green);
    text-shadow: 0 0 10px var(--retro-green);
}

.resource-card p {
    font-size: 1.3rem;
    color: var(--text-white);
    line-height: 1.7;
}

.resource-card:active {
    transform: translateY(-2px);
}

.resource-card:focus {
    outline: 2px solid var(--retro-cyan);
    outline-offset: 2px;
}

.cta {
    background: var(--card-bg);
    border: 4px solid var(--border-color);
    padding: 70px;
    margin: 60px 20px;
    text-align: center;
    box-shadow: 
        0 0 20px rgba(157, 76, 237, 0.5),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
    position: relative;
}

.cta::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--retro-cyan);
    box-shadow: 0 0 10px var(--retro-cyan);
}

.cta h2 {
    font-size: clamp(1.1rem, 5.5vw, 2.4rem);
    margin-bottom: 30px;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--retro-cyan),
        3px 3px 0px var(--retro-blue);
}

.cta p {
    font-size: 1.4rem;
    color: var(--text-white);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

.btn {
    display: inline-block;
    padding: 18px 45px;
    background: var(--retro-purple);
    color: var(--text-primary);
    text-decoration: none;
    border: 3px solid var(--retro-cyan);
    font-weight: 700;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    margin: 15px;
    cursor: pointer;
    box-shadow: 
        0 0 20px rgba(0, 245, 212, 0.5),
        inset 0 0 10px rgba(0, 245, 212, 0.1);
    text-shadow: 0 0 10px var(--retro-cyan);
    font-family: 'Share Tech Mono', monospace;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn::before {
    content: '▶ ';
    margin-right: 10px;
}

.btn::after {
    content: ' ◀';
    margin-left: 10px;
}

.btn:hover {
    transform: translateY(-3px);
    background: var(--retro-cyan);
    color: var(--retro-darker);
    box-shadow: 
        0 0 30px rgba(0, 245, 212, 0.8),
        inset 0 0 15px rgba(157, 76, 237, 0.2);
    text-shadow: 0 0 10px var(--retro-purple);
}

.btn:active {
    transform: translateY(-1px);
}

.btn.secondary {
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid var(--retro-purple);
    color: var(--retro-purple);
    box-shadow: 
        0 0 15px rgba(157, 76, 237, 0.5),
        inset 0 0 10px rgba(157, 76, 237, 0.1);
    text-shadow: 0 0 10px var(--retro-purple);
}

.btn.secondary:hover {
    background: var(--retro-purple);
    color: var(--text-primary);
    border-color: var(--retro-cyan);
    box-shadow: 
        0 0 25px rgba(157, 76, 237, 0.8),
        inset 0 0 15px rgba(0, 245, 212, 0.2);
}

.companies {
    padding: 80px 20px;
    text-align: center;
}

.companies h2 {
    font-size: clamp(1.1rem, 5.5vw, 2.4rem);
    margin-bottom: 40px;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--retro-cyan),
        3px 3px 0px var(--retro-blue);
}

/* Allow wrapping but don't break inside long words */
.mission h2, .benefits h2, .structure h2, .resources h2, .cta h2, .companies h2 {
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

.companies-content {
    max-width: 800px;
    margin: 0 auto 80px;
    line-height: 1.9;
    font-size: 1.4rem;
    color: var(--text-white);
}

.companies-content p {
    margin-bottom: 25px;
}

.companies-content .btn {
    text-align: center !important;
}

.contact {
    background: var(--card-bg);
    border: 4px solid var(--border-color);
    padding: 50px;
    margin: 60px 20px;
    text-align: center;
    box-shadow: 
        0 0 20px rgba(157, 76, 237, 0.5),
        inset 0 0 20px rgba(0, 245, 212, 0.1);
    position: relative;
}

.contact::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--retro-cyan);
    box-shadow: 0 0 10px var(--retro-cyan);
}

.contact h3 {
    font-size: 2.2rem;
    color: var(--text-primary);
    margin-bottom: 25px;
    text-shadow: 0 0 10px var(--retro-cyan);
}

.contact-info {
    font-size: 1.4rem;
    color: var(--text-white);
    margin-bottom: 0px;
}

.contact-info a {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    text-shadow: 0 0 10px var(--retro-cyan);
}

.contact-info a:hover {
    color: var(--retro-green);
    text-shadow: 0 0 15px var(--retro-green);
}

footer {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-white);
    font-size: 1.3rem;
    border-top: 4px solid var(--border-color);
    background: rgba(10, 14, 39, 0.5);
}

footer p {
    margin-bottom: 15px;
}

footer a.system-code {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    text-shadow: 0 0 10px var(--retro-cyan);
}

footer i.battle-city {
    text-shadow: 0 0 10px var(--retro-green);
    font-style: normal;
    cursor:crosshair
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* On rules page, disable scroll-triggered delay to avoid first-paint issues */
.rules-page .fade-in { opacity: 1; transform: none; }

@media (max-width: 1157px) and (min-width: 769px) {
    .thesis:nth-child(3):last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 992px) and (min-width: 769px) {
    .resource-card:nth-child(3):last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 992px) {
    .hero h1 { font-size: 3rem; }
    .hero p { font-size: 1.5rem; }
    .mission, .structure, .cta, .contact { padding: 40px 30px; }
}

@media (max-width: 768px) {
    .hero { padding: 50px 20px 0px 20px; }
    .hero h1 { font-size: 2.5rem; }
    .hero p { 
        font-size: 1.3rem;
        white-space: normal;
        word-break: keep-all;
    }
    .mission, .structure, .cta, .contact {
        padding: 30px 24px;
        margin: 40px 15px;
    }
    .structure-content ol { padding-left: 1.2rem; }
    .theses, .benefits-grid, .resources-grid {
        grid-template-columns: 1fr;
    }
    .benefit-card, .resource-card { padding: 30px 20px; }
    .btn {
        padding: 15px 30px;
        font-size: 1.2rem;
        margin: 10px 5px;
        display: block;
        margin: 15px auto;
        width: 80%;
        max-width: 300px;
    }
    .btn::before,
    .btn::after {
        content: '';
        margin: 0;
    }
    .hero p:first-of-type {
        text-align: center;
    }
    .hero .subtitle,
    .mission p,
    .structure-content,
    .companies-content,
    .cta p,
    .benefit-card p,
    .resource-card p {
        text-align: justify;
        text-justify: inter-word;
        hyphens: auto;
    }
    .mission h2,
    .benefits h2,
    .structure h2,
    .resources h2,
    .cta h2,
    .companies h2 {
        word-break: keep-all;
        overflow-wrap: normal;
    }
    .container {
        padding: 0 10px;
        max-width: 100%;
    }
    section {
        max-width: 100%;
        overflow-x: hidden;
    }

    .mission .mission-text {
        font-size: 1.5rem;
        border-left: none;
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 2rem; }
    header .terminal-title { font-size: 1.2rem; gap: 5px; }
    .mission h2, .benefits h2, .structure h2, .resources h2, .cta h2, .companies h2 {
        font-size: 2rem;
    }
    .container { padding: 0 15px; }
    .hero p:first-of-type {
        text-align: center;
    }
    .hero .subtitle,
    .mission p,
    .structure-content,
    .companies-content,
    .cta p,
    .benefit-card p,
    .resource-card p { text-align: justify; }
    .btn::before,
    .btn::after {
        content: '';
        margin: 0;
    }
}

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

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes flicker {
    0% { opacity: 1; }
    2% { opacity: 0.8; }
    4% { opacity: 1; }
    8% { opacity: 0.9; }
    10% { opacity: 1; }
    100% { opacity: 1; }
}

.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--retro-dark);
    border: 4px solid var(--border-color);
    box-shadow: 
        0 0 30px rgba(157, 76, 237, 0.8),
        inset 0 0 30px rgba(0, 245, 212, 0.1);
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: slideIn 0.4s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: var(--card-bg);
    padding: 25px 40px;
    border-bottom: 3px solid var(--retro-cyan);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header::before {
    content: '▓▒░';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--retro-green);
    font-size: 1.2rem;
    text-shadow: 0 0 10px var(--retro-green);
}

.modal-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--retro-cyan);
    margin: 0;
}

.modal-header h2 i {
    margin-right: 10px;
    color: var(--retro-green);
}

.modal-close {
    font-size: 3rem;
    font-weight: bold;
    color: var(--retro-pink);
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    text-shadow: 0 0 10px var(--retro-pink);
}

.modal-close:hover {
    color: var(--retro-cyan);
    text-shadow: 0 0 20px var(--retro-cyan);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-height: 0;
}

.carousel {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    flex: 1;
    min-height: 0;
}

.carousel-slide {
    min-width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-image-link {
    display: block;
    cursor: zoom-in;
    position: relative;
    transition: all 0.3s ease;
}

.carousel-image-link::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
    pointer-events: none;
}

.carousel-image-link:hover::after {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: auto;
    max-height: calc(90vh - 300px);
    object-fit: contain;
    display: block;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.carousel-slide iframe {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    height: auto;
    max-height: calc(90vh - 300px);
    aspect-ratio: 16/9;
    border: 2px solid var(--retro-purple);
    box-shadow: 0 0 15px rgba(157, 76, 237, 0.5);
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: block;
}

.carousel-image-link:hover img {
    transform: scale(1.02);
}

@keyframes imageGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(157, 76, 237, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 245, 212, 0.6);
    }
}

.gallery-caption {
    margin-top: 15px;
    margin-bottom: 80px;
    font-size: 1.1rem;
    color: var(--text-white);
    line-height: 1.5;
    text-align: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-left: 3px solid var(--retro-cyan);
    flex-shrink: 0;
    overflow: hidden;
}

.carousel-btn {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(157, 76, 237, 0.4);
    position: absolute;
    bottom: 10px;
    z-index: 10;
}

.carousel-btn-prev {
    left: 30px;
}

.carousel-btn-next {
    right: 30px;
}

.carousel-btn:hover {
    border-color: var(--retro-cyan);
    color: var(--retro-cyan);
    box-shadow: 0 0 25px rgba(0, 245, 212, 0.7);
    transform: scale(1.1);
}

.carousel-btn:active {
    transform: scale(0.95);
}

.carousel-btn:disabled {
    display: none;
}


.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 15px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    flex-shrink: 0;
}

.indicator {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(157, 76, 237, 0.3);
}

.indicator:hover {
    border-color: var(--retro-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.6);
    transform: scale(1.2);
}

.indicator.active {
    background: var(--retro-cyan);
    border-color: var(--retro-cyan);
    box-shadow: 0 0 20px rgba(0, 245, 212, 0.8);
}

.carousel-counter {
    text-align: center;
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--retro-cyan);
    z-index: 10;
    flex-shrink: 0;
}

.carousel-counter .current-slide {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--retro-green);
    text-shadow: 0 0 10px var(--retro-green);
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.4rem;
    }
    
    .modal-close {
        font-size: 2.5rem;
    }
    
    .modal-body {
        padding: 20px 15px;
    }
    
    .carousel-container {
        /* gap removed - buttons are now positioned absolutely inside */
        display: flex;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        bottom: 10px;
    }
    
    .carousel-btn-prev {
        left: 20px;
    }
    
    .carousel-btn-next {
        right: 20px;
    }
    
    .carousel-slide {
        padding: 15px;
    }
    
    .carousel-slide img {
        max-height: calc(95vh - 280px);
    }
    
    .carousel-slide iframe {
        max-height: calc(95vh - 280px);
    }
    
    .gallery-caption {
        font-size: 1rem;
        text-align: left;
        padding: 10px;
        margin-top: 10px;
        margin-bottom: 70px;
        line-height: 1.4;
    }
    
    .carousel-counter {
        font-size: 1.1rem;
        bottom: 35px;
    }
    
    .carousel-counter .current-slide {
        font-size: 1.3rem;
    }
    
    .carousel-indicators {
        bottom: 10px;
        gap: 12px;
    }
}

@media (orientation: portrait) and (max-width: 768px) {
    .carousel-slide img {
        max-height: calc(95vh - 280px);
    }
    
    .carousel-slide iframe {
        max-height: calc(95vh - 280px);
    }
}

@media (orientation: landscape) and (min-width: 769px) {
    .carousel-slide img {
        max-height: calc(90vh - 280px);
    }
    
    .carousel-slide iframe {
        max-height: calc(90vh - 280px);
    }
}

@media (orientation: landscape) and (max-height: 700px) {
    .modal-header {
        padding: 15px 30px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .carousel-slide {
        padding: 15px;
    }
    
    .carousel-slide img {
        max-height: calc(90vh - 250px);
    }
    
    .carousel-slide iframe {
        max-height: calc(90vh - 250px);
    }
    
    .gallery-caption {
        font-size: 1rem;
        padding: 8px;
        margin-top: 10px;
        margin-bottom: 70px;
        line-height: 1.4;
    }
    
    .carousel-counter {
        font-size: 1.1rem;
        bottom: 35px;
    }
    
    .carousel-indicators {
        bottom: 10px;
    }
}
