:root {
    --ps2-blue: #003399;
    --ps2-black: #050505;
    --text-glow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.4);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Optional: Hide cursor globally later, but keep for dev */
}

html,
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    background-color: var(--ps2-black);
    color: white;
    font-family: 'Arial', sans-serif;
}

/* Add this to the top of your styles.css */
@font-face {
    font-family: 'BTSE PS2';
    src: url('../fonts/btseps2.TTF') format('truetype');
    /* Adjust extension if .otf or .woff */
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Emotion Engine';
    src: url('../fonts/EmotionEngine-8ynA.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* =========================================
   THE GRIT: CRT TV Grain & Scanlines
   ========================================= */
.crt-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.crt-scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    opacity: 0.4;
}

/* =========================================
   BOOT SEQUENCE STYLES
   ========================================= */
#boot-container {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

#boot-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.intro-skip-hint {
    position: fixed;
    right: 28px;
    bottom: 24px;
    z-index: 25;
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(210, 220, 245, 0.58);
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(0.72rem, 1vw, 0.9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0;
    text-shadow:
        0 0 8px rgba(120, 170, 255, 0.22),
        0 0 18px rgba(120, 170, 255, 0.12);
    transition:
        opacity 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.intro-skip-hint:hover {
    color: rgba(235, 240, 255, 0.82);
    opacity: 0.75 !important;
}

.intro-skip-hint:active {
    transform: scale(0.96);
}

/* =========================================
   LEGAL WARNING SCREEN
   ========================================= */
#legal-warning {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: black;
    color: #ccc;
    font-family: 'Helvetica', 'Arial', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 10%;
    opacity: 0;
}
.warning-title {
    color: #d22; /* Aggressive Red */
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 25px;
    letter-spacing: 2px;
}
#legal-warning p {
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
    margin-bottom: 12px;
    line-height: 1.5;
    max-width: 800px;
}

/* =========================================
   ONBOARDING CONTROLS TOAST
   ========================================= */
#controls-toast {
    position: fixed;
    bottom: calc(4% + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    background: rgba(10, 10, 15, 0.85);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 8px;
    padding: 12px 24px;
    display: flex;
    gap: 20px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none; /* Let clicks pass through */
}
.control-item {
    color: rgba(230, 235, 255, 0.8);
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    letter-spacing: 0.05em;
}
.control-item span {
    color: #6edcff;
    font-weight: bold;
}

/* =========================================
   THE POWER BUTTON (Animated & Reactive)
   ========================================= */
.ps-power-logo {
    z-index: 10;
    width: 90px;
    cursor: pointer;
    opacity: 0.85;
    filter: drop-shadow(0 0 15px rgba(100, 150, 255, 0.4));
    transition: transform 0.08s cubic-bezier(0.4, 0, 0.2, 1), filter 0.18s ease, opacity 0.25s ease;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: manipulation;
    animation: breathe 3s infinite ease-in-out;
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(100, 150, 255, 0.4));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(100, 150, 255, 0.8));
    }
}

.ps-power-logo:hover {
    animation: none;
    transform: scale(1.1);
    filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.8)) brightness(1.2);
}

/* The physical "click" and flash effect */
.ps-power-logo:active {
    animation: none;
    transform: scale(0.9) rotate(-5deg) !important;
    filter: drop-shadow(0 0 40px rgba(255, 255, 255, 1)) brightness(2);
}

#boot-text-container {
    z-index: 5;
    text-align: center;
    position: absolute;
    opacity: 0;
    visibility: hidden;
    will-change: transform, opacity, filter;
    transform-origin: center center;
    backface-visibility: hidden;
}

/* The SCE Font style (Cleaned up for Emotion Engine) */
.sce-font {
    font-family: 'Emotion Engine', sans-serif;
    font-size: 5rem;
    font-weight: normal;
    letter-spacing: 2px;
    text-shadow: var(--text-glow);
}

.sce-subfont {
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 4px;
    margin-top: 15px;
    color: #ccc;
}

.hidden {
    display: none !important;
    pointer-events: none !important;
}

/* =========================================
   PS2 UI ELEMENTS & TYPOGRAPHY
   ========================================= */

/* The plain text readable font for bottom menus */
.ui-text {
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-size: 1.1rem;
    color: #cccccc;
    letter-spacing: 1px;
}

/* Inverts your black halo PNG to glowing white */
.halo-inverted {
    filter: invert(1) drop-shadow(0 0 15px rgba(255, 255, 255, 0.6));
    /* Add absolute positioning and transitions when we build Phase 2 */
}

/* Bottom Button Legend Styling (Triangle, Circle, Ex, Square) */
.button-legend {
    position: fixed;
    bottom: 40px;
    right: 50px;
    display: flex;
    gap: 25px;
    z-index: 100;
}

.button-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.button-prompt:hover {
    opacity: 0.7;
}

