body {
    margin: 0;
    overflow: hidden;
    background-color: #111;
    font-family: sans-serif;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
}

#loader-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

#loader-container.hidden {
    opacity: 0;
    pointer-events: none;
}

#loader-content {
    text-align: center;
    width: 300px;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    /* Monospace for tech vibe */
}

#loader-title {
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 2rem;
    letter-spacing: 10px;
    margin-bottom: 10px;
    white-space: nowrap;
    opacity: 0.15;
}

#loading-text {
    color: white;
    font-size: 0.7rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: #ffffff;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    /* Glow effect */
}

#progress-percentage {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: bold;
}

/* Right panel: przyklejony do prawego górnego rogu, controls + terminal jedna szerokość */
#right-panel {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 280px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    z-index: 100;
    pointer-events: none;
}

#right-panel > * {
    pointer-events: auto;
}

/* Camera HUD: top-left, live coords + Free / Dynamic / Reset */
#camera-hud {
    position: fixed;
    top: 25px;
    left: 25px;
    z-index: 100;
    pointer-events: auto;
    box-sizing: border-box;
    width: 280px;
    max-width: calc(100vw - 40px);
    padding: 10px 12px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.camera-hud-title {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

.camera-hud-mode {
    font-size: 11px;
    color: rgba(200, 255, 200, 0.9);
    margin: 0;
}

.camera-hud-coords {
    margin: 0;
    padding: 0;
    font-size: 11px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.88);
    white-space: pre-wrap;
    word-break: break-all;
}

.camera-hud-coords--hidden {
    display: none;
}

#camera-hud .mode-btn {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 0.05rem 0;
    margin: 0;
    text-align: left;
    width: 100%;
    min-width: 140px;
    box-sizing: border-box;
    background: none;
    border: none;
    border-radius: 0;
    color: #4CAF50;
    cursor: pointer;
    transition: color 0.2s, text-shadow 0.2s;
}

#camera-hud .mode-btn:hover {
    color: #81C784;
    text-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    text-decoration: underline;
}

#camera-hud .mode-btn.active {
    color: #000;
    background: rgba(76, 175, 80, 0.45);
    padding: 0.05rem 0.1rem;
    margin: 0 -0.1rem 0 0;
    text-decoration: none;
    animation: term-active-strobe 2.5s ease-in-out infinite;
}

@media (max-width: 480px) {
    #camera-hud {
        width: min(260px, calc(100vw - 24px));
        top: 12px;
        left: 12px;
        padding: 8px 10px;
    }

    #camera-hud .mode-btn,
    .camera-hud-coords {
        font-size: 11px;
    }
}

/* --- Post-intro UI: hidden until camera fly-in ends, then staggered reveal --- */
:root {
    --post-intro-slide-x: 44px;
    --post-intro-menu-stagger: 52ms;
    --post-intro-menu-dur: 0.62s;
    --post-intro-ui-delay: 60ms;
    --post-intro-ui-dur: 0.52s;
    --post-intro-shell-delay: 380ms;
    --post-intro-shell-dur: 0.55s;
    --post-intro-hud-delay: 100ms;
    --post-intro-hud-dur: 0.58s;
    --post-intro-prod-delay: 240ms;
    --post-intro-prod-dur: 0.72s;
}

body.post-intro-ui-pending #camera-hud,
body.post-intro-ui-pending .prod-label,
body.post-intro-ui-pending #ui-container,
body.post-intro-ui-pending #terminal-menu .term-line,
body.post-intro-ui-pending #topkek-terminal-shell {
    opacity: 0;
    pointer-events: none;
}

body.post-intro-ui-pending #camera-hud {
    transform: translate3d(0, calc(-1 * max(120%, 6rem)), 0);
}

body.post-intro-ui-pending .prod-label {
    transform: translate3d(0, calc(100% + 12px), 0);
}

body.post-intro-ui-pending #ui-container {
    transform: translate3d(var(--post-intro-slide-x), 0, 0);
}

