/* ==========================================================================
   mnpay - payment page design system
   --------------------------------------------------------------------------
   Self-contained: replaces the Colorlib "sign-up form" template (main1.css)
   that the page previously borrowed. Everything is driven by custom
   properties so colours, radii and spacing can be retuned in one place.

   Thai text uses Noto Sans Thai; numbers use the same family with tabular
   figures so amounts do not jitter while counting down.
   ========================================================================== */

/* --- tokens -------------------------------------------------------------- */
:root {
    /* brand: PromptPay navy + a teal-green accent for "go / success" */
    --c-navy-950: #0a1a33;
    --c-navy-900: #113566;
    --c-navy-800: #17457f;
    --c-navy-700: #1f5aa8;
    --c-teal-600: #0e9f8e;
    --c-teal-500: #14b8a6;
    --c-amber-500: #f59e0b;
    --c-rose-500: #f43f5e;

    --c-bg: #eef2f8;
    --c-bg-accent: #dfe8f5;
    --c-surface: #ffffff;
    --c-surface-2: #f7f9fc;
    --c-border: #dde4ee;
    --c-border-strong: #c7d2e2;

    --c-text: #0f172a;
    --c-text-muted: #5b6a83;
    --c-text-faint: #8494ad;

    --c-primary: var(--c-navy-800);
    --c-primary-hover: var(--c-navy-700);
    --c-primary-contrast: #ffffff;
    --c-accent: var(--c-teal-600);
    --c-accent-hover: #0b8a7b;

    --c-success: #0f9d58;
    --c-success-bg: #e7f7ef;
    --c-warning: #b45309;
    --c-warning-bg: #fef3e2;
    --c-danger: #dc2626;
    --c-danger-bg: #fdecec;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
    --shadow: 0 4px 16px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .05);
    --shadow-lg: 0 24px 60px rgba(10, 26, 51, .18), 0 6px 18px rgba(10, 26, 51, .08);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --font-sans: "Noto Sans Thai", "IBM Plex Sans Thai", "Sarabun", system-ui,
                 -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-num: "Noto Sans Thai", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --focus-ring: 0 0 0 3px rgba(31, 90, 168, .28);
}

/* Dark theme - driven by the OS, then overridable with [data-theme="dark"]. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --c-bg: #0b1220;
        --c-bg-accent: #101a2e;
        --c-surface: #141d2f;
        --c-surface-2: #1b2537;
        --c-border: #26324a;
        --c-border-strong: #35435f;

        --c-text: #e8eefb;
        --c-text-muted: #a3b1c9;
        --c-text-faint: #7b8aa5;

        --c-primary: #2b6fd4;
        --c-primary-hover: #3a7ee4;
        --c-accent: #14b8a6;
        --c-accent-hover: #2dd4bf;

        --c-success-bg: #102b21;
        --c-warning-bg: #2f2410;
        --c-danger-bg: #2e1518;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow: 0 6px 20px rgba(0, 0, 0, .45);
        --shadow-lg: 0 28px 70px rgba(0, 0, 0, .6);
        --focus-ring: 0 0 0 3px rgba(96, 165, 250, .35);
    }
}

:root[data-theme="dark"] {
    --c-bg: #0b1220;
    --c-bg-accent: #101a2e;
    --c-surface: #141d2f;
    --c-surface-2: #1b2537;
    --c-border: #26324a;
    --c-border-strong: #35435f;
    --c-text: #e8eefb;
    --c-text-muted: #a3b1c9;
    --c-text-faint: #7b8aa5;
    --c-primary: #2b6fd4;
    --c-primary-hover: #3a7ee4;
    --c-success-bg: #102b21;
    --c-warning-bg: #2f2410;
    --c-danger-bg: #2e1518;
    --shadow: 0 6px 20px rgba(0, 0, 0, .45);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, .6);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--c-text);
    background:
        radial-gradient(1100px 600px at 12% -10%, var(--c-bg-accent), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(20, 184, 166, .10), transparent 55%),
        var(--c-bg);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-6) var(--space-4) var(--space-7);
}

/* --- animated game-style background (ทุกหน้า) ----------------------------- */
/* Fixed layer behind everything (z-index:-1 sits above the canvas background
   and below all content). Page::header / AdminPage::header / admin login and
   the installer all emit the markup via Page::bg(). Reduced-motion users get
   a still frame. */