.button-icon {
    width: 24px;
    height: 24px;
    /* Keeps the coloured buttons vibrant */
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

/* =========================================
   EARLY BOOT HERO TEXT
   ========================================= */

.boot-hero-text {
    position: absolute;
    z-index: 6;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: BTSE PS2, sans-serif;
    font-size: clamp(1rem, 2.2vw, 2rem);
    font-weight: 700;
    color: rgba(235, 235, 240, 0.95);
    text-shadow:
        0 0 8px rgba(255, 255, 255, 0.65),
        0 0 20px rgba(120, 160, 255, 0.35);
    white-space: nowrap;
    pointer-events: none;
}

/* =========================================
   PHASE 2A: PS2 BROWSER HUB
   ========================================= */

.browser-menu {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: auto;
    opacity: 0;
    font-family: Helvetica, Arial, sans-serif;
}

.browser-options {
    position: absolute;
    left: 54%; /* 👈 Set this as your base spine line anchor */
    top: 46%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 0.92;
    letter-spacing: -2px;
}

/* INDIVIDUAL POSITIONING CONTROLS */

.browser-option[data-browser-option="browser"] {
    margin-left: 180px; /* 👈 Nudge "Browser" independently left or right */
    margin-bottom: -4px; /* Controls the exact vertical gap between the two options */
}

.browser-option[data-browser-option="system"] {
    margin-left: 0px; /* 👈 Nudge "System Configuration" independently left or right */
}

.browser-option {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(2rem, 4.1vw, 4.35rem);
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    transform-origin: left center;
    transition:
        color 0.18s ease,
        opacity 0.18s ease,
        filter 0.18s ease,
        transform 0.18s ease,
        text-shadow 0.18s ease;
}

.browser-option.active {
    color: rgba(125, 225, 255, 0.95);
    opacity: 1;
    filter: blur(0px);
    transform: translateX(0) scale(1.01);
    text-shadow:
        0 0 8px rgba(120, 220, 255, 0.95),
        0 0 22px rgba(60, 160, 255, 0.55),
        0 0 42px rgba(60, 160, 255, 0.25);
}

.browser-option.muted {
    color: rgba(150, 150, 160, 0.45);
    opacity: 0.78;
    filter: blur(0.3px);
    transform: translateX(0) scale(1);
    text-shadow:
        0 0 8px rgba(255, 255, 255, 0.08),
        0 0 18px rgba(80, 90, 120, 0.25);
}

.browser-option:focus {
    outline: none;
}

.browser-option:active {
    transform: translateX(1px) scale(0.995);
}

/* Footer is positioned like the real PS2 browser:
   X Enter lower center-left, Triangle Version much farther right. */
.browser-footer {
    position: absolute;
    inset: 0;
    z-index: 7;
    pointer-events: none;
    color: rgba(230, 230, 235, 0.78);
    font-size: clamp(1rem, 1.7vw, 1.75rem);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

.browser-footer .footer-item {
    appearance: none;
    border: 0;
    background: transparent;
    position: absolute;
    bottom: calc(10% + var(--safe-bottom));
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font: inherit;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    opacity: 0.88;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        filter 0.18s ease;
}

.browser-footer .footer-item:first-child {
    left: 36%; /* 👈 Perfectly balances the "Enter" action label under the center axis */
}

.browser-footer .footer-item.version-item {
    left: auto; /* Clear the old left rule cascade */
    right: 16%; /* 👈 Flushes the "Version" prompt straight out to the right boundary edge */
}

.browser-footer .footer-item:hover {
    opacity: 1;
    filter: brightness(1.18);
}

.browser-footer .footer-item:active {
    transform: scale(0.96);
}

.footer-button-icon {
    width: clamp(22px, 2vw, 32px);
    height: clamp(22px, 2vw, 32px);
    object-fit: contain;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.22));
}

/* Temporary dev toast used until Memory Card/System Config screens exist */
.phase-dev-toast {
    position: absolute;
    left: 50%;
    bottom: 18%;
    z-index: 30;
    transform: translateX(-50%);
    color: rgba(220, 235, 255, 0.82);
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(0.9rem, 1.6vw, 1.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    pointer-events: none;
    text-shadow:
        0 0 8px rgba(120, 200, 255, 0.45),
        0 0 18px rgba(80, 140, 255, 0.22);
    opacity: 0;
}

/* =========================================
   MOBILE ORIENTATION TOAST
   ========================================= */

#orientation-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 10000;
    width: min(88vw, 420px);
    transform: translateX(-50%);
    padding: 14px 18px;
    border: 1px solid rgba(130, 190, 255, 0.22);
    border-radius: 16px;
    background:
        radial-gradient(circle at 20% 0%, rgba(90, 160, 255, 0.18), transparent 45%),
        rgba(5, 8, 15, 0.86);
    backdrop-filter: blur(14px);
    color: rgba(235, 242, 255, 0.92);
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.92rem;
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow:
        0 0 22px rgba(60, 120, 255, 0.18),
        inset 0 0 22px rgba(255, 255, 255, 0.04);
}

#orientation-toast p {
    flex: 1;
    margin: 0;
}

#dismiss-toast {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(235, 242, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
}

.rotate-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    border: 2px solid rgba(130, 220, 255, 0.8);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(130, 220, 255, 0.45);
    animation: rotatePhoneHint 2.4s infinite ease-in-out;
}

@keyframes rotatePhoneHint {

    0%,
    100% {
        transform: rotate(0deg);
    }

    45%,
    65% {
        transform: rotate(90deg);
    }
}

