/* ════════════════════════════════════════════════════════════════
   XProjects v2 — "Chameleon Arcade"
   A skin layered over the v1 brutalist markup. Loaded only when the
   skin resolves to v2 (config/site.php), and every rule is scoped to
   html.skin-v2, so removing the class restores v1 exactly.

   Rules of the skin
   - Same palette: ink, paper, electric blue, mist cyan, one yellow.
   - Pixel type (Press Start 2P) only for short labels / HUD / scores;
     body copy and headlines stay Be Vietnam Pro + IBM Plex.
   - No curves: brutalist hard edges become pixel edges.
   - Motion moves in steps(), like sprites, and stops under
     prefers-reduced-motion.
   - The chameleon tint (--v2-tint) is set by skin.js from the section
     in view; everything that "adapts" reads that one variable.
   ════════════════════════════════════════════════════════════════ */

html.skin-v2 {
    --v2-px:    'Press Start 2P', 'Cairo', ui-monospace, monospace;
    --v2-term:  'VT323', 'JetBrains Mono', ui-monospace, monospace;
    --v2-blue:  #0066ff;
    --v2-deep:  #0050cb;
    --v2-mist:  #bce9fd;
    --v2-sky:   #b3c5ff;
    --v2-yellow:#FFB800;
    --v2-teal:  #386475;
    --v2-tint:  #0066ff;
    --v2-step:  3px;                 /* one "pixel" of the pixel border */
}

/* ── 1. Pixel type helpers ─────────────────────────────────────── */
html.skin-v2 .v2-px,
html.skin-v2 .v2-kicker {
    font-family: var(--v2-px);
    font-size: 10px;
    line-height: 1.7;
    letter-spacing: .02em;
    text-transform: uppercase;
    font-style: normal;
    -webkit-font-smoothing: none;
}
/* Arabic: the pixel face has no Arabic glyphs; Cairo bold carries it. */
html.skin-v2[lang="ar"] .v2-px,
html.skin-v2[lang="ar"] .v2-kicker { font-family: 'Cairo', system-ui, sans-serif; font-size: 13px; font-weight: 800; letter-spacing: 0; }

/* Section kicker: ▶ LABEL with a blinking menu cursor */
html.skin-v2 .v2-kicker {
    display: inline-flex; align-items: center; gap: 10px;
    color: inherit;
}
html.skin-v2 .v2-kicker::before {
    content: ""; flex: none;
    width: 0; height: 0;
    border-block: 5px solid transparent;
    border-inline-start: 7px solid currentColor;
    animation: v2-blink 1s steps(1, end) infinite;
}
html.skin-v2 .v2-kicker--center { justify-content: center; }

@keyframes v2-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ── 2. No curves ──────────────────────────────────────────────── */
html.skin-v2 body .rounded,
html.skin-v2 body .rounded-md,
html.skin-v2 body .rounded-lg,
html.skin-v2 body .rounded-xl,
html.skin-v2 body .rounded-2xl,
html.skin-v2 body .rounded-full,
html.skin-v2 .hero-chip,
html.skin-v2 .xp-footer .ft-sub,
html.skin-v2 .xp-footer .ft-sub__btn,
html.skin-v2 .xp-sb-chip,
html.skin-v2 .xp-sb-stamp,
html.skin-v2 .xp-sb-tab,
html.skin-v2 .xp-sb-counter .xp-sb-rec::before { border-radius: 0 !important; }
html.skin-v2 .xp-sb-stamp { font-family: var(--v2-px); font-size: 9px; letter-spacing: .02em; }
html.skin-v2[lang="ar"] .xp-sb-stamp { font-family: 'Cairo', system-ui, sans-serif; font-size: 12px; }

/* ── 3. Pixel buttons ──────────────────────────────────────────────
   The border is four offset box-shadows instead of a CSS border, which
   leaves the four corner pixels empty: the classic notched 8-bit edge.
   The fifth shadow is the brutalist drop, kept from v1. */
