:root {
    /* ✅ Boot-splash palette (loading screen only - NOT the page chrome). */
    --gold: #d7aa52;
    --gold-soft: #f6dd96;
    --deep: #050403;
    --velvet: #25040a;
    --line: rgba(246, 221, 150, .28);
    --progress: 0;

    /* ✅ Neon Vegas kit tokens for the page-level chrome (bar / rail / medallion buttons).
       Values are copied 1:1 from Assets/Scripts/UI/Kit/UiKitTokens.cs + UiKitTheme.cs so the
       DOM controls and the in-game UiKit.CloseMedallion are ONE design system. Never hand-pick
       a colour here - add a token with its C# name instead. */
    --neon-cyan: #2de2ff;                            /* UiKitTokens.Cyan */
    --neon-mag: #ff3df2;                             /* UiKitTokens.Mag */
    --neon-violet: #8a3dff;                          /* UiKitTokens.Violet */
    --neon-night: #0b0620;                           /* UiKitTokens.Night */
    --neon-plate: #08041a;                           /* UiKitTokens.Plate */
    --neon-ink: #f6f3ff;                             /* UiKitTokens.Ink */
    --neon-glass: rgba(255, 255, 255, .06);          /* UiKitTokens.Glass (bg-glass fill) */
    --neon-glass-border: rgba(255, 255, 255, .14);   /* UiKitTokens.GlassBorder (gb hairline) */
    --neon-medallion-shadow: rgba(0, 0, 0, .5);      /* CloseMedallion GlowBehind: black .5, blur 14 */
    --neon-pressed-scale: .94;                       /* UiMotion.PressedScale (UiKitPressFx) */

    /* ✅ Bezel medallion (the page buttons' look - see the "Bezel medallion buttons" section).
       Every colour below is a UiKitTokens colour at a stated alpha, or an arithmetic mix of two
       of them (the mixes are written out numerically because color-mix() is not available on
       every WebView this template ships to). Violet = #8a3dff = rgb(138,61,255),
       Cyan = #2de2ff = rgb(45,226,255). */
    --bezel-ring-violet: rgba(138, 61, 255, .7);     /* UiKitTokens.Violet @ .7 - ring start (rest) */
    --bezel-ring-cyan: rgba(45, 226, 255, .7);       /* UiKitTokens.Cyan @ .7 - ring end (rest) */
    --bezel-ring-mid-lit: rgba(92, 144, 255, 1);     /* midpoint Violet<->Cyan: ((138+45)/2, (61+226)/2, 255) - ring start (lit) */
    --bezel-ring-cyan-lit: rgba(45, 226, 255, 1);    /* UiKitTokens.Cyan @ 1 - ring end (lit) + the whole ring on press */
    --bezel-glow-rest: rgba(138, 61, 255, .25);      /* UiKitTokens.Violet @ .25 - ambient glow, 6px blur (rest) */
    --bezel-glow-lit: rgba(138, 61, 255, .4);        /* UiKitTokens.Violet @ .4 - ambient glow, 10px blur (lit) */
    --bezel-sheen: rgba(255, 255, 255, .14);         /* white .14 -> 0 @ 50%: top-half sheen over Night */
    --bezel-highlight: rgba(255, 255, 255, .25);     /* white .25: inner 1px top highlight (inset shadow) */
    --bezel-glyph-shadow: rgba(0, 0, 0, .6);         /* black .6: 1px glyph drop shadow */
    --bezel-glyph-lit: rgb(224, 251, 255);           /* white mixed 15% toward Cyan: 255-.15*(255-45), 255-.15*(255-226), 255 */
    --bezel-hover-scale: 1.04;                       /* hover/focus lift (= UiMotion.PressRelease overshoot) */

    /* ✅ UiKitTokens.MedallionCrest(bp): 54 desktop / 46 phone portrait / 42 phone landscape,
       switched below on exactly UiKitBreakpoints.Classify's rule (w <= 600 -> portrait, else
       h <= 500 -> landscape). js/iframe-chrome-layout.js medallionSizeFor() is the same rule
       and sets the buttons' inline size; this var only sizes the glyph and the non-iframe
       fallback so the two can never disagree. */
    --neon-medallion-size: 54px;
}

@media (max-width: 600px) {
    :root { --neon-medallion-size: 46px; }
}

@media (max-height: 500px) and (min-width: 601px) {
    :root { --neon-medallion-size: 42px; }
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: #111;
    font-family: Arial, sans-serif;
}

