/*
  FINAL CSS — Ayam Nekat x ArwanaGaming
  Theme update:
  - Red / black / gold vibe inspired by ArwanaGaming
  - Darker premium gaming look
  - Stronger 3D feel for modal, button, and jackpot panel
  - Prepared for upcoming HTML cleanup
  - Compatible with the current spin structure

  Asset map:
  - Background  : ../img/background-agm.png
  - Scatter 1/3 : ../img/blckmjh.png
  - Scatter 2   : ../img/blckmjh2.png
  - Logo anim   : ../img/gif-logo.gif
  - Favicon     : ../img/scs.png (set in HTML head)
*/

:root {
    --bg: #040608;
    --bg-2: #090d12;
    --text: #ffffff;
    --muted: #c9c9c9;

    --brand-red: #ff2a2a;
    --brand-red-dark: #8e0909;
    --brand-red-deep: #3a0404;
    --brand-gold: #ffd24a;
    --brand-orange: #ff8a00;
    --brand-black: #090909;

    --glass: rgba(5, 7, 12, 0.82);
    --glass-2: rgba(13, 16, 22, 0.92);
    --overlay: rgba(0, 0, 0, 0.76);

    --content-width: 500px;
    --spinner-width: 496px;
    --spinner-height: 500px;
    --reel-width: 123px;
    --reel-height: 501px;

    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    --shadow-red: 0 0 18px rgba(255, 42, 42, 0.55);
    --shadow-gold: 0 0 20px rgba(255, 210, 74, 0.55);
    --shadow-panel:
        0 18px 40px rgba(0, 0, 0, 0.45),
        0 0 28px rgba(255, 42, 42, 0.20);

    --font-ui: Arial, Helvetica, sans-serif;
}

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

html,
body {
    min-height: 100%;
    margin: 0;
}