.landing-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.landing-bg__wash {
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(48% 42% at 18% 12%, rgba(43, 111, 212, .38), transparent 62%),
        radial-gradient(42% 38% at 86% 22%, rgba(20, 184, 166, .26), transparent 62%),
        radial-gradient(50% 44% at 55% 105%, rgba(124, 58, 237, .24), transparent 66%),
        radial-gradient(36% 32% at 8% 92%, rgba(251, 191, 36, .16), transparent 68%);
    animation: landing-wash 24s ease-in-out infinite alternate;
}

@keyframes landing-wash {
    from { transform: translate3d(-2%, -1%, 0) scale(1); }
    to   { transform: translate3d(2.5%, 2%, 0) scale(1.07); }
}

/* two particle fields of "stars" drifting upward at different speeds */
.landing-bg__stars {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.landing-bg__stars::before,
.landing-bg__stars::after {
    content: "";
    position: absolute;
    left: 0;
    top: 100%;
    width: 2px;
    height: 2px;
    border-radius: 50%;
}

.landing-bg__stars::before {
    box-shadow:
        6vw   0     0 0   rgba(255, 255, 255, .70),
        18vw  -12vh 0 1px rgba(147, 197, 253, .85),
        31vw  -4vh  0 0   rgba(255, 255, 255, .55),
        44vw  -22vh 0 1px rgba(94, 234, 212, .80),
        57vw  -8vh  0 0   rgba(255, 255, 255, .65),
        71vw  -30vh 0 0   rgba(196, 181, 253, .85),
        83vw  -16vh 0 1px rgba(255, 255, 255, .60),
        92vw  -38vh 0 0   rgba(252, 211, 77, .70);
    animation: landing-stars 70s linear infinite,
               landing-twinkle 3.5s ease-in-out infinite alternate;
}

.landing-bg__stars::after {
    box-shadow:
        11vw  -46vh 0 0   rgba(255, 255, 255, .50),
        26vw  -6vh  0 1px rgba(94, 234, 212, .65),
        38vw  -54vh 0 0   rgba(147, 197, 253, .70),
        49vw  -33vh 0 0   rgba(255, 255, 255, .60),
        64vw  -60vh 0 1px rgba(196, 181, 253, .75),
        77vw  -25vh 0 0   rgba(255, 255, 255, .55),
        88vw  -68vh 0 0   rgba(94, 234, 212, .65),
        5vw   -74vh 0 1px rgba(252, 211, 77, .60);
    animation: landing-stars 95s linear infinite,
               landing-twinkle 5s ease-in-out infinite alternate;
}

@keyframes landing-stars {
    from { transform: translateY(0); }
    to   { transform: translateY(-140vh); }
}

@keyframes landing-twinkle {
    from { opacity: .3; }
    to   { opacity: .95; }
}

.landing-bg__grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.4px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(ellipse 72% 62% at 50% 34%, #000 20%, transparent 78%);
    mask-image: radial-gradient(ellipse 72% 62% at 50% 34%, #000 20%, transparent 78%);
}

.landing-bg__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(64px);
    opacity: .55;
    will-change: transform;
}

.landing-bg__orb--1 {
    width: 440px; height: 440px; top: -110px; left: -90px;
    background: radial-gradient(circle, rgba(59, 130, 246, .8), transparent 70%);
    animation: landing-orb1 21s ease-in-out infinite alternate;
}
.landing-bg__orb--2 {
    width: 400px; height: 400px; top: 16%; right: -130px;
    background: radial-gradient(circle, rgba(45, 212, 191, .65), transparent 70%);
    animation: landing-orb2 26s ease-in-out infinite alternate;
}
.landing-bg__orb--3 {
    width: 340px; height: 340px; bottom: -100px; left: 32%;
    background: radial-gradient(circle, rgba(167, 139, 250, .6), transparent 70%);
    animation: landing-orb3 23s ease-in-out infinite alternate;
}
.landing-bg__orb--4 {
    width: 250px; height: 250px; top: 58%; left: -70px;
    background: radial-gradient(circle, rgba(251, 191, 36, .45), transparent 70%);
    animation: landing-orb4 29s ease-in-out infinite alternate;
}

@keyframes landing-orb1 { to { transform: translate3d(90px, 70px, 0) scale(1.15); } }
@keyframes landing-orb2 { to { transform: translate3d(-80px, 60px, 0) scale(1.1); } }
@keyframes landing-orb3 { to { transform: translate3d(70px, -60px, 0) scale(1.12); } }
@keyframes landing-orb4 { to { transform: translate3d(110px, -50px, 0) scale(1.2); } }

/* cinematic vignette - dark edges like a game menu */
.landing-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 92% at 50% 42%, transparent 52%, rgba(3, 7, 18, .6));
}

