﻿.ds-title-display {
    margin: 0;
    font-family: var(--ds-font-display);
    font-weight: 700;
    font-size: clamp(calc(2.1rem * var(--ds-type-scale)), calc(4vw * var(--ds-type-scale)), calc(3.8rem * var(--ds-type-scale)));
    letter-spacing: var(--ds-letter-title);
    line-height: 0.96;
    text-transform: uppercase;
    color: var(--ds-color-text-gold);
    text-shadow: 0 1px 0 rgba(23, 14, 5, 0.88), 0 0 18px rgba(243, 210, 134, 0.12);
}

.ds-title-section {
    margin: 0;
    font-family: var(--ds-font-display);
    font-weight: 700;
    font-size: clamp(calc(1rem * var(--ds-type-scale)), calc(1.5vw * var(--ds-type-scale)), calc(1.36rem * var(--ds-type-scale)));
    letter-spacing: 0.04em;
    color: var(--ds-color-text-gold);
}

.ds-label,
.ds-chip-label {
    font-family: var(--ds-font-label);
    font-size: clamp(calc(0.4rem * var(--ds-type-scale)), calc(0.55vw * var(--ds-type-scale)), calc(0.52rem * var(--ds-type-scale)));
    line-height: 1.55;
    letter-spacing: var(--ds-letter-label);
    text-transform: uppercase;
    color: var(--ds-color-text-secondary);
}

.ds-body-copy {
    font-family: var(--ds-font-body);
    font-size: clamp(calc(0.96rem * var(--ds-type-scale)), calc(1.1vw * var(--ds-type-scale)), calc(1.1rem * var(--ds-type-scale)));
    line-height: 1.15;
    color: var(--ds-color-text-secondary);
}

/* Stat copy — pixel font for short, in-the-moment, game-centered text:
   stat deltas, slot labels, status pills, anything the player ACTS on.
   Reserve .ds-body-copy for story / longer reading. */
.ds-stat-copy {
    font-family: var(--ds-font-label);
    /* +10% over previous step */
    font-size: clamp(calc(0.46rem * var(--ds-type-scale)), calc(0.62vw * var(--ds-type-scale)), calc(0.58rem * var(--ds-type-scale)));
    letter-spacing: var(--ds-letter-label);
    text-transform: uppercase;
    color: var(--ds-color-text-secondary);
    line-height: 1.45;
}

.ds-stat-copy--positive { color: var(--ds-color-success); }
.ds-stat-copy--negative { color: var(--ds-color-danger); }
.ds-stat-copy--gold     { color: var(--ds-color-text-gold); }

.ds-number-display {
    font-family: var(--ds-font-number);
    font-weight: 700;
    color: var(--ds-color-text-gold);
    letter-spacing: 0.02em;
    line-height: 0.96;
}

.ds-number-display--sm { font-size: clamp(1.6rem, 2.4vw, 2.2rem); }
.ds-number-display--md { font-size: clamp(2.4rem, 3.6vw, 3.4rem); }
.ds-number-display--lg { font-size: clamp(3rem, 6vw, 4.6rem); }

.ds-panel {
    position: relative;
    overflow: hidden;
    border-radius: var(--ds-radius-lg);
    border: var(--ds-border-width) solid var(--ds-color-border-base);
    background: var(--ds-surface-panel);
    box-shadow: var(--ds-shadow-panel);
}

.ds-panel::before {
    content: '';
    position: absolute;
    inset: var(--ds-9s-contour-offset);
    border-radius: calc(var(--ds-radius-lg) - 4px);
    border: 1px solid var(--ds-9s-contour-color);
    pointer-events: none;
    z-index: 1;
}

.ds-panel--ornate {
    background: var(--ds-surface-panel-ornate);
    box-shadow: var(--ds-shadow-panel), var(--ds-shadow-cosmic);
}

.ds-panel--modal {
    background: var(--ds-surface-panel-modal);
}

.ds-panel--card {
    background: var(--ds-surface-card);
}

.ds-panel--board {
    background: var(--ds-surface-panel-ornate);
}

/* ─── Art-nouveau frames ─────────────────────────────────────────────
   Pure border-image 9-slice from the source PNG. NO additional CSS
   rails, NO double contour, NO border-radius — the artwork itself
   carries every line and curl. Slice values are tuned so the corner
   ornament fits entirely inside the corner sub-image, leaving only
   the straight gold rail in the edge sub-images that get stretched. */

.ds-frame {
    position: relative;
    box-sizing: border-box;
    background: transparent;
    isolation: isolate;
}

.ds-frame__inner {
    position: relative;
    z-index: 1;
    padding: var(--ds-space-4) var(--ds-space-5);
}