#unity-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When #unity-container is the fullscreen element, html/body are no longer
   painted behind it, so it needs its own background and explicit sizing. */
#unity-container:fullscreen,
#unity-container:-webkit-full-screen {
    width: 100%;
    height: 100%;
    background: #111;
}

#game-wrapper {
    position: relative;
    width: min(100%, calc(100vh * 16 / 9));
    height: min(100%, calc(100vw * 9 / 16));
}

/* Focusable but invisible. Not display:none or [hidden] - neither can take focus, which is
   the only thing this element is for. */
#keyboard-anchor {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    padding: 0;
    border: 0;
    background: none;
    pointer-events: none;
}

/* When the wrapper is fullscreen, stretch to fill.
   We use a JS-managed class instead of :fullscreen pseudo-class so the rule
   reliably stops applying when fullscreen exits across all browsers. */
#game-wrapper.fullscreen-mode {
    width: 100%;
    height: 100%;
    background: #111;
}

#unity-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    touch-action: none;
}

/* ✅ Rect (top/left/width/height) is set inline by main.js/webview.jslib to
   track the real iframe placement in both regular and fullscreen game
   modes. While the game is in iframe-fullscreen, webview.jslib shrinks the
   inline top/height by the #floor-chrome-bar's height via
   GetIframeTopInsetPx() (see index.html <style> + main.js) so the bar
   isn't covered - no rule here needs to change for that. */
#unity-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 10;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

/* ✅ Visibility toggle */
#unity-iframe.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ✅ WHY: the DOM iframe sits at z-index 10, above the Unity canvas, so the Unity settings
   panel is unreadable unless the frame is hidden while that panel is open. `visibility`
   (not `display`) is used so the game's layout size doesn't change - a resize would make
   Unity think its canvas changed and could interrupt the running game. */
#game-wrapper.iframe-obscured #unity-iframe,
#game-wrapper.iframe-obscured #close-button,
#game-wrapper.iframe-obscured #fullscreen-button,
#game-wrapper.iframe-obscured #floor-chrome-bar,
#game-wrapper.iframe-obscured #floor-chrome-rail {
    visibility: hidden;
    pointer-events: none;
}

/* ✅ Quiet floor chrome: visual look for the reserved top bar / phone-landscape right
   rail (structural rules - display/position/size - live in index.html's inline <style>,
   set inline every frame by main.js's PositionIframeButtons()). Bar and rail are the
   same neutral frame: one flat UiKitTokens.Night fill and the kit's 1px GlassBorder
   hairline ONLY on the edge each one borders the game on (bottom edge for the bar,
   left edge for the rail), so rotating a phone between the two never looks like a
   different surface. No gradient, no glow, no neon accent - the game is the colour.
   The hairline is an INSET box-shadow, not a border, so the strip's box stays exactly
   the --floor-chrome-h / --floor-rail-w thickness that js/iframe-chrome-layout.js
   computeInsets reads (a border would grow the box 1px onto the game). */
#floor-chrome-bar {
    background: var(--neon-night);
    box-shadow: inset 0 -1px 0 var(--neon-glass-border);
}

#floor-chrome-rail {
    background: var(--neon-night);
    box-shadow: inset 1px 0 0 var(--neon-glass-border);
}

/* ✅ Bezel medallion buttons - the page-level sibling of UiKit.CloseMedallion
   (Assets/Scripts/UI/Kit/UiKitChrome.cs), pitched as a premium game utility button:
   presence at rest, no neon halo. The disc is a flat UiKitTokens.Night fill with a white
   .14 -> 0 sheen over its top half and a 1px inner top highlight (white .25), framed by a
   2px bezel ring that runs UiKitTokens.Violet -> Cyan at 135deg (alpha .7 at rest), with
   a soft Violet .25 ambient glow (6px blur - the only glow at rest) and the kit's
   GlowBehind drop shadow (black .5, blur 14). The glyph is full white with a 1px black
   drop shadow so it reads on the lit disc. LIT (desktop :hover, :focus-visible): the ring
   goes opaque and shifts toward Cyan (Violet/Cyan midpoint -> Cyan), the glow lifts to
   Violet .4 @ 10px, the glyph tints 15% toward Cyan and the disc lifts to scale 1.04.
   PRESS (:active, touch included): UiKitPressFx scale .94 and the ring flashes solid
   Cyan. The close/fullscreen pair only ever paints while #game-wrapper has "iframe-mode"
   (main.js - they are iframe-only controls); #login-close / #cashier-close are the same control on the
   sign-in surface. index.html's inline <style> keeps just the structural
   position/size/display rules. The picto glyphs paint currentColor through a mask, so
   `color` here is the glyph colour.
   ✅ Geometry: border: none + box-sizing border-box, and the ring is a ::before overlay
   INSIDE the box, so the 54/46/42 box that --neon-medallion-size /
   IframeChromeLayout.medallionSizeFor() set - the hit box and the docked layout math -
   is untouched by the ring. The hover scale(1.04) is paint-only (transform), but it does
   grow the on-screen bounds: Tools/LayoutChecks/fullscreen-chrome-check.js "Hover 1.04"
   proves the lifted disc clears its neighbours at every size.
   ✅ Stacking: isolation: isolate makes each button its own stacking context so the
   ::before (z 0) / .picto-shadow glyph (z 1) order can't leak into the page's z-index scheme. */
