/* =====================================================================
   Nely Hub — public site
   =====================================================================
   Everything comes from the logo: a folded chrome ribbon on black.
     - the diagonal: the N's stroke drives the particle drift, the sheen
       sweeps and the card highlights
     - chrome: a brushed silver gradient instead of any brand colour
     - wide type: Archivo stretched to 125% for display, like stamped metal
   ===================================================================== */

/* ---- tokens ---------------------------------------------------------- */
:root {
    --ink:        #07070a;
    --ink-2:      #0b0b0f;
    --panel:      #101015;
    --panel-2:    #15151b;
    --raise:      #1c1c23;
    --line:       rgba(228, 231, 240, .08);
    --line-2:     rgba(228, 231, 240, .15);
    --line-hot:   rgba(228, 231, 240, .32);

    --text:       #f3f4f7;
    --text-2:     #babdc6;
    --text-3:     #838790;
    --text-4:     #5c606a;
    --ok:         #a3d6a6;

    --metal:      linear-gradient(135deg, #ffffff 0%, #d6d8dd 32%, #9a9da4 66%, #e8eaee 100%);
    --metal-soft: linear-gradient(135deg, #eceef2 0%, #a9acb3 100%);
    /* Same stops as NelyLib's mono GradientTitle, so the site wordmark and the
       in-game window title read as one material. Ends match, so it tiles. */
    --metal-word: linear-gradient(100deg,
        #696c76 0%, #ffffff 35%, #e4e7ee 50%, #ffffff 65%, #696c76 100%);

    --f-body:     "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --f-mono:     "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --radius:     16px;
    --radius-lg:  24px;
    --radius-sm:  10px;

    --shell:      1200px;
    --gutter:     28px;

    --ease:       cubic-bezier(.22, .61, .36, 1);
    --ease-out:   cubic-bezier(.16, 1, .3, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --fast:       .2s;
    --slow:       .5s;

    --nav-h:      76px;

    --px: 50%;
    --py: 0%;
    --plight: 0;
}

@property --spin {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* `clip` contains sideways overflow without becoming a scroll container,
       so the sticky navbar keeps working. */
    overflow-x: clip;
    background: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--ink);
    color: var(--text);
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3 { font-weight: 700; }

:focus-visible {
    outline: 2px solid rgba(228, 231, 240, .8);
    outline-offset: 3px;
    border-radius: 6px;
}

::selection { background: rgba(228, 231, 240, .9); color: #07070a; }

.shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
    position: fixed; top: 10px; inset-inline-start: 10px;
    z-index: 300; padding: 10px 16px;
    background: var(--raise); border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    transform: translateY(-160%);
    transition: transform var(--fast) var(--ease);
}
.skip:focus { transform: none; }

/* ---- page background ------------------------------------------------- */
.backdrop {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(1100px 640px at 78% -12%, rgba(228, 231, 240, .07), transparent 60%),
        radial-gradient(800px 600px at -6% 30%, rgba(228, 231, 240, .035), transparent 62%),
        var(--ink);
}
/* Fine diagonal hairlines, cut in the N's angle, fading out down the page. */
.backdrop::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(118deg, transparent 0 118px, rgba(228, 231, 240, .035) 118px 119px);
    mask-image: radial-gradient(1200px 760px at 70% 0%, #000 0%, transparent 72%);
    -webkit-mask-image: radial-gradient(1200px 760px at 70% 0%, #000 0%, transparent 72%);
}
/* Pointer-following light, fine pointers only (driven from app.js). */
.backdrop::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(560px 560px at var(--px) var(--py),
                rgba(228, 231, 240, .06), transparent 68%);
    opacity: var(--plight);
    transition: opacity .5s var(--ease);
}

.field {
    position: fixed; inset: 0; z-index: 1;
    width: 100%; height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.4s var(--ease);
}
.field.is-live { opacity: 1; }

.grain {
    position: fixed; inset: 0; z-index: 2; pointer-events: none;
    opacity: .04; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'>\
<filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter>\
<rect width='140' height='140' filter='url(%23n)'/></svg>");
}

main { position: relative; z-index: 3; }

/* ---- type helpers ------------------------------------------------------ */
.kicker {
    display: inline-flex; align-items: center; gap: 10px;
    margin: 0 0 18px;
    font-family: var(--f-mono);
    font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--text-3);
}
.kicker::before {
    content: "";
    width: 22px; height: 1px;
    background: currentColor;
    opacity: .7;
}

.section-title {
    margin: 0;
    font-size: clamp(38px, 6vw, 76px);
    font-stretch: 125%;
    font-weight: 800;
    line-height: .92;
    letter-spacing: -.035em;
    text-transform: uppercase;
}
.section-note { margin: 14px 0 0; color: var(--text-3); font-size: 15.5px; max-width: 42ch; }

.chrome {
    background: var(--metal-word);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: nely-sheen 6s linear infinite;
}
@keyframes nely-sheen {
    from { background-position: 0% 0; }
    to   { background-position: -200% 0; }
}

/* ---- brand ----------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 11px; }

.brand-mark {
    width: 30px; height: 30px; flex: none;
    object-fit: contain;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .6));
    transition: transform .6s var(--ease-spring);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }

.brand-word {
    font-size: 16px; font-weight: 800; font-stretch: 125%;
    letter-spacing: -.01em; text-transform: uppercase;
    background: var(--metal-word);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    white-space: nowrap;
    animation: nely-sheen 6s linear infinite;
}

/* ---- navbar ---------------------------------------------------------- */
.nav {
    position: sticky; top: 0; z-index: 100;
    height: var(--nav-h);
    display: flex; align-items: center;
    padding-inline: 14px;
}
.nav-inner {
    width: 100%; max-width: calc(var(--shell) - 8px);
    margin-inline: auto;
    height: 56px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding-inline: 18px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: background var(--slow) var(--ease), border-color var(--slow) var(--ease),
                box-shadow var(--slow) var(--ease), max-width var(--slow) var(--ease-out);
}
.nav.is-stuck .nav-inner {
    max-width: 860px;
    background: rgba(13, 13, 17, .72);
    border-color: var(--line-2);
    box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
    position: relative;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px; color: var(--text-3);
    transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.nav-link:hover { color: var(--text); background: rgba(228, 231, 240, .06); }
.nav-link.is-active { color: var(--text); }
.nav-link.is-active::after {
    content: "";
    position: absolute; left: 50%; bottom: 3px;
    width: 4px; height: 4px; margin-left: -2px;
    border-radius: 50%;
    background: var(--text);
    box-shadow: 0 0 8px rgba(255, 255, 255, .8);
}
.nav-sep { width: 1px; height: 18px; background: var(--line-2); margin-inline: 8px; }

/* ---- buttons ----------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 50px; padding: 0 24px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: rgba(20, 20, 26, .6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 15px; font-weight: 600;
    color: var(--text);
    overflow: hidden;
    isolation: isolate;
    transition: transform .35s var(--ease-spring), border-color var(--fast) var(--ease),
                background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--line-hot); background: var(--raise); }
.btn:active { transform: translateY(0) scale(.98); }

.btn-primary {
    color: #0a0a0d;
    border-color: transparent;
    background: var(--metal);
    box-shadow: 0 10px 30px -12px rgba(228, 231, 240, .5), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.btn-primary:hover {
    background: var(--metal);
    box-shadow: 0 14px 40px -12px rgba(228, 231, 240, .65), inset 0 1px 0 #fff;
}
/* Sheen sweep on hover, at the N's angle. */
.btn-primary::after {
    content: "";
    position: absolute; top: -60%; left: -80%;
    width: 50%; height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
    transform: rotate(28deg);
    transition: left .7s var(--ease-out);
    z-index: -1;
    pointer-events: none;
}
.btn-primary:hover::after { left: 140%; }

.btn-icon { width: 18px; height: 18px; flex: none; transition: transform .35s var(--ease-spring); }
.btn:hover .btn-icon.arrow { transform: translateX(3px); }
.rtl .btn-icon.arrow { transform: scaleX(-1); }
.rtl .btn:hover .btn-icon.arrow { transform: scaleX(-1) translateX(3px); }

.text-link {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--text-2);
    padding-bottom: 3px;
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
    transition: color var(--fast) var(--ease), background-size .45s var(--ease-out);
}
.text-link:hover { color: var(--text); background-size: 100% 1px; }
.text-link svg { width: 15px; height: 15px; transition: transform var(--fast) var(--ease); }
.text-link:hover svg { transform: translateX(3px); }
.rtl .text-link svg { transform: scaleX(-1); }
.rtl .text-link:hover svg { transform: scaleX(-1) translateX(3px); }

/* ---- hero ------------------------------------------------------------ */
.hero {
    position: relative;
    min-height: calc(100svh - var(--nav-h));
    display: grid; align-items: center;
    padding: 24px 0 96px;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    align-items: center;
    gap: clamp(20px, 4vw, 60px);
}

.wordmark {
    margin: 0;
    font-size: clamp(66px, 11.5vw, 172px);
    font-weight: 900;
    font-stretch: 125%;
    line-height: .84;
    letter-spacing: -.045em;
    text-transform: uppercase;
}
.w-line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.w-line > span {
    display: inline-block;
    background: var(--metal-word);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: w-rise 1.1s var(--ease-out) both, nely-sheen 6s linear infinite;
    animation-delay: calc(var(--i, 0) * 110ms + 120ms), 0s;
}
.w-line + .w-line > span { padding-inline-start: .55em; }
@keyframes w-rise {
    from { transform: translateY(105%) skewY(6deg); }
    to   { transform: none; }
}

.hero-tagline {
    margin: 28px 0 0;
    font-size: clamp(18px, 2vw, 22px);
    color: var(--text-2);
    max-width: 30ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.hero-in {
    animation: fade-up .9s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 110ms + 200ms);
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

/* The particle N. The <img> is the no-JS / failure fallback underneath. */
.hero-art { position: relative; display: grid; place-items: center; }
.mark {
    position: relative;
    width: min(100%, 540px);
    aspect-ratio: 1;
    cursor: crosshair;
    -webkit-tap-highlight-color: transparent;
}
.mark img {
    position: absolute; inset: 13%;
    width: 74%; height: 74%;
    object-fit: contain;
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .7));
    transition: opacity .6s var(--ease);
}
.mark.is-live img { opacity: 0; }
.mark-canvas { position: absolute; inset: 0; display: block; }

/* Instrument rings behind the mark. */
.mark-ring {
    position: absolute; inset: 4%;
    border-radius: 50%;
    border: 1px solid var(--line);
    pointer-events: none;
}
.mark-ring::before {
    content: "";
    position: absolute; inset: -1px;
    border-radius: 50%;
    padding: 1px;
    background: conic-gradient(from var(--spin), transparent 0 70%, rgba(228, 231, 240, .55) 88%, transparent 100%);
    -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);
    animation: spin 9s linear infinite;
}
.mark-ring--2 { inset: 17%; border-style: dashed; border-color: rgba(228, 231, 240, .07); }
.mark-ring--2::before { animation-duration: 14s; animation-direction: reverse; }
@keyframes spin { to { --spin: 360deg; } }

.mark-glow {
    position: absolute; inset: 22%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(228, 231, 240, .10), transparent);
    filter: blur(20px);
    pointer-events: none;
}