/* Big ornate panel — moon TL, star TR, gems BL/BR.
   Source: frame-panel-square.png, 1024 × 952 (transparent center).
   Slice 380 captures the full corner curl on each side; the leftover
   middle (264×192) is the only stretched region. */
.ds-frame--panel {
    border-style: solid;
    border-color: transparent;
    border-width: 110px;
    border-image-source: url('../assets/images/ui/frames/frame-panel-square.png');
    border-image-slice: 380 fill;
    border-image-repeat: stretch;
    border-image-width: 1;
    border-image-outset: 0;
}

.ds-frame--panel .ds-frame__inner {
    padding: var(--ds-space-3) var(--ds-space-4);
    min-height: 0;
}

/* Frames awaiting fresh art: keep the class so layouts hold but draw a
   soft placeholder so the design system flags them as TODO. */
.ds-frame--panel-mini,
.ds-frame--bar,
.ds-frame--bar-mini,
.ds-frame--button {
    border: 1px dashed rgba(194, 166, 101, 0.5);
    border-radius: var(--ds-radius-md);
    background: rgba(8, 13, 26, 0.4);
}

.ds-frame--panel-mini::after,
.ds-frame--bar::after,
.ds-frame--bar-mini::after,
.ds-frame--button::after {
    content: 'awaiting art';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ds-color-text-muted);
    font-family: var(--ds-font-label);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    pointer-events: none;
}

/* Standard placeholder sizes used while we're awaiting source art so the
   surrounding cards don't shift when the real PNGs land. */
.ds-frame--placeholder-xs { width: 100%; min-height: 48px; }
.ds-frame--placeholder-sm { width: 100%; min-height: 72px; }
.ds-frame--placeholder-md { width: 100%; min-height: 140px; }

/* Generic compositions */
.ds-stack-tight {
    display: grid;
    gap: var(--ds-space-2);
}

.ds-preview-row--tall {
    min-height: 120px;
}

.ds-rail {
    position: relative;
    padding: var(--ds-space-3) var(--ds-space-4);
    border-radius: var(--ds-radius-md);
    border: var(--ds-border-width) solid var(--ds-color-border-base);
    background: var(--ds-surface-rail);
    box-shadow: var(--ds-shadow-soft);
}

/* Centered single-line rail used under sigils, tips, trails. */
.ds-rail--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: var(--ds-space-2);
    text-align: center;
}

/* Two-line rail: title row over a stat row. */
.ds-rail--stack {
    display: grid;
    gap: var(--ds-space-1);
}

/* Compact stat-only rail (loadout deltas). Pixel font + tight padding. */
.ds-rail--stat {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    padding: var(--ds-space-2) var(--ds-space-3);
}

/* Inline-sized section title — same family as .ds-title-section but readable
   alongside body copy (no display sizing). */
.ds-title-section--inline {
    font-size: 1rem;
}

/* Badges are game-centered indicators (Level Up!, +9, Earned), so per the
   typography rule they live in the pixel family — not Cinzel. */
.ds-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px var(--ds-space-3);
    border-radius: var(--ds-radius-pill);
    border: var(--ds-border-width) solid rgba(246, 228, 182, 0.5);
    background: var(--ds-surface-badge);
    color: rgba(38, 22, 4, 0.96);
    font-family: var(--ds-font-label);
    font-size: clamp(calc(0.5rem * var(--ds-type-scale)), calc(0.7vw * var(--ds-type-scale)), calc(0.62rem * var(--ds-type-scale)));
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 1px 0 rgba(255, 244, 210, 0.32);
}

/* "Level Up!" / "New point" — a status indicator, NOT a button. Pulses glow
   to ask for attention; never reacts to click. */
.ds-badge--levelup {
    cursor: default;
    pointer-events: none;
}

/* Pixel box that bundles a label + value (Available Points) so the value
   never floats next to the giant Level number. */
.ds-points-box {
    display: grid;
    gap: 4px;
    padding: var(--ds-space-2) var(--ds-space-3);
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-color-border-soft);
    background: rgba(8, 13, 24, 0.74);
    text-align: right;
}

.ds-points-box__value {
    font-family: var(--ds-font-label);
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    color: var(--ds-color-text-gold);
    letter-spacing: 0.12em;
}

.ds-pill,
.locale-flag {
    border: var(--ds-border-width) solid var(--ds-color-border-base);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-surface-pill);
    color: var(--ds-color-text-primary);
    min-width: 42px;
    height: 28px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-family: var(--ds-font-label);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(134, 200, 255, 0.08);
    transition:
        transform var(--ds-motion-base) ease,
        border-color var(--ds-motion-base) ease,
        box-shadow var(--ds-motion-base) ease,
        opacity var(--ds-motion-base) ease;
}

