/* --------------------------------------------------
   DESIGN SYSTEM & VARIABLES
   -------------------------------------------------- */
:root {
    --bg-dark: #0a0b10;
    --panel-bg: rgba(20, 22, 37, 0.65);
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Neon Colors */
    --neon-pink: #ff007f;
    --neon-blue: #00f0ff;
    --neon-green: #39ff14;
    --neon-yellow: #fff000;
    --neon-magenta: #e0115f;
    --neon-cyan: #22fffb;
    --gold: #ffd700;
    --red: #ff3b30;
    
    /* Fonts */
    --font-retro: 'Press Start 2P', monospace;
    --font-sans: 'Outfit', 'Noto Sans TC', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: #f0f3f9;
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Custom Scrollbars for Sidebar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue);
}

/* --------------------------------------------------
   BACKGROUND ENVIRONMENT
   -------------------------------------------------- */
.arcade-wrapper {
    position: relative;
    width: 100%;
    max-width: 1350px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1;
}

.space-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, #15182d 0%, #050608 80%);
    z-index: -2;
}

.neon-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 50px 50px;
    background-image: 
        linear-gradient(to right, rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    transform: perspective(500px) rotateX(15deg);
    transform-origin: top;
    z-index: -1;
    opacity: 0.8;
}

/* --------------------------------------------------
   HEADER TITLE BANNER
   -------------------------------------------------- */
.arcade-header {
    text-align: center;
    padding: 10px 0;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.08);
}

.pixel-title {
    font-family: var(--font-retro);
    font-size: 2.5rem;
    letter-spacing: 4px;
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    margin-bottom: 5px;
}

.sub-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
}

.neon-text-pink {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

.neon-text-blue {
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

/* --------------------------------------------------
   CONSOLE CONSOLE LAYOUT
   -------------------------------------------------- */
.arcade-console {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 20px;
    align-items: start;
}

/* Sidebar Panels - Glassmorphism */
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(16px) saturate(120%);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin-bottom: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.glass-panel:hover {
    box-shadow: 0 8px 32px 0 rgba(0, 240, 255, 0.08);
    border-color: rgba(0, 240, 255, 0.2);
}

.panel-heading {
    font-family: var(--font-retro);
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    color: var(--neon-blue);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.4);
}

/* Status rows */
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.status-label {
    color: #a0a5c0;
    font-weight: 500;
}

.status-val {
    font-family: var(--font-retro);
    font-size: 0.9rem;
}

.num-glow {
    text-shadow: 0 0 8px currentColor;
}

.text-red { color: var(--red); }
.text-yellow { color: var(--neon-yellow); }
.text-blue { color: var(--neon-blue); }
.text-gold { color: var(--gold); }
.text-green { color: var(--neon-green); }
.text-magenta { color: var(--neon-pink); }

.panel-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 15px 0;
}

/* Retro Keycaps Guide */
.controls-list {
    list-style: none;
    font-size: 0.85rem;
}

.controls-list li {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 12px;
    color: #cfd4eb;
}

.key {
    background: linear-gradient(180deg, #2b2e42 0%, #151724 100%);
    border: 1px solid #4a4e69;
    border-bottom: 3px solid #0d0e16;
    border-radius: 4px;
    padding: 3px 8px;
    font-family: var(--font-retro);
    font-size: 0.65rem;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    display: inline-block;
    min-width: 18px;
    text-align: center;
}

.controls-tips {
    font-size: 0.75rem;
    color: #9299b8;
    line-height: 1.4;
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--neon-pink);
}

/* --------------------------------------------------
   SOUND CONSOLE
   -------------------------------------------------- */
.audio-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    filter: drop-shadow(0 0 4px var(--neon-blue));
    transition: transform 0.1s;
}

.btn-icon:active {
    transform: scale(0.9);
}

.audio-label {
    font-size: 0.85rem;
    color: #a0a5c0;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.slider-text {
    font-size: 0.7rem;
    color: #6a6f8c;
}

.retro-slider {
    flex: 1;
    -webkit-appearance: none;
    background: #141724;
    height: 6px;
    border-radius: 3px;
    outline: none;
    border: 1px solid rgba(255,255,255,0.1);
}

.retro-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue);
    cursor: pointer;
    border: none;
}

/* Retro Buttons */
.btn-retro {
    font-family: var(--font-retro);
    font-size: 0.65rem;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.15s;
    outline: none;
    box-shadow: 0 4px 0 currentColor;
    margin-bottom: 10px;
}

.btn-retro:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 currentColor;
}

