/* ============================================
   gamelicen.se - Pixel Art License Bureau
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #1A1B2E;
    --bg-secondary: #2A2D3E;
    --bg-tile-alt: #252838;
    --accent-gold: #D4A844;
    --accent-green: #33FF66;
    --accent-red: #CC3344;
    --surface-cream: #F0E6D0;
    --highlight-teal: #44BBAA;
    --shadow-ink: #0D0E1A;
    --vault-bg: #13142A;
    --wood-brown: #6B5B3E;
    --cart-grey: #8B8B9E;
    --cart-red: #CC3344;
    --cart-blue: #3355AA;
    --cart-green: #33AA55;
    --cart-gold: #D4A844;
    --cart-purple: #6644AA;
}

/* Global Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: auto;
    overflow-y: hidden;
    height: 100vh;
    width: 100%;
    background: var(--bg-primary);
    image-rendering: pixelated;
    font-family: 'VT323', monospace;
    color: var(--surface-cream);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-gold) var(--bg-primary);
}

body {
    scroll-snap-type: x mandatory;
}

/* Pixel Grid Overlay */
.pixel-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background:
        repeating-linear-gradient(
            to right,
            rgba(212, 168, 68, 0.04) 0px,
            rgba(212, 168, 68, 0.04) 1px,
            transparent 1px,
            transparent 16px
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(212, 168, 68, 0.04) 0px,
            rgba(212, 168, 68, 0.04) 1px,
            transparent 1px,
            transparent 16px
        );
}

/* Floating Particles */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: var(--accent-gold);
    opacity: 0.25;
}

@keyframes particleFloat {
    0% { transform: translateY(0) translateX(0); opacity: 0.2; }
    25% { transform: translateY(-30vh) translateX(20px); opacity: 0.35; }
    50% { transform: translateY(-60vh) translateX(-10px); opacity: 0.25; }
    75% { transform: translateY(-80vh) translateX(15px); opacity: 0.3; }
    100% { transform: translateY(-110vh) translateX(0); opacity: 0; }
}

/* HUD Overlay */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(13, 14, 26, 0.85);
    border-bottom: 1px solid rgba(212, 168, 68, 0.3);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.hud-left {
    flex: 1;
}

.hud-room-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
}

.hud-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.minimap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.minimap-dot {
    width: 12px;
    height: 12px;
    border: 1px solid rgba(212, 168, 68, 0.4);
    transition: all 0.3s ease;
}

.minimap-dot.active {
    background: var(--highlight-teal);
    border-color: var(--highlight-teal);
}

.hud-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.clerk-sprite {
    width: 16px;
    height: 24px;
    background: var(--accent-gold);
    position: relative;
    animation: clerkWalk 0.6s steps(4) infinite;
}

.clerk-sprite::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: var(--surface-cream);
}

