:root {
    color-scheme: dark;
    --ink: #fff7f0;
    --muted: #f3cdd6;
    --panel: rgba(61, 20, 30, 0.86);
    --line: rgba(247, 213, 109, 0.24);
    --green: #d6336c;
    --leaf: #f6a8c6;
    --gold: #f7d56d;
    --deep-gold: #7a2036;
    --pink: #f5a4c9;
    --red: #f05d7f;
    --bg-a: #3a0f1c;
    --bg-b: #7a3350;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(rgba(43, 14, 24, 0.72), rgba(43, 14, 24, 0.8)),
        url("wellsea-celebrate.jpeg") center / cover fixed,
        radial-gradient(circle at 15% 15%, rgba(247, 213, 109, 0.28), transparent 24rem),
        radial-gradient(circle at 82% 12%, rgba(245, 164, 201, 0.2), transparent 22rem),
        linear-gradient(135deg, var(--bg-a), var(--bg-b));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background-image:
        radial-gradient(circle, rgba(255, 244, 184, 0.9) 0 1px, transparent 2px),
        radial-gradient(circle, rgba(247, 213, 109, 0.65) 0 1px, transparent 2px);
    background-position: 0 0, 34px 42px;
    background-size: 92px 92px, 128px 128px;
    opacity: 0.45;
}

.page-login {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(420px, 100%);
}

.login-panel,
.draw-stage,
.approved-panel,
.side-panel {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(14px);
}

.login-panel {
    padding: 32px;
    border-radius: 8px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 24px;
    border-radius: 8px;
    color: #2b2a12;
    background: linear-gradient(135deg, var(--gold), #fff3b0 42%, var(--deep-gold));
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(247, 213, 109, 0.24);
}

h1,
h2,
p {
    margin: 0;
}

.login-panel h1 {
    margin-bottom: 8px;
    font-size: 28px;
    line-height: 1.15;
}

.login-panel p,
.stage-heading p,
.stage-heading small,
.winner-label {
    color: var(--muted);
}

.alert {
    margin-top: 20px;
    padding: 12px 14px;
    border: 1px solid rgba(251, 113, 133, 0.35);
    border-radius: 6px;
    color: #ffe4e6;
    background: rgba(251, 113, 133, 0.12);
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 14px;
    color: var(--ink);
    background: rgba(15, 23, 42, 0.78);
    outline: none;
}

input:focus {
    border-color: var(--green);
}

button,
a {
    border-radius: 6px;
}

button {
    min-height: 44px;
    border: 0;
    padding: 0 18px;
    color: #2b2a12;
    background: linear-gradient(135deg, var(--gold), #fff0a3 46%, #c8942b);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(247, 213, 109, 0.22);
}

button:hover {
    filter: brightness(1.05);
}

button:disabled {
    cursor: wait;
    opacity: 0.6;
}

button.stop {
    color: #fff7ed;
    background: var(--red);
}

.secondary,
#refreshButton {
    color: var(--ink);
    border: 1px solid var(--line);
    background: rgba(255, 248, 220, 0.08);
    box-shadow: none;
}

.logout-icon {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(247, 213, 109, 0.35);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(61, 20, 30, 0.66);
    backdrop-filter: blur(10px);
    text-decoration: none;
}

.logout-icon:hover {
    border-color: rgba(251, 113, 133, 0.55);
    color: #ffe4e6;
    background: rgba(251, 113, 133, 0.18);
}

.logout-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.draw-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 360px;
    gap: 22px;
    width: min(1240px, calc(100% - 32px));
    margin: 28px auto;
}

.draw-stage,
.approved-panel,
.side-panel {
    border-radius: 8px;
}

.approved-panel {
    padding: 22px;
}

.approved-panel h2 {
    margin-bottom: 14px;
    color: #fff4bd;
    font-size: 18px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.approved-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 780px;
    overflow-y: auto;
    padding-right: 4px;
}

.approved-list::-webkit-scrollbar {
    width: 7px;
}

.approved-list::-webkit-scrollbar-track {
    background: rgba(255, 248, 220, 0.08);
    border-radius: 999px;
}

.approved-list::-webkit-scrollbar-thumb {
    background: rgba(247, 213, 109, 0.48);
    border-radius: 999px;
}

.approved-list li {
    display: grid;
    gap: 5px;
    padding: 12px 13px;
    border: 1px solid rgba(247, 213, 109, 0.2);
    border-radius: 6px;
    background: rgba(255, 248, 220, 0.07);
}

.approved-list strong {
    color: #f9a8d4;
    font-size: 20px;
}