.scroll-cue {
    position: absolute; left: 50%; bottom: 26px;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    font-family: var(--f-mono);
    font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
    color: var(--text-4);
    transition: color var(--fast) var(--ease);
}
.scroll-cue:hover { color: var(--text-2); }
.scroll-line {
    position: relative;
    width: 1px; height: 46px;
    background: var(--line-2);
    overflow: hidden;
}
.scroll-line::after {
    content: "";
    position: absolute; left: 0; top: -40%;
    width: 1px; height: 40%;
    background: var(--text);
    animation: drip 2.2s var(--ease) infinite;
}
@keyframes drip { to { top: 100%; } }

/* ---- sections ---------------------------------------------------------- */
.section { position: relative; padding: clamp(70px, 12vh, 130px) 0; }

.section-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; margin-bottom: 40px;
}

/* ---- loader ----------------------------------------------------------- */
.loader-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: clamp(32px, 5vw, 80px);
    align-items: center;
}

.steps { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 2px; }
.step {
    position: relative;
    display: grid; grid-template-columns: 44px 1fr; align-items: baseline;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    font-size: 16.5px; color: var(--text-2);
    transition: color var(--fast) var(--ease), padding var(--slow) var(--ease-out);
}
.step:last-child { border-bottom: 1px solid var(--line); }
.step:hover { color: var(--text); padding-inline-start: 8px; }
.step-n { font-family: var(--f-mono); font-size: 12px; color: var(--text-4); letter-spacing: .08em; }
.loader-missing { margin-top: 24px; }

