@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;900&family=Inter:wght@300;400;600;800&display=swap');

:root {
    /* Premium Color Palette */
    --bg-dark: #0a0202;
    --bg-maroon: #0a2d0a; /* Changed to green */
    --primary-red: #11cc11; /* Changed to green */
    --gold-light: #F3E2B3;
    --gold-main: #D4AF37;
    --gold-dark: #8C6A1D;
    --text-main: #ffffff;
    --text-muted: #a09090;
    --glass-bg: rgba(5, 20, 5, 0.65); /* Adjusted to slightly green */
    --glass-border: rgba(212, 175, 55, 0.15);
    
    /* Shadows */
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 5px 25px rgba(212, 175, 55, 0.15);
    --glow-red: 0 0 40px rgba(17, 204, 17, 0.3); /* Changed to green glow */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #050000; /* Polos hitam gelap */
    
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 2vh 2vw;
}

/* Background Overlay for readability */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Darken the background so the machine stands out */
    background: radial-gradient(circle at center, rgba(10, 2, 2, 0.4) 0%, rgba(5, 0, 0, 0.85) 100%);
    pointer-events: none;
    z-index: 0;
}

@keyframes rotateSlow {
    100% { transform: rotate(360deg); }
}

.app-container {
    width: 100%;
    max-width: 1000px;
    position: relative;
    z-index: 1;
}

/* Header & Voucher Column (Now inside overlay) */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
    z-index: 2;
    text-align: center;
}

.header {
    text-align: center;
}

@media (min-width: 900px) {
    .header { text-align: left; }
}

.logo {
    display: none; /* Old class, hide if any remnants exist */
}

/* New specific logo classes */
.main-logo {
    max-width: 180px; /* Dikecilkan sedikit */
    height: auto;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.8));
    transition: transform 0.3s ease;
}

.main-logo:hover {
    transform: scale(1.05);
}

.marquee-logo {
    max-height: 45px; /* Pas di dalam kotak marquee */
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.6));
}

.title-plaque {
    background: linear-gradient(145deg, rgba(5, 20, 5, 0.9), rgba(0, 10, 0, 0.95));
    border: 2px solid var(--gold-main);
    border-radius: 12px;
    padding: 15px 25px;
    margin: 0 auto 20px auto;
    display: inline-block;
    box-shadow: 
        0 10px 25px rgba(0,0,0,0.8),
        inset 0 0 15px rgba(212, 175, 55, 0.2),
        0 0 15px rgba(212, 175, 55, 0.4);
    position: relative;
    overflow: hidden;
}

.title-plaque::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
    transform: skewX(-25deg);
    animation: shinePlaque 6s infinite;
}

@keyframes shinePlaque {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.title-3d {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    font-weight: 900;
    color: var(--gold-main);
    background: linear-gradient(to bottom, #fff8d6 0%, #ffd700 40%, #b8860b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.25;
    letter-spacing: 1px;
    margin: 0;
    filter: drop-shadow(2px 3px 0px rgba(0,0,0,0.95));
}

/* Glassmorphism Voucher Panel */
.voucher-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-soft), inset 0 0 20px rgba(255,255,255,0.02);
}

.subtitle-3d {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--gold-light);
    margin-bottom: 20px;
    font-weight: 800;
    text-align: center;
    /* Efek Semi 3D */
    text-shadow: 
        1px 1px 0px #806010,
        2px 2px 0px #503c0a,
        3px 3px 5px rgba(0,0,0,0.8);
}

.voucher-input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#voucher-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 18px;
    color: var(--gold-main);
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 8px;
    text-transform: uppercase;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

#voucher-input:focus {
    border-color: var(--gold-main);
    background: rgba(0, 10, 0, 0.6);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5), 0 0 15px rgba(212, 175, 55, 0.15);
}

#voucher-input::placeholder {
    color: rgba(255,255,255,0.15);
    letter-spacing: 4px;
    font-weight: 400;
}

#btn-submit-voucher, #btn-prize-list {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-main) 50%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

#btn-submit-voucher:hover, #btn-prize-list:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(212, 175, 55, 0.3);
    filter: brightness(1.1);
}

#btn-submit-voucher:active, #btn-prize-list:active {
    transform: translateY(2px);
    box-shadow: 0 5px 10px rgba(212, 175, 55, 0.2);
}

/* Modal Prize List */
.prize-list-content {
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    padding: 30px 20px;
}

.close-icon-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.close-icon-btn:hover {
    color: var(--error-color);
    transform: scale(1.1);
}