.approved-list span {
    color: #fff4bd;
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.approved-list small {
    color: var(--muted);
    font-size: 12px;
}

.approved-list .approved-empty {
    color: var(--muted);
    font-size: 13px;
}

.draw-stage {
    display: grid;
    align-content: center;
    min-height: calc(100vh - 56px);
    padding: 36px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 244, 184, 0.08), rgba(255, 255, 255, 0)),
        var(--panel);
    position: relative;
    overflow: hidden;
}

.draw-stage::before {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(247, 213, 109, 0.36);
    border-radius: 8px;
    pointer-events: none;
}

.draw-stage::after {
    content: "";
    position: absolute;
    inset: auto -12% -24% -12%;
    height: 220px;
    background: radial-gradient(ellipse, rgba(247, 213, 109, 0.18), transparent 68%);
    pointer-events: none;
}

.stage-heading,
.number-window,
.winner-label,
.actions {
    position: relative;
    z-index: 1;
}

.stage-heading {
    display: grid;
    gap: 10px;
    margin-bottom: 30px;
}

.stage-heading p {
    justify-self: center;
    width: fit-content;
    padding: 7px 14px;
    border: 1px solid rgba(246, 196, 83, 0.34);
    border-radius: 999px;
    color: #fff4bd;
    background: rgba(247, 213, 109, 0.12);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.stage-heading h1 {
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.05;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff4bd;
    text-shadow:
        0 2px 0 var(--deep-gold),
        0 7px 16px rgba(0, 0, 0, 0.44),
        0 0 26px rgba(247, 213, 109, 0.34);
}

.stage-heading h1 span {
    color: #ffe58f;
}

.brand-title {
    color: #ffe58f;
    font-size: clamp(24px, 3.4vw, 44px);
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow:
        0 2px 0 var(--deep-gold),
        0 7px 16px rgba(0, 0, 0, 0.36),
        0 0 22px rgba(247, 213, 109, 0.3);
}

.active-prize-label {
    color: var(--muted);
    font-size: clamp(18px, 2.2vw, 28px);
    font-weight: 800;
    text-transform: uppercase;
}

.active-prize-amount {
    color: #fff4bd;
    font-size: clamp(40px, 7vw, 84px);
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
    text-shadow:
        0 2px 0 var(--deep-gold),
        0 7px 16px rgba(0, 0, 0, 0.44),
        0 0 26px rgba(247, 213, 109, 0.34);
}

.stage-heading small {
    font-size: clamp(15px, 2vw, 20px);
    font-weight: 700;
}

.number-window {
    display: grid;
    place-items: center;
    min-height: 220px;
    border: 1px solid rgba(246, 196, 83, 0.42);
    border-radius: 8px;
    color: #fff1a4;
    background:
        linear-gradient(180deg, rgba(255, 238, 152, 0.14), rgba(64, 42, 11, 0.2)),
        rgba(35, 40, 20, 0.56);
    font-size: clamp(56px, 11vw, 150px);
    font-weight: 900;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    box-shadow:
        inset 0 0 34px rgba(247, 213, 109, 0.12),
        0 18px 45px rgba(0, 0, 0, 0.28);
    text-shadow:
        0 3px 0 #7b5116,
        0 0 28px rgba(246, 196, 83, 0.36);
}

.number-window.slot-mode {
    display: flex;
    /* nowrap: digit tidak boleh pernah turun ke baris kedua */
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1vw, 10px);
    padding: 16px;
    font-size: 0;
    text-shadow: none;
}

.reel-tile {
    position: relative;
    /* Berbagi lebar panggung secara merata, bukan mengikuti lebar layar (vw).
       Panggung diapit dua panel samping, jadi ukuran berbasis vw bikin digit
       terakhir kehabisan ruang dan terlempar ke bawah. */
    flex: 1 1 0;
    min-width: 0;
    max-width: 96px;
    aspect-ratio: 4 / 7;
    container-type: inline-size;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid rgba(246, 196, 83, 0.5);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 238, 152, 0.18), rgba(64, 42, 11, 0.28)),
        rgba(20, 24, 12, 0.55);
    box-shadow:
        inset 0 0 18px rgba(0, 0, 0, 0.45),
        inset 0 2px 0 rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reel-tile::before,
.reel-tile::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 32%;
    pointer-events: none;
    z-index: 2;
}

.reel-tile::before {
    top: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent);
}

.reel-tile::after {
    bottom: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), transparent);
}