/* =========================================
   PHASE 2B: MEMORY CARD ENTRY SCREEN
   ========================================= */

.screen-fade-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    background: #000;
    opacity: 0;
    visibility: hidden;
}

.memory-card-screen {
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: auto;
    background: #080808;
    font-family: Helvetica, Arial, sans-serif;
}

.memory-card-panel {
    position: absolute;
    left: 4.5vw;
    right: 4.5vw;
    top: 5.5vh;
    bottom: 6vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 35% 42%, rgba(255, 255, 255, 0.16), transparent 32%),
        linear-gradient(90deg, #a9aaa5 0%, #8f918b 48%, #53564f 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.28),
        inset 0 0 55px rgba(255, 255, 255, 0.08),
        inset -80px 0 140px rgba(0, 0, 0, 0.18);
}

.memory-card-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.03) 50%, rgba(0, 0, 0, 0.055) 50%),
        radial-gradient(circle at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.16) 100%);
    background-size: 100% 3px, 100% 100%;
    mix-blend-mode: multiply;
    opacity: 0.58;
}

.memory-card-title-left,
.memory-card-title-right {
    position: absolute;
    z-index: 10;
    top: 7%;
    font-size: clamp(1.5rem, 3.2vw, 3.1rem);
    font-weight: 700;
    letter-spacing: -1px;
    color: rgba(45, 45, 45, 0.72);
    text-shadow:
        2px 2px 0 rgba(255, 255, 255, 0.35),
        -1px -1px 0 rgba(0, 0, 0, 0.35),
        0 0 8px rgba(0, 0, 0, 0.12);
}

.memory-card-title-left {
    left: 4%;
}

.memory-card-title-right {
    right: 4%;
    color: rgba(185, 180, 75, 0.88);
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.38),
        -1px -1px 0 rgba(255, 255, 255, 0.22),
        0 0 8px rgba(255, 240, 110, 0.24);
}

.memory-card-center {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: 53%;
    width: clamp(82px, 10vw, 150px);
    height: clamp(82px, 10vw, 150px);
    transform: translate(-50%, -50%);
    will-change: transform, opacity, filter;
}

.memory-card-halo {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    width: 185%;
    height: 185%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    opacity: 0;
    filter:
        invert(1) brightness(1.15) blur(0.3px) drop-shadow(0 0 12px rgba(255, 255, 255, 0.45)) drop-shadow(0 0 28px rgba(255, 255, 255, 0.24));
    mix-blend-mode: screen;
    pointer-events: none;
    will-change: transform, opacity, filter;
}

.memory-card-glow {
    position: absolute;
    z-index: 1;
    inset: -45%;
    border-radius: 50%;
    background:
        radial-gradient(circle,
            rgba(255, 255, 255, 0.55) 0%,
            rgba(255, 255, 255, 0.24) 15%,
            rgba(255, 255, 255, 0.08) 34%,
            transparent 62%);
    filter: blur(7px);
    opacity: 0;
    mix-blend-mode: screen;
    pointer-events: none;
    will-change: transform, opacity;
}

.memory-card-icon {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: auto;
    will-change: transform, opacity, filter;
    filter:
        grayscale(0.5) contrast(0.88) brightness(0.78) drop-shadow(0 14px 16px rgba(0, 0, 0, 0.25));
}

.memory-card-footer {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: calc(6.5% + var(--safe-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: clamp(32px, 4%, 80px);
    color: rgba(38, 38, 38, 0.78);
    font-size: clamp(1.15rem, 2.4vw, 2.6rem);
    font-weight: 700;
    text-shadow:
        2px 2px 0 rgba(255, 255, 255, 0.36),
        -1px -1px 0 rgba(0, 0, 0, 0.28);
}

.memory-footer-item {
    appearance: none;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font: inherit;
    cursor: pointer;
    opacity: 0.88;
}

.memory-footer-item:hover {
    opacity: 1;
}

.memory-footer-item:active {
    transform: scale(0.96);
}

/* =========================================
   PHASE 2C: MEMORY CARD PROJECT SAVE GRID
   ========================================= */

.memory-save-meta {
    position: absolute;
    z-index: 10;
    left: 4%;
    top: 18%;
    color: rgba(35, 35, 35, 0.72);
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow:
        1px 1px 0 rgba(255, 255, 255, 0.36),
        -1px -1px 0 rgba(0, 0, 0, 0.22);
}

#memory-save-title {
    font-size: clamp(1.25rem, 2.6vw, 2.6rem);
}

#memory-save-subtitle {
    margin-top: 3px;
    font-size: clamp(0.85rem, 1.25vw, 1.25rem);
    opacity: 0.72;
}

.memory-loading-text {
    position: absolute;
    z-index: 12;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(1.55rem, 2.85vw, 3.15rem);
    font-weight: 600;
    color: rgba(242, 242, 242, 0.96);
    letter-spacing: -0.035em;
    text-transform: none;
    white-space: nowrap;
    pointer-events: none;
    -webkit-text-stroke: 0.65px rgba(0, 0, 0, 0.78);
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.78),
        0 0 2px rgba(0, 0, 0, 0.85);
}