.prize-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
    max-height: 50vh;
}

.prize-grid::-webkit-scrollbar {
    width: 8px;
}
.prize-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}
.prize-grid::-webkit-scrollbar-thumb {
    background: var(--gold-main);
    border-radius: 4px;
}

.prize-grid-item {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.prize-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
    border-color: var(--gold-light);
}

.prize-grid-item img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.8));
}

.prize-grid-item span {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

/* ---------------------------------------------------
   REALISTIC ARCADE CABINET
   --------------------------------------------------- */
.machine-section {
    position: relative;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    perspective: 1500px; /* Strong perspective for 3D effect */
    z-index: 10;
}

.arcade-cabinet {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    /* Tambahan outline/stroke tipis emas & bayangan hitam */
    filter: drop-shadow(0 0 2px rgba(212, 175, 55, 0.8)) drop-shadow(0 0 4px rgba(212, 175, 55, 0.5)) drop-shadow(0 30px 40px rgba(0,0,0,0.9));
    transform-style: preserve-3d;
}

/* Cabinet Top / Marquee */
.cabinet-roof {
    height: 30px;
    background: linear-gradient(to bottom, #008a00 0%, #4dff4d 15%, #00a000 30%, #003a00 70%, #001a00 100%);
    border-radius: 15px 15px 0 0;
    border: 2px solid;
    border-color: #006a00 #003a00 #001a00 #003a00;
    border-top: 2px solid rgba(150, 255, 150, 0.8);
    border-bottom: none;
    box-shadow: inset 0 6px 12px rgba(150,255,150,0.6), inset 0 2px 2px rgba(255,255,255,0.8), 0 5px 10px rgba(0,0,0,0.8);
    transform: perspective(500px) rotateX(10deg);
    transform-origin: bottom;
    margin: 0 10px;
}

.cabinet-marquee {
    height: 80px;
    background: linear-gradient(to bottom, #111, #000);
    border: 4px solid;
    border-color: #333 #111 #000 #111;
    border-top: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    margin: 0 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5), inset 0 0 20px rgba(212, 175, 55, 0.4);
}

/* Marquee Glowing Effect */
.cabinet-marquee::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-25deg);
    animation: shine 4s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.marquee-text {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 
        0 0 10px #00FF00,
        0 0 20px #00FF00,
        0 0 30px #00FF00,
        0 0 40px #FFD700;
    letter-spacing: 5px;
}

/* Glass Display Window (The Box) */
.machine-window {
    height: 480px;
    position: relative;
    background: #050505;
    /* Bingkai tipis elegan seperti layar monitor/mesin modern */
    border: 4px solid #1a1a1a;
    border-top-color: #2a2a2a;
    border-bottom-color: #050505;
    border-radius: 6px;
    /* Memberikan bayangan luar untuk bingkai (bezel) dan bayangan dalam super gelap untuk kedalaman ruang */
    box-shadow: 
        0 0 0 2px #3a3a3a, /* Kilau ujung bingkai */
        0 0 0 5px #0a0a0a, /* Ketebalan bingkai luar */
        0 10px 20px rgba(0,0,0,0.8), /* Bayangan jatuh bingkai ke bawah */
        inset 0 20px 50px rgba(0,0,0,0.9), /* Gelap di atas dalam */
        inset 15px 0 30px rgba(0,0,0,0.9), /* Gelap sisi kiri dalam */
        inset -15px 0 30px rgba(0,0,0,0.9); /* Gelap sisi kanan dalam */
    overflow: hidden;
    /* Simulate 3D depth for the entire window */
    perspective: 800px;
}



/* 3D Interior Walls */
.interior-wall {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 1;
    /* Carbon Fiber Texture Base */
    background-color: #111;
    background-image: 
        linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000), 
        linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000);
    background-position: 0 0, 5px 5px;
    background-size: 10px 10px;
}
/* Glossy Overlay Container */
.interior-wall::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.interior-wall.left {
    left: 0;
    transform: perspective(800px) rotateY(45deg);
    transform-origin: left;
    border-right: 2px solid rgba(255,255,255,0.15);
}
.interior-wall.left::after {
    /* Glossy lighting overlay reflecting from the front */
    background: linear-gradient(to right, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 30%, rgba(0,0,0,0.9) 100%);
}
.interior-wall.right {
    right: 0;
    transform: perspective(800px) rotateY(-45deg);
    transform-origin: right;
    border-left: 2px solid rgba(255,255,255,0.15);
}
.interior-wall.right::after {
    /* Glossy lighting overlay reflecting from the front */
    background: linear-gradient(to left, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 30%, rgba(0,0,0,0.9) 100%);
}
.interior-back {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Realistic brushed dark metal back wall with heavy shadowing */
    background: 
        linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.3) 20%, rgba(0,0,0,0.8) 100%),
        radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.9) 100%),
        repeating-linear-gradient(90deg, #1a1a1a 0px, #2a2a2a 2px, #111 4px);
    z-index: 0;
    box-shadow: inset 0 0 100px rgba(0,0,0,1);
}
.interior-floor {
    position: absolute;
    bottom: 0; left: 0; right: 0; height: 100px;
    background: linear-gradient(to bottom, #111, #444);
    transform: perspective(800px) rotateX(60deg);
    transform-origin: bottom;
    z-index: 1;
}

/* Front Glass Reflection */
.machine-window::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(125deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 40%, rgba(255,255,255,0.02) 100%);
    pointer-events: none;
    z-index: 15; /* Above everything inside */
    box-shadow: inset 0 0 20px rgba(255,255,255,0.05);
}