#game-wrapper.iframe-mode #close-button,
#game-wrapper.iframe-mode #fullscreen-button,
#login-close,
#cashier-close {
    box-sizing: border-box;
    isolation: isolate;
    background:
        linear-gradient(180deg, var(--bezel-sheen), rgba(255, 255, 255, 0) 50%),
        var(--neon-night);
    border: none;
    border-radius: 50%;
    box-shadow:
        inset 0 1px 0 var(--bezel-highlight),
        0 0 6px var(--bezel-glow-rest),
        0 6px 14px var(--neon-medallion-shadow);
    color: #fff;
    cursor: pointer;
    /* ✅ First-tap guarantees: no 300ms double-tap-zoom wait, no grey OS tap flash, no
       accidental text selection on a long press. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    /* ✅ Release to rest: UiMotion.PressRelease bounces to 1.04 over 80ms then settles over
       100ms - one overshoot curve over the same 180ms total. (Release while still hovered
       lands on the :hover rule's 120ms ease-out to 1.04 instead - see below.) Glow/glyph
       ease over the lit change. */
    transition:
        transform .18s cubic-bezier(.34, 1.56, .64, 1),
        box-shadow 120ms ease-out,
        color 120ms ease-out;
}

/* ✅ Bezel ring: a 2px Violet -> Cyan gradient ring painted by ::before (free on all three
   buttons - nothing else styles their pseudo-elements) and hollowed out with the
   padding-box/content-box mask-xor trick, so the gradient only shows in the 2px band
   and the disc fill stays visible inside it. inset: 0 + border-radius: inherit (50%)
   keeps it exactly on the disc edge; the buttons are already positioned elements
   (index.html: fixed in iframe-mode / absolute otherwise), so no position change is
   needed here. Gradient backgrounds don't interpolate, so the ring's state changes
   snap; the transition is kept so a future opacity-based crossfade is a one-liner. */
#game-wrapper.iframe-mode #close-button::before,
#game-wrapper.iframe-mode #fullscreen-button::before,
#login-close::before,
#cashier-close::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, var(--bezel-ring-violet), var(--bezel-ring-cyan));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
    transition: background 120ms ease-out, opacity 120ms ease-out;
}

/* ✅ Glyph box = 36/54 of the disc (kit icon ratio), so the X and the fullscreen glyphs
   match the in-game medallion icons at every breakpoint. position + z-index 1 lift the
   glyph above the ::before ring overlay (z 0).
   ✅ One icon family: the glyph is the kit's Layer Lab picto PNG (TemplateData/icons/,
   same files UiKitIcons uses in-game) painted as a CSS mask over currentColor by the
   inner .picto span, so the button's `color` (white at rest, --bezel-glyph-lit when lit)
   still tints it. The 1px drop shadow lives on THIS wrapper, not on the masked span:
   filter is applied before mask, so a drop-shadow on the masked element itself would be
   clipped away by its own mask. */
#game-wrapper.iframe-mode #close-button .picto-shadow,
#game-wrapper.iframe-mode #fullscreen-button .picto-shadow,
#login-close .picto-shadow,
#cashier-close .picto-shadow {
    display: block;
    position: relative;
    z-index: 1;
    width: calc(var(--neon-medallion-size) * 36 / 54);
    height: calc(var(--neon-medallion-size) * 36 / 54);
    filter: drop-shadow(0 1px 0 var(--bezel-glyph-shadow));
}