body.post-intro-ui-pending #terminal-menu .term-line {
    transform: translate3d(var(--post-intro-slide-x), 0, 0);
    filter: blur(0.5px);
}

body.post-intro-ui-pending #topkek-terminal-shell {
    transform: translate3d(var(--post-intro-slide-x), 0, 0);
}

body.post-intro-ui-ready #camera-hud,
body.post-intro-ui-ready #ui-container,
body.post-intro-ui-ready #terminal-menu .term-line,
body.post-intro-ui-ready #topkek-terminal-shell {
    pointer-events: auto;
}

@keyframes post-intro-slide-from-top {
    from {
        opacity: 0;
        transform: translate3d(0, calc(-1 * max(120%, 6rem)), 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes post-intro-slide-from-bottom {
    from {
        opacity: 0;
        transform: translate3d(0, calc(100% + 12px), 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes post-intro-slide-from-right {
    from {
        opacity: 0;
        transform: translate3d(var(--post-intro-slide-x), 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
        filter: blur(0);
    }
}

/* Terminal lines: slide from right + short chromatic “glitch” on entry */
@keyframes post-intro-menu-line-glitch {
    0% {
        opacity: 0;
        transform: translate3d(var(--post-intro-slide-x), 0, 0);
        text-shadow:
            3px 0 rgba(255, 0, 255, 0.55),
            -3px 0 rgba(0, 255, 255, 0.5);
        filter: blur(1px);
    }
    12% {
        opacity: 0.95;
        transform: translate3d(-3px, 0, 0);
        text-shadow:
            -2px 0 rgba(255, 0, 255, 0.45),
            2px 0 rgba(0, 255, 255, 0.4);
        filter: blur(0.3px);
    }
    26% {
        transform: translate3d(2px, 0, 0);
        text-shadow:
            2px 0 rgba(0, 255, 170, 0.35),
            -1px 0 rgba(255, 100, 200, 0.3);
    }
    42% {
        transform: translate3d(-1px, 0, 0);
        text-shadow: 1px 0 rgba(76, 175, 80, 0.4);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
        text-shadow: none;
        filter: none;
    }
}

body.post-intro-ui-ready #camera-hud {
    animation: post-intro-slide-from-top var(--post-intro-hud-dur) cubic-bezier(0.22, 1, 0.36, 1) var(--post-intro-hud-delay) forwards;
}

body.post-intro-ui-ready .prod-label {
    animation: post-intro-slide-from-bottom var(--post-intro-prod-dur) cubic-bezier(0.22, 1, 0.36, 1) var(--post-intro-prod-delay) forwards;
}

body.post-intro-ui-ready #ui-container {
    animation: post-intro-slide-from-right var(--post-intro-ui-dur) cubic-bezier(0.22, 1, 0.36, 1) var(--post-intro-ui-delay) forwards;
}

body.post-intro-ui-ready #topkek-terminal-shell {
    animation: post-intro-slide-from-right var(--post-intro-shell-dur) cubic-bezier(0.22, 1, 0.36, 1) var(--post-intro-shell-delay) forwards;
}

body.post-intro-ui-ready #terminal-menu .term-line {
    animation: post-intro-menu-line-glitch var(--post-intro-menu-dur) cubic-bezier(0.33, 1, 0.48, 1) calc(var(--post-intro-line-index, 0) * var(--post-intro-menu-stagger)) forwards;
}

@media (prefers-reduced-motion: reduce) {
    body.post-intro-ui-pending #camera-hud,
    body.post-intro-ui-pending .prod-label,
    body.post-intro-ui-pending #ui-container,
    body.post-intro-ui-pending #terminal-menu .term-line,
    body.post-intro-ui-pending #topkek-terminal-shell {
        opacity: 1;
        transform: none;
        filter: none;
        pointer-events: auto;
    }

    body.post-intro-ui-ready #camera-hud,
    body.post-intro-ui-ready .prod-label,
    body.post-intro-ui-ready #ui-container,
    body.post-intro-ui-ready #terminal-menu .term-line,
    body.post-intro-ui-ready #topkek-terminal-shell {
        animation: none;
        opacity: 1;
        transform: none;
        filter: none;
    }
}

#ui-container {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.controls-category-title {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2px;
}