.btn-danger-retro {
    background: rgba(255, 59, 48, 0.15);
    color: var(--red);
    border: 1px solid var(--red);
}
.btn-danger-retro:hover {
    background: var(--red);
    color: #fff;
    box-shadow: 0 0 15px var(--red);
}

.btn-secondary-retro {
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
    margin-top: 5px;
}
.btn-secondary-retro:hover {
    background: var(--neon-blue);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--neon-blue);
}

/* --------------------------------------------------
   ARCADE MONITOR (CENTER SCREEN)
   -------------------------------------------------- */
.console-screen-wrapper {
    display: flex;
    justify-content: center;
}

.arcade-bezel {
    background: linear-gradient(135deg, #1f212d 0%, #111219 100%);
    border: 4px solid #323547;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 
        0 15px 45px rgba(0,0,0,0.6),
        inset 0 2px 5px rgba(255,255,255,0.1),
        0 0 30px rgba(0, 240, 255, 0.05);
    width: 838px;
}

.bezel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    font-family: var(--font-retro);
    font-size: 0.6rem;
    color: #4a4e69;
    letter-spacing: 1px;
}

.bezel-light {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bezel-light::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-green);
    box-shadow: 0 0 6px var(--neon-green);
}

.bezel-light.blink-fast::before {
    background: var(--neon-pink);
    box-shadow: 0 0 6px var(--neon-pink);
    animation: blink 0.2s infinite;
}

.bezel-light.blink-slow::before {
    animation: blink 1.2s infinite;
}

.bezel-brand {
    font-size: 0.7rem;
    color: #8c92b3;
    letter-spacing: 2px;
    text-shadow: 0 1px 1px #000;
}

/* CRT Screen Enclosure */
.crt-screen {
    position: relative;
    width: 800px;
    height: 450px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.95);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #6b8cff; /* Retro sky blue */
}

/* CRT Effects Overlays */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 10;
}

/* Micro scanlines repeating gradient */
.scanlines-active .crt-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

/* Glowing vignette and subtle flickering */
.crt-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.05);
    pointer-events: none;
    z-index: 9;
}

.scanlines-active .crt-glow {
    animation: flicker 0.15s infinite;
}

/* Screen Overlays (Start, Death, Clear) */
.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 8, 14, 0.85);
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

.screen-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    max-width: 550px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pixel-art-cat {
    font-size: 3.5rem;
    animation: bounce 1s infinite alternate;
}

.overlay-main-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
}

.overlay-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #b1b6d1;
}

/* Neon buttons for start overlay */
.btn-play-neon {
    font-family: var(--font-retro);
    font-size: 0.95rem;
    padding: 15px 30px;
    border-radius: 8px;
    background: rgba(255, 0, 127, 0.15);
    color: var(--neon-pink);
    border: 2px solid var(--neon-pink);
    box-shadow: 0 0 15px var(--neon-pink);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1.5px;
    outline: none;
}

.btn-play-neon:hover {
    background: var(--neon-pink);
    color: #fff;
    box-shadow: 0 0 25px var(--neon-pink), 0 0 10px #fff;
    transform: scale(1.05);
}

.press-space {
    font-family: var(--font-retro);
    font-size: 0.65rem;
    color: #a0a5c0;
    letter-spacing: 1px;
    margin-top: 10px;
}

/* Victory styling details */
.victory-crown {
    font-size: 4rem;
    animation: pulse-effect 1.5s infinite;
}

.victory-sub {
    font-size: 1.1rem;
    color: #fcfcfc;
}

.victory-stats {
    background: rgba(255,255,255,0.04);
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 250px;
    text-align: left;
}

.victory-stats p {
    display: flex;
    justify-content: space-between;
}

/* Bezel Bottom Toggles */
.bezel-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
}

.coin-slots {
    display: flex;
    gap: 15px;
}

.coin-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-retro);
    font-size: 0.55rem;
    color: #535878;
}

.slot-light {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #252839;
}

.slot-light.active {
    background: var(--neon-pink);
    box-shadow: 0 0 6px var(--neon-pink);
    animation: blink 0.8s infinite;
}

.screen-controls {
    display: flex;
    gap: 20px;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #8c92b3;
    cursor: pointer;
    user-select: none;
}

.toggle-control input {
    accent-color: var(--neon-blue);
    cursor: pointer;
}

/* --------------------------------------------------
   TRAP-PEDIA (RIGHT PANEL)
   -------------------------------------------------- */
.trappedia-panel {
    display: flex;
    flex-direction: column;
    height: calc(450px + 78px); /* Height matches bezel screen wrapper exactly! */
}

.trappedia-intro {
    font-size: 0.75rem;
    color: #9299b8;
    line-height: 1.4;
    margin-bottom: 12px;
}

.trappedia-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

