/* =========================================================================
   Ninja Origins Online — design system
   All styling lives in this file. The site ships a CSP with `style-src 'self'`,
   so inline <style> blocks and style="" attributes are not allowed anywhere.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Tokens
   ---------------------------------------------------------------------- */
:root {
    color-scheme: dark;

    /* Surfaces — sumi ink */
    --ink-900: #060911;
    --ink-850: #090d19;
    --ink-800: #0c1120;
    --ink-750: #111830;
    --ink-700: #16203c;
    --ink-600: #1e2a4c;

    /* Text */
    --text: #eef2ff;
    --text-dim: #b9c3dd;
    --muted: #8d99b8;

    /* Accents — chakra */
    --ember: #ff8a3d;
    --ember-soft: #ffc76b;
    --ember-deep: #d9631d;
    --crimson: #e2453f;
    --jade: #45e0b0;
    --azure: #4fc3f7;

    /* Lines & glass */
    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .16);
    --glass: rgba(12, 17, 32, .72);

    /* Shape */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 999px;

    /* Depth */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-md: 0 18px 40px rgba(0, 0, 0, .45);
    --shadow-lg: 0 36px 90px rgba(0, 0, 0, .55);
    --glow-ember: 0 10px 34px rgba(255, 138, 61, .32);

    /* Rhythm */
    --shell: 1180px;
    --gap: clamp(1rem, 2.5vw, 1.6rem);
    --section-y: clamp(3.5rem, 9vw, 7rem);

    /* Type */
    --font-body: "Kanit", "Leelawadee UI", "Noto Sans Thai", "IBM Plex Sans Thai", "Sarabun",
                 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;

    --ease: cubic-bezier(.22, .61, .36, 1);
}

/* -------------------------------------------------------------------------
   2. Reset & base
   ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    font-size: clamp(1rem, .96rem + .2vw, 1.06rem);
    line-height: 1.7;
    color: var(--text);
    background-color: var(--ink-900);
    overflow-x: hidden;
}

/* Layered atmosphere: chakra glows over a deep ink base. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(58rem 42rem at 78% -8%, rgba(255, 138, 61, .16), transparent 62%),
        radial-gradient(46rem 38rem at 6% 4%, rgba(79, 195, 247, .10), transparent 60%),
        radial-gradient(70rem 50rem at 50% 108%, rgba(226, 69, 63, .10), transparent 64%),
        linear-gradient(180deg, var(--ink-850), var(--ink-900) 46%, #04070d);
}

/* Traditional seigaiha wave texture, dialled far back. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .5;
    background-image: url("../images/pattern-seigaiha.svg");
    background-size: 80px 40px;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
            mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: .35rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

code, kbd, samp {
    font-family: var(--font-mono);
    font-size: .92em;
    color: var(--ember-soft);
}

:focus-visible {
    outline: 2px solid var(--ember-soft);
    outline-offset: 3px;
    border-radius: 4px;
}

::selection { background: rgba(255, 138, 61, .32); color: #fff; }

/* -------------------------------------------------------------------------
   3. Typography
   ---------------------------------------------------------------------- */
h1, h2, h3, h4 {
    margin: 0 0 .6rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.02em;
    text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.7vw, 2.25rem); }
h3 { font-size: clamp(1.15rem, 1rem + .7vw, 1.4rem); }

/* Block-level so it always claims its own line — an inline-flex eyebrow will
   run up alongside a preceding inline element such as .hero-badge. */
.eyebrow {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: .55rem;
    margin: 0 0 .75rem;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--ember-soft);
}

.eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: none;
    background: var(--ember);
    box-shadow: 0 0 12px var(--ember);
    transform: rotate(45deg);
}

.lead {
    max-width: 58ch;
    font-size: clamp(1.05rem, 1rem + .35vw, 1.22rem);
    color: var(--text-dim);
}

.muted { color: var(--muted); }
.tiny { font-size: .85rem; }

/* Gradient headline accent. Falls back to solid ember where unsupported. */
.flare {
    color: var(--ember-soft);
    background: linear-gradient(100deg, var(--ember-soft), var(--ember) 45%, var(--crimson));
    -webkit-background-clip: text;
            background-clip: text;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
    .flare { color: transparent; }
}

/* -------------------------------------------------------------------------
   4. Layout primitives
   ---------------------------------------------------------------------- */
.shell {
    width: min(var(--shell), calc(100% - 2.5rem));
    margin-inline: auto;
}

.narrow { width: min(760px, calc(100% - 2.5rem)); }

.section { padding-block: var(--section-y); }
.section-tight { padding-block: clamp(2.5rem, 6vw, 4rem); }

.section-head {
    max-width: 62ch;
    margin-bottom: clamp(1.8rem, 4vw, 2.8rem);
}

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .8rem;
}