.loading-dots {
    display: inline-block;
    letter-spacing: 0;
    animation: loadingDotsBlink 1.05s infinite steps(2, end);
}

@keyframes loadingDotsBlink {

    0%,
    45% {
        opacity: 0;
    }

    46%,
    100% {
        opacity: 1;
    }
}

.memory-save-grid-wrapper {
    position: absolute;
    z-index: 3;
    left: 10%;
    right: 10%;
    top: 31%;
    bottom: 19%;
    /* The mask STAYS HERE on the static wrapper */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.memory-save-grid {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(95px, 1fr));
    grid-auto-rows: minmax(112px, 1fr);
    gap: clamp(18px, 3.5vw, 58px) clamp(28px, 5vw, 78px);
    align-items: center;
    justify-items: center;
    will-change: transform;
}

.memory-save-selector {
    position: absolute;
    z-index: 1;
    left: 0;
    top: 0;
    width: clamp(118px, 12vw, 178px);
    height: clamp(118px, 12vw, 178px);
    transform: translate(-50%, -50%);
    object-fit: contain;
    opacity: 0;
    pointer-events: none;
    filter:
        invert(1) brightness(1.35) drop-shadow(0 0 16px rgba(255, 255, 255, 0.58)) drop-shadow(0 0 42px rgba(255, 255, 255, 0.24));
    mix-blend-mode: screen;
    will-change: transform, opacity;
    animation: saveSelectorBreath 1.7s infinite ease-in-out;
}

@keyframes saveSelectorBreath {

    0%,
    100% {
        filter:
            invert(1) brightness(1.15) drop-shadow(0 0 12px rgba(255, 255, 255, 0.48)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.18));
    }

    50% {
        filter:
            invert(1) brightness(1.55) drop-shadow(0 0 22px rgba(255, 255, 255, 0.78)) drop-shadow(0 0 54px rgba(255, 255, 255, 0.32));
    }
}

.memory-save-item {
    appearance: none;
    border: 0;
    background: transparent;
    position: relative;
    z-index: 2;
    width: clamp(88px, 9.5vw, 142px);
    min-height: clamp(96px, 10vw, 150px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    touch-action: manipulation;
    color: rgba(32, 32, 32, 0.68);
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    text-align: center;
    text-shadow:
        1px 1px 0 rgba(255, 255, 255, 0.36),
        -1px -1px 0 rgba(0, 0, 0, 0.22);
    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        opacity 0.18s ease;
}

.memory-save-item.active {
    transform: translateY(-4px) scale(1.06);
    filter: brightness(1.1);
}

.memory-save-icon {
    width: clamp(56px, 6.5vw, 96px);
    height: clamp(56px, 6.5vw, 96px);
    object-fit: contain;
    filter:
        contrast(0.92) brightness(0.86) drop-shadow(0 10px 10px rgba(0, 0, 0, 0.22));
}

.memory-save-label {
    max-width: 160px;
    font-size: clamp(0.78rem, 1.1vw, 1rem);
    line-height: 1.05;
}

.memory-card-screen.grid-active .memory-card-footer {
    color: rgba(35, 35, 35, 0.72);
}

/* PS2 Save Grid Scrolling Prep */
.memory-card-grid {
    max-height: 45vh;
    /* Keep the grid bounded */
    overflow-y: scroll;
    /* Allow internal scrolling */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar IE 10+ */
    scroll-behavior: smooth;
}

.memory-card-grid::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.memory-save-grid {
    overflow: visible;
}

/* Limit the size of the Project Preview Image */
.project-preview-image {
    max-width: 35vh;
    max-height: 35vh;
    object-fit: contain;
}

/* Spinning Disc Animation */
.spin-disc {
    animation: spin-cd 0.1s linear infinite;
    border-radius: 70%;
    /* Just in case */
}

@keyframes spin-cd {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Make long Bio descriptions scrollable */
.project-description-container {
    max-height: 25vh;
    overflow-y: auto;
    padding-right: 15px;
    margin-bottom: 15px;
}

/* Retro custom scrollbar for the text box */
.project-description-container::-webkit-scrollbar {
    width: 6px;
}

.project-description-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.project-description-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

/* =========================================
   PHASE 2D: RAINBOW PROJECT OPTIONS SCREEN
   ========================================= */

.project-detail-screen {
    position: absolute;
    inset: 0;
    z-index: 80;
    pointer-events: auto;
    font-family: Helvetica, Arial, sans-serif;
}

.project-detail-panel {
    position: absolute;
    left: 3.8vw;
    right: 3.8vw;
    top: 5.5vh;
    bottom: 6vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 32% 48%, rgba(255, 255, 255, 0.18), transparent 26%),
        linear-gradient(135deg,
            rgba(210, 40, 32, 0.95) 0%,
            rgba(222, 122, 28, 0.88) 20%,
            rgba(216, 205, 48, 0.82) 39%,
            rgba(73, 194, 180, 0.86) 63%,
            rgba(70, 151, 220, 0.86) 78%,
            rgba(198, 62, 202, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.35),
        inset 0 0 75px rgba(255, 255, 255, 0.14),
        inset -90px 0 150px rgba(0, 0, 0, 0.13);
}

.project-detail-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 50%, rgba(0, 0, 0, 0.06) 50%),
        radial-gradient(circle at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.20) 100%);
    background-size: 100% 3px, 100% 100%;
    mix-blend-mode: multiply;
    opacity: 0.55;
}