@media (prefers-reduced-motion: reduce) {
    .landing-bg__wash,
    .landing-bg__stars::before,
    .landing-bg__stars::after,
    .landing-bg__orb { animation: none; }
}

img { max-width: 100%; height: auto; }
a { color: var(--c-primary); }

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* --- shell --------------------------------------------------------------- */
.pay-shell { width: 100%; max-width: 560px; }

.pay-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.pay-brand img { display: block; }
.pay-brand .logo-main { height: 46px; width: auto; }
.pay-brand .logo-partner { height: 26px; width: auto; opacity: .95; }

.pay-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.pay-card__head {
    background: linear-gradient(135deg, var(--c-navy-900), var(--c-navy-700));
    color: #fff;
    padding: var(--space-5) var(--space-5) var(--space-6);
    position: relative;
}

.pay-card__head::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px 0;
    height: 1px;
    background: rgba(255, 255, 255, .12);
}

.pay-card__title {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: .2px;
}

.pay-card__subtitle {
    margin: var(--space-1) 0 0;
    font-size: .86rem;
    color: rgba(255, 255, 255, .78);
}

.pay-card__body { padding: var(--space-5); }

/* close / exit control sits over the header */
.pay-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
    transition: background .15s ease, transform .15s ease;
}
.pay-close:hover { background: rgba(255, 255, 255, .26); transform: rotate(90deg); }

/* --- steps --------------------------------------------------------------- */
.steps {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    counter-reset: step;
}

.steps li {
    flex: 1;
    position: relative;
    text-align: center;
    font-size: .74rem;
    color: var(--c-text-faint);
    font-weight: 600;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: 0 auto var(--space-1);
    border-radius: 50%;
    background: var(--c-surface-2);
    border: 1.5px solid var(--c-border-strong);
    color: var(--c-text-muted);
    font-size: .82rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 15px;
    left: calc(50% + 16px);
    width: calc(100% - 32px);
    height: 2px;
    background: var(--c-border-strong);
}

.steps li.is-active { color: var(--c-primary); }
.steps li.is-active::before {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(31, 90, 168, .16);
}

.steps li.is-done { color: var(--c-success); }
.steps li.is-done::before {
    background: var(--c-success);
    border-color: var(--c-success);
    color: #fff;
    content: "✓";
}
.steps li.is-done:not(:last-child)::after { background: var(--c-success); }

/* --- form ---------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }

.field__label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: var(--c-text-muted);
    margin-bottom: var(--space-2);
    letter-spacing: .3px;
}

.input {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-size: 1rem;
    color: var(--c-text);
    background: var(--c-surface-2);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.input::placeholder { color: var(--c-text-faint); }
.input:hover { border-color: var(--c-border-strong); }
.input:focus {
    outline: none;
    background: var(--c-surface);
    border-color: var(--c-primary);
    box-shadow: var(--focus-ring);
}

.input[type="number"] { font-variant-numeric: tabular-nums; }

/* preset amount chips */
.amount-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: var(--space-2);
}

