/* ==========================================================================
   RuneCake — Precision polish layer
   Loaded last. Applies Apple-grade craft to the gilded medieval theme:
   optical typography, an 8pt rhythm, hairline materials, tactile controls
   and restrained motion. Purely presentational — no markup or behaviour.
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Motion — iOS-style ease-out and sheet curves */
    --p-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --p-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
    --p-press: cubic-bezier(0.4, 0, 0.6, 1);

    /* Materials */
    --p-hairline: rgba(255, 240, 190, 0.20);
    --p-hairline-strong: rgba(255, 246, 207, 0.46);
    --p-specular: rgba(255, 248, 214, 0.16);
    --p-key: 0 1px 2px rgba(0, 0, 0, 0.5);
    --p-ambient: 0 24px 60px -24px rgba(0, 0, 0, 0.9);

    /* Rhythm */
    --p-rhythm: clamp(1rem, 2.4vw, 1.75rem);
    --p-gutter: clamp(1rem, 4vw, 1.5rem);
}

/* ---------- Foundations ---------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 84px;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
    caret-color: var(--gold-bright);
    accent-color: var(--gold);
}

/* Apple-style crisp edges for the line-art crest */
img, svg { -webkit-user-drag: none; }
.crest, .brand-lockup .crest { shape-rendering: geometricPrecision; }

/* ---------- Typography: optical, balanced, readable ---------- */
h1, h2, h3, h4 {
    text-wrap: balance;
    line-height: 1.16;
}

h1 { letter-spacing: 0.018em; }
h2 { letter-spacing: 0.024em; }
h3, h4 { letter-spacing: 0.03em; }

p, li, blockquote, dd {
    text-wrap: pretty;
    line-height: 1.68;
}

/* Long-form copy keeps a comfortable measure instead of running edge to edge */
.seo-content p,
.seo-content li,
.seo-content dd,
.method p,
.callout p {
    max-width: 72ch;
}

.hero-subtitle, .hero p { text-wrap: balance; }

/* Prices and counters line up like a native app, not a ransom note */
.amount,
.balance-bar .amount,
.prize-amount,
.prize-big,
.countdown .num,
.rs-chip-value,
.rs-chip-value strong,
.gp-hour,
.price,
.pot,
.table-list td,
.duel-stat strong {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ---------- Rhythm ---------- */
.container {
    padding-left: var(--p-gutter);
    padding-right: var(--p-gutter);
}

.hero { padding-left: var(--p-gutter); padding-right: var(--p-gutter); }

.panel,
.seo-content {
    margin-bottom: var(--p-rhythm);
}

section[id],
h2[id],
div[id] {
    scroll-margin-top: 84px;
}

/* ---------- Materials: light from above, shadow from below ---------- */
.header.rs-navbar {
    background:
        linear-gradient(180deg, rgba(255, 226, 140, 0.10) 0%, rgba(255, 226, 140, 0.015) 40%, transparent 100%),
        linear-gradient(180deg, rgba(34, 21, 13, 0.88) 0%, rgba(14, 9, 5, 0.92) 100%);
    border-bottom: 1px solid var(--p-hairline-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 246, 207, 0.18),
        0 1px 0 rgba(0, 0, 0, 0.85),
        0 18px 40px -18px rgba(0, 0, 0, 0.95);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    backdrop-filter: blur(22px) saturate(1.5);
}

/* Hairline highlight along the top edge of every framed surface */
.hero,
.panel,
.seo-content,
.modal-content,
.balance-bar,
.prize-panel,
.quest-tracker {
    border-top-color: rgba(255, 246, 207, 0.72);
}

.card,
.feature-card,
.seo-card,
.method,
.listing-card,
.side-card,
.duel-stat,
.countdown .unit,
.result-box {
    border-top-color: rgba(255, 244, 201, 0.44);
}

/* Soft ambient depth, calmer than the neon glow */
.panel,
.seo-content,
.modal-content {
    box-shadow:
        inset 0 0 0 4px rgba(12, 8, 5, 0.88),
        inset 0 0 0 5px rgba(255, 226, 140, 0.26),
        inset 0 0 65px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(0, 0, 0, 0.9),
        var(--p-key),
        var(--p-ambient);
}

.hero {
    box-shadow:
        inset 0 0 0 5px rgba(10, 6, 4, 0.82),
        inset 0 0 0 6px rgba(255, 226, 140, 0.30),
        inset 0 0 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(0, 0, 0, 0.85),
        var(--p-key),
        0 28px 70px -30px rgba(0, 0, 0, 0.95),
        0 0 60px rgba(255, 214, 110, 0.07);
}

.site-footer {
    box-shadow:
        inset 0 1px 0 rgba(255, 246, 207, 0.28),
        inset 0 4px 0 rgba(0, 0, 0, 0.45),
        0 -18px 44px -22px rgba(0, 0, 0, 0.9);
}

/* Sheet-like modal scrim with a hint of warm light */
.modal {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* ---------- Controls: tactile, precise, spring-loaded ---------- */
.btn,
.btn-hero,
.tab,
.quick-bets button,
.mini-btn,
.ticket-stepper button,
.choice,
.rs-support-form button,
.rs-nav-main a,
.rs-nav-auth a,
.rs-nav-toggle,
.rs-nav-spin {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    transition-timing-function: var(--p-ease);
    transition-duration: 0.2s;
}

/* Rounded, native-feeling affordances on the interactive layer only */
.btn,
.btn-hero,
.quick-bets button,
.mini-btn,
.ticket-stepper button,
.choice,
.rs-support-form button {
    border-radius: 10px;
}

.tab { border-radius: 8px; }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
select,
textarea,
.admin-amount-input,
.admin-reason-input {
    border-radius: 8px;
    transition:
        border-color 0.2s var(--p-ease),
        box-shadow 0.25s var(--p-ease),
        background 0.2s var(--p-ease);
}

/* iOS never zooms when the field is at least 16px */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="email"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px;
    }
}