.controls-category-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Right-panel controls: wygląd jak linki w terminal-menu (zielony tekst) */
#right-panel .mode-btn {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 0.05rem 0;
    margin: 0;
    text-align: left;
    width: 100%;
    min-width: 140px;
    box-sizing: border-box;
    background: none;
    border: none;
    border-radius: 0;
    color: #4CAF50;
    cursor: pointer;
    transition: color 0.2s, text-shadow 0.2s;
}

#right-panel .mode-btn:hover {
    color: #81C784;
    text-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    text-decoration: underline;
}

#right-panel .mode-btn.active {
    color: #000;
    background: rgba(76, 175, 80, 0.45);
    padding: 0.05rem 0.1rem;
    margin: 0 -0.1rem 0 0;
    text-decoration: none;
    animation: term-active-strobe 2.5s ease-in-out infinite;
}

@keyframes term-active-strobe {
    0%, 100% { background-color: rgba(76, 175, 80, 0.38); }
    50%      { background-color: rgba(76, 175, 80, 0.55); }
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    cursor: pointer;
    font-family: sans-serif;
    font-size: 14px;
    transition: all 0.3s;
    border-radius: 4px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.8);
    color: black;
    border-color: white;
}

.mobile-info {
    position: absolute;
    bottom: 5px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    pointer-events: none;
    z-index: 99;
}

#mobile-letters-container {
    position: absolute;
    bottom: 80px;
    /* Above the mode buttons */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.letter-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-family: sans-serif;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter-btn:active,
.letter-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    color: black;
    border-color: white;
}

/* Production Label */
.prod-label {
    position: absolute;
    bottom: 25px;
    left: 25px;
    /* Position to the left */
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 1px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 4px;
}

/* APPSTAIN Modal – tło tlo.jpg */
#appstain-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#appstain-modal.hidden {
    display: none;
}

/* Pojawianie się modalu */
#appstain-modal:not(.hidden) {
    animation: appstain-modal-fadeIn 0.35s ease-out forwards;
}

#appstain-modal.appstain-modal-closing {
    animation: appstain-modal-fadeOut 0.25s ease-in forwards;
}

@keyframes appstain-modal-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes appstain-modal-fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

#appstain-backdrop {
    position: absolute;
    inset: 0;
    background: url('ASSETS/APPSTAIN/tlo.jpg') center / cover no-repeat;
}

#appstain-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    pointer-events: none;
}

#appstain-content {
    position: relative;
    z-index: 1;
    background: rgba(20, 22, 30, 0.95);
    padding: 28px 32px 32px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
    width: 58.5%;
    max-width: 598px;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.6) rgba(255, 255, 255, 0.06);
}

#appstain-content::-webkit-scrollbar {
    width: 6px;
}

#appstain-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}

#appstain-content::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.55);
    border-radius: 3px;
}

#appstain-content::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.85);
}

#appstain-content .close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 18px;
}

#appstain-content .close-btn:hover {
    color: white;
}

/* Logo & banners */
.appstain-logo {
    display: block;
    max-width: 80%;
    height: auto;
    margin: 0 auto 12px;
}

.appstain-banners {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px;
    margin-bottom: 20px;
}

.appstain-banner {
    max-width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}

/* Generic card box */
.appstain-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 14px 16px;
}

/* Section wrapper with heading + card interior */
.appstain-section-box {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
}

.appstain-section-title {
    color: rgba(212, 175, 55, 0.95);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 0 0 14px;
    text-align: left;
}

/* Trump head above intro card – centered, slightly larger */
#appstain-content .appstain-trump-widget.topkek-character-container {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 auto 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100px;
    overflow: visible;
}

#appstain-content .appstain-trump-widget .topkek-character-head {
    width: 100px;
    height: 100px;
}