html.skin-v2 .brutalist-button {
    border: 0 !important;
    margin: var(--v2-step);
    box-shadow:
        0 calc(var(--v2-step) * -1) 0 0 var(--c-border),
        0 var(--v2-step)            0 0 var(--c-border),
        calc(var(--v2-step) * -1) 0 0 0 var(--c-border),
        var(--v2-step) 0            0 0 var(--c-border),
        6px 6px 0 0 var(--c-border);
    transition: transform .14s steps(2, end), box-shadow .14s steps(2, end), background-color .14s steps(2, end), color .14s steps(2, end);
}
html.skin-v2 .brutalist-button:hover {
    box-shadow:
        0 calc(var(--v2-step) * -1) 0 0 var(--c-border),
        0 var(--v2-step)            0 0 var(--c-border),
        calc(var(--v2-step) * -1) 0 0 0 var(--c-border),
        var(--v2-step) 0            0 0 var(--c-border),
        9px 9px 0 0 var(--c-border);
}
html.skin-v2 .brutalist-button:active {
    box-shadow:
        0 calc(var(--v2-step) * -1) 0 0 var(--c-border),
        0 var(--v2-step)            0 0 var(--c-border),
        calc(var(--v2-step) * -1) 0 0 0 var(--c-border),
        var(--v2-step) 0            0 0 var(--c-border);
}
html.skin-v2 .brutalist-button:focus-visible { outline: 3px dashed var(--v2-deep); outline-offset: 6px; }

/* "Press start" CTAs: a pixel play-triangle leads the label. */
html.skin-v2 .v2-start { display: inline-flex; align-items: center; gap: 12px; }
html.skin-v2 .v2-start::before {
    content: ""; flex: none;
    width: 0; height: 0;
    border-block: 6px solid transparent;
    border-inline-start: 8px solid currentColor;
}
html.skin-v2 .v2-start:hover::before { animation: v2-blink .5s steps(1, end) infinite; }

/* ── 4. Cards = menu items ─────────────────────────────────────────
   Hover/focus a card and a pixel cursor appears in its corner, the way
   a game menu marks the selected option. */
html.skin-v2 .brutalist-card { position: relative; }
html.skin-v2 .brutalist-card::after {
    content: ""; position: absolute; z-index: 20; pointer-events: none;
    top: 12px; inset-inline-start: 12px;
    width: 0; height: 0;
    border-block: 6px solid transparent;
    border-inline-start: 8px solid var(--c-border);
    opacity: 0;
}
html.skin-v2 .brutalist-card:hover::after,
html.skin-v2 .brutalist-card:focus-within::after { animation: v2-blink .8s steps(1, end) infinite; }
html.skin-v2 .brutalist-card { transition: transform .16s steps(2, end), box-shadow .16s steps(2, end); }

/* Small pixel index tag in a card's top-end corner (01, 02 …) */
html.skin-v2 .v2-card-no {
    position: absolute; z-index: 15; top: 0; inset-inline-end: 0;
    background: var(--c-border); color: var(--c-surface-lowest);
    padding: 6px 9px 5px;
}

/* ── 5. Nav: the active page wears the menu cursor ─────────────── */
html.skin-v2 .xp-nav-link.text-primary { position: relative; }
html.skin-v2 .xp-nav-link.text-primary::before {
    content: ""; position: absolute; top: 50%; margin-top: -6px;
    inset-inline-start: -14px;
    width: 0; height: 0;
    border-block: 5px solid transparent;
    border-inline-start: 7px solid currentColor;
    animation: v2-blink 1s steps(1, end) infinite;
}
html.skin-v2 #mobile-menu .xp-nav-link.text-primary::before { inset-inline-start: auto; inset-inline-end: 0; margin-top: -5px; }
html.skin-v2 .xp-nav-link { text-transform: uppercase; letter-spacing: .06em; }

/* ── Navbar: arcade cabinet bar ────────────────────────────────────
   Dark navy bar, logo in a marquee plate with chasing bulbs (ved.exe's
   lit sign), mono links with the current page in yellow, cartridge
   language switch, coin CTA. Markup is untouched; CSS only. */