.amount-chip {
    padding: 10px 8px;
    font: inherit;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--c-text);
    background: var(--c-surface-2);
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s ease;
}

.amount-chip:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.amount-chip[aria-pressed="true"] {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(31, 90, 168, .28);
}

.hint {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: .82rem;
    color: var(--c-text-muted);
    background: var(--c-surface-2);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: var(--space-4);
}

.hint--warn { color: var(--c-warning); background: var(--c-warning-bg); border-style: solid; border-color: transparent; }

/* --- buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: 14px 20px;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn--primary {
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-hover));
    color: #fff;
    box-shadow: 0 8px 20px rgba(31, 90, 168, .30);
}
.btn--primary:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(31, 90, 168, .38); }

.btn--success {
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-hover));
    color: #fff;
    box-shadow: 0 8px 20px rgba(14, 159, 142, .30);
}
.btn--success:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(14, 159, 142, .40); }

.btn--ghost {
    background: transparent;
    color: var(--c-text-muted);
    border: 1.5px solid var(--c-border);
}
.btn--ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.btn--sm { width: auto; padding: 9px 16px; font-size: .88rem; }

/* --- amount / summary ---------------------------------------------------- */
.amount-display {
    text-align: center;
    padding: var(--space-4) 0 var(--space-2);
}

.amount-display__label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.amount-display__value {
    font-size: clamp(2.2rem, 9vw, 3.1rem);
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--c-text);
    margin: var(--space-1) 0 0;
}

.amount-display__unit { font-size: .42em; font-weight: 700; color: var(--c-text-muted); margin-left: .2em; }

/* --- QR ------------------------------------------------------------------ */
.qr-frame {
    position: relative;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin: var(--space-4) 0;
}

.qr-frame img { width: min(260px, 70vw); image-rendering: pixelated; }

/* animated scanning line - paused when the tab is hidden */
.qr-frame::after {
    content: "";
    position: absolute;
    left: 8%; right: 8%;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--c-teal-500), transparent);
    box-shadow: 0 0 14px rgba(20, 184, 166, .8);
    animation: qr-scan 2.6s ease-in-out infinite;
}

@keyframes qr-scan {
    0%, 100% { top: 10%; opacity: 0; }
    15%      { opacity: 1; }
    50%      { top: 88%; opacity: 1; }
    85%      { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .qr-frame::after { animation: none; display: none; }
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --- countdown ----------------------------------------------------------- */
.countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin: var(--space-4) 0;
}

.countdown__ring {
    --p: 0; /* 0..1 elapsed fraction */
    position: relative;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        conic-gradient(var(--c-rose-500) calc(var(--p) * 1turn), var(--c-border) 0);
    flex: none;
}

.countdown__ring::before {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: var(--c-surface);
}

.countdown__time {
    position: relative;
    font-size: 1.15rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--c-rose-500);
}

.countdown__meta { font-size: .84rem; color: var(--c-text-muted); }
.countdown__meta strong { display: block; font-size: .95rem; color: var(--c-text); }

.countdown.is-expired .countdown__ring { background: var(--c-border); }
.countdown.is-expired .countdown__time { color: var(--c-text-faint); }

/* --- reference row ------------------------------------------------------- */
.ref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: .9rem;
}

.ref-row__label { color: var(--c-text-muted); font-weight: 600; flex: none; }
.ref-row__value {
    font-weight: 700;
    font-family: var(--font-num);
    overflow-wrap: anywhere;
    text-align: right;
}