.project-preview-wrap {
    position: absolute;
    z-index: 3;
    left: 19%;
    top: 48%;
    width: clamp(230px, 28vw, 470px);
    height: clamp(165px, 21vw, 340px);
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
}

.project-preview-glow {
    position: absolute;
    inset: -25%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12) 35%, transparent 68%);
    filter: blur(16px);
    opacity: 0.75;
}

.project-detail-preview {
    position: relative;
    z-index: 2;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter:
        contrast(0.92) brightness(0.9) drop-shadow(0 18px 22px rgba(0, 0, 0, 0.32));
}

.project-detail-copy {
    position: absolute;
    z-index: 4;
    left: 42%;
    top: 17%;
    right: 8%;
    color: rgba(245, 245, 245, 0.9);
    text-align: center;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.58),
        0 0 8px rgba(0, 0, 0, 0.35);
}

.project-memory-label {
    font-size: clamp(1rem, 2.1vw, 2rem);
    font-weight: 700;
    color: rgba(245, 245, 245, 0.76);
    margin-bottom: 0.35rem;
}

#project-detail-title {
    font-size: clamp(1.9rem, 4vw, 4rem);
    line-height: 0.95;
    font-weight: 800;
    color: rgba(235, 220, 80, 0.92);
}

#project-detail-subtitle {
    margin-top: 0.2rem;
    font-size: clamp(1rem, 2.1vw, 2.1rem);
    line-height: 1;
    font-weight: 700;
    color: rgba(245, 245, 245, 0.88);
}

.project-detail-meta {
    margin-top: 0.75rem;
    font-size: clamp(0.8rem, 1.4vw, 1.2rem);
    color: rgba(245, 245, 245, 0.78);
}

.project-detail-description {
    margin: 0.9rem auto 0;
    max-width: 660px;
    max-height: 7.5em;
    /* Crops the text exactly, without gradients */
    overflow: hidden;
    /* Strict clip, NO web scrollbars */
    font-size: clamp(0.78rem, 1.2vw, 1rem);
    line-height: 1.25;
    color: rgba(35, 35, 35, 0.74);
    text-shadow:
        1px 1px 0 rgba(255, 255, 255, 0.22),
        -1px -1px 0 rgba(0, 0, 0, 0.18);
}