.reel-char {
    display: block;
    /* Baris pertama = cadangan untuk peramban lama; baris kedua menskala
       angka terhadap lebar kotaknya sendiri supaya tidak pernah terpotong
       saat kotak mengecil. */
    font-size: clamp(30px, 6.6vw, 92px);
    font-size: 92cqw;
    line-height: 1;
    font-weight: 900;
    color: #fff1a4;
    text-shadow: 0 3px 0 #7b5116, 0 0 22px rgba(246, 196, 83, 0.4);
    animation: reelDrop 0.16s cubic-bezier(0.22, 0.9, 0.32, 1.28);
}

@keyframes reelDrop {
    0% {
        transform: translateY(-65%);
        opacity: 0;
        filter: blur(3px);
    }

    60% {
        transform: translateY(6%);
        opacity: 1;
        filter: blur(0.5px);
    }

    100% {
        transform: translateY(0);
        opacity: 1;
        filter: blur(0);
    }
}

.reel-tile.is-locked {
    border-color: rgba(134, 239, 172, 0.85);
    box-shadow:
        inset 0 0 18px rgba(0, 0, 0, 0.45),
        0 0 26px rgba(134, 239, 172, 0.55);
    animation: reelLockPulse 0.4s ease;
}

@keyframes reelLockPulse {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.14);
    }

    100% {
        transform: scale(1);
    }
}

.number-window.is-revealed .reel-tile {
    animation: reelWinnerGlow 1.1s ease-in-out infinite alternate;
}

@keyframes reelWinnerGlow {
    from {
        box-shadow:
            inset 0 0 18px rgba(0, 0, 0, 0.45),
            0 0 18px rgba(247, 213, 109, 0.35);
    }

    to {
        box-shadow:
            inset 0 0 18px rgba(0, 0, 0, 0.45),
            0 0 42px rgba(247, 213, 109, 0.78);
    }
}

.winner-label {
    min-height: 28px;
    margin-top: 20px;
    font-size: 18px;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.actions button {
    min-width: 150px;
}

.side-panel {
    padding: 22px;
}

.prize-picker {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.prize-picker h2 {
    margin-bottom: 12px;
    color: #fff4bd;
    font-size: 18px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.prize-options {
    display: grid;
    gap: 10px;
}

.prize-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 11px 12px;
    border: 1px solid rgba(247, 213, 109, 0.24);
    color: var(--ink);
    background: rgba(255, 248, 220, 0.08);
    box-shadow: none;
    text-align: left;
}

.prize-option strong {
    font-size: 18px;
    color: #fff1a4;
}

.prize-option span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.prize-option b {
    color: #f9a8d4;
}

.prize-option.is-selected {
    border-color: rgba(247, 213, 109, 0.78);
    background: linear-gradient(135deg, rgba(247, 213, 109, 0.2), rgba(245, 164, 201, 0.14));
    box-shadow: 0 0 22px rgba(247, 213, 109, 0.18);
}

.prize-option.is-empty {
    opacity: 0.42;
}

.checkin-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.checkin-summary div {
    display: grid;
    gap: 4px;
}

.checkin-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.checkin-summary strong {
    color: var(--gold);
    font-size: 30px;
    line-height: 1;
}

.checkin-summary b {
    font-weight: 900;
}

#totalEligible {
    color: var(--gold);
}

#drawnCount {
    color: var(--pink);
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

.history-head h2 {
    font-size: 18px;
}

#refreshButton {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

.winner-list {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding-left: 0;
    list-style: none;
    max-height: 385px;
    overflow-y: auto;
    padding-right: 4px;
}

.winner-list::-webkit-scrollbar {
    width: 7px;
}

.winner-list::-webkit-scrollbar-track {
    background: rgba(255, 248, 220, 0.08);
    border-radius: 999px;
}

.winner-list::-webkit-scrollbar-thumb {
    background: rgba(247, 213, 109, 0.48);
    border-radius: 999px;
}

.winner-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
}

.winner-list li.winner-row--approved {
    border-color: rgba(74, 222, 128, 0.72);
    background: rgba(34, 197, 94, 0.1);
}

.winner-list li.winner-row--canceled {
    border-color: rgba(248, 113, 113, 0.72);
    background: rgba(239, 68, 68, 0.1);
}

.winner-list strong {
    display: block;
    color: #f9a8d4;
    font-size: 20px;
}

.winner-list span {
    color: var(--muted);
    font-size: 12px;
}

.winner-check {
    min-height: 34px;
    padding: 0 12px;
    color: #2b2a12;
    font-size: 12px;
}

.winner-actions {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.winner-status-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    justify-self: end;
    color: #102514;
    background: #86efac;
    font-size: 20px;
    font-weight: 900;
}