.stack > * + * { margin-top: 1rem; }

/* Hairline divider with a lit centre — used between major sections. */
.rule {
    height: 1px;
    border: 0;
    margin: 0;
    background: linear-gradient(90deg, transparent, var(--line-strong) 20%, rgba(255, 138, 61, .5) 50%, var(--line-strong) 80%, transparent);
}

.skip-link {
    position: fixed;
    top: .75rem;
    left: -999px;
    z-index: 100;
    padding: .75rem 1.1rem;
    border-radius: var(--r-sm);
    background: var(--ember);
    color: #1c1004;
    font-weight: 800;
    text-decoration: none;
}

.skip-link:focus { left: .75rem; }

/* -------------------------------------------------------------------------
   5. Header & navigation
   ---------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    transition: background .3s var(--ease), border-color .3s var(--ease);
}

.site-header.is-stuck {
    background: rgba(6, 9, 17, .92);
    border-bottom-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 76px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -.01em;
}

.brand img {
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 4px 14px rgba(255, 138, 61, .45));
    transition: transform .5s var(--ease);
}

.brand:hover img { transform: rotate(90deg); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 1.02rem; }

.brand-text span {
    font-size: .62rem;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    cursor: pointer;
}

.nav-toggle-bars {
    position: relative;
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: background .2s var(--ease);
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .28s var(--ease);
}

.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

.nav-area {
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.primary-nav a {
    position: relative;
    padding: .55rem .85rem;
    border-radius: var(--r-sm);
    color: var(--text-dim);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s var(--ease), background .2s var(--ease);
}

.primary-nav a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: .18rem;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--ember-soft), var(--crimson));
    transform: translateX(-50%);
    transition: width .28s var(--ease);
}

.primary-nav a:hover,
.primary-nav a:focus-visible { color: var(--text); background: rgba(255, 255, 255, .06); }
.primary-nav a:hover::after { width: 42%; }

.primary-nav a[aria-current="page"] { color: var(--text); }
.primary-nav a[aria-current="page"]::after { width: 42%; }

.nav-actions { display: flex; align-items: center; gap: .6rem; }

/* -------------------------------------------------------------------------
   6. Buttons
   ---------------------------------------------------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 46px;
    padding: .7rem 1.35rem;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .18s var(--ease), box-shadow .25s var(--ease),
                background .25s var(--ease), border-color .25s var(--ease), color .2s var(--ease);
}

.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:active:not(:disabled) { transform: translateY(0); }

.button:disabled,
.button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .5;
    transform: none;
}

.button.primary {
    color: #24140a;
    background: linear-gradient(135deg, var(--ember-soft), var(--ember) 55%, var(--ember-deep));
    box-shadow: var(--glow-ember);
}

.button.primary:hover:not(:disabled) { box-shadow: 0 16px 44px rgba(255, 138, 61, .45); }

.button.secondary {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, .05);
}

.button.secondary:hover:not(:disabled) {
    border-color: rgba(255, 138, 61, .55);
    background: rgba(255, 138, 61, .12);
}

.button.ghost {
    color: var(--text-dim);
    background: transparent;
}

.button.ghost:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .06); }

.button.block { width: 100%; }
.button.small { min-height: 38px; padding: .4rem .9rem; font-size: .9rem; }

/* -------------------------------------------------------------------------
   7. Surfaces — panel, card, notice
   ---------------------------------------------------------------------- */
.panel, .card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: linear-gradient(165deg, rgba(30, 42, 76, .55), rgba(9, 13, 25, .82));
    box-shadow: var(--shadow-md);
}

.panel { padding: clamp(1.3rem, 3vw, 2rem); }

.card {
    padding: clamp(1.3rem, 2.6vw, 1.75rem);
    overflow: hidden;
    transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}

/* Lit hairline across the top edge of every card. */
.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 138, 61, .7), transparent);
    opacity: .55;
    transition: opacity .3s var(--ease);
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 138, 61, .32);
    box-shadow: var(--shadow-lg);
}

.card:hover::before { opacity: 1; }

.card h3 { margin-bottom: .45rem; }
.card p:last-child { margin-bottom: 0; }

.card-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 138, 61, .3);
    border-radius: var(--r-md);
    background: rgba(255, 138, 61, .12);
    font-size: 1.35rem;
    line-height: 1;
}

.notice {
    display: flex;
    gap: .85rem;
    padding: 1rem 1.2rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--r-md);
    background: rgba(12, 17, 32, .7);
}