html.skin-v2 body > nav.fixed {
    background: #0a1b3d; border-bottom: 3px solid var(--c-border); box-shadow: none;
}
html.skin-v2 body > nav.fixed::before { /* faint scanlines on the bar */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(188,233,253,.04) 0 1px, transparent 1px 4px);
}
html.skin-v2 body > nav.fixed > div > a:first-child {
    /* The wordmark has white letters: it sits on the dark sign, never a light plate. */
    position: relative; padding: 6px 12px; background: #050d20;
    border: 2px solid rgba(188,233,253,.25); box-shadow: 0 0 0 3px #0a1b3d, 0 0 0 5px #FFB800;
}
html.skin-v2 body > nav.fixed > div > a:first-child img { height: 34px; }
html.skin-v2 body > nav.fixed > div > a:first-child::after { /* chasing marquee bulbs */
    content: ""; position: absolute; inset: -9px; pointer-events: none;
    background:
        repeating-linear-gradient(90deg, #FFB800 0 4px, transparent 4px 10px) 0 0 / 100% 3px no-repeat,
        repeating-linear-gradient(90deg, #FFB800 0 4px, transparent 4px 10px) 0 100% / 100% 3px no-repeat,
        repeating-linear-gradient(0deg, #FFB800 0 4px, transparent 4px 10px) 0 0 / 3px 100% no-repeat,
        repeating-linear-gradient(0deg, #FFB800 0 4px, transparent 4px 10px) 100% 0 / 3px 100% no-repeat;
    animation: v2-bulbs .9s steps(2, end) infinite;
}
@keyframes v2-bulbs { 50% { filter: brightness(1.6) drop-shadow(0 0 3px #FFB800); opacity: .55; } }
html.skin-v2 body > nav.fixed .xp-nav-link { color: #c9d6ef; border-color: transparent; font-weight: 700; }
html.skin-v2 body > nav.fixed .xp-nav-link:hover { color: #ffffff; }
html.skin-v2 body > nav.fixed .xp-nav-link.text-primary { color: #FFB800; border-color: #FFB800; border-bottom-style: dotted; text-shadow: 0 0 10px rgba(255,184,0,.45); }
html.skin-v2 body > nav.fixed #lang-btn,
html.skin-v2 body > nav.fixed #lang-btn-xs {
    background: #bce9fd; color: #0a1b3d; border: 2px solid var(--c-border);
    box-shadow: 3px 3px 0 0 #000; padding-inline: 12px;
}
html.skin-v2 body > nav.fixed #lang-btn::before { content: "◂ "; font-size: .8em; }
html.skin-v2 body > nav.fixed #lang-btn:hover { background: #FFB800; }
html.skin-v2 body > nav.fixed .brutalist-button {
    background: #FFB800; color: #1a1c1c;
    box-shadow: 0 -3px 0 0 #000, 0 3px 0 0 #000, -3px 0 0 0 #000, 3px 0 0 0 #000, 6px 6px 0 0 #000;
}
html.skin-v2 body > nav.fixed .brutalist-button:hover { background: #bce9fd; color: #0a1b3d; }
html.skin-v2 body > nav.fixed #menu-toggle { color: #f9f9f9; }

/* Mobile drawer → LEVEL SELECT screen */
html.skin-v2 #mobile-menu { background: #0a1b3d; color: #e8f1ff; border-color: var(--c-border); }
html.skin-v2 #mobile-menu > div:first-child { border-color: rgba(188,233,253,.25); }
html.skin-v2 #mobile-menu > div:first-child span[data-i18n] { font-family: 'Press Start 2P', 'Cairo', monospace; font-size: 10px; color: #FFB800; }
html.skin-v2 #mobile-menu button { color: #bce9fd; }
html.skin-v2 #mobile-menu nav { counter-reset: v2-lvl; }
html.skin-v2 #mobile-menu nav .xp-nav-link { counter-increment: v2-lvl; display: flex; gap: 14px; align-items: baseline; color: #c9d6ef; border-color: rgba(188,233,253,.15); }
html.skin-v2 #mobile-menu nav .xp-nav-link::after { content: counter(v2-lvl, decimal-leading-zero); order: -1; font-family: 'Press Start 2P', monospace; font-size: 9px; color: #6f7c9c; }
html.skin-v2 #mobile-menu nav .xp-nav-link.text-primary { color: #FFB800; border-color: #FFB800; }
html.skin-v2 #mobile-menu nav .xp-nav-link.text-primary::after { color: #FFB800; }
html.skin-v2 #mobile-menu #lang-btn-m { color: #bce9fd; }
html.skin-v2 #mobile-menu > div { border-color: rgba(188,233,253,.25) !important; }
html.skin-v2 #mobile-menu .brutalist-button { background: #FFB800; color: #1a1c1c; }

/* Pixel bunting hanging under the navbar (ved.exe's shop awning, arcade
   edition): blue / yellow / mist flags, each a stepped pennant. */
html.skin-v2 body > nav.fixed::after {
    content: ""; position: absolute; inset-inline: 0; top: 100%; height: 12px; pointer-events: none;
    margin-top: 2px;
    background:
        linear-gradient(90deg, transparent 4px, #0066ff 4px 18px, transparent 18px 26px, #FFB800 26px 40px, transparent 40px 48px, #bce9fd 48px 62px, transparent 62px 66px) 0 0 / 66px 6px repeat-x,
        linear-gradient(90deg, transparent 8px, #0066ff 8px 14px, transparent 14px 30px, #FFB800 30px 36px, transparent 36px 52px, #bce9fd 52px 58px, transparent 58px 66px) 0 6px / 66px 6px repeat-x;
    filter: drop-shadow(0 2px 0 var(--c-border));
}

/* ── 6. Textures ───────────────────────────────────────────────── */
/* CRT scanlines: drop a .v2-scan div into any positioned box. */
html.skin-v2 .v2-scan {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(26,28,28,.10) 0 1px, transparent 1px 4px);
    mix-blend-mode: multiply;
}
html.skin-v2 .v2-scan--light { background: repeating-linear-gradient(0deg, rgba(248,247,255,.06) 0 1px, transparent 1px 4px); mix-blend-mode: normal; }

/* Dot grids read as pixel grids: square dots instead of round ones. */
html.skin-v2 .pattern-dots {
    background-image: conic-gradient(at 2px 2px, transparent 75%, var(--c-border) 0);
    background-size: 24px 24px;
}

/* Scroll progress (home page): a segmented, tinted level bar. */
html.skin-v2 .xp-scroll-progress {
    height: 5px;
    background: repeating-linear-gradient(90deg, var(--v2-tint) 0 10px, transparent 10px 12px);
    transition: background-color .3s steps(3, end);
}

/* ── 7. Hero ───────────────────────────────────────────────────── */
/* HUD strip above the hero grid */
html.skin-v2 .v2-hud {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px;
    border: 3px solid var(--c-border);
    background: var(--c-surface-lowest);
    box-shadow: 6px 6px 0 0 var(--c-border);
    padding: 10px 16px;
    margin-bottom: 32px;
    color: var(--c-on-surface);
}
@media (min-width: 768px) { html.skin-v2 .v2-hud { margin-top: -48px; } }
html.skin-v2 .v2-hud-item { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
html.skin-v2 .v2-hud-item b { color: var(--v2-deep); font-weight: 400; }
html.skin-v2 .v2-hud-online { margin-inline-start: auto; }
html.skin-v2 .v2-hud-online i {
    width: 8px; height: 8px; background: #16a34a; display: inline-block;
    animation: v2-blink 1.2s steps(1, end) infinite;
}
html.skin-v2 .v2-hud .px-cham { width: 38px; height: auto; color: var(--v2-tint); transition: color .4s steps(4, end); }
@media (max-width: 640px) {
    html.skin-v2 .v2-hud { gap: 8px 18px; padding: 8px 12px; margin-bottom: 28px; }
    html.skin-v2 .v2-hud-hide-sm { display: none; }
}

html.skin-v2 #hero .hero-live { border-radius: 0; }
html.skin-v2 .hero-mark { height: .34em; background: var(--v2-yellow); }

/* Spec strip values become a green-screen readout */
html.skin-v2 .hero-spec dd { font-family: var(--v2-term); font-size: 20px; font-weight: 400; line-height: 1.1; letter-spacing: .02em; }
html.skin-v2[lang="ar"] .hero-spec dd { font-family: 'Cairo', system-ui, sans-serif; font-size: 13px; font-weight: 700; }
html.skin-v2 .hero-spec dt { font-family: var(--v2-px); font-size: 8px; letter-spacing: .04em; }
html.skin-v2[lang="ar"] .hero-spec dt { font-family: 'Cairo', system-ui, sans-serif; font-size: 11px; }

/* The blue slab becomes a game screen: scanlines, pixel ground, HUD caption */
html.skin-v2 .hero-slab-grid {
    background-image: conic-gradient(at 3px 3px, transparent 75%, rgba(248,247,255,.4) 0);
    background-size: 22px 22px;
}
html.skin-v2 .hero-chip { font-family: var(--v2-px); font-size: 9px; letter-spacing: .02em; padding: 8px 12px; }
html.skin-v2[lang="ar"] .hero-chip { font-family: 'Cairo', system-ui, sans-serif; font-size: 12px; }
html.skin-v2 .hero-slab-cap { font-family: var(--v2-px); font-size: 9px; letter-spacing: .02em; padding: 11px 14px; z-index: 3; }
html.skin-v2[lang="ar"] .hero-slab-cap { font-family: 'Cairo', system-ui, sans-serif; font-size: 12px; }
html.skin-v2 .v2-ground {
    position: absolute; z-index: 0; inset-inline: 0; bottom: 34px; height: 18px;
    background:
        linear-gradient(var(--c-border), var(--c-border)) top / 100% 3px no-repeat,
        conic-gradient(var(--v2-mist) 0 25%, var(--v2-sky) 0 50%, var(--v2-mist) 0 75%, var(--v2-sky) 0) 0 3px / 18px 18px;
}
html.skin-v2 .hero-slab .hero-mascot { margin-bottom: 46px; }

/* Energy bar: segments cycle through the palette, the chameleon "adapting" */
html.skin-v2 .v2-energy { display: inline-flex; align-items: center; gap: 8px; margin-inline-start: auto; }
html.skin-v2 .v2-energy-bar { display: inline-flex; gap: 2px; direction: ltr; }
html.skin-v2 .v2-energy-bar i { width: 7px; height: 11px; background: var(--v2-mist); animation: v2-adapt 3.2s steps(1, end) infinite; }
html.skin-v2 .v2-energy-bar i:nth-child(2) { animation-delay: .2s; }
html.skin-v2 .v2-energy-bar i:nth-child(3) { animation-delay: .4s; }
html.skin-v2 .v2-energy-bar i:nth-child(4) { animation-delay: .6s; }
html.skin-v2 .v2-energy-bar i:nth-child(5) { animation-delay: .8s; }
html.skin-v2 .v2-energy-bar i:nth-child(6) { animation-delay: 1s; }
html.skin-v2 .v2-energy-bar i:nth-child(7) { animation-delay: 1.2s; }
html.skin-v2 .v2-energy-bar i:nth-child(8) { animation-delay: 1.4s; }
@keyframes v2-adapt {
    0%   { background: var(--v2-mist); }
    25%  { background: var(--v2-yellow); }
    50%  { background: var(--v2-sky); }
    75%  { background: #ffffff; }
    100% { background: var(--v2-mist); }
}
@media (max-width: 420px) { html.skin-v2 .v2-energy-label { display: none; } }

/* ── 8. Client viewer: CRT monitor ─────────────────────────────── */
html.skin-v2 .xp-cv-cap,
html.skin-v2 .xp-cv-dot { font-family: var(--v2-px); font-size: 9px; letter-spacing: .02em; }
html.skin-v2 .xp-cv-name { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; }
html.skin-v2[lang="ar"] .xp-cv-name { font-family: 'Cairo', system-ui, sans-serif; }
html.skin-v2 .xp-cv-progress > i { background: repeating-linear-gradient(90deg, var(--v2-blue) 0 8px, transparent 8px 10px); }
html.skin-v2 .xp-cv-screen::before {
    background-image: repeating-linear-gradient(0deg, rgba(26,28,28,.05) 0 1px, transparent 1px 4px);
    background-size: auto; opacity: 1;
}

/* ── 9. Stats = high-score table ───────────────────────────────── */
html.skin-v2 #stats-section { position: relative; }
html.skin-v2 #stats-section h3 {
    font-family: var(--v2-px); font-style: normal; font-weight: 400;
    font-size: clamp(20px, 3vw, 38px); line-height: 1.25; letter-spacing: 0;
    color: var(--v2-yellow);
    text-shadow: 3px 3px 0 #0a1b3d;
    direction: ltr;                  /* scores read 500+ in both languages */
}
html.skin-v2 #stats-section p { font-family: var(--v2-px); font-size: 10px; letter-spacing: .04em; }
html.skin-v2[lang="ar"] #stats-section p { font-family: 'Cairo', system-ui, sans-serif; font-size: 13px; }
html.skin-v2 .v2-stats-kicker { color: var(--v2-mist); margin-bottom: 28px; display: flex; }
html.skin-v2 #stats-section > * { position: relative; z-index: 2; }
html.skin-v2 #stats-section > .v2-scan { position: absolute; z-index: 1; }

/* ── 10. Section eyebrows & kickers on colour fields ───────────── */
html.skin-v2 .v2-kicker-wrap { margin-bottom: 14px; }
html.skin-v2 #services-section .v2-kicker { color: var(--c-surface-lowest); }

/* Transformation steps → a level route (1-1 … 1-4) */
html.skin-v2 .xp-tf-steps > div { position: relative; }
html.skin-v2 .xp-tf-steps > div > span:first-child { font-family: var(--v2-px); font-size: 9px; letter-spacing: .02em; }
html.skin-v2 .xp-tf-steps > div:last-child { box-shadow: 4px 4px 0 0 var(--v2-yellow); }

/* ── 11. Work cards = missions ─────────────────────────────────── */
html.skin-v2 .v2-mission {
    position: absolute; z-index: 5; bottom: 0; inset-inline-start: 0;
    background: var(--c-border); color: var(--c-surface-lowest);
    padding: 8px 12px 7px;
}
html.skin-v2 .v2-cleared {
    /* Physical right on purpose: the card's tech tags are pinned physical-left in both directions. */
    position: absolute; z-index: 5; top: 14px; right: 14px;
    background: var(--c-border); color: var(--v2-yellow);
    box-shadow: 3px 3px 0 0 var(--c-surface-lowest);
    padding: 7px 10px 6px; font-size: 9px;
    transform: rotate(4deg);
}
html.skin-v2[dir="rtl"] .v2-cleared { transform: rotate(-4deg); }

/* ── 12. FAQ & accordion: dialogue boxes ───────────────────────── */
html.skin-v2 .accordion-item .accordion-icon { transition: transform .2s steps(2, end); }
html.skin-v2 .accordion-item.active { box-shadow: 6px 6px 0 0 var(--c-border), inset 0 0 0 3px var(--v2-deep); }

/* ── 13. CTA = continue screen ─────────────────────────────────── */
html.skin-v2 .v2-continue {
    display: inline-flex; align-items: center; gap: 16px;
    color: var(--v2-yellow); margin-bottom: 24px;
    font-size: 14px;
}
html.skin-v2 .v2-continue-n {
    display: inline-grid; place-items: center;
    min-width: 2.2em; padding: 6px 4px 4px;
    border: 3px solid var(--v2-yellow);
    direction: ltr;
}
html.skin-v2[lang="ar"] .v2-continue { font-size: 18px; }
html.skin-v2 .xp-cta-mesh { opacity: .35; }

/* ── 14. Footer: crenellated edge + save state ─────────────────── */
html.skin-v2 .xp-footer { position: relative; }
html.skin-v2 .xp-footer::before {
    content: ""; position: absolute; inset-inline: 0; top: -16px; height: 12px; pointer-events: none;
    background: linear-gradient(90deg, var(--c-border) 50%, transparent 0) 0 0 / 24px 12px repeat-x;
}
html.skin-v2 .xp-footer .ft-heading { font-family: var(--v2-px); font-size: 10px; letter-spacing: .04em; }
html.skin-v2[lang="ar"] .xp-footer .ft-heading { font-family: 'Cairo', system-ui, sans-serif; font-size: 14px; }
html.skin-v2 .v2-saved { display: inline-flex; align-items: center; gap: 8px; color: var(--v2-mist); }
html.skin-v2 .v2-saved .px-cham { width: 30px; height: auto; color: var(--v2-tint); }

/* ── 15. Level widget (all pages) ──────────────────────────────── */
html.skin-v2 .v2-lvl {
    position: fixed; z-index: 45;
    bottom: max(16px, env(safe-area-inset-bottom));
    inset-inline-start: 16px;
    transition: transform .2s steps(3, end), opacity .2s steps(3, end), visibility 0s;
}
/* Parked off-screen while the hero is in view (skin.js adds .is-on). */
html.skin-v2 .v2-lvl:not(.is-on) { opacity: 0; transform: translateY(24px); visibility: hidden; transition-delay: 0s, 0s, .2s; }
html.skin-v2 .v2-lvl-btn {
    display: flex; align-items: center; gap: 12px;
    background: var(--c-surface-lowest); color: var(--c-on-surface);
    margin: var(--v2-step);
    padding: 8px 14px 8px 10px;
    box-shadow:
        0 calc(var(--v2-step) * -1) 0 0 var(--c-border),
        0 var(--v2-step)            0 0 var(--c-border),
        calc(var(--v2-step) * -1) 0 0 0 var(--c-border),
        var(--v2-step) 0            0 0 var(--c-border),
        5px 5px 0 0 var(--c-border);
    cursor: pointer;
    text-align: start;
    transition: transform .12s steps(2, end);
}
html.skin-v2[dir="rtl"] .v2-lvl-btn { padding: 8px 10px 8px 14px; }
html.skin-v2 .v2-lvl-btn:hover { transform: translate(-2px, -2px); }
html.skin-v2 .v2-lvl-btn:focus-visible { outline: 3px dashed var(--v2-deep); outline-offset: 6px; }
html.skin-v2 .v2-lvl-sprite { display: block; width: 46px; }
html.skin-v2 .v2-lvl-sprite .px-cham {
    display: block; width: 46px; height: auto; overflow: visible;
    color: var(--v2-tint);
    transition: color .45s steps(4, end);
    animation: v2-bob 1.2s steps(1, end) infinite;
}
/* Sprites face the reading direction. */
html.skin-v2[dir="rtl"] .px-cham { transform: scaleX(-1); }
@keyframes v2-bob { 0%, 49% { translate: 0 0; } 50%, 100% { translate: 0 -2px; } }

html.skin-v2 .px-cham-tongue { transform-box: fill-box; transform-origin: left center; transform: scaleX(0); }
html.skin-v2 .px-cham-tongue-tip { transform: scale(0); }
html.skin-v2 .px-cham.is-licking .px-cham-tongue { animation: v2-lick .42s steps(3, end) 1; }
@keyframes v2-lick { 0% { transform: scale(0); } 45% { transform: scale(1); } 100% { transform: scale(0); } }

/* Compact by default (sprite · LVL nn · bar). The level name slides out
   for a moment on entering a new level ("STAGE START"), on hover, and
   while the menu is open. */
html.skin-v2 .v2-lvl-info { display: grid; gap: 5px; min-width: 0; }
html.skin-v2 .v2-lvl-num { color: var(--c-on-surface-var); font-size: 8px; white-space: nowrap; }
html.skin-v2 .v2-lvl-name {
    max-width: 0; max-height: 0; margin-block: -2.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-size: 9px;
    transition: max-width .24s steps(4, end);
}
html.skin-v2 .v2-lvl.is-announce .v2-lvl-name,
html.skin-v2 .v2-lvl:hover .v2-lvl-name,
html.skin-v2 .v2-lvl-btn:focus-visible .v2-lvl-name,
html.skin-v2 .v2-lvl-btn[aria-expanded="true"] .v2-lvl-name { max-width: 170px; max-height: 3em; margin-block: 0; }
html.skin-v2[lang="ar"] .v2-lvl-num, html.skin-v2[lang="ar"] .v2-lvl-name { font-size: 12px; }
html.skin-v2 .v2-lvl-bar { display: block; width: 56px; height: 6px; background: var(--c-surface-high); }
html.skin-v2 .v2-lvl-bar > i {
    display: block; height: 100%; width: 100%;
    background: repeating-linear-gradient(90deg, var(--v2-tint) 0 6px, transparent 6px 8px);
    transform: scaleX(0); transform-origin: left center;
}
html.skin-v2[dir="rtl"] .v2-lvl-bar > i { transform-origin: right center; }

html.skin-v2 .v2-lvl-menu {
    position: absolute; bottom: calc(100% + 14px); inset-inline-start: var(--v2-step);
    width: min(280px, calc(100vw - 40px));
    max-height: min(60vh, 420px); overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: var(--v2-sky) transparent;
    background: #0a1b3d; color: #f8f7ff;
    border: 3px solid var(--c-border);
    box-shadow: 6px 6px 0 0 var(--c-border);
    padding: 16px 14px;
}
html.skin-v2 .v2-lvl-menu[hidden] { display: none; }
html.skin-v2 .v2-lvl-menu .v2-px:first-child { color: var(--v2-mist); margin-bottom: 10px; }
html.skin-v2 .v2-lvl-menu ol { display: grid; gap: 2px; }
html.skin-v2 .v2-lvl-menu button {
    width: 100%; display: flex; gap: 10px; align-items: baseline;
    padding: 8px 8px 7px; text-align: start; color: inherit;
}
html.skin-v2 .v2-lvl-menu button span:first-child { color: var(--v2-sky); flex: none; direction: ltr; }
html.skin-v2 .v2-lvl-menu button span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.skin-v2 .v2-lvl-menu button:hover,
html.skin-v2 .v2-lvl-menu button:focus-visible,
html.skin-v2 .v2-lvl-menu button[aria-current="true"] { background: var(--v2-yellow); color: #1a1c1c; outline: none; }
html.skin-v2 .v2-lvl-menu button[aria-current="true"] span:first-child,
html.skin-v2 .v2-lvl-menu button:hover span:first-child { color: #1a1c1c; }

@media (max-width: 640px) {
    html.skin-v2 .v2-lvl { inset-inline-start: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
    html.skin-v2 .v2-lvl-btn { gap: 8px; padding: 6px 10px 6px 8px; }
    html.skin-v2 .v2-lvl-sprite, html.skin-v2 .v2-lvl-sprite .px-cham { width: 36px; }
    html.skin-v2 .v2-lvl.is-announce .v2-lvl-name { max-width: 120px; }
    html.skin-v2 .v2-lvl-bar { width: 44px; }
}
@media print { html.skin-v2 .v2-lvl { display: none; } }

/* ── 16. Boot screen (first visit per session) ─────────────────────
   Two pseudo-elements on <body>: the console text and the loading bar.
   Both fade out by themselves at 1.35 s; no JS needed to remove them. */
html.skin-v2.v2-boot body::before,
html.skin-v2.v2-boot body::after {
    position: fixed; z-index: 10000; pointer-events: none;
    animation: v2-boot-out .25s steps(3, end) 1.35s forwards;
}
html.skin-v2.v2-boot body::before {
    content: "XP-OS v2.0  //  CHAMELEON ARCADE\A\A> MOUNTING STUDIO ........ OK\A> LOADING SOFTWARE ....... OK\A> LOADING MEDIA .......... OK\A> ADAPTING COLOURS ....... OK\A\A PRESS START";
    inset: 0; display: grid; place-content: center;
    white-space: pre; text-align: start;
    background:
        repeating-linear-gradient(0deg, rgba(188,233,253,.05) 0 1px, transparent 1px 4px),
        radial-gradient(70% 60% at 50% 45%, #0a1b3d, #050d20);
    color: #bce9fd; text-shadow: 0 0 10px rgba(188,233,253,.6);
    font: 400 22px/1.25 'VT323', 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: .04em;
    clip-path: inset(0 0 0 0);
}
html.skin-v2.v2-boot body::after {
    content: ""; left: calc(50% - min(180px, 35vw)); bottom: 22%; width: min(360px, 70vw); height: 14px;
    border: 2px solid #bce9fd; padding: 2px;
    background: linear-gradient(#FFB800, #FFB800) 2px 2px / 0 8px no-repeat content-box;
    background-clip: content-box;
    animation: v2-boot-bar 1.1s steps(10, end) .1s forwards, v2-boot-out .25s steps(3, end) 1.35s forwards;
}
@keyframes v2-boot-bar { to { background-size: 100% 8px; } }
@keyframes v2-boot-out { to { opacity: 0; visibility: hidden; } }

/* ── 17. Reduced motion: everything stands still ───────────────── */
@media (prefers-reduced-motion: reduce) {
    html.skin-v2 .v2-kicker::before,
    html.skin-v2 .v2-start:hover::before,
    html.skin-v2 .brutalist-card:hover::after,
    html.skin-v2 .brutalist-card:focus-within::after,
    html.skin-v2 .xp-nav-link.text-primary::before,
    html.skin-v2 .v2-hud-online i,
    html.skin-v2 .v2-energy-bar i,
    html.skin-v2 .v2-lvl-sprite .px-cham,
    html.skin-v2 .px-cham.is-licking .px-cham-tongue { animation: none !important; }
    html.skin-v2 .brutalist-card:hover::after,
    html.skin-v2 .brutalist-card:focus-within::after { opacity: 1; }
    html.skin-v2 .brutalist-button,
    html.skin-v2 .brutalist-card,
    html.skin-v2 .v2-lvl-btn { transition: none !important; }
}