.winner-row--canceled .winner-status-icon {
    color: #fff7ed;
    background: #ef4444;
}

.winner-list .winner-approve,
.winner-list .winner-cancel {
    display: none;
}

.winner-approve,
.winner-cancel {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    box-shadow: none;
}

.winner-approve {
    background: linear-gradient(135deg, #bbf7d0, #f7d56d);
}

.winner-cancel {
    color: #fff7ed;
    background: var(--red);
}

.winner-modal,
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    padding: 24px;
}

.winner-modal.is-open,
.confirm-modal.is-open {
    /* flex + `margin: auto` pada panel: tetap terpusat, tapi saat isinya
       lebih tinggi dari layar seluruh isi masih bisa di-scroll. Dengan
       `place-items: center` bagian atas panel terpotong dan tidak bisa
       dijangkau, sehingga tombol Approve/Batalkan jadi tidak terklik. */
    display: flex;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.winner-modal__backdrop {
    /* fixed, bukan absolute, supaya latar tetap menutup layar saat di-scroll */
    position: fixed;
    inset: 0;
    background: rgba(12, 20, 10, 0.72);
    backdrop-filter: blur(8px);
}

.winner-modal__panel {
    position: relative;
    z-index: 1;
    margin: auto;
    width: min(720px, 100%);
    border: 1px solid rgba(247, 213, 109, 0.45);
    border-radius: 8px;
    padding: 34px;
    background:
        linear-gradient(180deg, rgba(255, 244, 184, 0.12), rgba(255, 255, 255, 0)),
        rgba(61, 20, 30, 0.96);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.confirm-modal {
    z-index: 50;
}

.confirm-modal__panel {
    position: relative;
    z-index: 1;
    margin: auto;
    width: min(430px, 100%);
    border: 1px solid rgba(247, 213, 109, 0.45);
    border-radius: 8px;
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(255, 244, 184, 0.12), rgba(255, 255, 255, 0)),
        rgba(61, 20, 30, 0.98);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.52), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.confirm-modal__panel h2 {
    margin-bottom: 10px;
    color: #fff4bd;
    font-size: 28px;
}

.confirm-modal__panel p {
    color: var(--muted);
    line-height: 1.5;
}

.winner-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    font-size: 22px;
    padding: 0;
    color: var(--ink);
    background: rgba(255, 248, 220, 0.1);
    box-shadow: none;
}

.winner-modal__eyebrow {
    margin-bottom: 10px;
    color: var(--gold);
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
}

.winner-modal__panel h2 {
    margin-bottom: 26px;
    color: #fff4bd;
    font-size: clamp(42px, 5vw, 64px);
    text-shadow: 0 2px 0 var(--deep-gold), 0 8px 18px rgba(0, 0, 0, 0.34);
}

.winner-detail {
    display: grid;
    gap: 16px;
    margin: 0;
}

.winner-detail div {
    display: grid;
    gap: 5px;
    padding: 18px 20px;
    border: 1px solid rgba(247, 213, 109, 0.2);
    border-radius: 6px;
    background: rgba(255, 248, 220, 0.07);
}

.winner-detail dt {
    color: var(--muted);
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
}

.winner-detail dd {
    margin: 0;
    color: #fff4bd;
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 24px;
}

.modal-actions button {
    min-height: 58px;
    font-size: 18px;
}

@media (max-width: 860px) {
    .draw-shell {
        grid-template-columns: 1fr;
        width: calc(100% - 24px);
        margin: 12px auto 24px;
    }

    .draw-stage {
        min-height: 560px;
        padding: 24px 16px;
    }

    .number-window {
        min-height: 160px;
    }

    .reel-tile {
        max-width: 64px;
    }

    .actions {
        flex-direction: column;
    }
}

/* Layar laptop yang pendek: rampingkan modal supaya seluruh isi termasuk
   tombol Approve/Batalkan muat tanpa perlu di-scroll. */
@media (max-height: 820px) {
    .winner-modal__panel {
        padding: 24px;
    }

    .winner-modal__eyebrow {
        margin-bottom: 6px;
        font-size: 15px;
    }

    .winner-modal__panel h2 {
        margin-bottom: 16px;
        font-size: clamp(26px, 3.4vw, 40px);
    }

    .winner-detail {
        gap: 10px;
    }

    .winner-detail div {
        padding: 10px 14px;
    }

    .winner-detail dt {
        font-size: 13px;
    }

    .winner-detail dd {
        font-size: clamp(22px, 2.8vw, 32px);
    }

    .modal-actions {
        margin-top: 16px;
    }

    .modal-actions button {
        min-height: 48px;
        font-size: 16px;
    }
}