@keyframes clerkWalk {
    0% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

/* Main Bureau Container */
.bureau {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 600vw;
    scroll-snap-type: x mandatory;
}

/* Room Base */
.room {
    flex-shrink: 0;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

/* =====================
   ROOM 0: BOOT SCREEN
   ===================== */
.room-boot {
    width: 100vw;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.boot-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    position: relative;
}

.boot-cursor {
    width: 8px;
    height: 16px;
    background: var(--accent-gold);
    animation: cursorBlink 1s steps(1) infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.boot-cursor.hidden {
    display: none;
}

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

.boot-title {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
    white-space: nowrap;
    min-height: 1.2em;
    text-shadow: 2px 2px 0 var(--shadow-ink);
}

.boot-title .char {
    display: inline-block;
    opacity: 0;
    animation: charAppear 0.05s forwards;
}

@keyframes charAppear {
    to { opacity: 1; }
}

.boot-loader {
    opacity: 0;
    transition: opacity 0.3s;
}

.boot-loader.visible {
    opacity: 1;
}

.loader-bar {
    width: 300px;
    height: 16px;
    border: 1px solid var(--accent-gold);
    position: relative;
    overflow: hidden;
    background: var(--shadow-ink);
}

.loader-fill {
    width: 0;
    height: 100%;
    background: var(--accent-green);
    transition: width 0.08s steps(1);
}

.loader-cartridges {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    pointer-events: none;
}

.loader-cartridge-icon {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}

.loader-cartridge-icon.visible {
    opacity: 0.6;
}

.boot-prompt {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.6rem, 1.2vw, 0.9rem);
    color: var(--surface-cream);
    opacity: 0;
    animation: none;
}

.boot-prompt.active {
    animation: promptPulse 1s ease-in-out infinite;
}

@keyframes promptPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.boot-starburst {
    position: absolute;
    width: 300px;
    height: 16px;
    pointer-events: none;
}

.starburst-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 0;
    background: var(--accent-gold);
    transform-origin: center top;
    opacity: 0;
}

@keyframes starburstExpand {
    0% { height: 0; opacity: 1; }
    60% { height: 60px; opacity: 0.8; }
    100% { height: 80px; opacity: 0; }
}

/* ========================
   ROOM 1: RECEPTION DESK
   ======================== */
.room-reception {
    width: 100vw;
    background: var(--bg-secondary);
    position: relative;
}

.reception-content {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Tiled Floor */
.room-reception::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background:
        repeating-conic-gradient(
            var(--bg-secondary) 0% 25%,
            var(--bg-tile-alt) 0% 50%
        ) 0 0 / 32px 32px;
    z-index: 0;
}

/* Shelves */
.shelves {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;
}

.shelf-row {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    background: var(--wood-brown);
    border-bottom: 2px solid #5A4B2E;
}

.cartridge-small {
    width: 16px;
    height: 24px;
    position: relative;
}

.cartridge-small::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 2px;
    width: 12px;
    height: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.cartridge-small.c-grey { background: var(--cart-grey); }
.cartridge-small.c-red { background: var(--cart-red); }
.cartridge-small.c-blue { background: var(--cart-blue); }
.cartridge-small.c-green { background: var(--cart-green); }
.cartridge-small.c-gold { background: var(--cart-gold); }
.cartridge-small.c-purple { background: var(--cart-purple); opacity: 0.8; }

/* Clerk NPC */
.clerk-npc {
    position: absolute;
    bottom: 210px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.clerk-body {
    width: 64px;
    height: 96px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.clerk-head {
    width: 24px;
    height: 24px;
    background: var(--surface-cream);
    position: relative;
}

.clerk-head::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 4px;
    width: 4px;
    height: 4px;
    background: var(--shadow-ink);
    box-shadow: 12px 0 0 var(--shadow-ink);
}

.clerk-head::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -2px;
    width: 28px;
    height: 8px;
    background: var(--shadow-ink);
}

.clerk-torso {
    width: 32px;
    height: 40px;
    background: var(--cart-blue);
    margin-top: 2px;
    position: relative;
}

.clerk-torso::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent-gold);
}

.clerk-arms {
    position: absolute;
    top: 28px;
    left: -8px;
    width: 80px;
    height: 8px;
    background: var(--cart-blue);
}

/* Speech Bubble */
.speech-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 16px;
    background: var(--surface-cream);
    border: 2px solid var(--shadow-ink);
    padding: 16px 20px;
    max-width: 400px;
    min-width: 200px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.speech-bubble.visible {
    opacity: 1;
}

.speech-text {
    font-family: 'VT323', monospace;
    font-size: clamp(0.9rem, 2vw, 1.4rem);
    line-height: 1.6;
    letter-spacing: 0.02em;
    color: var(--accent-green);
}

.speech-tail {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid var(--shadow-ink);
}

.speech-tail::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -6px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--surface-cream);
}

/* Reception Counter */
.reception-counter {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

.counter-top {
    height: 4px;
    background: var(--accent-gold);
}

.counter-body {
    height: 196px;
    background: var(--wood-brown);
    border-top: 2px solid #8B7B5E;
    position: relative;
}

.counter-body::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 40px 0 rgba(0, 0, 0, 0.15), 0 80px 0 rgba(0, 0, 0, 0.15);
}

/* ============================
   ROOM 2: ARCHIVE CORRIDOR
   ============================ */
