:root {
    --red: #e23744;
    --red2: #a31621;
    --gold: #e3b341;
    --gold2: #fbd45a;
    --silver: #c9d1d9;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    user-select: none;
}

html,
body {
    height: 100%;
    background: #000;
    overflow: hidden;
    color: #fff;
}

#app {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #000;
}

#canvas3d {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Overlay screens — padding ikut safe-area supaya tidak ketutup notch / home-bar */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 20;
    padding: max(20px, var(--safe-top)) max(20px, var(--safe-right)) max(20px, var(--safe-bottom)) max(20px, var(--safe-left));
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .85) 100%);
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Voucher screen */
.logo-bar {
    font-size: 11px;
    letter-spacing: 6px;
    color: var(--gold);
    margin-bottom: 8px;
    font-weight: 600;
}

.title {
    font-size: clamp(38px, 10vw, 64px);
    font-weight: 900;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 0 30px rgb(227 65 65 / 60%), 0 0 60px rgba(226, 55, 68, .4);
    letter-spacing: 2px;
    line-height: 1;
}

.title b {
    background: linear-gradient(135deg, #e34141, #e90000);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: #9aa6b5;
    font-size: 13px;
    margin-bottom: 28px;
    letter-spacing: 2px;
}

.panel {
    background: linear-gradient(180deg, rgba(24, 18, 10, .95), rgba(10, 7, 4, .97));
    border: 1.5px solid rgba(227, 179, 65, .55);
    border-radius: 20px;
    padding: clamp(20px, 5vw, 28px);
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .7), 0 0 90px rgba(227, 179, 65, .18),
        inset 0 1px 0 rgba(255, 255, 255, .08);
    position: relative;
    z-index: 5;
}

/* garis emas tipis di atas panel */
.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold2), var(--gold), var(--gold2), transparent);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(227, 179, 65, .6);
}

.panel-label {
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 3px;
    margin-bottom: 10px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

input.code {
    width: 100%;
    background: linear-gradient(180deg, #15110a, #0a0805);
    border: 2px solid rgba(227, 179, 65, .35);
    color: #fff;
    border-radius: 14px;
    padding: 16px;
    font-size: 22px;
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 800;
    transition: all .2s;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .5);
}

input.code::placeholder {
    color: #6e5c34;
    letter-spacing: 3px;
}

input.code:focus {
    outline: none;
    border-color: var(--gold2);
    box-shadow: 0 0 0 4px rgba(227, 179, 65, .2), inset 0 2px 8px rgba(0, 0, 0, .5),
        0 0 24px rgba(227, 179, 65, .35);
}

.btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 17px;
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    margin-top: 18px;
    letter-spacing: 2px;
    transition: transform .15s;
}

.btn:active {
    transform: scale(.98);
}

.btn-red {
    background: linear-gradient(135deg, #bd1003, #97010d, #d50011);
    border: 1.5px solid rgb(145 0 0);
    box-shadow: 0px 3px 1px white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}

.btn-red:hover {
    color: #000;
    background: linear-gradient(135deg, #d50011, #97010d, #bd1003);
    border: 1.5px solid rgb(145 0 0);
    box-shadow: 0px 3px 1px rgb(0, 0, 0);
    text-shadow: 0 2px 4px rgba(0, 0, 0, .4);  
}

/* ── LAYOUT KARAKTER PENGAPIT PANEL (tampilan awal) ── */
.start-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 1100px;
    position: relative;
}

.start-char {
    flex: 0 0 auto;
    width: clamp(160px, 22vw, 300px);
    pointer-events: none;
    filter: drop-shadow(0 18px 36px rgba(0, 0, 0, .75));
    align-self: flex-end;
    margin-bottom: -6px;
}

.start-char img {
    width: 100%;
    height: auto;
    display: block;
}

.start-char.left {
    margin-right: -4%;
}

/* sedikit di belakang panel */
.start-char.right {
    margin-left: -4%;
}

.start-center {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    padding: 0 6px;
}

/* ── TROFI SVG + INPUT MENYATU ── */
.trophy-wrap {
    position: relative;
    width: clamp(300px, 33vw, 440px);
}

.trophy-svg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 16px 40px rgba(0, 0, 0, .7));
}

/* form ditempel di area plat nama alas trofi (proporsi viewBox 440x560) */
.trophy-form {
    position: absolute;
    left: 25.5%;
    top: 72.5%;
    width: 49%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tf-label {
    color: var(--gold2);
    font-size: clamp(6px, 0.9vw, 8px);
    letter-spacing: 1.5px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
    line-height: 1;
}

.tf-input {
    width: 100%;
    background: linear-gradient(180deg, rgba(247, 207, 90, .95), rgba(198, 150, 20, .95));
    border: 1.5px solid #fff1b8;
    border-radius: 6px;
    color: #2a1c06;
    padding: clamp(4px, 0.8vw, 7px) 6px;
    font-size: clamp(8px, 1.2vw, 12px);
    font-weight: 800;
    text-align: center;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3), 0 0 8px rgba(255, 210, 90, .4);
    transition: all .18s;
}