/* Press: short, linear, immediately responsive */
.btn:active,
.btn-hero:active,
.tab:active,
.quick-bets button:active,
.mini-btn:active,
.ticket-stepper button:active,
.choice:active,
.rs-support-form button:active,
.rs-nav-spin:active,
.rs-nav-main a:active,
.rs-nav-auth a:active,
.rs-nav-toggle:active {
    transform: translateY(1px) scale(0.975);
    transition-duration: 0.09s;
    transition-timing-function: var(--p-press);
}

/* Hover lift: only where a real pointer exists */
@media (hover: hover) and (pointer: fine) {
    .btn:hover,
    .btn-hero:hover {
        transform: translateY(-2px);
    }

    .card,
    .feature-card,
    .seo-card,
    .method,
    .listing-card,
    .side-card,
    .prize-panel,
    .duel-stat {
        transition:
            transform 0.35s var(--p-ease-soft),
            border-color 0.35s var(--p-ease-soft),
            box-shadow 0.35s var(--p-ease-soft);
    }

    .card:hover,
    .feature-card:hover,
    .seo-card:hover,
    .method:hover,
    .listing-card:hover,
    .side-card:hover {
        transform: translateY(-3px);
        border-color: rgba(255, 232, 161, 0.5);
    }

    .table-list .row {
        transition: background 0.18s var(--p-ease), padding-left 0.18s var(--p-ease);
    }

    .table-list .row:hover {
        background: rgba(255, 226, 140, 0.045);
    }

    .footer-links a {
        text-underline-offset: 4px;
        text-decoration-thickness: 1px;
    }

    .footer-links a:hover {
        text-decoration: underline;
        text-decoration-color: rgba(255, 232, 161, 0.6);
    }
}

/* Nav items get a real 36px hit area on touch screens */
@media (pointer: coarse) {
    .rs-nav-main a,
    .rs-nav-auth a {
        min-height: 44px;
    }
}

/* ---------- Motion: keep the life, lose the jitter ---------- */
/* Constant gold pulsing reads as noise; hover and focus carry the energy now */
.logo,
.header.rs-navbar .rs-nav-spin,
.btn:not(:disabled):not(.btn-secondary):not(.btn-green):not(.btn-red),
.btn-hero:not(:disabled) {
    animation: none;
}

/* The crest breathes instead of blinking */
.brand-lockup .crest {
    animation: pCrestFloat 11s var(--p-ease-soft) infinite;
    will-change: transform;
}

@keyframes pCrestFloat {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(0, -6px, 0); }
}

/* Slightly softer engraving on the big gold headings */
.hero h1,
.hero h2,
.panel h2,
.seo-content h2,
.modal h2,
.prize-amount,
.prize-big,
.brand-wordmark,
.duel-hero h1 {
    text-shadow:
        0 1px 0 rgba(255, 246, 207, 0.9),
        0 2px 0 rgba(176, 132, 34, 0.85),
        0 5px 16px rgba(0, 0, 0, 0.75),
        0 0 26px rgba(255, 210, 100, 0.22);
}

/* Modal + support panel settle in on the sheet curve */
.modal-content,
#rs-support-panel {
    animation-timing-function: var(--p-ease);
}

/* ---------- Micro details ---------- */
::marker { color: var(--gold-mid); }

::placeholder { opacity: 0.72; }

button,
[role="button"],
.btn,
.tab,
summary {
    cursor: pointer;
}

button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
}

:focus-visible {
    outline: 2px solid rgba(255, 246, 207, 0.95);
    outline-offset: 3px;
}

/* Fields already draw their own gold ring; avoid a double outline */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

/* Flatter, higher-contrast scrollbar thumb on hover */
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #c99b2f 0%, #ffe8a1 45%, #fff4c9 55%, #c99b2f 100%);
}

@supports (-moz-appearance: none) {
    html {
        scrollbar-width: thin;
        scrollbar-color: #c99b2f #0b0805;
    }
}

/* ---------- Preferences ---------- */
@media (prefers-reduced-transparency: reduce) {
    .header.rs-navbar {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: linear-gradient(180deg, #22150d 0%, #0e0905 100%);
    }

    .modal {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: rgba(0, 0, 0, 0.94);
    }
}

@media (prefers-contrast: more) {
    .panel,
    .seo-content,
    .modal-content,
    .card,
    .feature-card,
    .seo-card,
    .method,
    .listing-card,
    .side-card,
    .duel-stat {
        border-color: var(--gold-bright);
    }

    .header.rs-navbar {
        border-bottom-color: var(--gold-pale);
    }
}

@media (prefers-reduced-motion: reduce) {
    .brand-lockup .crest { animation: none; }
}