.room-archive {
    width: 150vw;
    background: var(--bg-secondary);
    position: relative;
}

.archive-content {
    width: 100%;
    height: 100%;
    position: relative;
    padding-top: 48px;
}

/* Corridor Floor */
.corridor-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background:
        repeating-conic-gradient(
            var(--bg-secondary) 0% 25%,
            var(--bg-tile-alt) 0% 50%
        ) 0 0 / 32px 32px;
    transform: perspective(800px) rotateX(60deg);
    transform-origin: bottom center;
}

/* Filing Cabinets */
.cabinets-top,
.cabinets-bottom {
    display: flex;
    gap: 32px;
    padding: 16px 32px;
    z-index: 2;
    position: relative;
}

.cabinets-top {
    justify-content: flex-start;
}

.cabinets-bottom {
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    justify-content: flex-end;
}

.filing-cabinet {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer {
    width: 120px;
    height: 36px;
    background: var(--bg-tile-alt);
    border: 1px solid var(--accent-gold);
    display: flex;
    align-items: center;
    padding: 0 8px;
    position: relative;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 2px 2px 0 var(--shadow-ink);
    cursor: pointer;
}

.drawer.open {
    transform: translateX(80px);
}

.drawer-handle {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-gold);
    margin-right: 8px;
    flex-shrink: 0;
}

.drawer-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
}

.drawer .exclamation {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    color: var(--accent-gold);
    opacity: 0;
    animation: exclamationFlash 0.6s ease-out forwards;
}

@keyframes exclamationFlash {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-16px); }
}

/* Item Cards Grid */
.item-cards-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(2, 260px);
    grid-template-rows: repeat(3, auto);
    gap: 16px;
    z-index: 3;
}

.item-card {
    background: var(--surface-cream);
    border: 2px solid var(--accent-gold);
    padding: 16px;
    box-shadow: 2px 2px 0 var(--shadow-ink);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.item-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: repeat(8, 4px);
    grid-template-rows: repeat(8, 4px);
}

/* Icon Pixel Art via box-shadow */
.card-icon-open {
    background: var(--accent-green);
    box-shadow:
        4px 0 0 var(--accent-green),
        8px 0 0 var(--accent-green),
        0 4px 0 var(--accent-green),
        4px 4px 0 var(--shadow-ink),
        8px 4px 0 var(--accent-green),
        12px 4px 0 var(--accent-green),
        0 8px 0 var(--accent-green),
        4px 8px 0 var(--accent-green),
        8px 8px 0 var(--shadow-ink),
        12px 8px 0 var(--accent-green);
    width: 4px;
    height: 4px;
}

.card-icon-prop {
    background: var(--accent-red);
    box-shadow:
        4px 0 0 var(--accent-red),
        8px 0 0 var(--accent-red),
        0 4px 0 var(--accent-red),
        4px 4px 0 var(--accent-gold),
        8px 4px 0 var(--accent-gold),
        12px 4px 0 var(--accent-red),
        0 8px 0 var(--accent-red),
        4px 8px 0 var(--accent-red),
        8px 8px 0 var(--accent-red),
        12px 8px 0 var(--accent-red);
    width: 4px;
    height: 4px;
}

.card-icon-cc {
    background: var(--highlight-teal);
    box-shadow:
        4px 0 0 var(--highlight-teal),
        0 4px 0 var(--highlight-teal),
        4px 4px 0 var(--surface-cream),
        8px 4px 0 var(--highlight-teal),
        0 8px 0 var(--highlight-teal),
        4px 8px 0 var(--highlight-teal),
        8px 8px 0 var(--highlight-teal);
    width: 4px;
    height: 4px;
}

.card-icon-free {
    background: var(--accent-gold);
    box-shadow:
        4px 0 0 var(--accent-gold),
        8px 0 0 var(--accent-gold),
        0 4px 0 var(--accent-gold),
        4px 4px 0 var(--accent-green),
        8px 4px 0 var(--accent-green),
        0 8px 0 var(--accent-gold),
        4px 8px 0 var(--accent-gold),
        8px 8px 0 var(--accent-gold);
    width: 4px;
    height: 4px;
}