.loader-card {
    position: relative;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(22, 22, 28, .92), rgba(12, 12, 16, .92));
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .05);
    isolation: isolate;
}
/* Rotating chrome edge. */
.loader-card::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--spin),
        rgba(228, 231, 240, .12) 0%, rgba(228, 231, 240, .12) 55%,
        rgba(255, 255, 255, .75) 70%, rgba(228, 231, 240, .12) 85%);
    -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);
    animation: spin 6s linear infinite;
    pointer-events: none;
}
.loader-card::after {
    content: "";
    position: absolute; inset: 20% 10% -10%;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(228, 231, 240, .08), transparent);
    filter: blur(30px);
}

.loader-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.loader-bar img { width: 18px; height: 18px; opacity: .9; }
.loader-file { font-family: var(--f-mono); font-size: 13px; color: var(--text-2); }
.loader-lang {
    padding: 3px 9px; border-radius: 999px;
    border: 1px solid var(--line-2);
    font-family: var(--f-mono); font-size: 11px; color: var(--text-3);
}

.loader-body {
    display: flex; align-items: center; gap: 16px;
    padding: 30px 22px 30px 0;
}
.rtl .loader-body { padding: 30px 0 30px 22px; }
.loader-gutter {
    flex: none; width: 46px;
    text-align: center;
    font-family: var(--f-mono); font-size: 13px; color: var(--text-4);
    border-inline-end: 1px solid var(--line);
    align-self: stretch; display: grid; place-items: center;
}
.loader-code {
    flex: 1; min-width: 0; margin: 0;
    font-family: var(--f-mono);
    font-size: 14px; line-height: 1.7;
    white-space: pre-wrap; word-break: break-all;
    direction: ltr; text-align: left;
    scrollbar-width: thin; scrollbar-color: #2a2a32 transparent;
}
.loader-code::-webkit-scrollbar { height: 6px; }
.loader-code::-webkit-scrollbar-thumb { background: #2a2a32; border-radius: 3px; }
.tok-fn    { color: #eceef2; }
.tok-str   { color: var(--ok); }
.tok-punct { color: #70747d; }

.copy-btn {
    flex: none;
    margin-inline-start: auto;
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: rgba(228, 231, 240, .04);
    font-size: 13.5px; font-weight: 600; color: var(--text-2);
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease),
                background var(--fast) var(--ease), transform .35s var(--ease-spring);
}
.copy-btn:hover { color: #0a0a0d; background: var(--metal); border-color: transparent; transform: translateY(-1px); }
.copy-btn:active { transform: scale(.96); }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn.is-copied { color: #0a0a0d; background: var(--ok); border-color: transparent; }

/* ---- games grid -------------------------------------------------------- */
.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.card {
    --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
    position: relative;
    display: flex; flex-direction: column;
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(21, 21, 27, .9), rgba(13, 13, 17, .9));
    border: 1px solid var(--line);
    overflow: hidden;
    transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: transform .5s var(--ease-out), border-color var(--fast) var(--ease),
                box-shadow var(--slow) var(--ease);
}
.card.is-tilting { transition: transform .16s var(--ease-out), border-color var(--fast) var(--ease), box-shadow var(--slow) var(--ease); }
.card:hover {
    border-color: var(--line-hot);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(228, 231, 240, .04);
}
/* Light that follows the pointer across the card. */
.card::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 255, 255, .09), transparent 45%);
    opacity: 0;
    transition: opacity .35s var(--ease);
    pointer-events: none;
    z-index: 2;
}
.card:hover::after { opacity: 1; }