.ds-pill::before,
.locale-flag::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(112deg, rgba(255, 255, 255, 0) 24%, rgba(255, 241, 206, 0.18) 50%, rgba(255, 255, 255, 0) 76%);
    opacity: 0;
    transform: translateX(-128%);
    transition: transform calc(var(--ds-motion-slow) * 1.2) ease, opacity var(--ds-motion-fast) ease;
    pointer-events: none;
}

.ds-pill:hover,
.ds-pill:focus-visible,
.locale-flag:hover,
.locale-flag:focus-visible {
    transform: translateY(-1px);
    border-color: var(--ds-color-border-strong);
    box-shadow: var(--ds-shadow-selected), inset 0 0 12px rgba(243, 210, 134, 0.12);
}

.ds-pill:hover::before,
.ds-pill:focus-visible::before,
.locale-flag:hover::before,
.locale-flag:focus-visible::before {
    opacity: 1;
    transform: translateX(128%);
}

.ds-pill.is-active,
.locale-flag.active {
    border-color: var(--ds-color-border-strong);
    color: var(--ds-color-text-gold);
    box-shadow: var(--ds-shadow-selected), inset 0 0 14px rgba(243, 210, 134, 0.16);
}

.ds-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    min-height: var(--ds-button-min-h);
    padding: 0 var(--ds-space-4);
    border-radius: var(--ds-radius-pill);
    border: var(--ds-border-width) solid var(--ds-color-border-base);
    background: var(--ds-surface-button-secondary);
    color: var(--ds-color-text-primary);
    font-family: var(--ds-font-label);
    /* +10% over previous: Level Up / Reset / Delete read at the same beat
       as the rest of the pixel UI without being shouty. */
    font-size: clamp(calc(0.46rem * var(--ds-type-scale)), calc(0.6vw * var(--ds-type-scale)), calc(0.56rem * var(--ds-type-scale)));
    letter-spacing: var(--ds-letter-label);
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    isolation: isolate;
    transition:
        transform var(--ds-motion-base) ease,
        box-shadow var(--ds-motion-base) ease,
        border-color var(--ds-motion-base) ease,
        filter var(--ds-motion-base) ease;
}

.ds-button::before {
    content: '';
    position: absolute;
    inset: 10% 4%;
    border-radius: inherit;
    border: 1px solid rgba(255, 247, 226, 0.08);
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
    transition: opacity var(--ds-motion-fast) ease, transform var(--ds-motion-fast) ease;
}

.ds-button:hover,
.ds-button:focus-visible {
    transform: translateY(-1px);
    border-color: var(--ds-color-border-strong);
    box-shadow: var(--ds-shadow-selected);
}

.ds-button:hover::before,
.ds-button:focus-visible::before {
    opacity: 1;
    transform: scale(1);
}

.ds-button:active {
    transform: translateY(0);
    filter: brightness(1.08);
}

.ds-button:disabled,
.ds-button.is-disabled {
    cursor: default;
    opacity: 0.48;
    transform: none;
    box-shadow: none;
    border-color: var(--ds-color-disabled);
    color: rgba(204, 214, 239, 0.56);
}

.ds-button--primary {
    background: var(--ds-surface-button-primary);
    color: rgba(49, 30, 7, 0.94);
}

.ds-button--secondary {
    background: var(--ds-surface-button-secondary);
}

.ds-button--ghost {
    background: var(--ds-surface-button-ghost);
}

.ds-button--danger {
    background: var(--ds-surface-button-danger);
    border-color: rgba(255, 120, 132, 0.58);
    color: rgba(255, 232, 235, 0.94);
}

.ds-button--danger:hover,
.ds-button--danger:focus-visible {
    border-color: rgba(255, 154, 164, 0.92);
    box-shadow: var(--ds-shadow-danger);
    animation: ds-pulse-danger 1.4s var(--ds-ease-pulse) infinite;
}

/* Reset is destructive too — same hover signature, calmer base. */
.ds-button--reset {
    background: var(--ds-surface-button-secondary);
    border-color: rgba(255, 154, 164, 0.32);
    color: rgba(255, 220, 224, 0.92);
}

.ds-button--reset:hover,
.ds-button--reset:focus-visible {
    border-color: rgba(255, 154, 164, 0.86);
    box-shadow: var(--ds-shadow-danger);
}

@keyframes ds-pulse-danger {
    0%, 100% { box-shadow: var(--ds-shadow-danger); }
    50%      { box-shadow: var(--ds-shadow-danger), 0 0 22px rgba(255, 102, 116, 0.62); }
}