.tf-input::placeholder {
    color: #7a5a14;
    font-weight: 700;
}

.tf-input:focus {
    outline: none;
    border-color: #fff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 3px rgba(255, 225, 120, .5),
        0 0 16px rgba(255, 210, 90, .7);
}

/* tombol mulai di bawah trofi */
.trophy-btn {
    max-width: clamp(240px, 32vw, 360px);
    margin-top: 14px;
}

/* glow lembut di belakang masing-masing karakter */
.start-char.left img {
    filter: drop-shadow(0 0 24px rgba(227, 179, 65, .35));
}

.start-char.right img {
    filter: drop-shadow(0 0 24px rgba(226, 55, 68, .4));
}

/* di layar sempit (mobile) sembunyikan karakter pengapit, panel tetap di tengah */
@media (max-width:760px) {
    .start-char {
        display: none;
    }

}

.err {
    color: #ff1000;
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
    font-weight: 500;
    text-shadow: 0px 2px 1px black;
}

.demo-codes {
    margin-top: 18px;
    font-size: 11px;
    color: #6b7685;
    letter-spacing: 1px;
}

.demo-codes b {
    color: var(--gold);
    cursor: pointer;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s;
}

.demo-codes b:hover {
    background: rgba(227, 179, 65, .1);
}

/* HUD - in-game */
#hud {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

/* ====== HEADER pakai gambar Header_Game.png ======
   Gambar dipasang sebagai background penuh-lebar (rasio 1399:183).
   "PENALTY" + 2 foto karakter sudah menyatu di dalam gambar, jadi
   teks HTML hanya menumpuk USER ID + status STIKER/KEEPER. */
.scorebar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin-top: var(--safe-top);
    aspect-ratio: 1399 / 183;                       /* ikut rasio gambar header */
    background: url("../../images/Header_Game.png") center/100% 100% no-repeat;
}

/* Wadah teks overlay (kiri = striker/user, kanan = keeper) */
/* Teks ditaruh di BAR ATAS (di atas titik & bar hijau), bukan di tengah,
   supaya tidak menabrak indikator hijau di dalam gambar header. */
.hud-side {
    position: absolute;
    top: 5%;    
    display: flex;
    flex-direction: column;
    pointer-events: none;
    text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, .65);
}

/* ====== Setel posisi teks di sini ======
   top (di .hud-side)  : naik/turun
   left  (.hud-left)   : jarak USER ID dari tepi kiri
   right (.hud-right)  : jarak KEEPER dari tepi kanan
                         (29% = berhenti tepat sebelum 2 bar hijau kanan-atas) */
.hud-left {
    left: 14%;
    align-items: flex-start;
    text-align: left;
}

.hud-right {
    right: 14%;
    align-items: flex-end;
    text-align: right;
}

.hud-name {
    font-size: clamp(11px, 2.5vw, 21px);
    font-weight: 900;
    letter-spacing: .4px;
    color: #fff;
    line-height: 4;
    max-width: 30vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud-role {
    font-size: clamp(8px, 1.6vw, 13px);
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1.1;
    margin-top: 2px;
}

.hud-role-striker {
    color: var(--gold);
}

.hud-role-keeper {
    color: #4fc3ff;
}

/* ====== Teks "Cara Bermain" (tanpa kotak) ====== */
.stage-banner {
    position: absolute;
    top: calc(var(--safe-top) + 13.5vw + 12px);   /* tepat di bawah header */
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    text-align: center;
    color: #fff;
    font-size: clamp(12px, 2.6vw, 16px);
    font-weight: 600;
    letter-spacing: .3px;
    line-height: 1.35;
    text-shadow: 0 2px 6px #000, 0 0 12px rgba(0, 0, 0, .75);
    animation: fadePulse 1.6s infinite;
    white-space: normal;
    pointer-events: none;
}

.stage-banner .howto-title {
    display: block;
    font-size: clamp(16px, 3.4vw, 24px);
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: 4px;
    text-shadow: 0 2px 8px #000;
}

@keyframes fadePulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .55
    }
}

