/* gabs.games -- Arcade Cabinet */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy: #0B0E2A;
    --panel: #151937;
    --gold: #FFD700;
    --mint: #3DFFA2;
    --coral: #FF6B6B;
    --white: #E8E6F0;
    --lavender: #9B97B8;
    --violet: #8B5CF6;
}

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    color: var(--white);
    background-color: var(--navy);
    overflow-x: hidden;
}

/* ===================== SCANLINES ===================== */

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 1px,
        rgba(0, 0, 0, 0.03) 1px,
        rgba(0, 0, 0, 0.03) 2px
    );
}

/* ===================== GAME SCREENS ===================== */

.game-screen {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.screen-header {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--gold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 12px;
    text-align: center;
}

.screen-sub {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    color: var(--lavender);
    margin-bottom: 40px;
    text-align: center;
}

/* ===================== TITLE SCREEN ===================== */

#title-screen {
    position: relative;
}

.starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(1px 1px at 20% 30%, rgba(232, 230, 240, 0.4) 0%, transparent 100%),
                radial-gradient(1px 1px at 40% 70%, rgba(232, 230, 240, 0.3) 0%, transparent 100%),
                radial-gradient(1px 1px at 60% 20%, rgba(232, 230, 240, 0.5) 0%, transparent 100%),
                radial-gradient(1px 1px at 80% 50%, rgba(232, 230, 240, 0.2) 0%, transparent 100%),
                radial-gradient(1px 1px at 10% 80%, rgba(232, 230, 240, 0.35) 0%, transparent 100%),
                radial-gradient(1px 1px at 50% 40%, rgba(232, 230, 240, 0.25) 0%, transparent 100%),
                radial-gradient(1px 1px at 70% 90%, rgba(232, 230, 240, 0.4) 0%, transparent 100%),
                radial-gradient(1px 1px at 90% 10%, rgba(232, 230, 240, 0.3) 0%, transparent 100%);
    pointer-events: none;
}

.coin-container {
    margin-bottom: 32px;
}

.pixel-coin {
    width: 64px;
    height: 64px;
    background: var(--gold);
    border-radius: 50%;
    position: relative;
    animation: coinSpin 1.5s steps(4) infinite;
    image-rendering: pixelated;
    box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.2), inset 4px 4px 0 rgba(255, 255, 255, 0.2);
}

.pixel-coin::after {
    content: '값';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'DotGothic16', sans-serif;
    font-size: 24px;
    color: var(--navy);
}

@keyframes coinSpin {
    0% { transform: scaleX(1); }
    25% { transform: scaleX(0.2); }
    50% { transform: scaleX(1); }
    75% { transform: scaleX(0.2); }
    100% { transform: scaleX(1); }
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--gold);
    text-align: center;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.blink-prompt {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    color: var(--white);
    animation: blink 1s steps(1) infinite;
    margin-top: 40px;
    cursor: pointer;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.subtitle {
    font-family: 'DotGothic16', sans-serif;
    font-size: 1.1rem;
    color: var(--lavender);
    margin-top: 12px;
}

/* ===================== THE SHOP ===================== */

#the-shop {
    justify-content: flex-start;
    padding-top: 60px;
}

.shop-shelf {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 20px 40px 40px;
    max-width: 100%;
    cursor: grab;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.shop-shelf::-webkit-scrollbar {
    display: none;
}

.shop-card {
    flex: 0 0 280px;
    min-height: 340px;
    background: var(--panel);
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 28px 20px;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shop-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 0 var(--gold), 0 6px 0 var(--gold);
}

.coin-sm {
    width: 40px;
    height: 40px;
    background: var(--gold);
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.2);
}

.price-tag-sm {
    background: var(--navy);
    border: 1px solid var(--gold);
    padding: 4px 16px;
    margin-bottom: 16px;
    clip-path: polygon(8% 0%, 100% 0%, 100% 100%, 8% 100%, 0% 50%);
}

.price-tag-sm span {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.85rem;
    color: var(--gold);
}

.card-desc {
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    color: var(--white);
    line-height: 1.6;
}

/* ===================== THE ARENA ===================== */

#the-arena {
    padding-top: 60px;
}

.arena-layout {
    display: flex;
    gap: 24px;
    max-width: 900px;
    width: 100%;
    align-items: flex-start;
}

.arena-col {
    flex: 1;
}

.col-header {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
}

.col-header.red { color: var(--coral); }
.col-header.green { color: var(--mint); }

.arena-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel);
    padding: 12px 16px;
    margin-bottom: 8px;
    border-left: 3px solid transparent;
}

.overpriced .arena-item { border-left-color: var(--coral); }
.underpriced .arena-item { border-left-color: var(--mint); }

.item-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--white);
}

.item-price {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.85rem;
}

.item-price.red { color: var(--coral); }
.item-price.green { color: var(--mint); }

.arena-scale {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===================== SCORE TABLE ===================== */

#score-table {
    padding-top: 60px;
}

.leaderboard {
    max-width: 700px;
    width: 100%;
}

.score-row {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--panel);
    margin-bottom: 4px;
    border-left: 3px solid var(--gold);
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    transition-delay: calc(var(--row-index) * 0.12s);
}

.score-row.revealed {
    opacity: 1;
    transform: translateX(0);
}

.rank {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    color: var(--gold);
    min-width: 30px;
}

.initials {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    color: var(--violet);
    min-width: 40px;
}

.score {
    font-family: 'DotGothic16', sans-serif;
    font-size: 0.85rem;
    color: var(--mint);
    min-width: 80px;
}

.desc {
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    color: var(--lavender);
    flex: 1;
}

/* ===================== CREDITS ===================== */

#credits {
    overflow: hidden;
}

.credit-roll {
    width: 100%;
    height: 80vh;
    overflow: hidden;
    position: relative;
}

.credit-scroll {
    text-align: center;
    animation: scrollCredits 20s linear infinite;
    padding-top: 100%;
}

.credit-scroll:hover {
    animation-play-state: paused;
}

@keyframes scrollCredits {
    0% { transform: translateY(0); }
    100% { transform: translateY(-100%); }
}

.credit-line {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    color: var(--white);
    padding: 6px 0;
}

.credit-line.title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    color: var(--gold);
    padding-top: 20px;
}

.credit-line.spacer {
    height: 40px;
}

.credit-line.blink {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
    color: var(--gold);
    animation: blink 1s steps(1) infinite;
}

/* ===================== SLIDE IN ===================== */

.slide-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.slide-in.revealed {
    opacity: 1;
    transform: translateY(0);
}

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

@media (max-width: 768px) {
    .arena-layout {
        flex-direction: column;
    }

    .arena-scale {
        display: none;
    }

    .shop-card {
        flex: 0 0 240px;
        min-height: 280px;
    }

    .score-row {
        flex-wrap: wrap;
    }

    .desc {
        width: 100%;
        margin-top: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .credit-scroll {
        animation: none;
        transform: none;
        padding-top: 0;
    }

    .pixel-coin {
        animation: none;
    }
}