html {
    background: var(--bg);
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    font-family: var(--font-ui);
    background:
        linear-gradient(rgba(3, 4, 8, 0.40), rgba(3, 4, 8, 0.72)),
        radial-gradient(circle at top center, rgba(255, 42, 42, 0.12), transparent 32%),
        url("../img/background-agm.png") top center / min(100vw, var(--content-width)) auto no-repeat,
        linear-gradient(180deg, #05070b 0%, #020304 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 42, 42, 0.18), transparent 28%),
        radial-gradient(circle at 50% 85%, rgba(255, 166, 0, 0.09), transparent 22%);
    z-index: 0;
}

body.modal-open {
    position: relative;
    overflow: hidden !important;
}

body > * {
    position: relative;
    z-index: 1;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.text-center {
    text-align: center;
}

.clearfix::after {
    content: "";
    display: block;
    clear: both;
}

/* Hide old bootstrap modal if present */
.modal,
.modal-backdrop {
    display: none !important;
}

/* ========== HEADER / TOP INFO ========== */

.header {
    margin-top: 30px;
}

.header .head-top {
    margin-bottom: 10px;
    color: #fff7f7;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.65),
        0 0 10px rgba(255, 42, 42, 0.18);
}

.grandprize-value {
    width: calc(100% - 32px);
    max-width: 350px;
    margin: 18px auto 0;
    padding: 10px 16px;
    border: 1px solid rgba(255, 210, 74, 0.85);
    border-radius: var(--radius-pill);
    color: #fff8db;
    background:
        linear-gradient(180deg, rgba(42, 7, 7, 0.92), rgba(17, 4, 4, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -10px 20px rgba(0, 0, 0, 0.22),
        var(--shadow-gold);
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        0 0 12px rgba(255, 210, 74, 0.26);
    animation: glow-gold 1.8s ease-in-out infinite;
    backdrop-filter: blur(4px);
}

#countdown {
    color: #ffe083;
    font-size: 20px;
    font-weight: 700;
}

.count-title {
    display: block;
    margin-bottom: 15px;
    color: #ffffff;
    font-size: 0.94em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* ========== SPINNER ========== */

.spinner-wrapper {
    position: relative;
    width: min(100%, var(--spinner-width));
    height: var(--spinner-height);
    margin-inline: auto;
    overflow: hidden;
    border: 1px solid rgba(255, 45, 45, 0.20);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(14, 16, 20, 0.68), rgba(5, 6, 8, 0.78));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -12px 22px rgba(0, 0, 0, 0.25),
        0 10px 25px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(3px);
}

.spinner-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 18%),
        radial-gradient(circle at center, rgba(255, 42, 42, 0.10), transparent 60%);
    z-index: 1;
}

.spinner {
    position: relative;
    width: 100%;
    height: 100%;
}

.spinner-col {
    position: absolute;
    top: 0;
    width: var(--reel-width);
    height: var(--reel-height);
    overflow: hidden;
    z-index: 2;
}

.spinner-col1 {
    left: 0;
}

.spinner-col2 {
    left: 50%;
    transform: translateX(-50%);
}

.spinner-col3 {
    right: 0;
}

.spinner-col .img {
    width: 100%;
    height: 14400px;
    margin-top: 0;
    background: url("../img/blckmjh3.png") top center / contain repeat-y;
    transition: margin-top 3s cubic-bezier(.2, .72, .2, 1);
    will-change: margin-top;
    filter: drop-shadow(0 0 10px rgba(255, 42, 42, 0.12));
}

.spinner-col2 .img {
    margin-top: -340px;
    background-image: url("../img/blckmjh4.png");
    transition-duration: 4s;
}

.spinner-col3 .img {
    margin-top: -158px;
    transition-duration: 5s;
}

/* JS-compatible final positions */
.spinner-col1.spinned-1 .img {
    margin-top: -12692px;
}

.spinner-col2.spinned-1 .img {
    margin-top: -12537px;
}

.spinner-col3.spinned-1 .img {
    margin-top: -12692px;
}

.red-line {
    position: absolute;
    top: 250px;
    z-index: 10;
    display: none;
    width: 100%;
    height: 7px;
    background:
        linear-gradient(90deg, transparent 0%, var(--brand-red) 18%, #fff0a1 50%, var(--brand-red) 82%, transparent 100%);
    box-shadow:
        0 0 10px rgba(255, 42, 42, 0.50),
        0 0 18px rgba(255, 210, 74, 0.35);
    animation: blinker 0.6s linear infinite;
}

/* ========== BUTTONS ========== */

.btn-spin,
.finalButton {
    width: min(100%, 320px);
    min-height: 54px;
    border: 1px solid rgba(255, 220, 140, 0.80);
    border-radius: var(--radius-pill);
    color: #fff8f1;
    background:
        linear-gradient(180deg, #ffef88 0%, #ffb82e 12%, #ff3a2e 45%, #b30c0c 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.28),
        inset 0 -8px 18px rgba(0, 0, 0, 0.28),
        0 10px 18px rgba(0, 0, 0, 0.26),
        0 0 18px rgba(255, 42, 42, 0.32);
    font-family: var(--font-ui);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.35),
        0 0 10px rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition:
        transform 0.22s ease,
        filter 0.22s ease,
        box-shadow 0.22s ease;
}

.btn-spin {
    padding: 0 !important;
    font-size: 24px;
}

.finalButton {
    display: block;
    height: 54px;
    margin: 20px auto 0;
    padding: 0 18px !important;
    font-size: 16px;
    line-height: 52px;
    text-align: center;
    text-decoration: none;
    animation: pulse-cta 1.8s ease-in-out infinite;
}

.btn-spin:hover,
.finalButton:hover {
    transform: translateY(-2px) scale(1.03);
    filter: brightness(1.05) saturate(1.04);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.28),
        inset 0 -8px 18px rgba(0, 0, 0, 0.30),
        0 12px 25px rgba(0, 0, 0, 0.30),
        0 0 26px rgba(255, 42, 42, 0.48);
}

.btn-spin:active,
.finalButton:active {
    transform: scale(0.98);
}

.btn-spin.active {
    animation: pulse-cta 1.5s ease-in-out infinite;
}

/* ========== ERROR / MESSAGE ========== */

.spin-error {
    width: min(100%, 320px);
    margin: 20px auto;
    padding: 12px 14px;
    transform: scale(0.94);
    border: 1px solid rgba(255, 205, 126, 0.65);
    border-radius: 14px;
    color: #fff5ee;
    background:
        linear-gradient(180deg, rgba(112, 9, 9, 0.95), rgba(44, 4, 4, 0.97));
    box-shadow: 0 0 20px rgba(255, 42, 42, 0.22);
    text-align: center;
    opacity: 0;
    transition:
        transform 0.35s ease,
        opacity 0.35s ease;
}

.spin-error.active {
    transform: scale(1);
    opacity: 1;
}

/* ========== RESULT MODAL / JACKPOT CARD ========== */

.spin-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1071;
    display: none;
    width: 100%;
    height: 100%;
    opacity: 0;
    background:
        radial-gradient(circle at center, rgba(255, 42, 42, 0.16), transparent 35%),
        rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
}