.card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(140deg, #141418, #0d0d10);
    overflow: hidden;
}
.card-media::before { z-index: 1; }
.card-media img {
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.03);
    transition: opacity .5s var(--ease), transform .8s var(--ease-out), filter .5s var(--ease);
    filter: saturate(.85);
}
.card-media img.is-loaded { opacity: 1; }
.card:hover .card-media img { transform: scale(1.08); filter: saturate(1.05); }
/* Fade the art into the card body. */
.card-media:not(.is-fallback)::after {
    content: "";
    position: absolute; inset: auto 0 0 0; height: 45%;
    background: linear-gradient(transparent, rgba(13, 13, 17, .85));
    pointer-events: none;
}

/* Fallback tile: the real Nely mark on a quiet diagonal, never a broken image.
   --fb-* are set per card from the game name so tiles don't all match. */
.card-media.is-fallback {
    display: grid; place-items: center;
    background:
        linear-gradient(var(--fb-angle, 124deg), rgba(228, 231, 240, .06), transparent 46%),
        linear-gradient(150deg, #17171c, #0d0d10);
}
/* The image keeps a layout box while it loads (display:none would stop a lazy
   image ever fetching); absolute keeps it out of the centred grid. */
.card-media.is-fallback img { position: absolute; inset: 0; opacity: 0; }
.card-media.is-fallback::before {
    content: "";
    position: absolute; inset: 0;
    background-image: linear-gradient(var(--fb-angle, 124deg),
        transparent 49.6%, rgba(228, 231, 240, .05) 50%, transparent 50.4%);
    background-size: var(--fb-size, 90px) 100%;
    background-position: var(--fb-shift, 0) 0;
}
.card-media.is-fallback::after {
    content: "";
    position: relative;
    width: 48px; height: 48px;
    background: url("../assets/logo.png") center / contain no-repeat;
    opacity: .4;
    transition: transform .6s var(--ease-spring), opacity var(--fast);
}
.card:hover .card-media.is-fallback::after { transform: scale(1.12) rotate(-6deg); opacity: .7; }

.card-body {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px 18px;
}
.card-title {
    margin: 0;
    font-size: 16.5px; font-weight: 700; font-stretch: 110%;
    letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin: 6px 0 0;
    font-size: 12.5px; color: var(--text-3);
}
.card-views { display: inline-flex; gap: 6px; font-family: var(--f-mono); font-size: 11.5px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--f-mono); font-size: 11px;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-2);
}
.chip i {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px rgba(163, 214, 166, .7);
}
.card-go {
    flex: none;
    margin-inline-start: auto;
    display: grid; place-items: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    color: var(--text-3);
    transition: color var(--fast) var(--ease), background var(--fast) var(--ease),
                border-color var(--fast) var(--ease), transform .45s var(--ease-spring);
}
.card:hover .card-go {
    color: #0a0a0d; background: var(--metal); border-color: transparent;
    transform: rotate(-45deg);
}
.rtl .card:hover .card-go { transform: rotate(45deg); }
.rtl .card-go svg { transform: scaleX(-1); }
.card-go svg { width: 15px; height: 15px; }