/* ✅ Picto glyph: the PNG's alpha is the mask, currentColor is the paint. url() resolves
   against this stylesheet, which sits next to index.html at the template root, so
   TemplateData/icons/... is the right base. */
.picto {
    display: block;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    -webkit-mask-image: var(--picto);
    mask-image: var(--picto);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.picto-window-max { --picto: url("TemplateData/icons/PictoIcon_Window_Max.png"); }
.picto-window-min { --picto: url("TemplateData/icons/PictoIcon_Window_Min.png"); }
.picto-mark-x     { --picto: url("TemplateData/icons/PictoIcon_Mark_X.png"); }
.picto-setting    { --picto: url("TemplateData/icons/PictoIcon_Setting_2.png"); }

/* ✅ Keyboard focus (all devices) = the LIT look (same as desktop hover below): opaque ring
   shifted to Cyan, glow up to Violet .4 @ 10px (inset highlight + drop shadow kept in the
   list), glyph tinted 15% toward Cyan, disc lifted to 1.04. The lit ring IS the focus
   indicator, so the UA outline (and index.html's cyan outline-offset ring, which this
   out-ranks via the #login-modal / #game-wrapper.iframe-mode ancestors) is dropped -
   nothing is painted outside the disc. */
#game-wrapper.iframe-mode #close-button:focus-visible,
#game-wrapper.iframe-mode #fullscreen-button:focus-visible,
#login-modal #login-close:focus-visible,
#cashier-modal #cashier-close:focus-visible {
    box-shadow:
        inset 0 1px 0 var(--bezel-highlight),
        0 0 10px var(--bezel-glow-lit),
        0 6px 14px var(--neon-medallion-shadow);
    color: var(--bezel-glyph-lit);
    transform: scale(var(--bezel-hover-scale));
    outline: none;
    transition:
        transform 120ms ease-out,
        box-shadow 120ms ease-out,
        color 120ms ease-out;
}

#game-wrapper.iframe-mode #close-button:focus-visible::before,
#game-wrapper.iframe-mode #fullscreen-button:focus-visible::before,
#login-modal #login-close:focus-visible::before,
#cashier-modal #cashier-close:focus-visible::before {
    background: linear-gradient(135deg, var(--bezel-ring-mid-lit), var(--bezel-ring-cyan-lit));
}

/* ✅ Desktop-only hover: UiKitPressFx strips hover colours on touch so a finger never
   leaves a sticky highlight - the (hover: hover) gate is the CSS equivalent. Same LIT
   look as :focus-visible above. */
@media (hover: hover) {
    #game-wrapper.iframe-mode #close-button:hover,
    #game-wrapper.iframe-mode #fullscreen-button:hover,
    #login-close:hover,
    #cashier-close:hover {
        box-shadow:
            inset 0 1px 0 var(--bezel-highlight),
            0 0 10px var(--bezel-glow-lit),
            0 6px 14px var(--neon-medallion-shadow);
        color: var(--bezel-glyph-lit);
        transform: scale(var(--bezel-hover-scale));
        transition:
            transform 120ms ease-out,
            box-shadow 120ms ease-out,
            color 120ms ease-out;
    }

    #game-wrapper.iframe-mode #close-button:hover::before,
    #game-wrapper.iframe-mode #fullscreen-button:hover::before,
    #login-close:hover::before,
    #cashier-close:hover::before {
        background: linear-gradient(135deg, var(--bezel-ring-mid-lit), var(--bezel-ring-cyan-lit));
    }
}

/* ✅ Press (all devices, touch included): UiMotion.PressDown -> PressedScale (.94) over
   60ms, ring flashes solid Cyan for the duration of the press. Declared AFTER the hover /
   focus-visible rules at matching specificity (hence #login-modal #login-close here too)
   so the press scale beats the 1.04 lift while both apply; on release the transform
   transitions back to whichever state remains (1.04 while still hovered/focused, 1.0
   otherwise, via those rules' own transitions). */
#game-wrapper.iframe-mode #close-button:active,
#game-wrapper.iframe-mode #fullscreen-button:active,
#login-modal #login-close:active,
#cashier-modal #cashier-close:active {
    transform: scale(var(--neon-pressed-scale));
    transition: transform .06s ease-out;
}

#game-wrapper.iframe-mode #close-button:active::before,
#game-wrapper.iframe-mode #fullscreen-button:active::before,
#login-modal #login-close:active::before,
#cashier-modal #cashier-close:active::before {
    background: linear-gradient(135deg, var(--bezel-ring-cyan-lit), var(--bezel-ring-cyan-lit));
}