.copy-btn {
    flex: none;
    border: 1px solid var(--c-border-strong);
    background: var(--c-surface);
    color: var(--c-text-muted);
    border-radius: 999px;
    padding: 4px 12px;
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}
.copy-btn:hover { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* --- status pill --------------------------------------------------------- */
.status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.status--waiting { background: var(--c-surface-2); color: var(--c-text-muted); border: 1px solid var(--c-border); }
.status--error   { background: var(--c-danger-bg); color: var(--c-danger); }
.status--ok      { background: var(--c-success-bg); color: var(--c-success); }

.spinner {
    width: 18px;
    height: 18px;
    flex: none;
    border: 2.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- success ------------------------------------------------------------- */
.success-mark {
    width: 104px;
    height: 104px;
    margin: var(--space-2) auto var(--space-4);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--c-success-bg);
    animation: pop .45s cubic-bezier(.2, .9, .3, 1.4);
}

.success-mark svg { width: 56px; height: 56px; }

.success-mark path {
    stroke: var(--c-success);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: draw .5s .18s ease forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop  { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.success-title { text-align: center; font-size: 1.35rem; font-weight: 800; margin: 0 0 var(--space-2); }
.success-note  { text-align: center; color: var(--c-text-muted); font-size: .92rem; margin: 0 0 var(--space-2); }

.summary {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin: var(--space-4) 0;
}

.summary__row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 6px 0;
    font-size: .9rem;
}
.summary__row + .summary__row { border-top: 1px dashed var(--c-border); }
.summary__row dt { color: var(--c-text-muted); margin: 0; }
.summary__row dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- support strip ------------------------------------------------------- */
.support-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--c-border);
}

.support-strip img {
    height: 30px;
    width: auto;
    opacity: .78;
    filter: grayscale(.15);
    transition: opacity .15s ease, filter .15s ease;
}
.support-strip img:hover { opacity: 1; filter: none; }

.pay-foot {
    text-align: center;
    font-size: .78rem;
    color: var(--c-text-faint);
    margin-top: var(--space-5);
}

/* --- checkout dialog ------------------------------------------------------ */
/* The QR / amount / receipt states live in one dialog over the package grid
   so the player never leaves the page they picked from. Desktop shows a
   centred card, phones get a bottom sheet. */

body.dialog-open { overflow: hidden; }

.checkout { position: fixed; inset: 0; z-index: 900; }
.checkout[hidden] { display: none !important; }

.checkout__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 9, 20, .74);
    backdrop-filter: blur(3px);
    animation: ck-fade .2s ease;
}

.checkout__panel {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100vw - 28px));
    max-height: min(90vh, 880px);
    margin: max(4vh, 20px) auto 0;
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: ck-pop .26s cubic-bezier(.2, .9, .3, 1.1);
}

.checkout__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: linear-gradient(135deg, var(--c-navy-900), var(--c-navy-700));
    color: #fff;
}

.checkout__logo { height: 30px; width: auto; display: block; }
.checkout__title { flex: 1; font-size: 1.02rem; font-weight: 700; }

.checkout__close {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.checkout__close:hover { background: rgba(255, 255, 255, .28); transform: rotate(90deg); }

.checkout__body { flex: 1; padding: var(--space-5); overflow-y: auto; }

.checkout__foot {
    padding: var(--space-3) var(--space-5) var(--space-4);
    border-top: 1px solid var(--c-border);
}
.checkout__foot-label {
    display: block;
    text-align: center;
    font-size: .74rem;
    color: var(--c-text-faint);
    margin-bottom: var(--space-2);
}
.checkout__foot .support-strip {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    gap: var(--space-2);
}
.checkout__foot .support-strip img { height: 24px; }

/* one visible state at a time */
.ck-state { display: none; }
.checkout[data-state="form"]    .ck-state--form    { display: block; }
.checkout[data-state="qr"]      .ck-state--qr      { display: block; }
.checkout[data-state="done"]    .ck-state--done    { display: block; }
.checkout[data-state="loading"] .ck-state--loading { display: block; }

.ck-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-7) 0;
    color: var(--c-text-muted);
    font-weight: 600;
}
.ck-loading .spinner { width: 30px; height: 30px; border-width: 3px; color: var(--c-primary); }