/* ---- discord call to action ------------------------------------------- */
.cta {
    position: relative;
    overflow: hidden;
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: end; gap: 30px;
    padding: clamp(36px, 6vw, 72px);
    border-radius: 28px;
    border: 1px solid var(--line-2);
    background:
        radial-gradient(700px 400px at 100% 0%, rgba(228, 231, 240, .09), transparent 60%),
        linear-gradient(160deg, rgba(22, 22, 28, .9), rgba(9, 9, 12, .9));
    isolation: isolate;
}
.cta::before {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    background-image:
        repeating-linear-gradient(118deg, transparent 0 22px, rgba(228, 231, 240, .03) 22px 23px);
    mask-image: linear-gradient(90deg, transparent 30%, #000);
    -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000);
}
.cta-glyph {
    position: absolute; z-index: -1;
    inset-inline-end: -40px; top: -50px;
    width: 340px; height: 340px;
    color: rgba(228, 231, 240, .05);
    transform: rotate(-12deg);
    transition: transform 1.2s var(--ease-out), color .6s var(--ease);
}
.cta:hover .cta-glyph { transform: rotate(-4deg) scale(1.05); color: rgba(228, 231, 240, .08); }
.cta-title {
    margin: 0;
    font-size: clamp(36px, 6.4vw, 84px);
    font-weight: 900; font-stretch: 125%;
    line-height: .9; letter-spacing: -.04em;
    text-transform: uppercase;
}
.cta-note { margin: 18px 0 0; color: var(--text-2); font-size: 16.5px; max-width: 44ch; }

/* ---- games page --------------------------------------------------------- */
.page-head {
    position: relative;
    padding: clamp(40px, 8vh, 90px) 0 36px;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
}
.page-head h1 {
    margin: 0;
    font-size: clamp(64px, 12vw, 160px);
    font-weight: 900; font-stretch: 125%;
    line-height: .84; letter-spacing: -.05em;
    text-transform: uppercase;
}
.page-head p { margin: 18px 0 0; color: var(--text-3); font-size: 16px; }
.page-count {
    font-family: var(--f-mono);
    font-size: clamp(42px, 7vw, 92px);
    line-height: .8;
    color: transparent;
    -webkit-text-stroke: 1px rgba(228, 231, 240, .35);
    font-variant-numeric: tabular-nums;
}