/* Unlockable Trap Card Styles */
.trap-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.02);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    align-items: center;
}

.trap-card.locked {
    opacity: 0.3;
    filter: grayscale(100%);
    background: rgba(0,0,0,0.15);
}

.trap-card:not(.locked) {
    background: rgba(224, 17, 95, 0.08);
    border-color: rgba(224, 17, 95, 0.25);
    box-shadow: inset 0 0 10px rgba(224, 17, 95, 0.05);
}

.trap-card:not(.locked):hover {
    transform: scale(1.02);
    border-color: var(--neon-pink);
    box-shadow: 0 0 10px rgba(224, 17, 95, 0.15);
}

.trap-icon {
    font-size: 1.4rem;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
}

.trap-card:not(.locked) .trap-icon {
    background: rgba(224, 17, 95, 0.15);
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
    border: 1px solid rgba(224, 17, 95, 0.3);
}

.trap-info {
    flex: 1;
}

.trap-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #cfd4eb;
    margin-bottom: 3px;
}

.trap-card:not(.locked) .trap-name {
    color: #fff;
    text-shadow: 0 0 2px rgba(224,17,95,0.5);
}

.trap-desc {
    font-size: 0.72rem;
    color: #6a6f8c;
    line-height: 1.3;
}

.trap-card:not(.locked) .trap-desc {
    color: #a0a5c0;
}

.trappedia-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    margin-top: 12px;
}

/* --------------------------------------------------
   ARCADE BOTTOM DECK - INTERACTIVE GAMEPAD
   -------------------------------------------------- */