.ds-button--menu,
.home-menu-button {
    border: none;
    background: transparent;
    color: var(--ds-color-text-primary);
    font-family: var(--ds-font-label);
    text-shadow: 0 0 7px rgba(255, 255, 255, 0.74), 0 0 14px rgba(168, 111, 255, 0.38);
}

/* Menu buttons have no visible surface, so a halo on hover orbits empty space.
   Keep hover lift + brighter text glow only — no box-shadow, no border-color
   change, no inset pseudo ring. */
.ds-button--menu:hover,
.ds-button--menu:focus-visible,
.home-menu-button:hover,
.home-menu-button:focus-visible {
    box-shadow: none;
    border-color: transparent;
    text-shadow:
        0 0 8px rgba(255, 255, 255, 0.92),
        0 0 18px rgba(243, 210, 134, 0.62),
        0 0 32px rgba(168, 111, 255, 0.36);
}

.ds-button--menu::before,
.home-menu-button::before {
    display: none;
}

/* Larger menu variant for the home screen so Play / Enlightments / Options
   read at marquee weight. */
.ds-button--menu-lg {
    min-height: var(--ds-button-min-h-lg);
    font-size: clamp(calc(0.7rem * var(--ds-type-scale)), calc(1vw * var(--ds-type-scale)), calc(0.96rem * var(--ds-type-scale)));
    letter-spacing: 0.18em;
    padding: 0 var(--ds-space-5);
}

.ds-button--wide {
    width: min(100%, 560px);
    justify-content: space-between;
}

/* Art button is PLAYABLE (Resume, Return Home, Play Again, Activate),
   so it follows the typography rule: pixel font, high-contrast dark-on-gold.
   Explicit z-index sits above the gold ::before pseudo so the label can't
   disappear behind the gradient. */
.ds-button--art {
    position: relative;
    width: min(100%, 320px);
    min-height: 62px;
    padding: 0 24px;
    border: none;
    background: transparent;
    color: rgba(28, 14, 0, 1);
    font-family: var(--ds-font-label);
    font-weight: 400;
    font-size: clamp(calc(0.56rem * var(--ds-type-scale)), calc(0.78vw * var(--ds-type-scale)), calc(0.72rem * var(--ds-type-scale)));
    letter-spacing: 0.14em;
    text-shadow: 0 1px 0 rgba(255, 244, 210, 0.62);
    z-index: 1;
}

.ds-button--art > * {
    position: relative;
    z-index: 2;
}

.ds-button--art::before {
    inset: 10% 5%;
    z-index: -1;
    opacity: 1;
    transform: none;
    border: none;
    border-radius: var(--ds-radius-pill);
    background:
        radial-gradient(ellipse at 50% 50%, rgba(255, 236, 190, 0.18) 0%, rgba(255, 225, 170, 0.12) 42%, rgba(255, 225, 170, 0) 74%),
        var(--ds-surface-button-primary);
    clip-path: none;
    box-shadow: inset 0 0 0 1px rgba(255, 246, 220, 0.24), var(--ds-shadow-selected);
    transition: filter var(--ds-motion-fast) ease, box-shadow var(--ds-motion-base) ease;
}

.ds-button--art:hover::before,
.ds-button--art:focus-visible::before {
    filter: brightness(1.1);
    /* Glow stays anchored to the button shape rather than drifting outside */
    box-shadow: inset 0 0 0 1px rgba(255, 252, 236, 0.42), var(--ds-shadow-selected);
}

/* Suppress the underlying .ds-button hover lift+border on art buttons so the
   glow doesn't float outside the painted shape. */
.ds-button--art:hover,
.ds-button--art:focus-visible {
    transform: none;
    border-color: transparent;
    box-shadow: none;
}

.ds-field-row {
    display: grid;
    grid-template-columns: 110px 1fr 64px;
    align-items: center;
    gap: var(--ds-space-2);
    padding: var(--ds-space-2);
    border-radius: var(--ds-radius-sm);
    border: var(--ds-border-width) solid var(--ds-color-border-soft);
    background: rgba(11, 17, 31, 0.72);
}

/* Toggle row — label LEFT, value RIGHT. The checkbox sits in the value
   slot so it never floats centered. */
.ds-field-row--toggle {
    grid-template-columns: 1fr auto auto;
    column-gap: var(--ds-space-3);
}

.ds-field-row--toggle label {
    text-align: left;
}