/* Prize Chute Hole inside the machine */
.chute-hole {
    position: absolute;
    bottom: 0;
    left: 20px;
    width: 140px;
    height: 55px; /* Dibuat lebih pendek agar terlihat seperti di lantai */
    background: #050505;
    /* Memberikan efek perspektif 3D rebah ke lantai */
    transform-origin: bottom center;
    transform: perspective(200px) rotateX(45deg);
    border: 3px solid #222;
    border-bottom: none;
    border-radius: 4px 4px 0 0; /* Sudut kotak, bukan bulat tinggi */
    box-shadow: 
        inset 0 30px 30px rgba(0,0,0,1), /* Gelap di bagian dalam/bawah lubang */
        0 -2px 5px rgba(255,255,255,0.15); /* Pantulan cahaya di bibir lubang */
    z-index: 3;
    overflow: hidden;
}

/* Dinding dalam lubang untuk ilusi kedalaman ke bawah */
.chute-hole::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 100%;
    background: linear-gradient(to bottom, rgba(30,30,30,1) 0%, rgba(0,0,0,1) 60%);
    box-shadow: inset 0 5px 15px rgba(0,0,0,1);
}

/* Kaca pembatas bening yang melingkari lubang */
.chute-barrier {
    position: absolute;
    bottom: 0;
    left: 10px; /* Memeluk pinggir kiri lubang */
    width: 160px; /* Lebih lebar dari lubang (20px sampai 160px) */
    height: 100px; /* Berdiri tegak layaknya dinding kaca */
    background: rgba(150, 210, 255, 0.2); /* Warna kaca bening kebiruan */
    border: 3px solid rgba(255, 255, 255, 0.6); /* Kilapan sisi atas, kiri, dan kanan kaca */
    border-bottom: none; /* Menyentuh lantai */
    border-radius: 8px 8px 0 0; /* Sudut atas membulat */
    box-shadow: 
        inset 0 10px 20px rgba(255,255,255,0.3), /* Efek pantulan lampu mesin pada kaca */
        inset 0 -20px 30px rgba(0,0,0,0.2),
        10px 0 20px rgba(0,0,0,0.5); /* Bayangan kaca ke arah tumpukan hadiah */
    z-index: 50; /* Selalu di depan hadiah agar terhalang */
    backdrop-filter: blur(2px); /* Blur halus untuk benda di balik kaca */
    pointer-events: none;
}

/* Illusion of depth inside the hole */
.chute-hole::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 30px;
    background: linear-gradient(to bottom, #1a1a1a, #000);
    border-radius: 10px 10px 0 0;
}

/* ---------------------------------------------------
   THE CLAW MECHANISM
   --------------------------------------------------- */
