/* ============================================
   TOKENS
   ============================================ */
:root {
    --bg: #0b0e14;
    --bg-panel: #12161f;
    --bg-panel-2: #171c27;
    --line: #242b3a;
    --ink: #e9edf4;
    --muted: #7b869a;
    --muted-dim: #4c5567;
    /* default / fallback game accent — overridden per-card */
    --accent: #54c0c9;
    --accent-dim: #2c5257;
    --font-display: "Silkscreen", monospace;
    --font-mono: "JetBrains Mono", monospace;
    --font-body: "Inter", system-ui, sans-serif;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    position: relative;
    min-height: 100vh;
}

/* ============================================
   AMBIENT CRT TEXTURE — signature atmosphere
   kept very quiet, static by default
   ============================================ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.025) 0px,
        rgba(255, 255, 255, 0.025) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
        ellipse at 50% 0%,
        rgba(84, 192, 201, 0.08),
        transparent 60%
    );
}

@media (prefers-reduced-motion: no-preference) {
    .flicker {
        animation: flicker 6s ease-in-out infinite;
    }
}

@keyframes flicker {
    0%,
    96%,
    100% {
        opacity: 1;
    }

    97% {
        opacity: 0.96;
    }

    98% {
        opacity: 1;
    }
}

a {
    color: inherit;
}

/* ============================================
   LAYOUT SHELL
   ============================================ */
.wrap {
    position: relative;
    z-index: 2;
    max-width: 1040px;
    margin: 0 auto;
    padding: 64px 24px 96px;
}

/* ============================================
   HEADER
   ============================================ */
header {
    margin-bottom: 56px;
}

.prompt {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 14px;
    letter-spacing: 0.02em;
}

.prompt .sym {
    color: var(--accent);
}

.prompt .cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--accent);
    margin-left: 2px;
    transform: translateY(2px);
}

h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(32px, 6vw, 52px);
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin: 0 0 16px;
    color: #fff;
    text-shadow: 0 0 24px rgba(84, 192, 201, 0.35);
}

.lede {
    font-size: 16px;
    color: var(--muted);
    max-width: 46ch;
    margin: 0;
}

.divider {
    border: none;
    border-top: 1px dashed var(--line);
    margin: 40px 0;
}

/* ============================================
   SHELF LABEL
   ============================================ */
.shelf-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 24px;
}

.shelf-label h2 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin: 0;
    white-space: nowrap;
}

.shelf-label .rule {
    height: 1px;
    background: var(--line);
    width: 100%;
}

/* ============================================
   CARTRIDGE GRID
   ============================================ */
.shelf {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 56px;
}

.cartridge {
    --accent: #54c0c9;
    --accent-dim: #2c5257;
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.cartridge::before {
    /* the cartridge ridge — top edge glow, colored per game */
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--accent-dim));
}

.cartridge:hover,
.cartridge:focus-within {
    transform: translateY(-4px);
    border-color: var(--accent-dim);
    box-shadow:
        0 12px 32px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px var(--accent-dim);
}

.cart-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cart-icon {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: var(--bg-panel-2);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    image-rendering: pixelated;
    overflow: hidden;
}

.cart-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.cart-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: #fff;
    margin: 0 0 4px;
    line-height: 1.3;
}

.cart-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cart-desc {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.platforms li {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    background: var(--bg-panel-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px 8px;
}

.cart-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.btn {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 9px 14px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: #0b0e14;
    flex: 1;
    justify-content: center;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-ghost {
    border-color: var(--line);
    color: var(--muted);
}

.btn-ghost:hover {
    border-color: var(--accent-dim);
    color: var(--ink);
}

/* ============================================
   GHOST / COMING SOON CARD
   ============================================ */
.cartridge.ghost {
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted-dim);
    border-style: dashed;
    min-height: 180px;
}

.cartridge.ghost::before {
    display: none;
}

.cartridge.ghost:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--line);
}

.ghost-slot {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.ghost-slot .sym {
    color: var(--accent-dim);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted-dim);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

footer a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

footer a:hover {
    color: var(--accent);
    border-color: var(--accent-dim);
}

/* ============================================
   FOCUS STATES (accessibility)
   ============================================ */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .wrap {
        padding: 40px 18px 72px;
    }

    .shelf {
        grid-template-columns: 1fr;
    }
}