/* ✅ UiMotion honours MotionPreferences.ReduceMotion by skipping the press tween entirely;
   the hover/focus lift is a motion too, so it is dropped here as well. Colour/glow changes
   still apply (they're state, not motion); only transforms and their transitions go. */
@media (prefers-reduced-motion: reduce) {
    #game-wrapper.iframe-mode #close-button,
    #game-wrapper.iframe-mode #fullscreen-button,
    #login-close,
    #cashier-close,
    #game-wrapper.iframe-mode #close-button::before,
    #game-wrapper.iframe-mode #fullscreen-button::before,
    #login-close::before,
    #cashier-close::before {
        transition: none;
    }

    #game-wrapper.iframe-mode #close-button:hover,
    #game-wrapper.iframe-mode #fullscreen-button:hover,
    #login-close:hover,
    #cashier-close:hover,
    #game-wrapper.iframe-mode #close-button:focus-visible,
    #game-wrapper.iframe-mode #fullscreen-button:focus-visible,
    #login-modal #login-close:focus-visible,
    #cashier-modal #cashier-close:focus-visible,
    #game-wrapper.iframe-mode #close-button:active,
    #game-wrapper.iframe-mode #fullscreen-button:active,
    #login-modal #login-close:active,
    #cashier-modal #cashier-close:active {
        transform: none;
        transition: none;
    }
}

/* ✅ CS-NEW-1: layered fallback so the loading screen reads as a lit casino
   floor even at 0 bytes of image (background-image on .cinema-bg hasn't
   decoded yet, or fails to load). Radial glow from --velvet at centre-bottom
   fading to --deep at the edges, roughly matching where the real backdrop's
   warm floor light sits. isolation/z-index stacking is unchanged. */
#loading-screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(ellipse at 50% 85%, var(--velvet), transparent 60%),
        #020101;
    color: #fff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    z-index: 1;
    transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
}

/* ✅ Finish sequence. Runs once Unity is up, across the hold that lets the game's
   Addressable content download behind this screen (CONTENT_PRELOAD_HOLD_MS in main.js):
   the loading chrome retires, the 21 swells, and the last stretch is the fade off the
   game. The two durations are handed down from main.js so the animation and the hold it
   has to fill cannot drift apart; the fallbacks match the defaults there. */

#loading-screen.finishing {
    transition: opacity var(--finish-fade-ms, 1200ms) ease;
}

/* The progress ring, the flavor text and the HUD have nothing left to report once Unity
   is loaded, so they leave early and hand the frame to the logo. */
#loading-screen.finishing .progress-orbit,
#loading-screen.finishing .metal-disc,
#loading-screen.finishing .copy-block,
#loading-screen.finishing .minimal-hud {
    opacity: 0;
    transition: opacity .7s ease;
}

#loading-screen.finishing .crest {
    transform: scale(1.5);
    transition: transform var(--finish-grow-ms, 3800ms) cubic-bezier(.16,.66,.3,1);
}

#loading-screen.finishing .logo {
    filter: drop-shadow(0 0 34px rgba(190,255,121,.4)) drop-shadow(0 16px 26px rgba(0,0,0,.6));
    transition: filter var(--finish-grow-ms, 3800ms) ease-out;
}

.cinema-bg {
    position: absolute;
    inset: -4%;
    /* ✅ CS-NEW-1: this layer is never transparent-black before the jpg
       decodes (or if it fails to load). background-color is the ultimate
       fallback; the radial-gradient is a second background-image layer
       sitting behind the jpg (a failed/undecoded image layer paints as
       transparent, letting the layer below it show through), so the
       velvet-to-deep glow is visible until the real photo is ready. */
    background-color: var(--velvet);
    background-image:
        url('img/casino-bg.jpg'),
        radial-gradient(ellipse at 50% 60%, var(--velvet), var(--deep) 75%);
    background-size: cover;
    background-position: center 53%;
    transform: scale(1.04);
    filter: contrast(1.08) saturate(.92) brightness(.72);
    animation: slowPush 18s ease-in-out infinite alternate;
    z-index: -8;
}