/* Speech bubble directly below head, centered, floats over modal content */
#appstain-content .appstain-trump-widget .topkek-speech-bubble {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    width: 260px;
    z-index: 50;
    animation: appstain-bubbleAppear 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes appstain-bubbleAppear {
    from {
        opacity: 0;
        transform: scale(0.7) translateX(-50%);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(-50%);
    }
}

.appstain-intro-card {
    margin-bottom: 16px;
    text-align: center;
}

.appstain-intro {
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

/* Tutorial: one-line info + two quest thumbnails */
.appstain-quest-intro {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 12px;
}

.appstain-quest-thumbs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.appstain-quest-thumbs .appstain-quest-img {
    flex-shrink: 0;
    width: 160px;
    max-width: 160px;
    height: auto;
    border-radius: 8px;
    display: block;
    object-fit: cover;
}

/* Video */
.appstain-video-wrap {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.appstain-video {
    flex-shrink: 0;
    width: 55%;
    max-width: 440px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: block;
}

.appstain-caption-card {
    flex: 1;
    min-width: 0;
}

.appstain-video-caption {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-style: italic;
    margin: 0;
    line-height: 1.5;
}

/* Audio – custom player (native audio hidden) */
#appstain-audio-el {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.appstain-audio-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.appstain-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.appstain-audio-btn {
    flex-shrink: 0;
    background: rgba(212, 175, 55, 0.25);
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.appstain-audio-btn:hover {
    background: rgba(212, 175, 55, 0.4);
    border-color: rgba(212, 175, 55, 0.7);
}

.appstain-audio-btn.playing {
    background: rgba(212, 175, 55, 0.35);
}

.appstain-audio-progress-wrap {
    flex: 1;
    min-width: 120px;
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.appstain-audio-seek {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.appstain-audio-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: rgba(212, 175, 55, 0.7);
    border-radius: 3px;
    pointer-events: none;
}

.appstain-audio-time {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-family: monospace;
}

.appstain-audio-caption {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    margin: 0;
}

/* Range input styling for Firefox (thumb visible when used) */
.appstain-audio-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.9);
    cursor: pointer;
}
.appstain-audio-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.9);
    border: none;
    cursor: pointer;
}

/* Screenshots grid */
.appstain-screenshots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.appstain-screenshot {
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: block;
    cursor: pointer;
    transition: border-color 0.15s;
}

.appstain-screenshot:hover {
    border-color: rgba(212, 175, 55, 0.6);
}

/* Alpha / version card */
.appstain-alpha-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
}

.appstain-alpha-badge {
    color: rgba(212, 175, 55, 0.95);
    font-size: 13px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.appstain-alpha-detail {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    margin: 0;
    line-height: 1.4;
}

/* Riddle / password section */
.appstain-riddle {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.appstain-riddle-question {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px;
}

#appstain-content #appstain-password {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 14px;
    width: 100%;
    max-width: 260px;
    margin-bottom: 12px;
    border-radius: 6px;
    font-family: monospace;
    text-align: center;
    box-sizing: border-box;
}

#appstain-content #appstain-password:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
}

#appstain-content #appstain-submit {
    margin-bottom: 8px;
}

.appstain-error {
    color: #e57373;
    font-size: 13px;
    margin: 0;
    display: none;
}

.appstain-error.visible {
    display: block;
}

@media (max-width: 640px) {
    .appstain-quest-thumbs {
        flex-direction: column;
        align-items: center;
    }
    .appstain-quest-thumbs .appstain-quest-img {
        max-width: 100%;
        width: 100%;
    }
    .appstain-section-title {
        text-align: center;
    }
    .appstain-video-wrap {
        flex-direction: column;
    }
    .appstain-video {
        width: 100%;
        max-width: 100%;
    }
    .appstain-audio-player {
        flex-wrap: wrap;
    }
    .appstain-alpha-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .appstain-screenshots {
        grid-template-columns: repeat(2, 1fr);
    }
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 16px;
}


/* Terminal Menu (inside #right-panel, ta sama szerokość – w przepływie panelu, nie na dole ekranu) */
#right-panel #terminal-menu {
    position: static;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
    z-index: 100;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 4px;
}

.term-line {
    margin-bottom: 2px;
    pointer-events: auto;
}