.notice p:last-child { margin-bottom: 0; }
.notice.safe { border-left-color: var(--jade); background: rgba(69, 224, 176, .08); }
.notice.warning { border-left-color: var(--ember); background: rgba(255, 138, 61, .09); }
.notice.danger { border-left-color: var(--crimson); background: rgba(226, 69, 63, .1); }
.notice.info { border-left-color: var(--azure); background: rgba(79, 195, 247, .08); }
.notice-icon { flex: none; font-size: 1.15rem; line-height: 1.5; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.badge.live { border-color: rgba(69, 224, 176, .45); color: var(--jade); background: rgba(69, 224, 176, .1); }
.badge.soon { border-color: rgba(255, 138, 61, .45); color: var(--ember-soft); background: rgba(255, 138, 61, .1); }

.dot {
    width: .55rem;
    height: .55rem;
    border-radius: var(--r-pill);
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

/* -------------------------------------------------------------------------
   8. Hero
   ---------------------------------------------------------------------- */
.hero {
    position: relative;
    padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5.5rem);
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr);
    gap: clamp(2rem, 5vw, 3.5rem);
    align-items: center;
}

.hero h1 { margin-bottom: 1.1rem; }
.hero .actions { margin-top: 2rem; }

.hero-note {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    margin-top: 2.4rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--line);
    font-size: .9rem;
    color: var(--muted);
}

.hero-note strong { display: block; color: var(--text); font-size: 1.35rem; line-height: 1.2; }

/* Rotating shuriken behind the hero aside. */
.hero-emblem {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 300px;
}

.hero-emblem img {
    width: min(280px, 74%);
    filter: drop-shadow(0 24px 60px rgba(255, 138, 61, .35));
    animation: spin-slow 48s linear infinite;
}

.hero-emblem::before {
    content: "";
    position: absolute;
    width: min(340px, 92%);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 138, 61, .28), transparent 68%);
    animation: pulse-glow 6s ease-in-out infinite;
}

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

@keyframes pulse-glow {
    0%, 100% { opacity: .65; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

/* -------------------------------------------------------------------------
   9. Stats
   ---------------------------------------------------------------------- */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--line);
    overflow: hidden;
}

.stat {
    padding: clamp(1.1rem, 2.4vw, 1.6rem);
    background: rgba(9, 13, 25, .86);
    text-align: center;
}

.stat b {
    display: block;
    font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -.02em;
    background: linear-gradient(120deg, var(--ember-soft), var(--ember));
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.stat span {
    font-size: .82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* -------------------------------------------------------------------------
   10. News list
   ---------------------------------------------------------------------- */
.news-list { display: grid; gap: .75rem; }

.news-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.1rem;
    padding: 1.05rem 1.3rem;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: rgba(9, 13, 25, .6);
    text-decoration: none;
    transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}

.news-item:hover,
.news-item:focus-visible {
    transform: translateX(4px);
    border-color: rgba(255, 138, 61, .35);
    background: rgba(255, 138, 61, .07);
}

.news-date {
    flex: none;
    min-width: 62px;
    padding: .35rem .55rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: .78rem;
    text-align: center;
    color: var(--ember-soft);
}

.news-item h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.news-item p { margin: .15rem 0 0; font-size: .88rem; color: var(--muted); }
.news-arrow { color: var(--muted); transition: transform .25s var(--ease), color .25s var(--ease); }
.news-item:hover .news-arrow { transform: translateX(4px); color: var(--ember); }

/* -------------------------------------------------------------------------
   11. Showcase tiles
   ---------------------------------------------------------------------- */
.showcase { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 230px;
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(165deg, rgba(30, 42, 76, .5), rgba(6, 9, 17, .9));
    transition: transform .3s var(--ease), border-color .3s var(--ease);
}

.tile::before {
    content: "";
    position: absolute;
    inset: auto -30% -45% -30%;
    height: 78%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, var(--tile-accent, var(--ember)), transparent 70%);
    opacity: .3;
    transition: opacity .35s var(--ease), transform .35s var(--ease);
}

.tile:hover { transform: translateY(-6px); border-color: rgba(255, 255, 255, .22); }
.tile:hover::before { opacity: .55; transform: scale(1.12); }