.ds-field-row--toggle input[type='checkbox'] {
    width: 22px;
    height: 22px;
    margin: 0;
    /* Use the cool blue accent — yellow on a yellow border looked muddy. */
    accent-color: var(--ds-color-accent-blue);
}

.ds-field-row--toggle .ds-field-value {
    min-width: 56px;
    text-align: right;
}

.ds-field-row label {
    font-family: var(--ds-font-label);
    font-size: clamp(calc(0.34rem * var(--ds-type-scale)), calc(0.44vw * var(--ds-type-scale)), calc(0.42rem * var(--ds-type-scale)));
    color: var(--ds-color-text-secondary);
}

.ds-field-row input[type='range'] {
    width: 100%;
}

.ds-field-row output,
.ds-field-row .ds-field-value {
    text-align: right;
    font-family: var(--ds-font-label);
    font-size: clamp(calc(0.34rem * var(--ds-type-scale)), calc(0.44vw * var(--ds-type-scale)), calc(0.42rem * var(--ds-type-scale)));
    color: var(--ds-color-text-gold);
}

.ds-banner,
#sigil-toast,
#now-playing-banner {
    border-radius: var(--ds-radius-pill);
    border: var(--ds-border-width) solid rgba(243, 210, 134, 0.28);
    background: rgba(11, 18, 34, 0.76);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.28), inset 0 0 14px rgba(134, 200, 255, 0.08);
}

.ds-banner--inline {
    display: inline-block;
    padding: var(--ds-space-2) var(--ds-space-4);
    width: fit-content;
}

/* ─── Tooltip-on-hover (comic balloon) ───
   Wrap any anchor with .ds-help and add <span class="ds-help__bubble">…</span>.
   The bubble pixel-pops in from below on hover/focus. Pixel copy by default. */
.ds-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: help;
    color: var(--ds-color-text-gold);
}

.ds-help__icon {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--ds-color-border-base);
    background: rgba(8, 13, 26, 0.72);
    font-family: var(--ds-font-label);
    font-size: 9px;
    color: var(--ds-color-text-gold);
}

.ds-help__bubble {
    /* position: fixed so the bubble escapes every ancestor's overflow:hidden
       and renders above everything. Coords are written by the demo script
       on hover/focus; we keep it offscreen by default. */
    position: fixed;
    top: 0;
    left: 0;
    transform: translateY(6px) scale(0.92);
    transform-origin: bottom center;
    min-width: 180px;
    max-width: 260px;
    padding: var(--ds-space-3) var(--ds-space-3);
    border-radius: var(--ds-radius-md);
    background: linear-gradient(180deg, rgba(28, 38, 64, 0.98), rgba(8, 13, 26, 0.98));
    border: 1px solid var(--ds-color-border-base);
    box-shadow: var(--ds-shadow-panel);
    color: var(--ds-color-text-primary);
    font-family: var(--ds-font-label);
    font-size: 10px;
    line-height: 1.6;
    letter-spacing: 0.06em;
    text-transform: none;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--ds-motion-fast) var(--ds-ease-rise),
        transform var(--ds-motion-base) var(--ds-ease-rise),
        visibility 0s linear var(--ds-motion-base);
    z-index: 9999;
}

/* Comic-balloon tail — diamond pointer at bottom-center */
.ds-help__bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 14px;
    height: 14px;
    transform: translateX(-50%) rotate(45deg);
    background: linear-gradient(180deg, rgba(28, 38, 64, 0.98), rgba(8, 13, 26, 0.98));
    border-right: 1px solid var(--ds-color-border-base);
    border-bottom: 1px solid var(--ds-color-border-base);
}

.ds-help:hover .ds-help__bubble,
.ds-help:focus-visible .ds-help__bubble,
.ds-help:focus-within .ds-help__bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}

.ds-state-card {
    position: relative;
    min-height: 120px;
    padding: var(--ds-space-3);
    border-radius: var(--ds-radius-md);
    border: var(--ds-border-width) solid var(--ds-color-border-soft);
    background: var(--ds-surface-card);
    box-shadow: inset 0 0 14px rgba(134, 200, 255, 0.08);
}

.ds-state-card.is-selected {
    border-color: var(--ds-color-border-strong);
    background: var(--ds-surface-card-selected);
    box-shadow: var(--ds-shadow-selected), inset 0 0 14px rgba(243, 210, 134, 0.16);
}

.ds-state-card.is-locked {
    filter: grayscale(1) brightness(0.62);
    opacity: 0.72;
}