.card-icon-share {
    background: var(--cart-blue);
    box-shadow:
        4px 0 0 var(--cart-blue),
        8px 0 0 var(--cart-blue),
        0 4px 0 var(--accent-gold),
        4px 4px 0 var(--cart-blue),
        8px 4px 0 var(--accent-gold),
        0 8px 0 var(--cart-blue),
        4px 8px 0 var(--cart-blue),
        8px 8px 0 var(--cart-blue);
    width: 4px;
    height: 4px;
}

.card-icon-pd {
    background: var(--surface-cream);
    box-shadow:
        4px 0 0 var(--shadow-ink),
        8px 0 0 var(--surface-cream),
        0 4px 0 var(--shadow-ink),
        4px 4px 0 var(--surface-cream),
        8px 4px 0 var(--shadow-ink),
        0 8px 0 var(--surface-cream),
        4px 8px 0 var(--shadow-ink),
        8px 8px 0 var(--surface-cream);
    width: 4px;
    height: 4px;
}

.card-title {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    color: var(--accent-gold);
    margin-bottom: 8px;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.card-desc {
    font-family: 'VT323', monospace;
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    line-height: 1.5;
    color: var(--shadow-ink);
}

/* ========================
   ROOM 3: STAMP ROOM
   ======================== */
.room-stamp {
    width: 100vw;
    background: #303348;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stamp-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    padding-top: 48px;
}

/* Main Stamp */
.main-stamp {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform: translateY(-100px);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.22, 1.0, 0.36, 1), opacity 0.3s;
}

.main-stamp.animate-in {
    transform: translateY(0);
    opacity: 1;
}

.main-stamp.impact {
    animation: stampImpact 0.09s ease-out;
}

@keyframes stampImpact {
    0% { transform: translateY(0) translateX(0); }
    20% { transform: translateY(0) translateX(2px); }
    40% { transform: translateY(0) translateX(-2px); }
    60% { transform: translateY(0) translateX(2px); }
    80% { transform: translateY(0) translateX(-1px); }
    100% { transform: translateY(0) translateX(0); }
}

.stamp-handle {
    width: 40px;
    height: 48px;
    background: #5A5A6E;
    border-radius: 0;
    position: relative;
}

.stamp-handle::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 4px;
    width: 32px;
    height: 16px;
    background: #6A6A7E;
    border-radius: 0;
}

.stamp-arm {
    width: 16px;
    height: 24px;
    background: #4A4A5E;
}

.stamp-face {
    width: 200px;
    height: 200px;
    border: 4px dashed var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.stamp-face::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px dashed var(--accent-green);
    opacity: 0.5;
}

.stamp-text {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.8rem, 2vw, 1.4rem);
    color: var(--accent-green);
    transform: rotate(-15deg);
    letter-spacing: 0.1em;
}

.stamp-impact {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.stamp-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    opacity: 0;
}

@keyframes particleExplode {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { opacity: 0; }
}