.tile-fire { --tile-accent: #ff6b3d; }
.tile-water { --tile-accent: #4fc3f7; }
.tile-wind { --tile-accent: #45e0b0; }
.tile-earth { --tile-accent: #c9a227; }
.tile-lightning { --tile-accent: #a78bfa; }

.tile-kanji {
    position: absolute;
    top: .6rem;
    right: 1rem;
    z-index: -1;
    font-size: 5.5rem;
    font-weight: 800;
    line-height: 1;
    color: rgba(255, 255, 255, .06);
    user-select: none;
}

.tile h3 { margin-bottom: .3rem; }
.tile p { margin: 0; font-size: .9rem; color: var(--text-dim); }

/* -------------------------------------------------------------------------
   12. Steps
   ---------------------------------------------------------------------- */
.steps { display: grid; gap: 1rem; counter-reset: step; list-style: none; padding: 0; }

.steps li {
    counter-increment: step;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.1rem;
    align-items: start;
    padding: 1.15rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: rgba(9, 13, 25, .6);
    margin: 0;
}

.steps li::before {
    content: counter(step);
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 138, 61, .4);
    border-radius: var(--r-pill);
    background: rgba(255, 138, 61, .12);
    color: var(--ember-soft);
    font-weight: 800;
    font-size: .95rem;
}

.steps h3 { margin: 0 0 .2rem; font-size: 1.02rem; }
.steps p { margin: 0; font-size: .92rem; color: var(--muted); }

/* Definition-style spec table. */
.spec-list { display: grid; gap: 0; margin: 0; }

.spec-row {
    display: grid;
    grid-template-columns: minmax(120px, 30%) 1fr;
    gap: 1rem;
    padding: .8rem 0;
    border-bottom: 1px solid var(--line);
}

.spec-row:last-child { border-bottom: 0; }
.spec-row dt { color: var(--muted); font-size: .9rem; }
.spec-row dd { margin: 0; font-weight: 600; }

/* -------------------------------------------------------------------------
   13. Forms & auth
   ---------------------------------------------------------------------- */
.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
    padding-block: clamp(2.5rem, 7vw, 5rem);
}

.auth-pitch ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }

.auth-pitch li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .75rem;
    margin-bottom: .9rem;
    color: var(--text-dim);
}

.auth-pitch li::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-top: .55rem;
    background: var(--ember);
    box-shadow: 0 0 10px var(--ember);
    transform: rotate(45deg);
}

.auth-card { padding: clamp(1.5rem, 3.5vw, 2.25rem); }
.auth-card h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2rem); }

.form { display: grid; gap: 1.15rem; }

.field { display: grid; gap: .45rem; }

.field > label {
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.field .hint { font-size: .8rem; color: var(--muted); }

.input,
.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: .7rem .9rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: rgba(6, 9, 17, .7);
    color: var(--text);
    font: inherit;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}

.field input::placeholder { color: rgba(141, 153, 184, .7); }

.field input:hover,
.field select:hover { border-color: rgba(255, 255, 255, .26); }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--ember);
    background: rgba(6, 9, 17, .95);
    box-shadow: 0 0 0 3px rgba(255, 138, 61, .2);
}

.field.has-error input { border-color: var(--crimson); }
.field.has-error input:focus { box-shadow: 0 0 0 3px rgba(226, 69, 63, .22); }

.field-error {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .84rem;
    font-weight: 600;
    color: #ff8f8a;
}

/* Password field with a reveal button docked inside. */
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 3.4rem; }

.reveal-toggle {
    position: absolute;
    top: 50%;
    right: .4rem;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 38px;
    padding: 0 .5rem;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
}

.js .reveal-toggle { display: inline-flex; }
.reveal-toggle:hover { color: var(--ember-soft); background: rgba(255, 255, 255, .06); }

.form-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-size: .9rem;
    color: var(--muted);
}

.form-foot a { color: var(--ember-soft); font-weight: 600; }

.checkbox {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .6rem;
    align-items: start;
    font-size: .9rem;
    color: var(--text-dim);
    cursor: pointer;
}

.checkbox input {
    width: 20px;
    height: 20px;
    min-height: 0;
    margin: .25rem 0 0;
    accent-color: var(--ember);
    cursor: pointer;
}

/* -------------------------------------------------------------------------
   14. Footer
   ---------------------------------------------------------------------- */
.site-footer {
    margin-top: auto;
    padding-block: clamp(2.5rem, 6vw, 4rem) 2rem;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, transparent, rgba(6, 9, 17, .85));
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: 2.5rem;
}

.footer-brand p { max-width: 34ch; font-size: .9rem; color: var(--muted); }

.footer-col h4 {
    margin-bottom: .9rem;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
}

.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: .55rem; }

.footer-col a {
    color: var(--text-dim);
    font-size: .92rem;
    text-decoration: none;
    transition: color .2s var(--ease);
}

.footer-col a:hover { color: var(--ember-soft); }

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--line);
    font-size: .85rem;
    color: var(--muted);
}

.footer-bottom p { margin: 0; }

/* -------------------------------------------------------------------------
   15. Error page
   ---------------------------------------------------------------------- */
.error-page {
    display: grid;
    place-items: center;
    text-align: center;
    padding-block: clamp(4rem, 12vw, 8rem);
}

.error-code {
    font-size: clamp(5rem, 18vw, 11rem);
    font-weight: 800;
    line-height: .9;
    letter-spacing: -.05em;
    background: linear-gradient(120deg, var(--ember-soft), var(--crimson));
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

/* -------------------------------------------------------------------------
   16. Scroll reveal (only engages once JS confirms support)
   ---------------------------------------------------------------------- */
.js .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
}