.claw-rail-x {
    position: absolute;
    top: 15px;
    left: -10px; right: -10px; width: auto;
    height: 20px;
    /* Realistic 3D Chrome/Iron Pipe */
    background: linear-gradient(to bottom, #111 0%, #888 15%, #fff 40%, #999 55%, #444 80%, #111 100%);
    box-shadow: 0 20px 30px rgba(0,0,0,0.9), inset 0 2px 2px rgba(255,255,255,0.5);
    /* Set z-index ke 2 agar selalu berada di belakang mekanisme capit (claw-rail-y) 
       bahkan ketika capit turun dan z-index-nya dikurangi menjadi 3 */
    z-index: 2;
    border-radius: 10px;
}

.claw-rail-y {
    position: absolute;
    top: 25px; /* Behind rail x */
    left: 50%;
    width: 40px; /* Width of carriage area */
    height: 20px; /* Changed from 100px: height of the invisible wire container. 20px puts the image directly under the carriage */
    transform: translateX(-50%);
    transition: left 0.5s cubic-bezier(0.25, 1, 0.5, 1), height 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 6;
    background: transparent; /* Changed from solid block */
}

/* Motor carriage that stays at top */
.claw-carriage {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 28px;
    background: linear-gradient(to right, #222 0%, #777 20%, #ccc 50%, #777 80%, #222 100%);
    border: 2px solid #111;
    border-bottom: 3px solid #000;
    border-top: 2px solid #888;
    border-radius: 6px;
    box-shadow: 0 15px 25px rgba(0,0,0,0.9), inset 0 0 5px rgba(255,255,255,0.6);
    z-index: 2;
}
.claw-carriage::after {
    /* Mechanical detail */
    content: '';
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 12px; height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #888, #222);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.2);
}

.claw-wire {
    position: absolute;
    /* Mulai tepat dari tengah lubang carriage (-8px top carriage + 14px center = 6px) */
    top: 6px; 
    left: 49.8%; /* Tepat di tengah ring gantungan capit */
    transform: translateX(-50%);
    width: 6px; /* Ukuran sangat kecil menyesuaikan gambar asli */
    /* Tambah tinggi agar bisa memanjang sampai ke capit */
    height: calc(100% + 40px); 
    
    /* 
      Kloning sempurna dari gambar Full HD Anda:
      Garis 45 derajat dari atas-kiri ke bawah-kanan.
      Warna: Silver -> Garis Hitam -> Emas -> Garis Hitam
    */
    background: repeating-linear-gradient(
        45deg,
        #d1d1d1 0px,
        #d1d1d1 2px,
        #333333 2px,
        #333333 3px,
        #d6b24a 3px,
        #d6b24a 5px,
        #333333 5px,
        #333333 6px
    );
    
    border-left: 1px solid #1a1a1a;
    border-right: 1px solid #1a1a1a;
    /* z-index -1 memaksanya berada DI BELAKANG kotak carriage secara mutlak */
    z-index: -1; 
    box-shadow: inset 1px 0 2px rgba(255,255,255,0.4), inset -1px 0 2px rgba(0,0,0,0.3); /* Efek 3D ringan */
}

.claw-head-img {
    position: absolute;
    top: 100%; /* Automatically hangs exactly at the bottom of the rail, regardless of image size */
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: top center;
    width: auto; /* Uses the actual size of the image file */
    height: auto;
    max-width: 250px; /* Prevent it from being massively huge if the file is too big */
    z-index: 6;
    filter: drop-shadow(0 15px 15px rgba(0,0,0,0.8));
    transition: transform 0.15s ease-out; /* Smooth responsive sway */
}

.claw-head-img.grabbing {
    /* Since we use an image, we can slightly scale it horizontally to simulate a grabbing motion, or just drop it a bit */
    transform: translateX(-50%) scaleX(0.9) translateY(5px);
}

/* Items in Machine */
.items-container {
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 180px;
    z-index: 4;
}

@keyframes idleFloat {
    0%, 100% { margin-bottom: 0; }
    50% { margin-bottom: 5px; }
}

.machine-item {
    position: absolute;
    width: 120px;
    height: 120px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom center;
    animation: idleFloat 3s ease-in-out infinite;
}

.machine-item.picked { position: absolute; top: calc(100% + 80px); bottom: auto; left: 50%; transform: translateX(-50%); z-index: 2; transition: none; }

/* ---------------------------------------------------
   CABINET BASE & CONTROLS
   --------------------------------------------------- */
.cabinet-base {
    position: relative;
    width: 100%;
    margin-top: -5px; /* Overlap slightly with window */
    z-index: 20;
}

.cabinet-roof {
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.2);
    border-top: 2px solid rgba(255,255,255,0.3);
}

.cabinet-marquee {
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.2);
    border-top: 2px solid rgba(255,255,255,0.3);
}