.ds-icon-slot {
    width: 64px;
    aspect-ratio: 1;
    border-radius: var(--ds-radius-sm);
    border: var(--ds-border-width) solid rgba(144, 171, 221, 0.42);
    background: radial-gradient(circle at 35% 30%, rgba(134, 200, 255, 0.24), transparent 34%), linear-gradient(180deg, rgba(24, 37, 61, 0.98), rgba(9, 14, 25, 0.99));
    box-shadow: inset 0 0 14px rgba(134, 200, 255, 0.12);
    transition: transform var(--ds-motion-fast) var(--ds-ease-snap),
                border-color var(--ds-motion-fast) ease,
                box-shadow var(--ds-motion-base) ease;
}

/* Click affordance — cursor + hover lift + tap response. Add .ds-clickable
   on any element you want to feel pressable; the JS toggles selection. */
.ds-clickable {
    cursor: pointer;
    user-select: none;
}

.ds-clickable:hover {
    transform: translateY(-1px);
    border-color: var(--ds-color-border-strong);
}

.ds-clickable:active {
    transform: translateY(0) scale(0.98);
}

/* Sigil slot: taller aspect to match the hexagonal shield art (1 : 1.55),
   deep black backdrop instead of the default blue wash so the universe glow
   reads through the slot. The slot's width still flexes; the height scales
   automatically through aspect-ratio. */
.ds-icon-slot--sigil {
    aspect-ratio: 1 / 1.55;
    border-color: rgba(130, 165, 224, 0.5);
    border-radius: calc(var(--ds-radius-sm) + 4px);
    background: #03050C;
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.4);
}

.ds-icon-slot--selected {
    border-color: var(--ds-color-border-strong);
    box-shadow: var(--ds-shadow-selected), inset 0 0 14px rgba(243, 210, 134, 0.16);
}

/* Locked: dimmed, dark gray contour, padlock symbol. Player can see the
   slot exists but can't interact with it yet. */
.ds-icon-slot.is-locked {
    border-color: rgba(110, 123, 156, 0.32);
    background: rgba(8, 12, 22, 0.78);
    color: rgba(165, 175, 198, 0.4);
    box-shadow: none;
    cursor: not-allowed;
    position: relative;
}

.ds-icon-slot.is-locked::after {
    content: '\01F512'; /* unicode padlock — placeholder until art lands */
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 18px;
    color: rgba(165, 175, 198, 0.38);
    filter: grayscale(1);
}

.ds-progress {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 3px;
    padding: 4px 6px;
    border-radius: var(--ds-radius-pill);
    border: var(--ds-border-width) solid rgba(187, 151, 78, 0.4);
    background: linear-gradient(180deg, rgba(20, 18, 23, 0.98), rgba(10, 14, 22, 0.96));
}

.ds-progress--12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.ds-progress--16 { grid-template-columns: repeat(16, minmax(0, 1fr)); }

.ds-progress__slot {
    min-height: 14px;
    border-radius: var(--ds-radius-pill);
    border: 1px solid rgba(96, 89, 74, 0.52);
    background: linear-gradient(180deg, rgba(47, 40, 36, 0.66), rgba(18, 24, 38, 0.96));
}

.ds-progress__slot.is-base {
    border-color: rgba(241, 203, 109, 0.58);
    background: linear-gradient(90deg, rgba(255, 231, 129, 0.96), rgba(227, 179, 72, 0.9));
}

.ds-progress__slot.is-positive {
    border-color: rgba(126, 231, 205, 0.56);
    background: linear-gradient(90deg, rgba(72, 79, 108, 0.96), rgba(92, 164, 162, 0.82));
}

.ds-progress__slot.is-danger {
    box-shadow: inset 0 0 0 2px rgba(255, 77, 90, 0.88);
}

.ds-code,
.ds-token-list {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(213, 226, 255, 0.9);
}

.ds-specimen-card__id.ds-code {
    line-height: 1.4;
    word-break: break-word;
}

#audio-welcome-card,
#home-options-panel,
#pause-sigils-panel,
#game-over-overlay #final-score-details,
#game-over-overlay #rating-container,
#enlightments-overlay #enlightments-panel,
#enlightments-overlay #enlightments-sigil-section,
#enlightments-overlay #enlightments-lower-board,
#enlightments-overlay .enlightments-loadout-row,
#enlightments-overlay .enlightments-stat {
    border-color: var(--ds-color-border-base);
}

#audio-welcome-card,
#home-options-panel,
#pause-sigils-panel,
#game-over-overlay #final-score-details,
#game-over-overlay #rating-container {
    background: var(--ds-surface-panel-modal);
    box-shadow: var(--ds-shadow-panel);
}

#enlightments-overlay #enlightments-panel,
#enlightments-overlay #enlightments-sigil-section,
#enlightments-overlay #enlightments-lower-board,
#enlightments-overlay .enlightments-loadout-row,
#enlightments-overlay .enlightments-stat {
    box-shadow: var(--ds-shadow-panel);
}