.project-detail-stack {
    margin: 0.75rem auto 0;
    max-width: 650px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.project-detail-stack span {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: rgba(30, 30, 30, 0.78);
    font-size: 0.72rem;
    font-weight: 700;
    text-shadow: none;
}

.project-option-list {
    margin-top: clamp(0.8rem, 2vw, 1.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05rem;
}

.project-option {
    appearance: none;
    border: 0;
    background: transparent;
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(1.35rem, 2.75vw, 2.85rem);
    font-weight: 800;
    line-height: 0.98;
    cursor: pointer;
    transition:
        color 0.16s ease,
        opacity 0.16s ease,
        transform 0.16s ease,
        text-shadow 0.16s ease;
}

.project-option.active {
    color: rgba(110, 235, 255, 0.95);
    transform: scale(1.035);
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.52),
        0 0 12px rgba(90, 210, 255, 0.65);
}

.project-option.muted {
    color: rgba(30, 30, 30, 0.58);
    text-shadow:
        1px 1px 0 rgba(255, 255, 255, 0.22),
        -1px -1px 0 rgba(0, 0, 0, 0.20);
    opacity: 0.88;
}

.project-option:focus {
    outline: none;
}

.project-detail-footer {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: calc(6.5% + var(--safe-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: clamp(32px, 4%, 80px);
    color: rgba(35, 35, 35, 0.74);
    font-size: clamp(1.1rem, 2.25vw, 2.4rem);
    font-weight: 800;
    text-shadow:
        2px 2px 0 rgba(255, 255, 255, 0.32),
        -1px -1px 0 rgba(0, 0, 0, 0.25);
}

.project-footer-item {
    appearance: none;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.project-footer-item:active {
    transform: scale(0.96);
}

/* =========================================
   CASE STUDY VIEWER & LOADING SCREEN
   ========================================= */

#ps2-loading-screen {
    position: fixed;
    inset: 0;
    z-index: 900;
    background-color: #000;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 8%;
    opacity: 0;
    pointer-events: none;
}

.loading-text-blink {
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
    animation: loadingBlink 1.2s infinite steps(2, end);
}

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

#case-study-viewer {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(10, 12, 15, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
}

.case-study-container {
    width: 85%;
    max-width: 800px;
    height: 75vh;
    border: 1px solid rgba(110, 220, 255, 0.3);
    background: linear-gradient(180deg, rgba(15, 20, 30, 0.9) 0%, rgba(5, 8, 12, 0.95) 100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(110, 220, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.cs-header {
    padding: 15px 25px;
    border-bottom: 1px solid rgba(110, 220, 255, 0.2);
    font-family: 'Helvetica', sans-serif;
    color: #6edcff;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}

.cs-content-area {
    padding: 30px 40px;
    overflow-y: auto;
    flex: 1;
    color: #c8d6e5;
    font-family: 'Courier New', Courier, monospace; /* Tech log vibe */
    font-size: 1rem;
    line-height: 1.6;
    scrollbar-width: none; /* Hide default scrollbars */
}
.cs-content-area::-webkit-scrollbar { display: none; }

/* Case Study Internal Typography */
.cs-content-area h3 {
    color: #fff;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 1px dashed rgba(255,255,255,0.2);
    padding-bottom: 5px;
    font-size: 1.2rem;
}
.cs-content-area p { margin-bottom: 15px; }
.cs-content-area ul { margin-bottom: 15px; padding-left: 20px; }
.cs-content-area li { margin-bottom: 8px; color: #8395a7; }
.cs-content-area strong { color: #f2f2f2; }

.cs-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(110, 220, 255, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 30px;
}

/* =========================================
   PHASE 3A: SYSTEM CONFIGURATION
   ========================================= */

.system-config-screen {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: auto;
    font-family: Helvetica, Arial, sans-serif;
}

.system-config-panel {
    position: absolute;
    left: 4vw;
    right: 4vw;
    top: 5vh;
    bottom: 6vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 45% 50%, rgba(0, 0, 0, 0.85) 0%, rgba(20, 18, 40, 0.4) 45%, transparent 70%),
        linear-gradient(115deg, #2f2a4a 0%, #1c1830 50%, #100d1c 100%);
    border: 1px solid rgba(120, 110, 160, 0.22);
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.6),
        inset 0 0 90px rgba(100, 90, 150, 0.05),
        inset -90px 0 160px rgba(0, 0, 0, 0.3);
}

.system-config-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 30;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 50%, rgba(0, 0, 0, 0.055) 50%),
        radial-gradient(circle at 50% 50%, transparent 54%, rgba(0, 0, 0, 0.20) 100%);
    background-size: 100% 3px, 100% 100%;
    mix-blend-mode: multiply;
    opacity: 0.55;
}

.system-config-date,
.system-config-time {
    position: absolute;
    z-index: 24;
    top: 6.2%;
    color: rgba(245, 245, 248, 0.88);
    font-family: Helvetica, Arial, sans-serif;
    font-size: clamp(1.4rem, 2.8vw, 3.05rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.72),
        0 0 7px rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

.system-config-date {
    left: 4.2%;
}

.system-config-time {
    right: 5.2%;
}

.system-config-3d-mount {
    position: absolute;
    z-index: 4;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.system-config-3d-mount canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.system-config-panel.using-three .system-config-css-fallback {
    display: none;
}

.system-config-orrery {
    position: absolute;
    left: 24%;
    top: 50%;
    width: 18vw;
    height: 18vw;
    max-width: 280px;
    max-height: 280px;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.system-config-core {
    position: absolute;
    width: 32%;
    height: 32%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(180, 160, 220, 0.7), rgba(120, 100, 180, 0.3) 50%, transparent 70%);
    filter: blur(4px);
    z-index: 2;
    pointer-events: none;
}

.system-config-ring {
    position: absolute;
    width: 85%;
    height: 85%;
    border-radius: 50%;
    border: 1px solid rgba(160, 140, 200, 0.15);
    z-index: 1;
    pointer-events: none;
}

.system-config-cube {
    position: absolute;
    width: 42px;
    height: 42px;
    z-index: 3;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 0.25s ease,
        filter 0.25s ease,
        box-shadow 0.25s ease;
    background: rgba(140, 120, 190, 0.35);
    border: 1px solid rgba(180, 160, 220, 0.25);
    border-radius: 6px;
    filter: brightness(0.6) saturate(0.5);
    box-shadow: 0 0 12px rgba(100, 80, 160, 0.15);
}

.system-config-cube.active {
    background: rgba(180, 200, 240, 0.45);
    border-color: rgba(200, 220, 255, 0.5);
    filter: brightness(1.2) saturate(0.9);
    box-shadow:
        0 0 18px rgba(150, 180, 255, 0.35),
        0 0 40px rgba(120, 150, 255, 0.15);
}

.system-config-cube-label {
    font-size: 0.58rem;
    color: rgba(220, 220, 240, 0.85);
    font-weight: 700;
    text-align: center;
    line-height: 1.05;
    text-shadow: 0 0 6px rgba(200, 200, 255, 0.2);
    pointer-events: none;
    user-select: none;
}

.system-config-copy {
    position: absolute;
    z-index: 25;
    left: 43%;
    right: 6%;
    top: 38%;
    text-align: center;
    pointer-events: none;
}

.system-config-heading {
    font-size: clamp(1.45rem, 2.65vw, 3rem);
    line-height: 1;
    font-weight: 800;
    color: rgba(210, 205, 90, 0.92);
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.72),
        0 0 9px rgba(240, 230, 120, 0.22);
    margin-bottom: 0.65rem;
}

.system-config-remap {
    font-size: clamp(1.75rem, 3.25vw, 3.35rem);
    line-height: 0.95;
    font-weight: 800;
    color: rgba(105, 220, 255, 0.94);
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.62),
        0 0 11px rgba(120, 220, 255, 0.42);
    letter-spacing: -0.035em;
    margin-bottom: 0.35rem;
}

.system-config-value {
    font-size: clamp(1.3rem, 2.35vw, 2.35rem);
    line-height: 1;
    font-weight: 700;
    color: rgba(245, 245, 248, 0.88);
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.68),
        0 0 8px rgba(255, 255, 255, 0.16);
}

.system-config-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(5.6% + var(--safe-bottom));
    z-index: 26;
    pointer-events: none;
}

.system-config-footer-inner {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    padding: 0 4%;
    color: rgba(242, 242, 246, 0.86);
    font-size: clamp(1.05rem, 1.75vw, 1.75rem);
    font-weight: 700;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.72),
        0 0 7px rgba(255, 255, 255, 0.18);
}

.system-config-footer-inner.editing {
    grid-template-columns: repeat(3, 1fr);
    padding: 0 12%;
}

.system-config-footer-item {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
    flex-shrink: 0;
    pointer-events: auto;
    opacity: 0.88;
    cursor: pointer;
    touch-action: manipulation;
}

.system-config-footer-item:hover {
    opacity: 1;
}

.system-config-footer-item:active {
    transform: scale(0.96);
}

.system-config-footer-hint {
    color: rgba(180, 200, 240, 0.5);
    font-size: 0.75em;
    letter-spacing: 0.05em;
    white-space: nowrap;
    display: inline-block;
}

/* =========================================
   PHASE 6: VERSION INFORMATION SCREEN
   ========================================= */
.version-info-screen {
    position: absolute;
    inset: 0;
    z-index: 100;
    background-color: #050506;
    pointer-events: auto;
    font-family: Helvetica, Arial, sans-serif;
}

.version-info-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
}

/* 3D Canvas Mount */
.version-three-mount {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.version-three-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* TEXT CONTAINER (Controls the position of the entire text block)
*/
.version-content {
    --label-width: clamp(280px, 35vw, 420px); /* 👈 Widened to fit the long WASD label */
    position: absolute;
    z-index: 2;
    left: 38%; /* 👈 Shifted left to give the label room to breathe */
    right: 5%;
    top: 28%;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    letter-spacing: 0.5px;
}

/* HEADER ALIGNMENT
*/
.version-header {
    color: #d1b848;
    /* PS2 Gold */
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    margin-bottom: 35px;
    text-align: center;
    text-shadow: 0 0 8px rgba(209, 184, 72, 0.3);
}

.version-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.v-row-container {
    display: flex;
    flex-direction: column;
}

.v-row {
    display: flex;
    align-items: flex-start;
    padding: 3px 0;
}

/* RIGHT-ALIGNED LABELS 
*/
.v-label {
    width: var(--label-width);
    text-align: right;
    /* Authentic PS2 alignment */
    padding-right: 25px;
    /* The gap between label and value */
    color: #6e8e96;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    /* Prevents text from squishing and clashing */
}

.v-row.active .v-label {
    color: #62c3d0;
}

/* LEFT-ALIGNED VALUES (With Wrapping Enabled)
*/
.v-value {
    flex: 1;
    text-align: left;
    color: #888;
    font-weight: 700;
    white-space: normal;
    /* Enables long text like the Browser description to wrap cleanly */
    line-height: 1.25;
}

.v-row.active .v-value {
    color: #f2f2f2;
}

.version-footer {
    position: absolute;
    bottom: calc(6.5% + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 40px;
    color: rgba(230, 230, 235, 0.78);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.25vw, 2.4rem);
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.32), -1px -1px 0 rgba(0, 0, 0, 0.25);
    z-index: 5;
}

.v-footer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.2s;
    opacity: 0.88;
}