.js .reveal.is-visible { opacity: 1; transform: none; }

/* -------------------------------------------------------------------------
   17. Responsive
   ---------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .grid-4, .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .showcase { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-emblem { order: -1; min-height: 210px; }
    .hero-emblem img { width: min(200px, 55%); }
    .auth-layout { grid-template-columns: minmax(0, 1fr); }
    .auth-pitch { display: none; }
}

@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }

    /* Without JS the menu stays open so the site remains navigable. */
    .js .primary-nav,
    .js .nav-actions {
        display: none;
    }

    .nav-area {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
        padding: 1rem 1.25rem 1.5rem;
        border-bottom: 1px solid var(--line);
        background: rgba(6, 9, 17, .98);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        box-shadow: var(--shadow-md);
    }

    .js .nav-area[data-open="true"] .primary-nav,
    .js .nav-area[data-open="true"] .nav-actions { display: flex; }

    .primary-nav { flex-direction: column; align-items: stretch; }
    .primary-nav a { padding: .8rem 1rem; }
    .primary-nav a::after { display: none; }
    .primary-nav a[aria-current="page"] { background: rgba(255, 138, 61, .12); color: var(--ember-soft); }
    .nav-actions { flex-direction: column; align-items: stretch; padding-top: .5rem; }
    .nav-actions .button { width: 100%; }

    .site-header { position: relative; }
}

@media (max-width: 720px) {
    .grid-2, .grid-3, .grid-4,
    .showcase, .stat-strip { grid-template-columns: minmax(0, 1fr); }

    .footer-grid { grid-template-columns: minmax(0, 1fr); }
    .news-item { grid-template-columns: auto 1fr; }
    .news-arrow { display: none; }
    .spec-row { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
    .actions .button { width: 100%; }
    .hero-note { gap: 1rem 1.8rem; }
}

/* -------------------------------------------------------------------------
   18. Motion & print
   ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }

    .js .reveal { opacity: 1; transform: none; }
    .button:hover, .card:hover, .tile:hover, .news-item:hover { transform: none; }
}

@media (prefers-contrast: more) {
    :root { --line: rgba(255, 255, 255, .28); --line-strong: rgba(255, 255, 255, .45); --muted: #b3bdd6; }
}

@media print {
    body::before, body::after, .site-header, .site-footer, .hero-emblem { display: none; }
    body { background: #fff; color: #000; }
}

/* =========================================================================
   19. Landing page
   Section structure adapted from the reference layout, rebuilt on this
   design system: no inline styles, no CDN icon font, no external stylesheet.
   ========================================================================= */

/* --- Hero extras -------------------------------------------------------- */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.2rem;
    padding: .4rem 1rem;
    border: 1px solid rgba(255, 138, 61, .4);
    border-radius: var(--r-pill);
    background: rgba(255, 138, 61, .12);
    color: var(--ember-soft);
    font-size: .85rem;
    font-weight: 700;
}

.hero-title { display: grid; gap: .1rem; }
.hero-title .line-2 { font-size: 1.16em; }

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 2.4rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--line);
    overflow: hidden;
}

.hero-stat {
    padding: 1rem .75rem;
    background: rgba(9, 13, 25, .86);
    text-align: center;
}

.hero-stat b {
    display: block;
    font-size: clamp(1.1rem, .9rem + .8vw, 1.5rem);
    font-weight: 800;
    line-height: 1.25;
    background: linear-gradient(120deg, var(--ember-soft), var(--ember));
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}

.hero-stat span {
    font-size: .76rem;
    letter-spacing: .05em;
    color: var(--muted);
}

/* --- Download source grid ---------------------------------------------- */
.dl-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap);
}

.dl-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: linear-gradient(165deg, rgba(30, 42, 76, .5), rgba(9, 13, 25, .84));
    color: inherit;
    text-decoration: none;
    transition: transform .28s var(--ease), border-color .28s var(--ease), box-shadow .28s var(--ease);
}

.dl-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 138, 61, .38);
    box-shadow: var(--shadow-lg);
}

.dl-card[aria-disabled="true"] {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.dl-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: .7rem;
    border-radius: var(--r-md);
    font-size: 1.5rem;
    line-height: 1;
    background: linear-gradient(135deg, var(--dl-accent, var(--ember)), rgba(0, 0, 0, .35));
    box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}

