@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --bg-color: #0d0208;
    --machine-case: #1f1f2e;
    --machine-trim: #11111a;
    --neon-green: #00ff66;
    --neon-red: #ff3333;
    --neon-blue: #00ffff;
    --neon-amber: #ffb700;
}

* {
    box-sizing: border-box;
    image-rendering: pixelated;
    font-family: 'VT323', monospace;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(rgba(0, 255, 102, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 102, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    color: #fff;
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

h1 {
    color: var(--neon-red);
    text-shadow: 2px 2px 0px #550000;
    font-size: calc(1.5rem + 1vw);
    margin: 0;
    text-align: center;
    letter-spacing: 2px;
}

.subtitle {
    color: #888;
    font-size: calc(0.9rem + 0.3vw);
    margin: 0 0 10px 0;
    text-align: center;
    text-transform: uppercase;
}

.vending-container {
    width: 100%;
    max-width: 1100px;
    height: calc(100vh - 80px);
    background: var(--machine-case);
    border: 6px solid #000;
    box-shadow: 
        6px 6px 0px #000,
        inset 4px 4px 0px #3a3a52,
        inset -4px -4px 0px #11111a;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: 1fr 90px;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.display-window {
    background: #05050a;
    border: 5px solid #000;
    box-shadow: inset 4px 4px 0px #000;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.display-window::before, .crt-screen::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.04));
    z-index: 10;
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

.item-slot {
    background: #11111d;
    border: 4px solid #000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
}

.item-slot:hover {
    border-color: var(--neon-blue);
    background: #161629;
}

.item-slot.selected {
    border-color: var(--neon-green);
    background: #0d2417;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.4);
}

.item-code {
    color: var(--neon-amber);
    font-size: 1.5rem;
    align-self: flex-start;
    font-weight: bold;
    line-height: 1;
}

.item-icon {
    font-size: calc(1.8rem + 1vw);
    margin: 0;
    line-height: 1;
    filter: drop-shadow(0px 2px 0px #000);
}

.item-name {
    font-size: 1.4rem;
    color: #fff;
    line-height: 1.1;
    font-weight: bold;
}

.item-cost {
    color: var(--neon-red);
    font-size: 1.1rem;
    text-transform: uppercase;
    font-weight: bold;
}

.control-panel {
    background: var(--machine-trim);
    border: 5px solid #000;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    overflow: hidden;
}

.crt-screen {
    background: #001100;
    border: 4px solid #000;
    padding: 12px;
    color: var(--neon-green);
    font-size: 1.4rem;
    flex: 1;
    position: relative;
    box-shadow: inset 0 0 10px #000;
    line-height: 1.3;
    overflow: hidden;
    white-space: normal;
    word-break: break-all;
    font-weight: bold;
}

.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

.coin-mech-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.coin-slot {
    width: 75px;
    height: 90px;
    background: #222;
    border: 4px solid #000;
    box-shadow: inset 3px 3px 0px #111;
    position: relative;
    cursor: pointer;
}

.slot-hole {
    width: 14px;
    height: 50px;
    background: #050505;
    border: 2px solid #444;
    position: absolute;
    top: 16px;
    left: 26px;
    z-index: 2;
}

.coin-label {
    font-size: 1.1rem;
    color: #aaa;
    margin-top: 4px;
    text-transform: uppercase;
    text-align: center;
    font-weight: bold;
}

.wallet-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 75px;
}

.coin-wrapper {
    width: 50px;
    height: 50px;
    position: relative;
}

.life-coin {
    width: 50px;
    height: 50px;
    background: var(--neon-amber);
    border: 4px solid #000;
    border-radius: 50%;
    box-shadow: inset 3px 3px 0px #fff, 3px 3px 0px #000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: bold;
    font-size: 1.7rem;
    cursor: pointer;
    z-index: 5;
    position: absolute;
    top: 0;
    left: 0;
}

.dispenser-row {
    grid-column: 1 / span 2;
    height: 100%;
    background: #0a0a0f;
    border: 5px solid #000;
    box-shadow: inset 4px 4px 0px #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.dispenser-flap {
    width: 50%;
    height: 80%;
    background: #1c1c24;
    border: 4px solid #000;
    box-shadow: inset 2px 2px 0px #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 1.5rem;
    position: absolute;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.2s ease;
    font-weight: bold;
}

.dispensed-receipt {
    background: #fff;
    color: #000;
    padding: 8px 20px;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px dashed #000;
    box-shadow: 4px 4px 0px var(--neon-red);
    cursor: pointer;
    animation: dropItem 0.2s ease-out forwards;
    z-index: 20;
    max-width: 95%;
    text-align: center;
}

@keyframes dropItem {
    0% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.receipt-modal {
    background: #fcfbe3;
    color: #111;
    width: 100%;
    max-width: 480px;
    border: 5px solid #000;
    padding: 20px;
    box-shadow: 6px 6px 0px var(--neon-red);
    font-family: monospace;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed #000;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.receipt-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.receipt-body {
    line-height: 1.3;
    font-size: 1.2rem;
}

.ref-document-btn {
    background: #ff3333 !important;
    color: #fff !important;
    border: 3px solid #000 !important;
    padding: 10px;
    width: 100%;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    margin-top: 10px;
    box-shadow: 3px 3px 0px #000;
    text-transform: uppercase;
    display: block;
    text-align: center;
    font-size: 1.2rem;
}

.close-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px;
    font-size: 1.3rem;
    width: 100%;
    margin-top: 10px;
    cursor: pointer;
    box-shadow: 3px 3px 0px #555;
}

.start-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #05050a;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    transition: opacity 0.3s ease;
}

.start-box {
    background: #11111d;
    border: 5px solid #000;
    box-shadow: 8px 8px 0px #ff3333;
    padding: 25px;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.start-title {
    font-size: 3rem;
    color: var(--neon-red);
    text-shadow: 3px 3px 0px #000;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.start-warning {
    font-size: 1.3rem;
    color: #aaa;
    line-height: 1.3;
    border: 2px dashed #333;
    padding: 15px;
    margin-bottom: 25px;
    text-align: justify;
}

.boot-btn {
    background: #000;
    color: var(--neon-green);
    border: 4px solid var(--neon-green);
    padding: 10px 30px;
    font-size: 1.8rem;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 4px 4px 0px #000;
}

@keyframes slotSpark {
    0% { background: #ff3333; box-shadow: 0 0 5px #ff3333, inset 0 0 5px #000; }
    100% { background: #ffb700; box-shadow: 0 0 20px #ffb700, inset 0 0 2px #fff; }
}

.item-slot:hover .item-code {
    animation: textVibrate 0.15s infinite;
}

@keyframes textVibrate {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    100% { transform: translate(-1px, -1px) rotate(0deg); }
}

.life-coin {
    animation: coinPulse 2s infinite ease-in-out;
}

@keyframes coinPulse {
    0%, 100% { box-shadow: inset 3px 3px 0px #fff, 3px 3px 0px #000; }
    50% { box-shadow: inset 3px 3px 0px #fff, 0 0 15px var(--neon-amber), 3px 3px 0px #000; }
}

@media (max-width: 850px) {
    body {
        padding: 5px;
        height: 100vh;
        height: 100svh;
    }

    h1, .subtitle {
        display: none !important;
    }

    .vending-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 110px 55px;
        gap: 6px;
        padding: 8px;
        height: 100svh;
    }
    
    .display-window {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 5px;
        padding: 5px;
    }

    .item-slot {
        padding: 4px;
    }

    .item-code {
        font-size: 1.1rem;
    }

    .item-icon {
        font-size: 1.6rem;
    }

    .item-name {
        font-size: 0.95rem;
    }

    .item-cost {
        font-size: 0.8rem;
    }
    
    .control-panel {
        flex-direction: row;
        align-items: center;
        padding: 6px;
        gap: 6px;
    }
    
    .crt-screen {
        font-size: 1.1rem;
        padding: 6px;
        height: 100%;
    }

    .coin-mech-container {
        width: 60px;
    }

    .coin-slot {
        width: 50px;
        height: 60px;
    }

    .slot-hole {
        width: 10px;
        height: 32px;
        top: 10px;
        left: 17px;
    }

    .coin-label {
        font-size: 0.75rem;
        margin-top: 2px;
    }

    .wallet-area {
        width: 60px;
        height: auto;
    }

    .coin-wrapper {
        width: 36px;
        height: 36px;
    }

    .life-coin {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .dispenser-row {
        grid-column: 1;
    }

    .dispenser-flap {
        font-size: 1.1rem;
        width: 90%;
    }

    .dispensed-receipt {
        font-size: 0.95rem;
        padding: 4px 10px;
    }
}

@media (max-width: 500px) {
    body {
        padding: 10px;
        height: 100vh;
        height: 100svh;
    }

    h1, .subtitle {
        display: none !important;
    }
    
    .vending-container {
        padding: 6px;
        gap: 4px;
        width: 96%;
        height: 84svh;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 22% 14%;
        box-shadow: 4px 4px 0px #000;
    }

    .display-window {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 3px;
        padding: 3px;
    }

    .item-slot {
        padding: 2px;
        border-width: 2px;
    }

    .item-code {
        font-size: 0.9rem;
    }

    .item-icon {
        font-size: 1.1rem;
    }

    .item-name {
        font-size: 0.8rem;
    }

    .item-cost {
        font-size: 0.7rem;
        margin: 0;
    }

    .control-panel {
        flex-direction: row;
        padding: 4px;
        gap: 4px;
    }

    .crt-screen {
        font-size: 0.9rem;
        padding: 4px;
        height: 100%;
        line-height: 1.1;
    }

    .coin-mech-container {
        width: 45px;
    }

    .coin-slot {
        width: 38px;
        height: 46px;
        border-width: 2px;
    }

    .slot-hole {
        width: 5px;
        height: 22px;
        top: 10px;
        left: 14px;
    }

    .coin-label {
        font-size: 0.65rem;
    }

    .wallet-area {
        width: 45px;
    }

    .coin-wrapper {
        width: 26px;
        height: 26px;
    }

    .life-coin {
        width: 26px;
        height: 26px;
        font-size: 0.95rem;
        border-width: 2px;
    }

    .dispenser-row {
        grid-column: 1;
        height: 100%;
        border-width: 3px;
    }

    .dispenser-flap {
        font-size: 0.9rem;
        width: 95%;
        height: 85%;
    }

    .dispensed-receipt {
        font-size: 0.8rem;
        padding: 2px 6px;
    }
}