.cinema-grade {
    position: absolute;
    inset: 0;
    z-index: -6;
    background:
        radial-gradient(circle at 50% 45%, rgba(255,190,88,.15), transparent 24%),
        radial-gradient(circle at 48% 70%, rgba(115,12,20,.30), transparent 32%),
        linear-gradient(90deg, rgba(0,0,0,.82), rgba(0,0,0,.16) 34%, rgba(0,0,0,.16) 66%, rgba(0,0,0,.82)),
        linear-gradient(180deg, rgba(0,0,0,.48), transparent 30%, rgba(0,0,0,.88));
}

.cinema-grade:after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 100% 3px;
    mix-blend-mode: overlay;
    opacity: .18;
    pointer-events: none;
}

.volumetric-light {
    position: absolute;
    top: -20%;
    width: 34vw;
    height: 115vh;
    z-index: -5;
    opacity: .32;
    filter: blur(22px);
    background: linear-gradient(180deg, rgba(255,226,147,.48), rgba(255,194,91,.10) 40%, transparent 70%);
    transform-origin: top;
    animation: breathe 5.5s ease-in-out infinite;
}

.light-left { left: 15%; transform: rotate(14deg); }
.light-right { right: 12%; transform: rotate(-12deg); animation-delay: -2s; }

.floor-glass {
    position: absolute;
    left: 7%;
    right: 7%;
    bottom: -16%;
    height: 34%;
    z-index: -3;
    background: radial-gradient(ellipse at center, rgba(255,207,109,.16), transparent 62%);
    filter: blur(18px);
    opacity: .75;
    animation: floorPulse 6s ease-in-out infinite;
}

.gold-dust, .gold-dust:before, .gold-dust:after {
    position: absolute;
    inset: 0;
    content: "";
    z-index: -2;
    pointer-events: none;
    opacity: .55;
    background-image:
        radial-gradient(circle, rgba(255,219,143,.8) 0 1px, transparent 1.7px),
        radial-gradient(circle, rgba(255,255,255,.45) 0 1px, transparent 1.5px);
    background-size: 180px 180px, 260px 260px;
    background-position: 10% 20%, 70% 30%;
    animation: dustMove 22s linear infinite;
}

.gold-dust:before { opacity: .28; background-size: 120px 120px, 310px 310px; animation-duration: 28s; animation-direction: reverse; }
.gold-dust:after { opacity: .18; filter: blur(1px); background-size: 90px 90px, 210px 210px; animation-duration: 16s; }

.npc-shadow {
    position: absolute;
    bottom: 14%;
    width: 42px;
    height: 140px;
    z-index: -1;
    border-radius: 46% 46% 16% 16%;
    background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.58));
    filter: blur(1px);
    opacity: 0;
    animation: npcCross 14s ease-in-out infinite;
}

.npc-a { left: -8%; animation-delay: 1.2s; }
.npc-b { right: -10%; height: 120px; width: 36px; animation-name: npcCrossReverse; animation-delay: 7s; }

.hero-loader {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 30px;
    transform: translateY(-1.5vh);
}

.crest {
    position: relative;
    /* ✅ CS-NEW-1: capped by vmin (not just vw) so a short viewport (landscape
       phone) can't blow the crest up to fill the screen height-wise - see the
       max-height landscape query below for the further-reduced short cap. */
    width: min(33vw, 52vmin, 330px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

.progress-orbit {
    position: absolute;
    inset: 0;
    filter: drop-shadow(0 0 20px rgba(215,170,82,.22));
    animation: orbitFloat 6s ease-in-out infinite;
}

.orbit-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.orbit-track { fill: none; stroke: rgba(246,221,150,.10); stroke-width: 1.5; stroke-dasharray: 2 10; }
.orbit-progress {
    fill: none;
    stroke: var(--gold-soft);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-dasharray: 590;
    stroke-dashoffset: calc(590 - (590 * var(--progress) / 100));
    transition: stroke-dashoffset .45s cubic-bezier(.22,.61,.36,1);
    filter: drop-shadow(0 0 10px rgba(246,221,150,.65));
}

.orbit-dot {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold-soft);
    box-shadow: 0 0 18px var(--gold-soft);
    left: 50%;
    top: 50%;
    transform-origin: 0 0;
}

.dot-one { animation: dotOrbit 5.2s linear infinite; }
.dot-two { width: 4px; height: 4px; animation: dotOrbit 8s linear infinite reverse; opacity: .65; }

.metal-disc {
    position: absolute;
    width: 72%;
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 42% 32%, rgba(255,236,184,.18), rgba(255,207,107,.05) 31%, rgba(0,0,0,.44) 63%, rgba(0,0,0,.78)),
        conic-gradient(from 180deg, transparent, rgba(246,221,150,.23), transparent, rgba(135,81,22,.25), transparent);
    border: 1px solid rgba(246,221,150,.20);
    box-shadow: inset 0 0 60px rgba(0,0,0,.74), 0 34px 70px rgba(0,0,0,.55);
    backdrop-filter: blur(7px);
}