.v-footer-item:hover {
    opacity: 1;
}

.v-footer-item:active {
    transform: scale(0.95);
}

/* =========================================
   RESPONSIVE OVERRIDES
   ========================================= */

/* Mobile portrait: keep it usable, don't lock it. */
@media (max-width: 820px) and (orientation: portrait) {
    #boot-container {
        height: 100dvh;
    }

    .browser-options {
        left: 12%; 
        top: 43%;
        transform: translateY(-50%);
        align-items: flex-start;
        letter-spacing: -1px;
    }

    /* Mobile individual tweaks if needed */
    .browser-option[data-browser-option="browser"] {
        margin-left: 20px; 
        margin-bottom: 6px;
    }

    .browser-option[data-browser-option="system"] {
        margin-left: 0px;
    }

    .browser-option {
        font-size: clamp(2.6rem, 12vw, 4.2rem);
        line-height: 0.96;
    }

    .browser-footer .footer-item:first-child {
        left: 16%;
    }

    .browser-footer .footer-item.version-item {
        left: auto;
        right: 16%;
    }

    .browser-footer .footer-item {
        bottom: 12%;
        font-size: clamp(1rem, 5vw, 1.4rem);
    }

    .footer-button-icon {
        width: 26px;
        height: 26px;
    }
}