.controls {
    position: sticky; top: calc(var(--nav-h) - 4px); z-index: 50;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 28px;
    padding: 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(11, 11, 14, .78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.search { position: relative; flex: 1; min-width: 220px; }
.search svg {
    position: absolute; top: 50%; inset-inline-start: 16px;
    width: 17px; height: 17px; transform: translateY(-50%);
    color: var(--text-4); pointer-events: none;
    transition: color var(--fast) var(--ease);
}
.search:focus-within svg { color: var(--text); }
.search input {
    width: 100%; height: 44px;
    padding: 0 44px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(228, 231, 240, .04);
    font-size: 15px;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.search input::placeholder { color: var(--text-4); }
.search input:focus { border-color: var(--line-hot); background: rgba(228, 231, 240, .07); outline: none; }
.search input::-webkit-search-cancel-button { display: none; }

.search-clear {
    position: absolute; top: 50%; inset-inline-end: 8px;
    width: 30px; height: 30px; margin-top: -15px;
    display: none; place-items: center;
    border-radius: 50%; color: var(--text-3);
}
.search-clear.is-shown { display: grid; }
.search-clear:hover { color: var(--text); background: rgba(228, 231, 240, .08); }
.search-clear svg { width: 13px; height: 13px; }

.result-count { font-family: var(--f-mono); font-size: 12px; color: var(--text-4); white-space: nowrap; padding-inline: 10px 14px; }

.empty { padding: 70px 0; text-align: center; }
.empty img { margin: 0 auto; opacity: .3; width: 52px; height: 52px; }
.empty p { margin: 16px 0 0; font-size: 16px; }
.empty .empty-hint { margin-top: 4px; font-size: 14px; color: var(--text-4); }

/* ---- dropdown ---------------------------------------------------------- */
.dd { position: relative; }
.dd-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 44px; padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 13.5px; color: var(--text-2);
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.nav .dd-btn { height: 38px; padding: 0 13px; }
.dd-btn:hover { color: var(--text); border-color: var(--line-2); background: rgba(228, 231, 240, .04); }
.dd-btn .caret { width: 12px; height: 12px; transition: transform var(--fast) var(--ease); }
.dd-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.dd-btn .globe { width: 15px; height: 15px; }

.dd-menu {
    position: absolute; top: calc(100% + 10px); inset-inline-end: 0;
    min-width: 180px; padding: 6px;
    border-radius: 16px;
    border: 1px solid var(--line-2);
    background: rgba(17, 17, 22, .96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .85);
    opacity: 0; visibility: hidden;
    transform: translateY(-6px) scale(.97);
    transform-origin: top right;
    transition: opacity var(--fast) var(--ease), transform .3s var(--ease-out), visibility var(--fast);
    z-index: 120;
}
.rtl .dd-menu { transform-origin: top left; }
.dd.is-open .dd-menu { opacity: 1; visibility: visible; transform: none; }

.dd-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px;
    border-radius: 10px;
    font-size: 13.5px; color: var(--text-3);
    text-align: start;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.dd-item:hover, .dd-item:focus-visible { background: rgba(228, 231, 240, .07); color: var(--text); outline: none; }
.dd-item[aria-selected="true"] { color: var(--text); }
.dd-item[aria-selected="true"]::after {
    content: ""; margin-inline-start: auto;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text);
}
.dd-code { font-family: var(--f-mono); font-size: 11px; color: var(--text-4); width: 20px; }

/* ---- mobile nav -------------------------------------------------------- */
.burger {
    display: none; place-items: center; align-content: center;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    color: var(--text-2);
}
.burger:hover { color: var(--text); border-color: var(--line-hot); }
.burger span {
    display: block; width: 16px; height: 1.5px;
    background: currentColor; border-radius: 2px;
    transition: transform .3s var(--ease-out), opacity var(--fast);
}
.burger span + span { margin-top: 4px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.scrim {
    position: fixed; inset: 0; z-index: 140;
    background: rgba(3, 3, 5, .6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden;
    transition: opacity .3s var(--ease), visibility .3s;
}
.scrim.is-open { opacity: 1; visibility: visible; }

.sheet {
    position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 150;
    width: min(340px, 88vw);
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 16, .98);
    border-inline-start: 1px solid var(--line-2);
    transform: translateX(100%);
    transition: transform .45s var(--ease-out);
    overflow-y: auto;
}
.rtl .sheet { transform: translateX(-100%); }
.sheet.is-open, .rtl .sheet.is-open { transform: none; }

.sheet-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; padding-inline: 6px; }
.sheet-close {
    display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--line-2); color: var(--text-3);
}
.sheet-close:hover { color: var(--text); border-color: var(--line-hot); }
.sheet-close svg { width: 15px; height: 15px; }

.sheet-link {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 12px;
    border-radius: 14px;
    font-size: 22px; font-weight: 800; font-stretch: 120%;
    text-transform: uppercase; letter-spacing: -.02em;
    color: var(--text-3);
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform .4s var(--ease-out);
}
.sheet.is-open .sheet-link { animation: sheet-in .5s var(--ease-out) both; }
.sheet.is-open .sheet-link:nth-of-type(2) { animation-delay: .05s; }
.sheet.is-open .sheet-link:nth-of-type(3) { animation-delay: .1s; }
@keyframes sheet-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.sheet-link:hover, .sheet-link.is-active { background: rgba(228, 231, 240, .06); color: var(--text); }
.sheet-link svg { width: 20px; height: 20px; flex: none; color: var(--text-4); }

.sheet-label {
    margin: 26px 0 8px; padding-inline: 12px;
    font-family: var(--f-mono);
    font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--text-4);
}
.sheet-langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sheet-lang {
    padding: 10px 6px; border-radius: 999px;
    border: 1px solid var(--line);
    font-family: var(--f-mono); font-size: 12px; color: var(--text-3);
    text-align: center;
}
.sheet-lang:hover { color: var(--text); border-color: var(--line-2); }
.sheet-lang[aria-selected="true"] { color: #0a0a0d; background: var(--metal-soft); border-color: transparent; }

/* ---- footer ---------------------------------------------------------- */
.footer {
    position: relative; z-index: 3;
    margin-top: clamp(40px, 8vh, 90px);
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(9, 9, 12, .6), rgba(5, 5, 7, .95));
    overflow: hidden;
}
.footer-inner {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 34px; flex-wrap: wrap;
    padding-block: 48px 30px;
}
.footer-brand { max-width: 320px; }
.footer-brand p { margin: 14px 0 0; font-size: 14px; color: var(--text-3); line-height: 1.7; }