.logo-shell {
    position: relative;
    width: 62%;
    min-width: 190px;
    padding: 26px 25px;
    border-radius: 26px;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.logo {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 18px rgba(190,255,121,.25)) drop-shadow(0 12px 18px rgba(0,0,0,.65));
}

.specular-sweep {
    position: absolute;
    top: -40%;
    bottom: -40%;
    left: -75%;
    width: 46%;
    transform: rotate(18deg);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.20), rgba(246,221,150,.34), transparent);
    animation: sweep 3.8s cubic-bezier(.2,.75,.24,1) infinite;
}

.copy-block {
    text-align: center;
    letter-spacing: .02em;
    transform: translateY(-12px);
}

.loading-message {
    margin: 0;
    font-size: clamp(20px, 2.4vw, 34px);
    font-weight: 500;
    text-shadow: 0 8px 24px rgba(0,0,0,.8);
}

.subcopy {
    margin: 8px 0 0;
    color: rgba(255,241,207,.58);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .42em;
}

.minimal-hud {
    position: absolute;
    right: 34px;
    bottom: 28px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 15px;
    border: 1px solid rgba(246,221,150,.13);
    border-radius: 999px;
    background: rgba(0,0,0,.28);
    backdrop-filter: blur(10px);
    color: rgba(255,241,207,.75);
    letter-spacing: .16em;
    font-size: 11px;
    box-shadow: 0 14px 48px rgba(0,0,0,.45);
}

/* ✅ min-width grew from 38px and letter-spacing was reset to normal so the
   "12.3 / 68.1 MB · ~14s" readout (js/main.js UpdateLoadingReadout) doesn't get
   stretched by the HUD's wide .16em tracking or clipped against the divider —
   a bare "0%" still fits the same slot fine at this width. */
.percent { font-size: 13px; color: var(--gold-soft); min-width: 150px; text-align: right; letter-spacing: normal; white-space: nowrap; }
.divider { width: 1px; height: 14px; background: rgba(246,221,150,.22); }

@keyframes slowPush { from { transform: scale(1.035) translate3d(-.5%,0,0); } to { transform: scale(1.095) translate3d(.5%,-1%,0); } }
@keyframes breathe { 0%,100% { opacity: .22; } 50% { opacity: .43; } }
@keyframes floorPulse { 0%,100% { opacity: .48; transform: scaleX(.95); } 50% { opacity: .78; transform: scaleX(1.05); } }
@keyframes dustMove { to { background-position: 10% -180%, 70% -130%; } }
@keyframes npcCross { 0%,14% { transform: translateX(0) scale(.85); opacity: 0; } 25% { opacity: .32; } 55% { opacity: .22; } 75%,100% { transform: translateX(118vw) scale(1.08); opacity: 0; } }
@keyframes npcCrossReverse { 0%,20% { transform: translateX(0) scale(.8); opacity: 0; } 31% { opacity: .25; } 55% { opacity: .18; } 78%,100% { transform: translateX(-118vw) scale(1.05); opacity: 0; } }
@keyframes orbitFloat { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.012); } }
@keyframes dotOrbit { from { transform: rotate(0deg) translateX(47%); } to { transform: rotate(360deg) translateX(47%); } }
@keyframes sweep { 0% { left: -80%; opacity: 0; } 12% { opacity: 1; } 42%,100% { left: 130%; opacity: 0; } }

@media (max-width: 760px) {
    .crest { width: min(60vw, 280px); }
    .logo-shell { min-width: 165px; padding: 20px; }
    .subcopy { letter-spacing: .22em; }
    .minimal-hud { right: 18px; bottom: 18px; }
}

/* ✅ CS-NEW-1: the max-width rule above never matches a landscape phone
   (e.g. 844x390 - width is well over 760px), so without this the crest
   stays min(33vw,52vmin,330px) ≈ 278px against a 390px-tall viewport and
   the .metal-disc (72% of the crest) fills the screen. This targets short
   viewports by height/orientation instead, and shrinks/repositions the
   whole loader stack so the crest, copy and HUD all stay on-screen and
   legible at a ~390px height. */