/* Impact Rings */
.impact-rings {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.impact-ring {
    position: absolute;
    border: 2px solid var(--accent-green);
    opacity: 0;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@keyframes ringExpand {
    0% { width: 20px; height: 20px; opacity: 0.8; }
    100% { width: 200px; height: 200px; opacity: 0; }
}

/* Document */
.stamp-document {
    width: 280px;
    padding: 24px;
    background: var(--surface-cream);
    box-shadow: 2px 2px 0 var(--shadow-ink);
    position: relative;
    margin-top: -48px;
}

.doc-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-line {
    height: 2px;
    background: rgba(13, 14, 26, 0.15);
    width: 100%;
}

.doc-line.short {
    width: 60%;
}

.doc-stamp-mark {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--accent-green);
    transform: rotate(-15deg);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    opacity: 0;
    letter-spacing: 0.1em;
    border: 2px dashed var(--accent-green);
    padding: 8px 16px;
}

.doc-stamp-mark.visible {
    opacity: 0.7;
}

/* Small Stamps Grid */
.small-stamps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.small-stamp {
    cursor: pointer;
    transition: transform 0.15s;
}

.small-stamp:hover {
    transform: scale(1.05);
}

.small-stamp-face {
    width: 80px;
    height: 80px;
    border: 3px dashed;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.small-stamp-face span {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.45rem;
    letter-spacing: 0.05em;
    transform: rotate(-15deg);
}

.stamp-review {
    border-color: var(--highlight-teal);
    color: var(--highlight-teal);
}

.stamp-pending {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.stamp-denied {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.stamp-approved {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.small-stamp.bounce .small-stamp-face {
    animation: stampBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stampBounce {
    0% { transform: scale(0); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ===========================
   ROOM 4: CARTRIDGE VAULT
   =========================== */
.room-vault {
    width: 150vw;
    background: var(--vault-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
}

.vault-content {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vault-masonry {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding-top: 48px;
}

.vault-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.vault-column:nth-child(2) { margin-top: 32px; }
.vault-column:nth-child(3) { margin-top: -16px; }
.vault-column:nth-child(4) { margin-top: 48px; }
.vault-column:nth-child(5) { margin-top: 16px; }

/* Cartridge Sprites */
.vault-cartridge {
    width: 64px;
    height: 96px;
    position: relative;
    cursor: pointer;
    transition: filter 0.2s;
}

.vault-cartridge:hover {
    filter: brightness(1.2);
}

.vault-cartridge:hover .cart-shell {
    box-shadow: 0 0 0 2px var(--highlight-teal);
    animation: selectionCursor 0.8s linear infinite;
}

@keyframes selectionCursor {
    0% { box-shadow: 0 0 0 2px var(--highlight-teal); }
    50% { box-shadow: 0 0 0 2px transparent; }
    100% { box-shadow: 0 0 0 2px var(--highlight-teal); }
}

.cart-shell {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px;
    box-shadow: 2px 2px 0 var(--shadow-ink);
}

.vault-cartridge.c-grey .cart-shell { background: var(--cart-grey); }
.vault-cartridge.c-red .cart-shell { background: var(--cart-red); }
.vault-cartridge.c-blue .cart-shell { background: var(--cart-blue); }
.vault-cartridge.c-green .cart-shell { background: var(--cart-green); }
.vault-cartridge.c-gold .cart-shell { background: var(--cart-gold); }
.vault-cartridge.c-purple .cart-shell { background: var(--cart-purple); opacity: 0.8; }

/* Cartridge notch at top */
.cart-shell::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 8px;
    background: inherit;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.cart-label {
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-code {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.35rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: auto;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

/* Pixel Art Mini Scenes */
.cart-scene {
    width: 32px;
    height: 32px;
    position: relative;
}

/* Mountain scene */
.scene-mountain::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 16px solid var(--accent-green);
}

.scene-mountain::after {
    content: '';
    position: absolute;
    bottom: 14px;
    left: 10px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--surface-cream);
}

/* Spaceship scene */
.scene-spaceship {
    background: var(--shadow-ink);
}

.scene-spaceship::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 8px;
    width: 16px;
    height: 8px;
    background: var(--cart-grey);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: rotate(90deg);
}

.scene-spaceship::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 14px;
    width: 4px;
    height: 8px;
    background: var(--accent-red);
}

/* Waves scene */
.scene-waves::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 2px;
    width: 28px;
    height: 4px;
    background: var(--highlight-teal);
    box-shadow: 0 -8px 0 var(--cart-blue), 4px -4px 0 var(--highlight-teal);
}

/* Tree scene */
.scene-tree::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 13px;
    width: 6px;
    height: 12px;
    background: var(--wood-brown);
}

.scene-tree::after {
    content: '';
    position: absolute;
    bottom: 14px;
    left: 6px;
    width: 20px;
    height: 14px;
    background: var(--accent-green);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

/* Castle scene */
.scene-castle::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 24px;
    height: 16px;
    background: var(--cart-grey);
}

.scene-castle::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 4px;
    width: 4px;
    height: 8px;
    background: var(--cart-grey);
    box-shadow: 10px 0 0 var(--cart-grey), 20px 0 0 var(--cart-grey);
}

/* Car scene */
.scene-car::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 4px;
    width: 24px;
    height: 8px;
    background: var(--accent-red);
}

.scene-car::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 6px;
    width: 6px;
    height: 6px;
    background: var(--shadow-ink);
    border-radius: 50%;
    box-shadow: 14px 0 0 var(--shadow-ink);
}

/* Puzzle scene */
.scene-puzzle::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 4px;
    width: 12px;
    height: 12px;
    background: var(--accent-gold);
    box-shadow: 12px 12px 0 var(--accent-gold);
}

.scene-puzzle::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 16px;
    width: 12px;
    height: 12px;
    background: var(--highlight-teal);
    box-shadow: -12px 12px 0 var(--highlight-teal);
}

/* Dragon scene */
.scene-dragon::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 16px;
    height: 12px;
    background: var(--accent-red);
    clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}