.interactive-term-line {
    color: #4CAF50;
    /* Terminal Green */
    cursor: pointer;
    transition: color 0.2s, text-shadow 0.2s;
}

.interactive-term-line:hover {
    color: #81C784;
    text-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    text-decoration: underline;
}

#term-anim-portfolio.portfolio-active,
#term-vajbuj.vajbuj-active {
    background: rgba(76, 175, 80, 0.25);
    border-radius: 4px;
}

/* Shared: Glitch Lab & GENIMG modals */
.portfolio-modal-box {
    position: relative;
    z-index: 1;
    background: #111;
    border: 1px solid #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
    border-radius: 6px;
}

.portfolio-modal-title {
    margin: 0 0 20px 0;
    font-size: 22px;
    color: #4CAF50;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
    padding-bottom: 8px;
}

/* Glitch Lab Modal */
#glitch-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    font-family: 'Courier New', monospace;
}

#glitch-modal.hidden {
    display: none;
}

#glitch-backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

#glitch-content {
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: #4CAF50 #111;
}

#glitch-content .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

.glitch-lang-row {
    padding: 0 0 12px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
}

#lang-toggle {
    color: white;
    font-weight: bold;
    cursor: default;
}

.lang-opt {
    color: #555;
    cursor: pointer;
    transition: color 0.3s;
}

.lang-opt.active {
    color: #4CAF50;
}

.lang-opt:hover {
    color: white;
}

#glitch-body {
    padding: 0;
}

#glitch-img-container {
    width: 100%;
    max-height: 320px;
    overflow: hidden;
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 4px;
    background: #000;
    margin-bottom: 24px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#glitch-img-container:hover {
    border-color: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
}

.glitch-hero-img {
    width: 100%;
    height: 100%;
    max-height: 320px;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}

#glitch-img-container:hover .glitch-hero-img {
    opacity: 0.92;
}

#glitch-content::-webkit-scrollbar {
    width: 10px;
}

#glitch-content::-webkit-scrollbar-track {
    background: #111;
}

#glitch-content::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border: 1px solid #111;
}

#glitch-content::-webkit-scrollbar-thumb:hover {
    background: #66BB6A;
}

/* Image Viewer (Lightbox) */
#image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    cursor: zoom-out;
}

#image-viewer.hidden {
    display: none;
}

#image-viewer img {
    max-width: 95%;
    max-height: 95%;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

#glitch-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(76, 175, 80, 0.25);
    text-align: center;
}

#glitch-repo-btn {
    background: transparent;
    border: 1px solid #4CAF50;
    color: #4CAF50;
    padding: 10px 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
}

#glitch-repo-btn:hover {
    background: rgba(76, 175, 80, 0.1);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    color: white;
}

/* GENIMG Modal */
#genimg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    font-family: 'Courier New', monospace;
}

#genimg-modal.hidden {
    display: none;
}

#genimg-backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

#genimg-content {
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: #4CAF50 #111;
}

#genimg-content .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

.genimg-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.genimg-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.genimg-thumb:hover {
    border-color: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
}

.genimg-md {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.6;
}

.genimg-md h1 {
    color: #4CAF50;
    font-size: 20px;
    margin: 0 0 16px 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
    padding-bottom: 8px;
}

.genimg-md h2 {
    color: #81C784;
    font-size: 17px;
    margin: 18px 0 10px 0;
}

.genimg-md h3 {
    color: #4CAF50;
    font-size: 18px;
    margin: 0 0 12px 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
    padding-bottom: 8px;
}

.genimg-md h4 {
    color: #81C784;
    font-size: 15px;
    margin: 16px 0 8px 0;
}

.genimg-md p {
    margin: 0 0 10px 0;
}

.genimg-md ul {
    margin: 0 0 12px 0;
    padding-left: 22px;
}

.genimg-md li {
    margin-bottom: 6px;
}

.genimg-md code {
    background: rgba(76, 175, 80, 0.15);
    color: #81C784;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

/* Portfolio Vimeo Modal */
#portfolio-vimeo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2200;
    font-family: 'Courier New', monospace;
}