.arcade-deck {
    background: linear-gradient(180deg, #181922 0%, #0a0b0f 100%);
    border: 3px solid #282a3a;
    border-top: 5px solid #454964;
    border-radius: 10px 10px 15px 15px;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 
        0 10px 20px rgba(0,0,0,0.5),
        inset 0 1px 3px rgba(255,255,255,0.2);
    gap: 20px;
}

/* Mechanical WASD Keypad Group */
.wasd-group {
    display: grid;
    grid-template-areas: 
        ". w ."
        "a s d";
    gap: 8px;
    width: 150px;
    height: 100px;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.wasd-key {
    background: linear-gradient(180deg, #3a3d52 0%, #1c1d29 100%);
    border: 2px solid #5a5e7b;
    border-bottom: 4px solid #0d0e16;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-retro);
    font-size: 0.8rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    transition: all 0.05s;
    touch-action: manipulation;
}

.wasd-key:hover {
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.wasd-key:active, .wasd-key.active {
    transform: translateY(3px);
    border-bottom-width: 1px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    background: var(--neon-blue);
    border-color: var(--neon-cyan);
    color: #000;
    text-shadow: 0 0 5px #fff;
}

.wasd-key-w { grid-area: w; }
.wasd-key-a { grid-area: a; }
.wasd-key-s { grid-area: s; }
.wasd-key-d { grid-area: d; }

.key-desc {
    font-size: 0.38rem;
    color: #6a6f8c;
    margin-top: 2px;
    font-weight: bold;
}

.wasd-key:active .key-desc, .wasd-key.active .key-desc {
    color: #000;
}

/* Action Pad Group */
.action-pad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.action-pad-group {
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.action-btn {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.4);
    box-shadow: 0 4px 0 rgba(0,0,0,0.6), inset 0 2px 3px rgba(255,255,255,0.3);
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-retro);
    font-size: 0.48rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px #000;
    transition: all 0.05s;
    touch-action: manipulation;
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 10px;
    height: 5px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
}

.action-btn:active, .action-btn.active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.6);
}

.action-btn-red { 
    background: radial-gradient(circle at 35% 35%, var(--neon-pink) 0%, #80003c 80%); 
    box-shadow: 0 4px 0 #5c002b, inset 0 2px 3px rgba(255,255,255,0.3), 0 0 10px rgba(255, 0, 127, 0.3);
}
.action-btn-red:active, .action-btn-red.active {
    box-shadow: 0 1px 0 #5c002b, 0 0 18px rgba(255, 0, 127, 0.7);
}

.action-btn-yellow { 
    background: radial-gradient(circle at 35% 35%, var(--neon-yellow) 0%, #807800 80%); 
    box-shadow: 0 4px 0 #5c5700, inset 0 2px 3px rgba(255,255,255,0.3), 0 0 10px rgba(255, 240, 0, 0.3);
    color: #000;
    text-shadow: none;
}
.action-btn-yellow:active, .action-btn-yellow.active {
    box-shadow: 0 1px 0 #5c5700, 0 0 18px rgba(255, 240, 0, 0.7);
}

.action-btn-blue { 
    background: radial-gradient(circle at 35% 35%, var(--neon-blue) 0%, #007780 80%); 
    box-shadow: 0 4px 0 #00545c, inset 0 2px 3px rgba(255,255,255,0.3), 0 0 10px rgba(0, 240, 255, 0.3);
}
.action-btn-blue:active, .action-btn-blue.active {
    box-shadow: 0 1px 0 #00545c, 0 0 18px rgba(0, 240, 255, 0.7);
}

.btn-sub-label {
    font-size: 0.35rem;
    opacity: 0.8;
    margin-top: 2px;
}

.deck-label {
    font-family: var(--font-retro);
    font-size: 0.5rem;
    color: #4a4e69;
    letter-spacing: 1px;
    margin-top: 5px;
    text-shadow: 0 1px 1px #000;
}

/* --------------------------------------------------
   FLOATING SCREEN ROTATION TOGGLE
   -------------------------------------------------- */
.btn-rotate-vibe {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(20, 22, 37, 0.85);
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: none; /* Only show on mobile views */
}

.btn-rotate-vibe:hover {
    background: var(--neon-blue);
    color: var(--bg-dark);
    box-shadow: 0 0 25px var(--neon-blue);
    transform: scale(1.05);
}

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

/* --------------------------------------------------
   MOBILE FORCED LANDSCAPE ROTATION SYSTEM
   -------------------------------------------------- */
body.forced-landscape {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

body.forced-landscape .arcade-wrapper {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    width: 95vh !important;
    height: 95vw !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
    transform-origin: center !important;
    padding: 8px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 5px !important;
    box-sizing: border-box !important;
}

body.forced-landscape .arcade-console {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
}

body.forced-landscape .sidebar-left,
body.forced-landscape .sidebar-right {
    display: none !important;
}

body.forced-landscape .arcade-bezel {
    width: 100% !important;
    max-width: 540px !important;
    padding: 8px !important;
    margin: 0 auto !important;
    border-radius: 12px !important;
}

body.forced-landscape .crt-screen {
    width: 100% !important;
    height: 200px !important; /* Scale game height to fit beautifully inside screen dimensions */
}

body.forced-landscape .arcade-deck {
    padding: 8px 15px !important;
    width: 100% !important;
    max-width: 540px !important;
    margin: 0 auto !important;
    border-radius: 8px !important;
    gap: 15px !important;
}

body.forced-landscape .arcade-header {
    display: none !important; /* Hide header to maximize vertical workspace */
}

body.forced-landscape .wasd-key {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.65rem !important;
}

body.forced-landscape .wasd-group {
    width: 120px !important;
    height: 80px !important;
    padding: 4px !important;
}

body.forced-landscape .action-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 0.4rem !important;
}

body.forced-landscape .action-pad-group {
    padding: 4px 10px !important;
    gap: 8px !important;
}

/* --------------------------------------------------
   ANIMATIONS & KEYFRAMES
   -------------------------------------------------- */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

@keyframes flicker {
    0% { opacity: 0.98; }
    50% { opacity: 1; }
    100% { opacity: 0.99; }
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.shake-effect {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.pulse-effect {
    animation: pulse 1.5s infinite;
}

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

.animated-pop {
    animation: pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive Scaling down for smaller displays */
@media (max-width: 1380px) {
    .arcade-wrapper {
        transform: scale(0.9);
        transform-origin: center top;
        margin-top: -30px;
    }
}

@media (max-width: 1250px) {
    .arcade-wrapper {
        transform: scale(0.8);
    }
}

/* Collapse layout to single column on devices with width <= 900px */
@media (max-width: 900px) {
    .arcade-wrapper {
        transform: none !important;
        margin: 0 auto !important;
        padding: 10px !important;
        max-width: 100% !important;
    }
    
    .arcade-console {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .sidebar-left, .sidebar-right {
        display: none !important; /* Hide sidebars to focus purely on the game on phone portrait */
    }
    
    .arcade-bezel {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        border-radius: 12px !important;
    }
    
    .crt-screen {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important; /* Maintain widescreen ratio beautifully */
    }
    
    .arcade-deck {
        width: 100% !important;
        padding: 12px 15px !important;
        gap: 15px !important;
        border-radius: 8px !important;
    }
    
    .wasd-key {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.75rem !important;
    }
    
    .wasd-group {
        width: 130px !important;
        height: 90px !important;
        padding: 6px !important;
    }
    
    .action-btn {
        width: 42px !important;
        height: 42px !important;
        font-size: 0.42rem !important;
    }
    
    .action-pad-group {
        padding: 6px 12px !important;
        gap: 10px !important;
    }
}