.scene-dragon::after {
    content: '';
    position: absolute;
    bottom: 18px;
    left: 4px;
    width: 4px;
    height: 8px;
    background: var(--accent-gold);
}

/* Plane scene */
.scene-plane::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 6px;
    width: 20px;
    height: 4px;
    background: var(--surface-cream);
}

.scene-plane::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 12px;
    width: 12px;
    height: 4px;
    background: var(--surface-cream);
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

/* Robot scene */
.scene-robot::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 10px;
    width: 12px;
    height: 16px;
    background: var(--cart-grey);
}

.scene-robot::after {
    content: '';
    position: absolute;
    bottom: 18px;
    left: 12px;
    width: 8px;
    height: 8px;
    background: var(--highlight-teal);
}

/* Chest scene */
.scene-chest::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 6px;
    width: 20px;
    height: 12px;
    background: var(--wood-brown);
    border: 1px solid var(--accent-gold);
}

.scene-chest::after {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 14px;
    width: 4px;
    height: 4px;
    background: var(--accent-gold);
}

/* Ghost scene */
.scene-ghost::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 16px;
    height: 20px;
    background: var(--surface-cream);
    opacity: 0.7;
    clip-path: polygon(0 0, 100% 0, 100% 80%, 75% 100%, 50% 80%, 25% 100%, 0 80%);
}

.scene-ghost::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 12px;
    width: 4px;
    height: 4px;
    background: var(--shadow-ink);
    box-shadow: 6px 0 0 var(--shadow-ink);
}

/* Sword scene */
.scene-sword::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 14px;
    width: 4px;
    height: 20px;
    background: var(--cart-grey);
}

.scene-sword::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 8px;
    width: 16px;
    height: 4px;
    background: var(--accent-gold);
}

/* Star scene */
.scene-star {
    background: var(--shadow-ink);
}

.scene-star::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 10px;
    width: 4px;
    height: 4px;
    background: var(--accent-gold);
    box-shadow:
        8px 4px 0 var(--surface-cream),
        -6px 8px 0 var(--accent-gold),
        12px 12px 0 var(--surface-cream),
        2px 16px 0 var(--accent-gold);
}

/* Farm scene */
.scene-farm::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 2px;
    width: 28px;
    height: 8px;
    background: var(--accent-green);
}

.scene-farm::after {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 10px;
    width: 12px;
    height: 10px;
    background: var(--accent-red);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* Dungeon scene */
.scene-dungeon::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: var(--bg-tile-alt);
    border: 2px solid var(--cart-grey);
}

.scene-dungeon::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 12px;
    width: 8px;
    height: 10px;
    background: var(--shadow-ink);
    border-top: 2px solid var(--accent-gold);
}

/* Clock scene */
.scene-clock::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 8px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
}

.scene-clock::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 15px;
    width: 2px;
    height: 8px;
    background: var(--accent-gold);
    transform-origin: top center;
    transform: rotate(30deg);
}

/* Bobbing Animation */
@keyframes cartridgeBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.vault-cartridge:nth-child(1) { animation: cartridgeBob 3s ease-in-out infinite; }
.vault-cartridge:nth-child(2) { animation: cartridgeBob 3.5s ease-in-out infinite 0.3s; }
.vault-cartridge:nth-child(3) { animation: cartridgeBob 4s ease-in-out infinite 0.6s; }
.vault-cartridge:nth-child(4) { animation: cartridgeBob 3.2s ease-in-out infinite 0.9s; }