/* Mobile version stays usable instead of hard-locking landscape. */
@media (max-width: 820px) and (orientation: portrait) {
    .memory-card-panel {
        left: 4vw;
        right: 4vw;
        top: 9vh;
        bottom: 9vh;
    }

    .memory-card-title-left,
    .memory-card-title-right {
        font-size: clamp(1.2rem, 6vw, 2rem);
        top: 6%;
    }

    .memory-card-title-right {
        right: 5%;
        max-width: 58vw;
        text-align: right;
    }

    .memory-card-center {
        top: 52%;
        width: 110px;
        height: 110px;
    }

    .memory-card-footer {
        bottom: 8%;
        font-size: clamp(1.1rem, 5vw, 1.6rem);
        gap: 42px;
    }
}

/* Mobile: 2-column memory grid */
@media (max-width: 820px) and (orientation: portrait) {
    .memory-save-meta {
        left: 7%;
        top: 16%;
    }

    .memory-save-grid {
        left: 7%;
        right: 7%;
        top: 28%;
        bottom: 20%;
        grid-template-columns: repeat(2, minmax(88px, 1fr));
        gap: 22px 28px;
    }

    .memory-save-selector {
        width: 132px;
        height: 132px;
    }

    .memory-save-item {
        width: 112px;
        min-height: 126px;
    }

    .memory-save-icon {
        width: 70px;
        height: 70px;
    }

    .memory-save-label {
        font-size: 0.82rem;
    }

    .memory-loading-text {
        top: 50%;
        bottom: auto;
    }
}

@media (max-width: 820px) and (orientation: portrait) {
    .project-detail-panel {
        left: 4vw;
        right: 4vw;
        top: 8vh;
        bottom: 8vh;
    }

    .project-preview-wrap {
        left: 50%;
        top: 26%;
        width: 190px;
        height: 150px;
    }

    .project-detail-copy {
        left: 8%;
        right: 8%;
        top: 42%;
    }

    #project-detail-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .project-option {
        font-size: clamp(1.5rem, 8vw, 2.3rem);
    }

    .project-detail-footer {
        bottom: 6%;
        font-size: clamp(1.1rem, 5vw, 1.5rem);
    }
}

/* =========================================
   PHONE PORTRAIT (narrow screens under 550px)
   ========================================= */
@media (max-width: 550px) and (orientation: portrait) {
    .browser-options {
        left: 8%;
    }

    .browser-option {
        font-size: clamp(1.75rem, 8.5vw, 2.65rem);
        line-height: 0.94;
    }

    .browser-footer .footer-item:first-child {
        left: 12%;
    }

    .browser-footer .footer-item.version-item {
        left: 52%;
    }

    .memory-card-panel {
        top: 5vh;
        bottom: 5vh;
    }

    .memory-card-center {
        width: 80px;
        height: 80px;
        top: 46%;
    }

    .memory-save-meta {
        top: 12%;
    }

    .memory-save-grid {
        top: 25%;
        bottom: 16%;
        gap: 12px 16px;
    }

    .memory-save-item {
        width: 88px;
        min-height: 90px;
    }

    .memory-save-selector {
        width: 108px;
        height: 108px;
    }

    .memory-card-footer {
        bottom: calc(4% + var(--safe-bottom));
        font-size: clamp(0.85rem, 4vw, 1.1rem);
        gap: 32px;
    }

    .project-detail-panel {
        top: 4vh;
        bottom: 4vh;
    }

    .project-preview-wrap {
        top: 22%;
        width: 140px;
        height: 110px;
    }

    .project-detail-copy {
        top: 36%;
    }

    .project-detail-stack {
        gap: 4px;
        max-height: 2.4rem;
        overflow: hidden;
    }

    .project-detail-stack span {
        font-size: 0.58rem;
        padding: 2px 6px;
    }

    .project-option {
        font-size: clamp(1.2rem, 6vw, 1.6rem);
    }

    .project-detail-footer {
        bottom: calc(3% + var(--safe-bottom));
        font-size: clamp(0.85rem, 4vw, 1.1rem);
        gap: 28px;
    }
}

/* =========================================
   PHONE LANDSCAPE (short viewports under 500px height)
   ========================================= */
@media (max-height: 500px) and (orientation: landscape) {
    .browser-options {
        left: 48%;
        top: 40%;
    }

    .browser-option {
        font-size: clamp(1.4rem, 3vw, 2.4rem);
    }

    .browser-footer .footer-item {
        bottom: calc(6% + var(--safe-bottom));
    }

    .memory-card-panel {
        top: 2vh;
        bottom: 2vh;
    }

    .memory-card-center {
        width: 64px;
        height: 64px;
    }

    .memory-save-grid {
        top: 28%;
        bottom: 12%;
        gap: 8px 12px;
    }

    .memory-save-selector {
        width: 96px;
        height: 96px;
    }

    .memory-card-footer {
        bottom: calc(3% + var(--safe-bottom));
        font-size: clamp(0.8rem, 3vw, 1rem);
    }

    .project-detail-panel {
        top: 2vh;
        bottom: 2vh;
    }

    .project-preview-wrap {
        width: clamp(140px, 20vw, 230px);
        height: clamp(95px, 16vw, 170px);
        top: 28%;
    }

    .project-detail-copy {
        top: 32%;
    }

    .project-detail-footer {
        bottom: calc(3% + var(--safe-bottom));
        font-size: clamp(0.8rem, 3vw, 1rem);
    }
}