#portfolio-vimeo-modal.hidden {
    display: none;
}

#portfolio-vimeo-backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

#portfolio-vimeo-content {
    position: relative;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 90vw;
    max-width: 960px;
    max-height: 90vh;
    padding: 18px 18px 24px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
}

#portfolio-vimeo-content .close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
}

.portfolio-vimeo-aspect {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
    border-radius: 4px;
}

.portfolio-vimeo-aspect iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Portfolio Detail Modal (per-animation) */
.portfolio-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2150;
    font-family: 'Courier New', monospace;
}

.portfolio-detail-modal.hidden {
    display: none;
}

.portfolio-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.portfolio-detail-content {
    position: relative;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 90vw;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 24px 32px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
}

.portfolio-detail-title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
}

.portfolio-detail-description {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

.portfolio-detail-gallery {
    margin-bottom: 20px;
}

.portfolio-detail-typography {
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.portfolio-detail-content .close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
}

.portfolio-detail-content .button-primary {
    margin-top: 8px;
}

.genimg-md hr {
    border: none;
    border-top: 1px solid rgba(76, 175, 80, 0.25);
    margin: 20px 0;
}

#genimg-content::-webkit-scrollbar {
    width: 10px;
}

#genimg-content::-webkit-scrollbar-track {
    background: #111;
}

#genimg-content::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border: 1px solid #111;
}

#genimg-content::-webkit-scrollbar-thumb:hover {
    background: #66BB6A;
}

/* SCNDBREJN Modal */
#scndbrejn-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    font-family: 'Courier New', monospace;
}

#scndbrejn-modal.hidden {
    display: none;
}

#scndbrejn-backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

#scndbrejn-content {
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: #4CAF50 #111;
}

#scndbrejn-content .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
}

#scndbrejn-content::-webkit-scrollbar {
    width: 10px;
}

#scndbrejn-content::-webkit-scrollbar-track {
    background: #111;
}

#scndbrejn-content::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border: 1px solid #111;
}

#scndbrejn-content::-webkit-scrollbar-thumb:hover {
    background: #66BB6A;
}

/* Custom Text Modal */
#custom-text-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#custom-text-modal.hidden {
    display: none;
}

#custom-text-content {
    background: #222;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    text-align: center;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#custom-text-content h2 {
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

#custom-text-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px;
    width: 100%;
    border-radius: 4px;
    font-family: monospace;
    text-align: center;
    font-size: 20px;
    text-transform: uppercase;
    box-sizing: border-box;
    /* Ensure padding doesn't overflow width */
}

#custom-text-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

.modal-buttons {
    display: flex;
    justify-content: center;
}

#custom-text-submit {
    width: 100%;
    margin-top: 10px;
}

/* TOPKEK command console (bottom of #right-panel) */
.topkek-terminal-shell {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(200, 255, 200, 0.9);
    background: #0a0a0a;
    border: 1px solid #4CAF50;
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.15);
    pointer-events: auto;
}

.topkek-terminal-shell-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(76, 175, 80, 0.75);
    margin-bottom: 6px;
}

.topkek-terminal-log {
    max-height: 140px;
    overflow-y: auto;
    margin-bottom: 6px;
    padding: 4px 2px;
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.45);
    line-height: 1.35;
    word-break: break-word;
}

.topkek-terminal-log-line {
    margin: 0 0 2px 0;
    white-space: pre-wrap;
}

.topkek-terminal-log-line.topkek-terminal-welcome {
    color: rgba(129, 199, 132, 0.85);
}

.topkek-terminal-log-line.topkek-terminal-err {
    color: #ff8a80;
}

.topkek-terminal-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topkek-terminal-prompt {
    color: #4CAF50;
    flex-shrink: 0;
    user-select: none;
}

.topkek-terminal-input {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(76, 175, 80, 0.4);
    border-radius: 2px;
    padding: 4px 6px;
    outline: none;
}

.topkek-terminal-input:focus {
    border-color: #81C784;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.25);
}