.dl-icon--win { --dl-accent: #4fc3f7; }
.dl-icon--mirror { --dl-accent: #a78bfa; }
.dl-icon--spec { --dl-accent: #45e0b0; }
.dl-icon--coin { --dl-accent: #ffc76b; }
.dl-icon--user { --dl-accent: #ff8a3d; }
.dl-icon--status { --dl-accent: #e2453f; }

.dl-card h3 { margin: 0; font-size: 1.05rem; }
.dl-card p { margin: 0; font-size: .88rem; color: var(--muted); }

.dl-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: .18rem .55rem;
    border-radius: var(--r-pill);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.dl-badge--hot { color: #2a0f0c; background: linear-gradient(135deg, #ff8a3d, #e2453f); }
.dl-badge--new { color: #06241a; background: linear-gradient(135deg, #45e0b0, #22a37a); }
.dl-badge--soon { color: var(--muted); border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .05); }

/* --- Feature grid ------------------------------------------------------- */
.feat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }

.feat-card {
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: linear-gradient(165deg, rgba(30, 42, 76, .45), rgba(9, 13, 25, .8));
    transition: transform .28s var(--ease), border-color .28s var(--ease);
}

.feat-card:hover { transform: translateY(-4px); border-color: rgba(255, 138, 61, .3); }

.feat-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 138, 61, .28);
    border-radius: var(--r-md);
    background: rgba(255, 138, 61, .1);
    font-size: 1.6rem;
    line-height: 1;
}

.feat-card h3 { margin-bottom: .4rem; font-size: 1.08rem; }
.feat-card p { margin: 0; font-size: .92rem; color: var(--muted); }

/* --- Game modes --------------------------------------------------------- */
.modes-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }

.mode-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 260px;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(180deg, rgba(30, 42, 76, .35), rgba(6, 9, 17, .92));
    transition: transform .3s var(--ease), border-color .3s var(--ease);
}

/* Art placeholder: a tinted chakra wash instead of a screenshot. Swap the
   ::before for a real <img> once capture art is available. */
.mode-card::before {
    content: "";
    position: absolute;
    inset: 0 0 38% 0;
    z-index: -1;
    background:
        radial-gradient(circle at 50% 30%, var(--mode-accent, var(--ember)), transparent 68%),
        linear-gradient(180deg, rgba(255, 255, 255, .06), transparent);
    opacity: .42;
    transition: opacity .35s var(--ease), transform .35s var(--ease);
}

.mode-card:hover { transform: translateY(-6px); border-color: rgba(255, 255, 255, .22); }
.mode-card:hover::before { opacity: .68; transform: scale(1.06); }

.mode-card--dungeon { --mode-accent: #a78bfa; }
.mode-card--pvp { --mode-accent: #e2453f; }
.mode-card--arena { --mode-accent: #4fc3f7; }
.mode-card--more { --mode-accent: #45e0b0; }

.mode-glyph {
    position: absolute;
    top: 1.1rem;
    left: 1.25rem;
    z-index: -1;
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    color: rgba(255, 255, 255, .1);
    user-select: none;
}

.mode-info { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.mode-info h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.mode-info p { margin: 0; font-size: .85rem; color: var(--muted); }

.mode-arrow {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    color: var(--muted);
    transition: transform .28s var(--ease), color .28s var(--ease), border-color .28s var(--ease);
}

.mode-card:hover .mode-arrow { transform: translateX(4px); color: var(--ember); border-color: rgba(255, 138, 61, .5); }

/* --- News tabs & cards --------------------------------------------------- */
.news-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: 1.6rem;
}

.ntab {
    min-height: 42px;
    padding: .5rem 1.05rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .04);
    color: var(--muted);
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}

.ntab:hover { color: var(--text); border-color: rgba(255, 138, 61, .4); }

.ntab[aria-selected="true"] {
    color: #24140a;
    border-color: transparent;
    background: linear-gradient(135deg, var(--ember-soft), var(--ember));
}

.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }

.news-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: linear-gradient(165deg, rgba(30, 42, 76, .45), rgba(9, 13, 25, .84));
    color: inherit;
    text-decoration: none;
    transition: transform .28s var(--ease), border-color .28s var(--ease);
}

.news-card:hover { transform: translateY(-5px); border-color: rgba(255, 138, 61, .35); }

.news-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(circle at 50% 40%, var(--news-accent, var(--ember)), transparent 70%),
        linear-gradient(160deg, rgba(30, 42, 76, .8), rgba(6, 9, 17, .95));
}

.news-card--news { --news-accent: #ff8a3d; }
.news-card--event { --news-accent: #a855f7; }
.news-card--patch { --news-accent: #10b981; }

.news-tag {
    position: absolute;
    top: .8rem;
    left: .8rem;
    padding: .2rem .6rem;
    border-radius: var(--r-pill);
    background: rgba(6, 9, 17, .8);
    border: 1px solid var(--line-strong);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.news-body { display: flex; flex-direction: column; gap: .35rem; padding: 1.15rem 1.25rem 1.35rem; }

.news-meta {
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--ember-soft);
}

.news-body h3 { margin: 0; font-size: 1.05rem; }
.news-body p { margin: 0; font-size: .89rem; color: var(--muted); }
.news-more { margin-top: .4rem; font-size: .86rem; font-weight: 700; color: var(--ember-soft); }

.news-empty { grid-column: 1 / -1; }

/* --- Community ----------------------------------------------------------- */
.community-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 3rem);
    padding: clamp(1.6rem, 4vw, 2.6rem);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background:
        radial-gradient(40rem 20rem at 100% 0%, rgba(255, 138, 61, .16), transparent 65%),
        linear-gradient(165deg, rgba(30, 42, 76, .55), rgba(9, 13, 25, .88));
}

.community-panel h2 { margin-bottom: .3rem; }
.community-panel p { margin: 0; color: var(--text-dim); }

.com-btns { display: flex; flex-wrap: wrap; gap: .7rem; }

.com-btn {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 48px;
    padding: .7rem 1.2rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--com-accent, rgba(255, 255, 255, .06));
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: transform .2s var(--ease), box-shadow .25s var(--ease), filter .2s var(--ease);
}

.com-btn:hover { transform: translateY(-2px); filter: brightness(1.12); box-shadow: var(--shadow-md); }
.com-btn--fb { --com-accent: linear-gradient(135deg, #1877f2, #0d5bbd); border-color: transparent; }
.com-btn--dc { --com-accent: linear-gradient(135deg, #5865f2, #3d47c4); border-color: transparent; }
.com-btn--grp { --com-accent: linear-gradient(135deg, #ff8a3d, #d9631d); border-color: transparent; color: #24140a; }

/* Placeholder targets until the real community URLs are supplied. */
.com-btn[href="#"], .fsoc[href="#"] { cursor: not-allowed; opacity: .6; }

/* --- Footer socials ------------------------------------------------------ */
.footer-socials { display: flex; gap: .5rem; margin-top: 1rem; }

.fsoc {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    color: var(--muted);
    text-decoration: none;
    transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}

.fsoc:hover { color: var(--ember-soft); border-color: rgba(255, 138, 61, .5); background: rgba(255, 138, 61, .1); }

/* --- Floating download button -------------------------------------------- */
.fab {
    position: fixed;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 52px;
    padding: .8rem 1.4rem;
    border-radius: var(--r-pill);
    color: #24140a;
    font-weight: 800;
    text-decoration: none;
    background: linear-gradient(135deg, var(--ember-soft), var(--ember) 55%, var(--ember-deep));
    box-shadow: 0 14px 40px rgba(255, 138, 61, .45);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), opacity .3s var(--ease);
}

.fab:hover { transform: translateY(-3px); box-shadow: 0 20px 52px rgba(255, 138, 61, .55); }

.js .fab {
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
}

.js .fab.is-shown {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* =========================================================================
   20. Game portal (/home)
   ========================================================================= */
.portal {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: var(--gap);
    padding-block: clamp(1.75rem, 4vw, 2.75rem);
    align-items: start;
}

.portal-side {
    position: sticky;
    top: 96px;
    display: grid;
    gap: .75rem;
}

/* Oversized primary action — the one thing a returning player looks for. */
.start-game {
    position: relative;
    display: grid;
    place-items: center;
    gap: .15rem;
    padding: 1.35rem 1rem;
    border: 1px solid rgba(255, 199, 107, .5);
    border-radius: var(--r-lg);
    overflow: hidden;
    color: #24140a;
    text-align: center;
    text-decoration: none;
    background: linear-gradient(135deg, var(--ember-soft), var(--ember) 52%, var(--ember-deep));
    box-shadow: 0 16px 44px rgba(255, 138, 61, .4);
    transition: transform .22s var(--ease), box-shadow .28s var(--ease);
}

.start-game:hover { transform: translateY(-3px); box-shadow: 0 22px 60px rgba(255, 138, 61, .55); }

.start-game small {
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .24em;
    text-transform: uppercase;
    opacity: .75;
}

.start-game b { font-size: 1.5rem; font-weight: 900; letter-spacing: -.01em; }

/* Sweep highlight across the CTA. */
.start-game::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
    animation: sweep 4.5s var(--ease) infinite;
}

@keyframes sweep {
    0%, 62% { left: -60%; }
    100% { left: 120%; }
}

.side-card {
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: linear-gradient(165deg, rgba(30, 42, 76, .5), rgba(9, 13, 25, .84));
}

.side-card h2 {
    margin-bottom: .8rem;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
}

.side-account { display: grid; gap: .55rem; }

.side-identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .7rem;
    padding-bottom: .8rem;
    margin-bottom: .2rem;
    border-bottom: 1px solid var(--line);
}

.side-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 138, 61, .35);
    border-radius: var(--r-pill);
    background: rgba(255, 138, 61, .12);
    font-size: 1.2rem;
}

.side-identity b { display: block; font-size: .95rem; line-height: 1.3; }
.side-identity span { font-size: .78rem; color: var(--muted); }

.side-menu { display: grid; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.side-menu li { margin: 0; }

.side-menu a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .7rem;
    min-height: 46px;
    padding: .6rem .85rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, .03);
    color: var(--text-dim);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s var(--ease), background .2s var(--ease),
                border-color .2s var(--ease), transform .2s var(--ease);
}

.side-menu a:hover {
    transform: translateX(3px);
    color: var(--text);
    border-color: rgba(255, 138, 61, .38);
    background: rgba(255, 138, 61, .1);
}

.side-menu .chev { color: var(--muted); font-size: .9rem; }

/* --- Server list ---------------------------------------------------------- */
.portal-main { display: grid; gap: var(--gap); }

.server-panel { padding: clamp(1.2rem, 2.6vw, 1.75rem); }

.server-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.server-head h2 { margin: 0; font-size: 1.15rem; }

.server-list { display: grid; gap: .65rem; }

.server-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: .95rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: rgba(9, 13, 25, .6);
    transition: border-color .25s var(--ease), background .25s var(--ease);
}

.server-row:hover { border-color: rgba(255, 138, 61, .32); background: rgba(255, 138, 61, .06); }

.server-row.is-offline { opacity: .55; }

.server-meta { display: grid; gap: .35rem; min-width: 0; }

.server-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
}

.server-status {
    width: .6rem;
    height: .6rem;
    flex: none;
    border-radius: var(--r-pill);
    background: var(--jade);
    box-shadow: 0 0 10px var(--jade);
}

.is-offline .server-status { background: var(--muted); box-shadow: none; }

.tag {
    padding: .12rem .5rem;
    border-radius: var(--r-pill);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.tag--hot { color: #2a0f0c; background: linear-gradient(135deg, #ff8a3d, #e2453f); }
.tag--rec { color: #06241a; background: linear-gradient(135deg, #45e0b0, #22a37a); }
.tag--new { color: #0b1c2e; background: linear-gradient(135deg, #4fc3f7, #2b8fc4); }

/* Population bar. Width is set from a --load custom property in the markup's
   class list, never an inline style, so the CSP stays intact. */
.server-load {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .6rem;
    font-size: .78rem;
    color: var(--muted);
}

.load-track {
    height: 5px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .1);
    overflow: hidden;
}

.load-fill {
    height: 100%;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--jade), var(--ember));
}

.load-0 { width: 0; }
.load-25 { width: 25%; }
.load-50 { width: 50%; }
.load-75 { width: 75%; }
.load-90 { width: 90%; }
.load-100 { width: 100%; background: linear-gradient(90deg, var(--ember), var(--crimson)); }

.server-enter { display: flex; flex-wrap: wrap; gap: .45rem; }

.enter-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 84px;
    padding: .4rem .9rem;
    border: 1px solid rgba(255, 138, 61, .4);
    border-radius: var(--r-sm);
    background: rgba(255, 138, 61, .1);
    color: var(--ember-soft);
    font-size: .88rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}

.enter-link:hover { transform: translateY(-2px); color: #24140a; background: linear-gradient(135deg, var(--ember-soft), var(--ember)); }

.enter-link[aria-disabled="true"] {
    pointer-events: none;
    opacity: .45;
    color: var(--muted);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, .04);
}

.empty-state {
    display: grid;
    place-items: center;
    gap: .5rem;
    padding: clamp(2rem, 6vw, 3.5rem) 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    text-align: center;
    color: var(--muted);
}

.empty-state .empty-glyph { font-size: 2.2rem; opacity: .5; }

/* --- Portal responsive ---------------------------------------------------- */
@media (max-width: 1024px) {
    .dl-grid, .feat-grid, .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .community-panel { grid-template-columns: minmax(0, 1fr); }
    .portal { grid-template-columns: minmax(0, 1fr); }
    .portal-side { position: static; }
}

@media (max-width: 720px) {
    .dl-grid, .feat-grid, .news-grid, .modes-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-row { grid-template-columns: minmax(0, 1fr); }
    .server-enter .enter-link { flex: 1; }
    .com-btns { width: 100%; }
    .com-btn { flex: 1; justify-content: center; }
    .fab span { display: none; }
    .fab { min-width: 52px; padding: .8rem; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .start-game::after { animation: none; display: none; }
    .js .fab { opacity: 1; transform: none; pointer-events: auto; }
}

/* Cloudflare Turnstile widget — iframe กว้างคงที่ ~300px กันล้นบนจอแคบ */
.cf-turnstile { max-width: 100%; overflow: hidden; }
.cf-turnstile iframe { max-width: 100%; }