/* Tombol SHOOT — pakai gambar Game_Shooter.png (skala layar via vmin) */
#goBtn {
    position: absolute;
    bottom: calc(40px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: clamp(108px, 30vmin, 150px);
    height: clamp(108px, 30vmin, 150px);
    border: none;
    border-radius: 50%;
    padding: 0;
    background: url("../../images/Game_Shooter.png") center/contain no-repeat;
    background-color: transparent;
    color: transparent;          /* sembunyikan teks (gambar sudah ada "SHOOT") */
    font-size: 0;
    cursor: pointer;
    pointer-events: auto;
    z-index: 15;
    filter: drop-shadow(0 0 22px rgba(255, 150, 40, .65)) drop-shadow(0 6px 14px rgba(0, 0, 0, .55));
    animation: goPulse 1.1s infinite ease-in-out;
}

@keyframes goPulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.07);
    }
}

/* Result screen */
.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 380px;
    width: 100%;
}

.result-big {
    font-size: clamp(42px, 11vw, 55px);
    font-weight: 900;
    margin-bottom: 6px;
    letter-spacing: 2px;
    text-shadow: 0 0 30px currentColor;
    line-height: 1;
}

.goal {
    color: var(--red2);
}

.save {
    color: var(--silver);
}

.result-sub {
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 20px;
    font-style: italic;
}

.reward-card {
    background: linear-gradient(180deg, rgba(28, 20, 10, .96), rgba(12, 8, 4, .98));
    border: 2px solid var(--red2);
    border-radius: 18px;
    padding: clamp(16px, 5vw, 24px);
    width: 100%;
    box-shadow: 0 0 50px rgb(227 65 65 / 40%), inset 0 1px 0 rgba(255, 255, 255, .08);
    position: relative;
    overflow: visible;
}

.reward-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--red2), var(--red2), var(--red2), transparent);
    box-shadow: 0 0 12px rgb(215 0 0 / 60%);
}

/* trofi mini di atas kartu hadiah */
.reward-trophy {
    padding-top: clamp(46px, 13vw, 64px);
}

.reward-cup {
    position: absolute;
    top: clamp(-44px, -12vw, -58px);
    left: 50%;
    transform: translateX(-50%);
    width: clamp(78px, 22vw, 110px);
    height: auto;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .6)) drop-shadow(0 0 14px rgba(255, 206, 90, .5));
}

.reward-label {
    font-size: 11px;
    color: var(--red2);
    letter-spacing: 2px;
    font-weight: 700;
    margin-top: 1rem;
}

.reward-value {
    font-size: clamp(20px, 6vw, 26px);
    font-weight: 900;
    color: #fff;
    margin-top: 8px;
    line-height: 1.2;
    word-break: break-word;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}

.reward-type {
    font-size: 11px;
    color: var(--gold2);
    opacity: .7;
    margin-top: 10px;
    letter-spacing: 2px;
}

#againBtn {
    max-width: 260px;
}

/* loader on canvas */
.loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 3px;
    z-index: 5;
}

/* ── RESPONSIF: layar pendek (HP kecil / browser bar tinggi) ── */
@media (max-height:680px) {
    .subtitle {
        margin-bottom: 18px;
    }

    .result-sub {
        margin-bottom: 14px;
    }

    .btn {
        padding: 14px;
    }

    #againBtn {
        margin-top: 16px !important;
    }

    #goBtn {
        bottom: calc(24px + var(--safe-bottom));
    }
}

/* ── RESPONSIF: HP sangat sempit ── */
@media (max-width:360px) {
    input.code {
        font-size: 19px;
        letter-spacing: 3px;
        padding: 14px;
    }

    .subtitle {
        font-size: 12px;
        letter-spacing: 1px;
    }
}

/* ── LANDSCAPE di HP: rapatkan supaya muat tanpa scroll ── */
@media (orientation:landscape) and (max-height:480px) {
    .title {
        font-size: clamp(30px, 7vh, 48px);
        margin-bottom: 2px;
    }

    .subtitle {
        margin-bottom: 12px;
        font-size: 11px;
    }

    .panel {
        padding: 16px;
        max-width: 420px;
    }

    .btn {
        margin-top: 10px;
        padding: 12px;
    }

    #goBtn {
        width: clamp(80px, 18vh, 110px);
        height: clamp(80px, 18vh, 110px);
        font-size: clamp(24px, 6vh, 32px);
        bottom: calc(16px + var(--safe-bottom));
    }

    .result-big {
        font-size: clamp(34px, 9vh, 56px);
    }

    .trophy-wrap {
        position: relative;
        width: clamp(300px, 33vw, 440px);
    }
}

@media screen and (max-width: 768px) and (min-width: 375px) { 
    .hud-side {
        position: absolute;
        top: -10%;
    }

    .hud-name {
        font-size: 9px;
        line-height: 5;
    }


}