@media (max-height: 520px) and (orientation: landscape) {
    .crest { width: min(40vmin, 210px); }
    .hero-loader { gap: 12px; transform: none; }
    .logo-shell { min-width: 0; padding: 12px; }
    .loading-message { font-size: clamp(15px, 3.4vh, 20px); }
    .subcopy { font-size: 10px; letter-spacing: .22em; }
    .copy-block { transform: none; }
    .minimal-hud { right: 12px; bottom: 10px; padding: 8px 12px; }
    .percent { min-width: 130px; }
}

/* ✅ CS-NEW-1: backdrop-filter over an animating layer re-blurs every frame,
   which stalls the very animation this screen is meant to show on the low-
   powered/coarse-pointer (touch) GPUs it runs on most. Drop it here and trim
   the volumetric light's blur instead of leaving mobile stuck re-computing a
   backdrop blur 60x a second. */
@media (pointer: coarse) {
    .metal-disc {
        backdrop-filter: none;
        background:
            radial-gradient(circle at 42% 32%, rgba(255,236,184,.18), rgba(255,207,107,.05) 31%, rgba(0,0,0,.44) 63%, rgba(0,0,0,.58)),
            conic-gradient(from 180deg, transparent, rgba(246,221,150,.23), transparent, rgba(135,81,22,.25), transparent);
    }

    .minimal-hud { backdrop-filter: none; }
    .volumetric-light { filter: blur(12px); }
}

@media (prefers-reduced-motion: reduce) {
    #loading-screen *, #loading-screen *:before, #loading-screen *:after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }

    /* The rule above kills the swell's transition but not the transform itself, which
       would leave the logo snapping to 1.5x in a single frame - the one thing reduced
       motion is asking us not to do. Drop the swell; the screen still holds and fades. */
    #loading-screen.finishing .crest {
        transform: none !important;
    }
}

#iframe-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 11;

    opacity: 0;
    pointer-events: none;
}

#rotate-message {
    display: none;
    position: fixed;
    inset: 0;
    background: #111;
    color: #fff;
    font-size: 32px;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

#rotate-icon {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
}

@media (orientation: portrait) {
    #rotate-message {
        display: flex;
    }

    #unity-container {
        display: none;
    }
}

/* ✅ iOS home screen toast */
#ios-toast {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 14px;
    padding: 12px 40px 12px 16px;
    border-radius: 10px;
    z-index: 9999;
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#ios-toast.visible {
    display: block;
}

#ios-toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
}

/* ✅ CS-256 iOS reload-loop guard. Fixed above everything (loading screen z-index:1,
   leave-confirm 30, our own buttons 20) since it can replace the boot sequence entirely -
   toggled by js/main.js via the "visible" class, same pattern as #ios-toast/#leave-confirm.
   Palette matches #leave-confirm-panel (gold-on-charcoal) rather than introducing a new one. */
#reload-guard {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;

    align-items: center;
    justify-content: center;

    background: rgba(2, 4, 9, 0.86);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

#reload-guard.visible {
    display: flex;
}

#reload-guard-panel {
    width: min(86vw, 420px);
    padding: 30px 28px 26px;
    border: 1px solid rgba(246, 221, 150, 0.22);
    border-radius: 14px;
    background: rgba(10, 17, 28, 0.98);
    color: #fff;
    text-align: center;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}

#reload-guard-panel h2 {
    margin: 0 0 10px;
    font-size: clamp(19px, 3.2vw, 24px);
    color: var(--gold-soft);
    letter-spacing: 0.02em;
}

#reload-guard-panel p {
    margin: 0 0 14px;
    font-size: clamp(14px, 2.2vw, 16px);
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.86);
}

/* The low-memory hint: visually distinct (smaller, warm tint) from the main
   explanation above it, so it reads as a tip rather than a repeat of the same line. */
#reload-guard-hint {
    margin-bottom: 22px;
    font-size: 12.5px;
    color: rgba(255, 200, 140, 0.78);
}

#reload-guard-retry {
    min-height: 52px;
    width: 100%;
    padding: 0 22px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: clamp(14px, 2.1vw, 16px);
    font-weight: 600;
    color: #050403;
    background: var(--gold-soft);
    cursor: pointer;
}

#reload-guard-retry:active {
    transform: translateY(1px);
}

#reload-guard-retry:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.9);
    outline-offset: 2px;
}