#home-options-title,
#pause-sigils-title,
#rating-title,
#audio-welcome-title,
#pause-title,
#game-over-title,
#enlightments-title {
    color: var(--ds-color-text-gold);
}

#home-options-subtitle,
#audio-welcome-text,
#game-over-overlay .game-over-stat-label,
#game-over-overlay #rating-thanks,
#enlightments-overlay #enlightments-sigil-desc,
#enlightments-overlay #enlightments-tip-desc,
#enlightments-overlay #enlightments-trail-desc {
    color: var(--ds-color-text-secondary);
}

#home-options-close-button,
#enlightments-close-button {
    border-color: var(--ds-color-border-base);
    background: var(--ds-surface-pill);
    color: var(--ds-color-text-primary);
    box-shadow: inset 0 0 10px rgba(134, 200, 255, 0.08);
}

#home-options-close-button:hover,
#home-options-close-button:focus-visible,
#enlightments-close-button:hover,
#enlightments-close-button:focus-visible {
    border-color: var(--ds-color-border-strong);
    box-shadow: var(--ds-shadow-selected), inset 0 0 12px rgba(243, 210, 134, 0.12);
}

#connect-account-button,
#home-options-close-button,
#enlightments-actions button,
#enlightments-full-respec-button,
#enlightments-reset-button {
    font-family: var(--ds-font-label);
}

#connect-account-button {
    background: var(--ds-surface-button-secondary);
    border-color: var(--ds-color-border-soft);
    color: var(--ds-color-text-primary);
}

#connect-account-button:hover,
#connect-account-button:focus-visible {
    border-color: var(--ds-color-border-strong);
    box-shadow: var(--ds-shadow-accent);
}

.home-options-row {
    border-color: var(--ds-color-border-soft);
    background: rgba(11, 17, 31, 0.72);
}

.home-options-row label,
.home-options-row span,
#enlightments-overlay #enlightments-level-label,
#enlightments-overlay #enlightments-points-label,
#enlightments-overlay #enlightments-wallet-label,
#enlightments-overlay #enlightments-respec-label {
    font-family: var(--ds-font-label);
}

#enlightments-overlay #enlightments-level-value,
#enlightments-overlay #enlightments-points-value,
#enlightments-overlay #enlightments-wallet-value,
#enlightments-overlay #enlightments-respec-value {
    font-family: var(--ds-font-number);
    color: var(--ds-color-text-gold);
}

#now-playing-text,
#sigil-toast,
#game-over-overlay #final-score-details span[id^='final-'] {
    color: var(--ds-color-text-primary);
}

#pause-overlay .pause-sigil-toggle,
#pause-overlay .pause-sigil-toggle.is-inactive {
    border-color: var(--ds-color-border-soft);
    background: rgba(9, 14, 29, 0.7);
    color: var(--ds-color-text-secondary);
}

#pause-overlay .pause-sigil-toggle.is-active {
    border-color: var(--ds-color-border-strong);
    color: var(--ds-color-text-gold);
    box-shadow: var(--ds-shadow-selected), inset 0 0 20px rgba(168, 111, 255, 0.28);
}

#game-over-overlay .star {
    color: rgba(175, 194, 244, 0.82);
}

#game-over-overlay .star:hover,
#game-over-overlay .star.filled {
    color: var(--ds-color-text-gold);
    text-shadow: 0 0 10px rgba(255, 223, 145, 0.48);
}

:is(#pause-overlay, #game-over-overlay) .pause-art-button-label,
#audio-welcome-button-text {
    color: var(--ds-color-text-gold);
    font-family: var(--ds-font-display);
}

@media (max-width: 960px) {
    .ds-field-row {
        grid-template-columns: 1fr;
    }
    .ds-field-row--toggle {
        grid-template-columns: 1fr auto auto;
    }
}

/* ─── Seal ───
   A corner stamp that overlays without consuming layout space.
   Drop on any positioning context (.ds-icon-slot, .ds-state-card, .ds-button)
   by giving the parent `position: relative` and adding <span class="ds-seal">NEW!</span>. */
.ds-seal {
    position: absolute;
    top: var(--ds-seal-offset);
    right: var(--ds-seal-offset);
    z-index: 4;
    min-width: var(--ds-seal-size);
    height: var(--ds-seal-size);
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-seal-bg);
    color: var(--ds-seal-text);
    border: 1px solid var(--ds-seal-border);
    box-shadow: var(--ds-seal-shadow);
    font-family: var(--ds-font-label);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    pointer-events: none;
    transform-origin: center;
    animation: ds-pulse-glow 2.4s var(--ds-ease-pulse) infinite;
}