.footer-col h3 {
    margin: 0 0 14px;
    font-family: var(--f-mono);
    font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--text-4); font-weight: 500;
}
.footer-col a {
    display: block; padding: 5px 0;
    font-size: 14.5px; color: var(--text-2);
    transition: color var(--fast) var(--ease), transform .35s var(--ease-out);
}
.footer-col a:hover { color: var(--text); transform: translateX(4px); }
.rtl .footer-col a:hover { transform: translateX(-4px); }

/* Oversized wordmark cut off by the bottom of the page. */
.footer-word {
    display: block;
    margin: 0 0 -.18em;
    font-size: clamp(52px, 15vw, 230px);   /* the word is ~6.1em wide */
    font-weight: 900; font-stretch: 125%;
    line-height: 1; letter-spacing: -.06em;
    text-transform: uppercase; text-align: center;
    white-space: nowrap;
    color: transparent;
    background: linear-gradient(180deg, rgba(228, 231, 240, .16), rgba(228, 231, 240, 0) 85%);
    -webkit-background-clip: text; background-clip: text;
    user-select: none;
    direction: ltr;
}

.footer-bottom {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
    padding-block: 18px 22px;
    border-top: 1px solid var(--line);
    font-family: var(--f-mono);
    font-size: 12px; color: var(--text-4);
}

/* ---- reveal ---------------------------------------------------------- */
/* Visible by default; hidden only once app.js has installed the observer
   that reveals them again (.reveals-armed), so a broken script can never
   leave the page blank. */
.reveal { opacity: 1; transform: none; }
.reveals-armed .reveal {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(6px);
}
.reveals-armed .reveal.is-in {
    opacity: 1; transform: none; filter: none;
    transition: opacity .8s var(--ease-out), transform .9s var(--ease-out), filter .8s var(--ease-out);
}
/* Cards keep their tilt transform once revealed. */
.reveals-armed .card.reveal.is-in {
    transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
    transition: opacity .8s var(--ease-out), transform .9s var(--ease-out), filter .8s var(--ease-out),
                border-color var(--fast) var(--ease), box-shadow var(--slow) var(--ease);
}
.reveals-armed .card.reveal.is-in.is-tilting {
    transition: transform .16s var(--ease-out), border-color var(--fast) var(--ease), box-shadow var(--slow) var(--ease);
}
.reveals-armed .card.reveal.is-in.is-settled {
    transition: transform .5s var(--ease-out), border-color var(--fast) var(--ease), box-shadow var(--slow) var(--ease);
}