.control-panel-slanted {
    background: linear-gradient(180deg, #00aa00 0%, #4dff4d 5%, #008800 20%, #003a00 50%, #001100 100%);
    border: 5px solid;
    border-color: #007a00 #003a00 #001100 #003a00;
    border-top: 2px solid rgba(180, 255, 180, 0.9); /* Super shiny top edge */
    padding: 20px;
    /* Slanted effect */
    transform: perspective(600px) rotateX(15deg);
    transform-origin: top;
    box-shadow: 0 20px 30px rgba(0,0,0,0.8), inset 0 4px 6px rgba(150,255,150,0.8), inset 0 1px 2px rgba(255,255,255,0.9);
    border-radius: 0 0 10px 10px;
}

.controls-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

/* Base under the control panel */
.cabinet-bottom {
    background-image: 
        linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0.8) 100%),
        repeating-linear-gradient(90deg, #003a00 0px, #004a00 2px, #002a00 4px);
    background-color: #002a00;
    border: 5px solid;
    border-color: #002a00 #001a00 #000 #001a00;
    border-top: none;
    height: auto;
    min-height: 150px;
    padding-bottom: 25px;
    margin: 0 15px; /* Slightly narrower than control panel */
    border-radius: 0 0 15px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: inset 0 20px 30px rgba(0,0,0,0.9);
}





/* Analog Joystick Styling */
.joystick-container {
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111, #050505);
    border-radius: 50%;
    border: 3px solid #2a0b0b;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8), inset 0 2px 10px rgba(255,255,255,0.05);
    position: relative;
}

/* Joystick Base */
.joystick-base {
    width: 100px;
    height: 100px;
    background: #000;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 15px 25px rgba(0,0,0,1), 0 0 0 4px #222;
    display: flex;
    justify-content: center;
    align-items: center;
    /* To contain the stick visually if needed, but stick moves outside */
}

/* Metal shaft of the joystick (simulated) */
.joystick-base::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #555 0%, #111 80%);
    border-radius: 50%;
    z-index: 1;
}

/* Joystick Direction Arrows */
.joystick-arrow {
    position: absolute;
    color: rgba(212, 175, 55, 0.4); /* Gold color with low opacity */
    font-size: 1.2rem;
    z-index: 2;
    transition: color 0.2s ease;
    color: #444;
    font-size: 1rem;
    pointer-events: none;
}

.joystick-arrow.up { top: 10px; left: 50%; transform: translateX(-50%); }
.joystick-arrow.down { bottom: 10px; left: 50%; transform: translateX(-50%); }
.joystick-arrow.left { left: 10px; top: 50%; transform: translateY(-50%); }
.joystick-arrow.right { right: 10px; top: 50%; transform: translateY(-50%); }