.ds-seal--corner-tl { top: var(--ds-seal-offset); left: var(--ds-seal-offset); right: auto; }
.ds-seal--corner-bl { bottom: var(--ds-seal-offset); left: var(--ds-seal-offset); top: auto; right: auto; }
.ds-seal--corner-br { bottom: var(--ds-seal-offset); right: var(--ds-seal-offset); top: auto; }
.ds-seal--quiet     { animation: none; }

/* Mark the host so authors don't forget the positioning context */
.ds-has-seal { position: relative; }

/* ─── Accordion ─── */
.ds-accordion {
    border: var(--ds-border-width) solid var(--ds-color-border-base);
    border-radius: var(--ds-radius-md);
    background: var(--ds-surface-rail);
    overflow: hidden;
}

.ds-accordion + .ds-accordion {
    margin-top: var(--ds-space-2);
}

.ds-accordion__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    width: 100%;
    padding: var(--ds-space-3) var(--ds-space-4);
    background: transparent;
    border: 0;
    color: var(--ds-color-text-gold);
    font-family: var(--ds-font-display);
    font-size: clamp(calc(0.95rem * var(--ds-type-scale)), calc(1.4vw * var(--ds-type-scale)), calc(1.2rem * var(--ds-type-scale)));
    letter-spacing: 0.04em;
    cursor: pointer;
    text-align: left;
}

.ds-accordion__header:hover,
.ds-accordion__header:focus-visible {
    background: rgba(243, 210, 134, 0.06);
    outline: none;
}

.ds-accordion__chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform var(--ds-accordion-duration) var(--ds-ease-snap);
}

.ds-accordion.is-open .ds-accordion__chevron {
    transform: rotate(45deg);
}

.ds-accordion__body {
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--ds-accordion-duration) var(--ds-ease-rise);
}

.ds-accordion.is-open .ds-accordion__body {
    max-height: var(--ds-accordion-body-h, 800px);
}

.ds-accordion__inner {
    padding: 0 var(--ds-space-4) var(--ds-space-4);
    display: grid;
    gap: var(--ds-space-2);
}

/* ─── Canonical motion signatures ───
   Four shapes that cover almost every UI moment.
   Compose with --ds-motion-* durations and --ds-ease-* curves. */
@keyframes ds-enter-rise {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes ds-enter-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ds-exit-fall {
    from { opacity: 1; transform: translateY(0)    scale(1); }
    to   { opacity: 0; transform: translateY(8px)  scale(0.98); }
}

/* Pulse glow — never transform: scale (that pixel-stretches the host).
   Only the shadow breathes. */
@keyframes ds-pulse-glow {
    0%, 100% { box-shadow: var(--ds-seal-shadow); }
    50%      { box-shadow: var(--ds-seal-shadow), 0 0 22px rgba(243, 210, 134, 0.5), 0 0 6px rgba(255, 244, 210, 0.42); }
}

/* Utility classes — drop on any element to play the signature once */
.ds-motion--enter-rise { animation: ds-enter-rise var(--ds-motion-base) var(--ds-ease-rise) both; }
.ds-motion--enter-fade { animation: ds-enter-fade var(--ds-motion-base) var(--ds-ease-rise) both; }
.ds-motion--exit-fall  { animation: ds-exit-fall  var(--ds-motion-base) var(--ds-ease-fall) both; }
.ds-motion--pulse-glow { animation: ds-pulse-glow 2.4s var(--ds-ease-pulse) infinite; }

@media (prefers-reduced-motion: reduce) {
    .ds-motion--enter-rise,
    .ds-motion--enter-fade,
    .ds-motion--exit-fall,
    .ds-motion--pulse-glow,
    .ds-seal {
        animation: none !important;
    }
}

/* ─── i18n swap transition ───
   Targets every [data-i18n] node. The leaving state slides right + fades out;
   the entering state arrives from the left and settles. */
[data-i18n] {
    transition:
        opacity var(--ds-motion-fast) var(--ds-ease-fall),
        transform var(--ds-motion-fast) var(--ds-ease-fall);
    will-change: opacity, transform;
}

[data-i18n].ds-i18n-leaving {
    opacity: 0;
    transform: translateX(20px);
}

[data-i18n].ds-i18n-entering {
    opacity: 0;
    transform: translateX(-20px);
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    [data-i18n] { transition: none; }
    [data-i18n].ds-i18n-leaving,
    [data-i18n].ds-i18n-entering { opacity: 1; transform: none; }
}