/* ---- custom cursor (fine pointers only) ------------------------------ */
.cursor-dot, .cursor-ring {
    position: fixed; top: 0; left: 0; z-index: 400;
    pointer-events: none;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .25s var(--ease);
}
.cursor-dot {
    width: 6px; height: 6px;
    background: #fff;
    margin: -3px 0 0 -3px;
    mix-blend-mode: difference;
}
.cursor-ring {
    width: 34px; height: 34px;
    border: 1px solid rgba(228, 231, 240, .4);
    margin: -17px 0 0 -17px;
    transition: opacity .25s var(--ease), width .3s var(--ease-out),
                height .3s var(--ease-out), margin .3s var(--ease-out),
                border-color .25s var(--ease), background .25s var(--ease);
}
body.cursor-on .cursor-dot, body.cursor-on .cursor-ring { opacity: 1; }
body.cursor-on.cursor-hot .cursor-ring {
    width: 56px; height: 56px; margin: -28px 0 0 -28px;
    border-color: rgba(228, 231, 240, .7);
    background: rgba(228, 231, 240, .05);
}
body.cursor-on, body.cursor-on a, body.cursor-on button,
body.cursor-on input, body.cursor-on select, body.cursor-on .mark { cursor: none; }

/* ---- 404 -------------------------------------------------------------- */
.nf {
    position: relative; z-index: 3;
    min-height: 100svh;
    display: grid; align-content: center; justify-items: center;
    text-align: center;
    padding: 40px 20px;
}
.nf .mark { width: min(62vw, 280px); }
.nf-code {
    margin: 6px 0 0;
    font-size: clamp(90px, 20vw, 200px);
    font-weight: 900; font-stretch: 125%;
    line-height: .85; letter-spacing: -.06em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(228, 231, 240, .4);
}
.nf-title {
    margin: 18px 0 0;
    font-size: clamp(22px, 4vw, 32px); font-weight: 800; font-stretch: 120%;
    letter-spacing: -.02em; text-transform: uppercase;
}
.nf-note { margin: 10px 0 0; color: var(--text-3); font-size: 15px; }
.nf-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 30px; }

/* ---- arabic ----------------------------------------------------------- */
/* Tracking breaks Arabic letter joining, and the mono face has no Arabic. */
.rtl .kicker, .rtl .sheet-label, .rtl .footer-col h3, .rtl .chip,
.rtl .scroll-cue, .rtl .section-title, .rtl .cta-title, .rtl .page-head h1,
.rtl .sheet-link, .rtl .nf-title, .rtl .result-count {
    letter-spacing: 0;
    font-family: var(--f-body);
}
.rtl .wordmark { text-align: right; }

/* ---- responsive ------------------------------------------------------ */
@media (max-width: 1080px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    :root { --gutter: 20px; --nav-h: 68px; }
    .nav { padding-inline: 10px; }
    .nav-inner { padding-inline: 14px 8px; }
    .nav.is-stuck .nav-inner { max-width: 100%; }
    .nav-links, .nav-sep { display: none; }
    .burger { display: grid; }

    .hero { min-height: auto; padding: 10px 0 110px; }
    .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .hero-art { order: -1; margin-bottom: 18px; }
    .mark { width: min(72vw, 380px); }
    .hero-copy { text-align: start; }

    .loader-grid { grid-template-columns: minmax(0, 1fr); }
    .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
    .cta { grid-template-columns: minmax(0, 1fr); align-items: start; }
    .page-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
    .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .wordmark { font-size: 21vw; }
    .w-line + .w-line > span { padding-inline-start: .3em; }
    .loader-body { padding: 20px 18px; }
    .rtl .loader-body { padding: 20px 18px; }
    .loader-gutter { display: none; }
    .loader-code { font-size: 13px; }
    .controls { border-radius: 22px; padding: 8px; gap: 8px; }
    .search { min-width: 100%; }
    .controls .dd { flex: 1; }
    .controls .dd-btn { width: 100%; justify-content: center; }
    .cta .btn { width: 100%; }
    .footer-inner { flex-direction: column; }
    .scroll-cue { display: none; }
}

@media (max-width: 380px) {
    .brand-word { font-size: 14px; }
    .sheet-langs { grid-template-columns: repeat(2, 1fr); }
}

/* Touch / coarse pointers never get the cursor or the pointer light. */
@media (hover: none), (pointer: coarse) {
    .cursor-dot, .cursor-ring { display: none; }
    .backdrop::after { display: none; }
    body.cursor-on, body.cursor-on a, body.cursor-on button { cursor: auto; }
}

/* ---- reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .reveals-armed .reveal { opacity: 1; transform: none; filter: none; }
    .backdrop::after, .card::after, .btn-primary::after { display: none; }
    .card { transform: none !important; }
}