/* Vault Tooltip */
.vault-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 1002;
    opacity: 0;
    transition: opacity 0.2s;
    transform: translateY(-8px);
}

.vault-tooltip.visible {
    opacity: 1;
}

.tooltip-content {
    background: var(--surface-cream);
    border: 2px solid var(--accent-gold);
    padding: 8px 12px;
    box-shadow: 2px 2px 0 var(--shadow-ink);
    display: flex;
    flex-direction: column;
    gap: 4px;
    white-space: nowrap;
}

.tooltip-title {
    font-family: 'Silkscreen', cursive;
    font-size: 0.7rem;
    color: var(--accent-gold);
}

.tooltip-meta {
    font-family: 'VT323', monospace;
    font-size: 0.85rem;
    color: var(--shadow-ink);
}

/* ========================
   PIXEL WIPE TRANSITION
   ======================== */
.pixel-wipe {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
    z-index: 2000;
}

.wipe-col {
    flex: 1;
    background: var(--shadow-ink);
    transform: scaleY(0);
    transform-origin: top;
}

.pixel-wipe.active .wipe-col {
    animation: wipeColumn 0.4s ease-in-out forwards;
}

@keyframes wipeColumn {
    0% { transform: scaleY(0); }
    50% { transform: scaleY(1); }
    100% { transform: scaleY(0); transform-origin: bottom; }
}

/* Stagger wipe columns */
.pixel-wipe.active .wipe-col:nth-child(1) { animation-delay: 0ms; }
.pixel-wipe.active .wipe-col:nth-child(2) { animation-delay: 20ms; }
.pixel-wipe.active .wipe-col:nth-child(3) { animation-delay: 40ms; }
.pixel-wipe.active .wipe-col:nth-child(4) { animation-delay: 60ms; }
.pixel-wipe.active .wipe-col:nth-child(5) { animation-delay: 80ms; }
.pixel-wipe.active .wipe-col:nth-child(6) { animation-delay: 100ms; }
.pixel-wipe.active .wipe-col:nth-child(7) { animation-delay: 120ms; }
.pixel-wipe.active .wipe-col:nth-child(8) { animation-delay: 140ms; }
.pixel-wipe.active .wipe-col:nth-child(9) { animation-delay: 160ms; }
.pixel-wipe.active .wipe-col:nth-child(10) { animation-delay: 180ms; }
.pixel-wipe.active .wipe-col:nth-child(11) { animation-delay: 200ms; }
.pixel-wipe.active .wipe-col:nth-child(12) { animation-delay: 220ms; }
.pixel-wipe.active .wipe-col:nth-child(13) { animation-delay: 240ms; }
.pixel-wipe.active .wipe-col:nth-child(14) { animation-delay: 260ms; }
.pixel-wipe.active .wipe-col:nth-child(15) { animation-delay: 280ms; }
.pixel-wipe.active .wipe-col:nth-child(16) { animation-delay: 300ms; }
.pixel-wipe.active .wipe-col:nth-child(17) { animation-delay: 320ms; }
.pixel-wipe.active .wipe-col:nth-child(18) { animation-delay: 340ms; }
.pixel-wipe.active .wipe-col:nth-child(19) { animation-delay: 360ms; }
.pixel-wipe.active .wipe-col:nth-child(20) { animation-delay: 380ms; }

/* ========================
   RESPONSIVE ADJUSTMENTS
   ======================== */
@media (max-width: 768px) {
    .item-cards-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        max-height: 70vh;
        overflow-y: auto;
        padding: 16px;
    }

    .vault-masonry {
        gap: 12px;
    }

    .vault-cartridge {
        width: 48px;
        height: 72px;
    }

    .cart-label {
        width: 36px;
        height: 36px;
    }

    .stamp-face {
        width: 140px;
        height: 140px;
    }

    .small-stamp-face {
        width: 60px;
        height: 60px;
    }

    .speech-bubble {
        max-width: 280px;
        min-width: 160px;
    }
}