.spin-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1072;
    width: calc(100% - 34px);
    max-width: 500px;
    overflow: hidden;
    border: 1px solid rgba(255, 198, 120, 0.65);
    border-radius: 24px;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(20, 5, 5, 0.98) 0%, rgba(7, 10, 16, 0.98) 38%, rgba(4, 6, 10, 0.99) 100%);
    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.58),
        0 0 0 1px rgba(255, 42, 42, 0.08),
        0 0 34px rgba(255, 42, 42, 0.35),
        0 0 65px rgba(255, 210, 74, 0.18);
    transform: translate(-50%, -145vh);
    opacity: 0;
    transition:
        transform 0.58s cubic-bezier(.2, .82, .2, 1),
        opacity 0.34s ease;
}

.spin-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 12%),
        radial-gradient(circle at top center, rgba(255, 42, 42, 0.18), transparent 26%);
}

.spin-modal.open {
    transform: translate(-50%, -50%);
    opacity: 1;
    animation: glow-red-panel 2.2s ease-in-out infinite;
}

.spin-modal-header {
    position: relative;
    padding: 16px 20px 15px;
    color: #fff5dc;
    background:
        linear-gradient(180deg, #ffde5e 0%, #ff7e24 18%, #d41717 48%, #640707 100%);
    font-family: var(--font-ui);
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.8px;
    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.35),
        0 0 14px rgba(255, 245, 200, 0.15);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.24),
        inset 0 -8px 16px rgba(0, 0, 0, 0.25);
}

.spin-modal-header::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 236, 181, 0.85), transparent);
}

.spin-modal .content {
    padding: 30px 26px 30px;
    font-family: var(--font-ui);
    line-height: 1.75;
    text-align: center;
    color: #f4f4f4;
}

.spin-modal .content p,
.spin-modal .content div,
.spin-modal .content span {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.spin-modal .content strong,
.spin-modal .content b,
.brand-name {
    color: #ffe07c;
    font-weight: 800;
}

.spin-modal .content .headline,
.spin-modal .content .status-success {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid rgba(255, 206, 124, 0.35);
    border-radius: var(--radius-pill);
    background: rgba(255, 42, 42, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.spin-modal .content .jackpot-note,
.spin-modal .content .feature-line {
    margin-top: 12px;
    color: #f8f3ea;
}

.spin-modal .content .warning {
    color: #ffc054;
    font-weight: 700;
}

.spin-modal .content .danger-text {
    color: #ff6b5d;
    font-weight: 700;
}

.countdown-wrap,
.time-box-group {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 12px 0 4px;
    flex-wrap: wrap;
}

.countdown-box,
.time-box {
    min-width: 72px;
    padding: 10px 8px 9px;
    border: 1px solid rgba(255, 205, 126, 0.36);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 42, 42, 0.05)),
        rgba(7, 10, 15, 0.94);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 14px rgba(255, 42, 42, 0.12);
}

.countdown-box .num,
.time-box .num {
    display: block;
    color: #fff2cb;
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.40),
        0 0 10px rgba(255, 210, 74, 0.18);
}