.ck-actions { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.ck-actions .btn { width: 100%; }

.ck-center { text-align: center; margin: var(--space-4) 0; }

.ck-account { margin-bottom: var(--space-4); }
.ck-account .tag { flex: none; }

.amount-display--pay { padding-top: 0; }
.amount-display__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.hint--gift {
    color: var(--c-success);
    background: var(--c-success-bg);
    border-style: solid;
    border-color: transparent;
}
.hint--gift strong { color: var(--c-success); }

/* promotion block header (single-campaign view, no tabs) */
.promo-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 10px 14px;
    margin-bottom: var(--space-3);
    background: var(--c-surface-2);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius);
}
.promo-head strong { font-size: .95rem; }
.promo-head p {
    flex-basis: 100%;
    margin: 0;
    font-size: .82rem;
    color: var(--c-text-muted);
}

@keyframes ck-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ck-pop {
    from { opacity: 0; transform: translateY(18px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

@media (max-width: 620px) {
    .checkout__panel {
        width: 100%;
        max-width: none;
        margin: 0;
        position: absolute;
        inset: auto 0 0 0;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        animation: ck-sheet .3s ease;
    }
    .checkout__body { padding: var(--space-4); }
    .checkout__foot { padding: var(--space-3) var(--space-4) var(--space-4); }
}
@keyframes ck-sheet {
    from { transform: translateY(48px); opacity: .4; }
    to   { transform: none; opacity: 1; }
}


/* --- alerts / toast ------------------------------------------------------ */
.toast-stack {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 460px);
    display: grid;
    gap: var(--space-2);
    z-index: 999;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 13px 16px;
    border-radius: var(--radius);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 4px solid var(--c-primary);
    box-shadow: var(--shadow-lg);
    font-size: .9rem;
    pointer-events: auto;
    animation: slide-in .28s ease;
}

.toast--success { border-left-color: var(--c-success); }
.toast--error   { border-left-color: var(--c-danger); }
.toast--warning { border-left-color: var(--c-amber-500); }

.toast__icon { flex: none; font-weight: 800; }
.toast--success .toast__icon { color: var(--c-success); }
.toast--error   .toast__icon { color: var(--c-danger); }
.toast--warning .toast__icon { color: var(--c-amber-500); }

.toast__close {
    margin-left: auto;
    flex: none;
    border: none;
    background: none;
    color: var(--c-text-faint);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- license banner (แถบแจ้งเตือนใบอนุญาตเช่าระบบ) ---------------------- */
.lic-banner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 9px var(--space-4);
    font-size: .87rem;
    font-weight: 700;
    line-height: 1.5;
    position: relative;
    z-index: 30;
    border-bottom: 1px solid transparent;
}

.lic-banner__icon { flex: none; font-size: 1rem; line-height: 1; }
.lic-banner__text { max-width: 70ch; }

.lic-banner__link {
    flex: none;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .85);
    color: inherit;
}
.lic-banner__link:hover { background: #fff; }

.lic-banner--warn {
    background: var(--c-warning-bg);
    color: var(--c-warning);
    border-bottom-color: color-mix(in srgb, var(--c-warning) 30%, transparent);
}

.lic-banner--error {
    background: var(--c-danger-bg);
    color: var(--c-danger);
    border-bottom-color: color-mix(in srgb, var(--c-danger) 35%, transparent);
    animation: lic-pulse 2.4s ease-in-out infinite;
}

@keyframes lic-pulse {
    0%, 100% { filter: none; }
    50%      { filter: saturate(1.5) brightness(.98); }
}

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 480px) {
    body { padding: var(--space-4) var(--space-3) var(--space-6); }
    .pay-card__body { padding: var(--space-4); }
    .pay-card__head { padding: var(--space-4) var(--space-4) var(--space-5); }
    .steps li { font-size: .68rem; }
    .countdown { flex-direction: column; gap: var(--space-2); }
}

@media print {
    .pay-close, .toast-stack, .qr-frame::after { display: none !important; }
    body { background: #fff; padding: 0; }
    .pay-card { box-shadow: none; border: 1px solid #ccc; }
}