/* Joystick Stick (The ball) */
.joystick-stick {
    width: 55px;
    height: 55px;
    /* Default is glowing/active */
    background: radial-gradient(circle at 30% 20%, #88ff88 0%, #00ff00 40%, #008a00 100%);
    border-radius: 50%;
    position: absolute;
    top: 50%; left: 50%;
    margin-top: -27.5px; margin-left: -27.5px;
    box-shadow: 
        0 15px 25px rgba(0,0,0,0.9), 
        0 0 15px rgba(0, 255, 0, 0.8), /* Green glow when active */
        inset -5px -5px 15px rgba(0,0,0,0.6),
        inset 5px 5px 10px rgba(255,255,255,0.7);
    z-index: 2;
    transition: transform 0.1s ease;
    flex-shrink: 0; /* Prevent oval squashing */
    cursor: grab;
    touch-action: none; 
}

.joystick-stick.disabled {
    background: radial-gradient(circle at 30% 20%, #666 0%, #333 50%, #111 100%);
    box-shadow: 
        0 5px 10px rgba(0,0,0,0.9), 
        inset -5px -5px 15px rgba(0,0,0,0.6),
        inset 5px 5px 10px rgba(255,255,255,0.1);
    cursor: not-allowed;
}

.joystick-stick:not(.disabled):active {
    cursor: grabbing;
    transform: scale(0.95);
}

.joystick-stick.disabled {
    filter: grayscale(0.8);
    cursor: not-allowed;
}

/* Action Button (CAPIT & ACAK base) */
.action-btn {
    width: 105px;
    height: 105px;
    flex-shrink: 0;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    /* Outer bezel rim (looks like black/dark grey plastic housing) */
    border: 6px solid #1a1a1a;
    border-top-color: #2a2a2a;
    border-bottom-color: #050505;
    /* The actual button inside the housing */
    background: radial-gradient(circle at 50% 20%, #66ff66 0%, #00cc00 40%, #006600 100%);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        0 15px 25px rgba(0,0,0,0.9),
        0 2px 3px rgba(255,255,255,0.1),
        inset 0 0 15px rgba(0,0,0,1),
        inset 0 -15px 20px rgba(0,0,0,0.6),
        inset 0 10px 15px rgba(255,255,255,0.4);
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

/* Crisp curved specular highlight on top of the button for that glossy plastic feel */
.action-btn::before {
    content: '';
    position: absolute;
    top: 5%;
    left: 15%;
    width: 70%;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50% 50% 20% 20%;
    pointer-events: none;
    transition: top 0.1s ease, opacity 0.1s ease;
}

.action-btn:not(:disabled):hover {
    filter: brightness(1.2);
}

.action-btn:not(:disabled):active {
    transform: translateY(4px); /* Satisfying physical press down */
    box-shadow: 
        0 8px 15px rgba(0,0,0,0.9),
        0 2px 3px rgba(255,255,255,0.1),
        inset 0 0 20px rgba(0,0,0,1),
        inset 0 -5px 10px rgba(0,0,0,0.7),
        inset 0 5px 8px rgba(255,255,255,0.2);
}

.action-btn:not(:disabled):active::before {
    top: 8%;
    opacity: 0.5;
}

.action-btn:disabled {
    filter: grayscale(0.8) brightness(0.6);
    cursor: not-allowed;
}

/* Shuffle Button (ACAK) */
.shuffle-btn {
    width: 85px;
    height: 85px;
    font-size: 1rem;
    background: radial-gradient(circle at 50% 20%, #4facfe 0%, #0099cc 45%, #004466 100%);
}

/* Professional Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(5, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0; pointer-events: none;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    background: linear-gradient(145deg, #0b1f0b, #030f03);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 90%;
    width: 450px;
    transform: translateY(30px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 30px 60px rgba(0,0,0,0.9), 0 0 40px rgba(212, 175, 55, 0.05);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Validation Modal specific */
.validation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.icon-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: rgba(0,0,0,0.3);
}

.icon-container.success {
    border: 2px solid #2ecc71;
    box-shadow: 0 0 30px rgba(46, 204, 113, 0.2), inset 0 0 20px rgba(46, 204, 113, 0.1);
}

.icon-container.error {
    border: 2px solid #e74c3c;
    box-shadow: 0 0 30px rgba(231, 76, 60, 0.2), inset 0 0 20px rgba(231, 76, 60, 0.1);
}

.icon-container svg { width: 45px; height: 45px; }

/* SVG Animation Draw */
@keyframes drawStroke {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 0; }
}

.icon-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawStroke 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.2s;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.icon-container.success .icon-path { stroke: #2ecc71; }
.icon-container.error .icon-path { stroke: #e74c3c; }

#validation-text {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.text-success { color: #2ecc71; text-shadow: 0 0 15px rgba(46, 204, 113, 0.4); }
.text-error { color: #e74c3c; text-shadow: 0 0 15px rgba(231, 76, 60, 0.4); }

/* Win Modal specific */
.prize-image-container {
    width: 220px;
    height: 220px;
    margin: 0 auto 25px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: elegantFloat 4s ease-in-out infinite;
}

@keyframes elegantFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

#prize-img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.6));
}

.win-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #ffffff;
    background: linear-gradient(145deg, rgba(10, 30, 10, 0.95), rgba(5, 15, 5, 0.95));
    border: 1px solid var(--gold-main);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 
        0 10px 25px rgba(0,0,0,0.8),
        inset 0 0 15px rgba(212, 175, 55, 0.15);
}

#prize-name {
    color: var(--gold-main);
    font-size: 1.5rem;
    font-family: 'Cinzel', serif;
    font-weight: 800;
    text-transform: uppercase;
    display: block;
    margin: 10px 0;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.claim-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #2AABEE, #229ED9);
    color: white;
    text-decoration: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(42, 171, 238, 0.3);
    width: 100%;
}

.claim-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(42, 171, 238, 0.4);
    filter: brightness(1.1);
}

.claim-btn i { font-size: 1.3rem; }

.modal-btn {
    background: transparent;
    color: var(--gold-main);
    border: 1px solid var(--gold-main);
    padding: 12px 35px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-btn:hover { 
    background: rgba(212, 175, 55, 0.1); 
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.modal-btn.outline {
    margin-top: 20px;
    border-color: #444;
    color: #666;
    font-size: 0.8rem;
    padding: 8px 20px;
}
.modal-btn.outline:hover {
    border-color: #888;
    color: #aaa;
    background: transparent;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        padding: 10px 0;
    }
    .arcade-cabinet {
        max-width: 420px; /* Jangan terlalu lebar ke samping */
        margin: 0 auto; /* Tengah */
    }
    .machine-window { 
        height: 420px !important; /* Ditinggikan agar capit punya ruang gerak turun yang dalam */
        min-height: auto !important; 
    }
    
    /* Buat tabel panduan (htp-cards) sangat ringkas dan menyamping di semua tablet/HP */
    .htp-container {
        padding: 10px;
    }
    .htp-header { margin-bottom: 10px; }
    .htp-header h3 { font-size: 20px; margin-bottom: 2px; }
    
    .htp-cards {
        flex-direction: column !important; /* Ditumpuk ke bawah (List) */
        overflow-x: hidden;
        gap: 6px !important; /* Diberi sedikit jarak agar tidak terlalu dempet */
        padding-bottom: 0;
    }
    .htp-card {
        width: 100%; /* Memenuhi kontainer */
        flex-direction: row !important; /* Label dan teks bersebelahan */
        align-items: center !important; /* Teks rata tengah vertikal */
        text-align: left !important;
        padding: 6px 12px !important; /* Diberi ruang bernafas sedikit */
        gap: 10px;
        min-height: 0 !important;
    }
    .htp-num {
        margin-bottom: 0 !important;
        font-size: 14px !important;
        font-weight: bold;
    }
    .htp-card p {
        margin: 0 !important; /* Pangkas margin bawaan p */
        font-size: 11px !important;
        line-height: 1.1 !important; /* Pangkas line-height */
        flex: 1; /* Teks mengambil sisa ruang */
        padding: 0 !important;
    }
    .tutor-img {
        margin: 0;
        width: 100px;
        max-width: 40%;
        height: auto;
    }
}

@media (max-width: 500px) {
    .app-container {
        padding: 10px 0; /* Remove horizontal padding entirely so machine can fit screen */
    }
    
    /* Scale down the control panel components so they fit perfectly */
    .controls-panel { padding: 0 15px; }
    
    .action-btn { 
        width: 75px; 
        height: 75px; 
        font-size: 0.9rem; 
        border-width: 3px;
    }
    
    .shuffle-btn {
        width: 65px;
        height: 65px;
        font-size: 0.8rem;
    }
    
    .joystick-base { 
        width: 80px; 
        height: 80px; 
        border-width: 3px;
    }
    
    .joystick-stick { 
        width: 40px; 
        height: 40px; 
        margin-top: -20px; 
        margin-left: -20px; 
    }
    
    /* Adjust interior walls so they don't break the layout on thin screens */
    .interior-wall { width: 30px; }

    .voucher-section { padding: 15px; }
    #voucher-input { font-size: 1rem; padding: 12px; }
    .modal-content { padding: 25px 15px; }
}

/* Tablet & Mobile Tutorial Adjustments */
@media (max-width: 650px) {
    .left-column { gap: 10px; }
    .main-logo { max-width: 130px; margin-bottom: 5px; }
    .title-3d { font-size: 1.5rem; margin-bottom: 5px; }
    .voucher-section { padding: 15px; }
}
    .tutor-img {
        margin-top: 0;
        margin-left: auto;
        width: 90px;
        max-width: 35%; /* Agar tidak menabrak teks di mobile */
        height: auto;
    }
}

/* --- ANIMATIONS FOR GAMEPLAY --- */
@keyframes swayHanging {
    0% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-52%) rotate(-3deg); }
    50% { transform: translateX(-50%) rotate(0deg); }
    75% { transform: translateX(-48%) rotate(3deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

@keyframes clawSway {
    0% { transform: translateX(-50%) scaleX(0.9) rotate(0deg); }
    25% { transform: translateX(-50%) scaleX(0.9) rotate(-4deg); }
    50% { transform: translateX(-50%) scaleX(0.9) rotate(0deg); }
    75% { transform: translateX(-50%) scaleX(0.9) rotate(4deg); }
    100% { transform: translateX(-50%) scaleX(0.9) rotate(0deg); }
}

@keyframes prizeSway {
    0% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(-4deg); }
    50% { transform: translateX(-50%) rotate(0deg); }
    75% { transform: translateX(-50%) rotate(4deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

/* --- TUTORIAL SECTION (HOW TO PLAY) --- */
.htp-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    width: 90%; /* Memberi jarak dari pinggir mesin merah */
    margin: 20px 0;
    padding: 20px 30px;
    /* Efek kaca akrilik gelap bercahaya yang tertanam di body mesin */
    background: radial-gradient(circle at 50% 0%, #1a1a1a, #000);
    border: 3px solid #000;
    border-bottom: 3px solid #222;
    border-radius: 12px;
    box-shadow: 
        inset 0 0 20px rgba(255, 255, 255, 0.05), /* Pantulan kaca dalam */
        inset 0 10px 20px rgba(0,0,0,0.8), /* Bayangan dalam */
        0 2px 2px rgba(255, 255, 255, 0.15), /* Pantulan cahaya di ujung lubang pelat besi */
        0 15px 25px rgba(0,0,0,0.9); /* Bayangan jatuh di mesin */
}

.htp-header {
    width: 100%;
    margin-bottom: 25px;
    text-align: center;
}

.htp-header h3 {
    color: #fff;
    font-size: 28px;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    margin: 0 0 8px 0;
    letter-spacing: 1px;
    text-transform: uppercase;
    /* Efek Semi 3D dengan tumpukan text-shadow */
    text-shadow: 
        0 1px 0 #aaa,
        0 2px 0 #888,
        0 3px 0 #666,
        0 4px 0 #444,
        0 5px 8px rgba(0,0,0,0.8);
}

.htp-header p {
    color: #d4af37; /* Warna emas agar lebih mewah */
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

.htp-cards {
    display: flex;
    gap: 15px;
    width: 100%;
}

.htp-card {
    flex: 1;
    background: #161616;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.htp-card:hover {
    transform: translateY(-5px);
    border-color: #333;
    background: #1a1a1a;
}

.htp-num {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
}

.htp-card p {
    color: #d0d0d0;
    font-size: 11px;
    line-height: 1.4;
    margin: 0 0 15px 0;
    flex-grow: 1;
}

/* 3D Button Icons */
.btn-icon-red {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #4dff4d 0%, #00cc00 100%);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 0 #008b00, 0 5px 5px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.btn-icon-yellow {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, #ffeb3b 0%, #fbc02d 100%);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 0 #c49000, 0 5px 5px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    font-size: 10px;
    font-weight: bold;
}

.icon-whatsapp {
    color: #25D366;
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.icon-joystick {
    color: #4facfe;
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
/* Custom Images for Tutorial */
.tutor-img {
    width: 100%;
    max-width: 130px; /* Dikecilkan sedikit agar tidak tembus batas */
    height: auto;
    object-fit: contain;
    margin-top: 20px;
    border-radius: 6px; /* Sudut sedikit membulat agar menyatu dengan kartu */
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}

/* --- EFEK KOIN EMAS MANIAKPLAY JATUH --- */
.coin-shower-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}
.coin-shower-container.bg {
    z-index: 0; /* Di belakang mesin, tapi di atas background gelap */
}
.coin-shower-container.fg {
    z-index: 999; /* Di depan mesin, tapi di bawah pop-up */
}

.falling-coin {
    position: absolute;
    top: -150px;
    animation-name: logoFallAnim;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    transform-style: preserve-3d;
    /* Sedikit bayangan agar terpisah dari background */
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5));
}

@keyframes logoFallAnim {
    0% {
        top: -150px;
        transform: rotateY(0deg) rotateZ(0deg) rotateX(0deg);
    }
    100% {
        top: 105vh;
        /* Putaran 3D yang sangat pelan dan elegan layaknya bulu/kertas jatuh */
        transform: rotateY(360deg) rotateZ(90deg) rotateX(180deg);
    }
}

/* --- AUTO SCALE AGAR FIT 1 LAYAR TANPA SCROLL --- */
body {
    overflow: hidden; /* Matikan scroll body, jika butuh scroll pop-up masih bisa */
}

.app-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.arcade-cabinet {
    transform-origin: center center;
    transition: transform 0.3s ease;
}

@media (max-height: 900px) {
    .arcade-cabinet { transform: scale(0.85); margin-top: -20px; }
}
@media (max-height: 800px) {
    .arcade-cabinet { transform: scale(0.75); margin-top: -40px; }
}
@media (max-height: 700px) {
    .arcade-cabinet { transform: scale(0.65); margin-top: -60px; }
}
@media (max-height: 600px) {
    .arcade-cabinet { transform: scale(0.55); margin-top: -80px; }
}
@media (max-height: 500px) {
    .arcade-cabinet { transform: scale(0.45); margin-top: -100px; }
}

/* Supaya di mode hp layar sempit juga ikut mengecil */
@media (max-width: 500px) and (max-height: 850px) {
    .arcade-cabinet { transform: scale(0.75); margin-top: -30px; }
}
@media (max-width: 500px) and (max-height: 750px) {
    .arcade-cabinet { transform: scale(0.65); margin-top: -50px; }
}
@media (max-width: 500px) and (max-height: 650px) {
    .arcade-cabinet { transform: scale(0.55); margin-top: -70px; }
}