.countdown-box .label,
.time-box .label {
    display: block;
    margin-top: 6px;
    color: #ffd7b3;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

/* Generic helper classes for the next HTML refactor */
.panel-3d {
    border: 1px solid rgba(255, 205, 126, 0.32);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 42, 42, 0.12), rgba(255, 42, 42, 0.03)),
        rgba(7, 10, 15, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 22px rgba(255, 42, 42, 0.16);
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 205, 126, 0.40);
    border-radius: var(--radius-pill);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 42, 42, 0.08)),
        rgba(12, 10, 10, 0.92);
    box-shadow: 0 0 16px rgba(255, 42, 42, 0.18);
    color: #fff4da;
    font-weight: 800;
}

/* ========== ANIMATED LOGO LAYER ========== */

.cuak {
    position: absolute;
    inset: 0;
    width: min(100%, var(--content-width));
    height: 100%;
    margin-inline: auto;
    pointer-events: none;
}

.cuak .imganim {
    display: block;
    width: 100%;
    height: 100%;
    background: url("../img/gif-logo.gif") center / contain no-repeat;
    filter:
        drop-shadow(0 0 14px rgba(255, 42, 42, 0.15))
        drop-shadow(0 0 24px rgba(255, 210, 74, 0.08));
}

/* ========== ACCESSIBILITY ========== */

.hide-by-clipping {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ========== ANIMATIONS ========== */

@keyframes glow-gold {
    0%, 100% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.18),
            inset 0 -10px 20px rgba(0, 0, 0, 0.22),
            0 0 18px rgba(255, 210, 74, 0.40);
    }

    50% {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.18),
            inset 0 -10px 20px rgba(0, 0, 0, 0.22),
            0 0 34px rgba(255, 210, 74, 0.62);
    }
}

@keyframes glow-red-panel {
    0%, 100% {
        box-shadow:
            0 18px 45px rgba(0, 0, 0, 0.58),
            0 0 0 1px rgba(255, 42, 42, 0.08),
            0 0 28px rgba(255, 42, 42, 0.24),
            0 0 52px rgba(255, 210, 74, 0.10);
    }

    50% {
        box-shadow:
            0 18px 45px rgba(0, 0, 0, 0.58),
            0 0 0 1px rgba(255, 42, 42, 0.12),
            0 0 40px rgba(255, 42, 42, 0.38),
            0 0 72px rgba(255, 210, 74, 0.16);
    }
}

@keyframes pulse-cta {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes blinker {
    50% {
        opacity: 0.2;
    }
}

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

@media (max-width: 650px) {
    .header {
        margin-top: 20px;
    }

    .header .head-top {
        font-size: 20px;
    }

    .grandprize-value {
        max-width: 330px;
        font-size: clamp(21px, 6vw, 24px);
    }

    .grandprize-text,
    .img-infos {
        width: calc(100% - 32px);
        max-width: 400px;
    }

    .spinner-wrapper {
        width: min(100%, var(--spinner-width));
    }

    .spin-modal {
        width: calc(100% - 24px);
    }

    .spin-modal-header {
        font-size: 24px;
    }

    .countdown-box,
    .time-box {
        min-width: 62px;
    }

    .countdown-box .num,
    .time-box .num {
        font-size: 26px;
    }
}

@media (max-width: 530px) {
    body {
        background-size: 100vw auto;
    }

    .spinner-wrapper {
        margin-top: -101px;
        margin-bottom: 5px;
    }

    .spinner {
        transform: none;
    }

    .spinner .spinner-col {
        transform: scale(0.6);
        transform-origin: top left;
    }

    .spinner .spinner-col2 {
        left: 50%;
        transform: translateX(-50%) scale(0.6);
        transform-origin: top center;
    }

    .spinner .spinner-col3 {
        transform-origin: top right;
    }

    .btn-spin,
    .finalButton {
        width: min(100%, 100%);
    }

    .spin-modal .content {
        padding: 24px 18px 24px;
        line-height: 1.65;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
