/* ============================================================
   Algorune brand layer on 0x

   Ancient basalt hall - NOT neon / cyber / SaaS.
   Kill 0x cyan. UI chrome is bone, ash, copper, deep stone.
   Glyph colors stay on the seals only (tiles), not the chrome.
   ============================================================ */

:root {
    /* inscription display - carved stone, not futurist display */
    --font-display: "Cinzel", "Times New Roman", serif;

    /* deep basalt cave - warmer and dustier than pure black */
    --bg: #12110f;
    --surface: #1c1a17;
    --surface-strong: #28251f;
    --text: #d8d2c4;
    --text-muted: #9a9284;
    --text-faint: #6e675c;
    --hairline: rgba(216, 210, 196, 0.1);
    --header-bg: #1c1a17;

    /* primary chrome accent = bone / limestone (no cyan) */
    --shine: #c4b8a0;
    --shine-strong: #8a7f6a;
    --shine-bright: #e4dcc8;
    --on-shine: #12110f;

    /* secondary = copper / banked ember (muted, not neon orange) */
    --shine-2: #b56a38;
    --shine-2-strong: #6e3a18;
    --shine-2-bright: #d49a5c;
    --on-shine-2: #12110f;

    /* stone steps from generator PAL */
    --stone-d: #2e2c28;
    --stone-m: #3f3c36;
    --stone-l: #545048;
    --crack: #1a1814;
    --outline: #0a0908;

    /* trait swatches (on seals / chips only - keep true) */
    --rune-ember: #c45a22;
    --rune-ember-hi: #d49a5c;
    --rune-frost: #5a8aaa;
    --rune-frost-hi: #8ab4c8;
    --rune-venom: #4a8a3a;
    --rune-void: #6a4a8a;
    --rune-gold: #b8983a;
    --rune-none: #6e6a62;

    --danger: #a85a4a;
    --warning: var(--rune-gold);
    --success: var(--rune-venom);
    --info: var(--shine);

    --chart-1: var(--shine);
    --chart-2: var(--shine-2);
    --chart-3: var(--rune-void);
    --chart-4: var(--rune-gold);
    --chart-5: var(--rune-venom);

    --radius: 0px;
    --rune-inset:
        inset 0 1px 0 rgba(232, 220, 196, 0.05),
        inset 0 -2px 0 rgba(0, 0, 0, 0.5);
    --rune-ridge: 1px solid var(--stone-m);
    --rune-shadow: 0 0 0 1px var(--outline), 3px 4px 0 rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
    --bg: #e8e2d4;
    --surface: #f2ede2;
    --surface-strong: #ddd4c4;
    --text: #1c1814;
    --text-muted: #4a443c;
    --text-faint: #6e675c;
    --hairline: rgba(28, 24, 20, 0.12);
    --header-bg: #f2ede2;

    --shine: #5a5040;
    --shine-strong: #3a3428;
    --shine-bright: #7a6e58;
    --on-shine: #f2ede2;

    --shine-2: #8a4a22;
    --shine-2-strong: #5a2e12;
    --shine-2-bright: #a85e2e;
    --on-shine-2: #f2ede2;

    --stone-d: #c8c0b0;
    --stone-m: #b0a890;
    --stone-l: #968e78;
    --crack: #d8d0c0;
    --outline: #e8e2d4;

    --chart-1: var(--shine);
    --chart-2: var(--shine-2);
    --chart-3: #5a3a6a;
    --chart-4: #8a6a20;
    --chart-5: #3a6a2a;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #e8e2d4;
        --surface: #f2ede2;
        --surface-strong: #ddd4c4;
        --text: #1c1814;
        --text-muted: #4a443c;
        --text-faint: #6e675c;
        --hairline: rgba(28, 24, 20, 0.12);
        --header-bg: #f2ede2;

        --shine: #5a5040;
        --shine-strong: #3a3428;
        --shine-bright: #7a6e58;
        --on-shine: #f2ede2;

        --shine-2: #8a4a22;
        --shine-2-strong: #5a2e12;
        --shine-2-bright: #a85e2e;
        --on-shine-2: #f2ede2;

        --stone-d: #c8c0b0;
        --stone-m: #b0a890;
        --stone-l: #968e78;
        --crack: #d8d0c0;
        --outline: #e8e2d4;

        --chart-1: var(--shine);
        --chart-2: var(--shine-2);
        --chart-3: #5a3a6a;
        --chart-4: #8a6a20;
        --chart-5: #3a6a2a;
    }
}

/* Page chrome */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-mono);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg);
    /* dust + coarse grit - no grid cyber lines */
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(180, 160, 120, 0.06), transparent 55%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 5px,
            rgba(0, 0, 0, 0.08) 5px,
            rgba(0, 0, 0, 0.08) 6px
        );
    overflow-x: hidden;
}

a {
    color: var(--shine-2-bright);
    text-decoration: none;
}
a:hover {
    color: var(--shine-bright);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.shell {
    width: min(100%, var(--page-max));
    margin: 0 auto;
    /* gutters: safe-area + fluid pad; never wider than 5vw on small screens */
    --shell-pad: max(12px, env(safe-area-inset-left, 0px), min(var(--pad), 4.5vw));
    --shell-pad-r: max(12px, env(safe-area-inset-right, 0px), min(var(--pad), 4.5vw));
    padding: 0 var(--shell-pad-r) calc(var(--space-9) + env(safe-area-inset-bottom, 0px));
    padding-left: var(--shell-pad);
    padding-right: var(--shell-pad-r);
    box-sizing: border-box;
    overflow-x: clip;
}

@media (min-width: 720px) {
    .shell {
        --shell-pad: max(16px, env(safe-area-inset-left, 0px), min(var(--pad), 5vw));
        --shell-pad-r: max(16px, env(safe-area-inset-right, 0px), min(var(--pad), 5vw));
    }
}

/* Header - tablet lip; CSS grid so mobile always gets brand row + nav row */
.top {
    --top-gutter: max(12px, env(safe-area-inset-left, 0px), min(var(--pad), 4vw));
    --top-gutter-r: max(12px, env(safe-area-inset-right, 0px), min(var(--pad), 4vw));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "mark actions"
        "nav nav";
    align-items: center;
    column-gap: var(--space-2);
    row-gap: 0;
    padding: max(var(--space-2), env(safe-area-inset-top, 0px)) var(--top-gutter-r) 0 var(--top-gutter);
    border-bottom: 2px solid var(--stone-d);
    box-shadow: 0 1px 0 var(--outline), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
    margin-bottom: var(--space-5);
    margin-left: calc(-1 * var(--top-gutter));
    margin-right: calc(-1 * var(--top-gutter-r));
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 20;
    width: auto;
    max-width: none;
}

.top .mark {
    grid-area: mark;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-size: clamp(1rem, 4.5vw, 1.35rem);
    color: var(--text);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.top .mark:hover {
    color: var(--shine-bright);
    text-decoration: none;
}
.top .mark img {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 0;
    border: 1px solid var(--stone-m);
    box-shadow: 0 0 0 1px var(--outline);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: var(--outline);
}

.top nav {
    grid-area: nav;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    border-top: 1px solid var(--stone-d);
    margin-top: var(--space-1);
}
.top nav::-webkit-scrollbar {
    display: none;
}
.top nav a {
    color: var(--text-muted);
    font-size: clamp(0.7rem, 2.8vw, var(--text-sm));
    font-weight: 500;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-3);
    border-radius: 0;
    flex: 1 0 auto;
    min-width: max-content;
}
.top nav a:hover,
.top nav a[aria-current="page"] {
    color: var(--shine-bright);
    text-decoration: none;
}
.top nav a[aria-current="page"] {
    border-bottom: 2px solid var(--shine-2);
    color: var(--shine-bright);
    background: rgba(181, 106, 56, 0.08);
}

.top-actions {
    grid-area: actions;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    justify-self: end;
}

.wallet-btn {
    font: 600 0.7rem / 1.2 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-strong);
    border: 1px solid var(--stone-d);
    border-radius: var(--radius);
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px;
    cursor: pointer;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wallet-btn:hover {
    border-color: var(--shine-2);
    color: var(--shine-2-bright);
}
.wallet-btn:focus-visible {
    outline: 2px solid var(--shine);
    outline-offset: 2px;
}
.wallet-btn[hidden] {
    display: none !important;
}

/* Connected profile: opens bag */
.profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    color: var(--text-muted);
    background: var(--surface-strong);
    border: 1px solid var(--stone-d);
    border-radius: 50%;
    cursor: pointer;
}
.profile-btn svg {
    width: 22px;
    height: 22px;
}
.profile-btn:hover {
    border-color: var(--shine-2);
    color: var(--shine-2-bright);
}
.profile-btn:focus-visible {
    outline: 2px solid var(--shine);
    outline-offset: 2px;
}
.profile-btn.is-on {
    border-color: var(--stone-m);
    color: var(--shine-bright);
}
.profile-btn[hidden] {
    display: none !important;
}

.bag-address {
    width: 100%;
    max-width: 36rem;
    font: 500 var(--text-sm) / 1.2 var(--font-mono);
    color: var(--text);
    background: var(--crack);
    border: 2px solid var(--stone-d);
    padding: var(--space-2) var(--space-3);
    min-height: 44px;
    font-size: max(16px, var(--text-sm));
}
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.wallet-picker {
    margin-top: var(--space-3);
}
.wallet-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
}
#bagGate[hidden],
#bagOwnedPanel[hidden] {
    display: none !important;
}
#bagGate .h-btn {
    margin-top: var(--space-3);
}
.wallet-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    text-align: left;
    font: 500 var(--text-sm) / 1.2 var(--font-mono);
    color: var(--text);
    background: var(--crack);
    border: 2px solid var(--stone-d);
    min-height: 48px;
    padding: 10px 14px;
    cursor: pointer;
}
.wallet-option:hover {
    border-color: var(--shine-2);
    color: var(--shine-bright);
}
.wallet-option img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}
.bag-empty {
    margin-top: var(--space-4);
}
.bag-empty[hidden] {
    display: none !important;
}
.filters label:has(#f-owned) {
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
    text-transform: none;
    letter-spacing: 0.04em;
}
.filters label:has(#f-owned) input {
    width: auto;
    min-height: 20px;
    min-width: 20px;
}

.holders-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-2);
}
.holder-row {
    display: grid;
    grid-template-columns: 7.5rem 5.5rem 1fr;
    gap: var(--space-2);
    align-items: baseline;
    padding: 8px 10px;
    border: 1px solid var(--stone-d);
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--text-sm);
}
.holder-row:hover {
    border-color: var(--shine-2);
    color: var(--shine-bright);
}
.holder-addr {
    font-family: var(--font-mono);
    color: var(--text);
}
.holder-count {
    color: var(--shine-2-bright);
}
.holder-sample {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-faint);
}
@media (max-width: 560px) {
    .holder-row {
        grid-template-columns: 1fr auto;
    }
    .holder-sample {
        grid-column: 1 / -1;
    }
}
.bag-asa {
    font-size: 11px;
    color: var(--text-faint);
}


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

.top .ox-theme-toggle {
    flex-shrink: 0;
}

@media (min-width: 720px) {
    .top {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-3) var(--space-5);
        padding-top: max(var(--space-4), env(safe-area-inset-top, 0px));
        padding-bottom: var(--space-4);
        margin-bottom: var(--space-6);
        align-items: center;
    }
    .top .mark {
        font-size: max(20px, var(--text-xl));
        margin-right: auto;
    }
    .top .mark img {
        width: 32px;
        height: 32px;
    }
    .top nav {
        width: auto;
        overflow: visible;
        gap: var(--space-2) var(--space-4);
        flex-wrap: wrap;
        border-top: 0;
        margin-top: 0;
        flex: 0 1 auto;
    }
    .top nav a {
        padding: 0;
        flex: 0 0 auto;
        justify-content: flex-start;
        font-size: var(--text-sm);
        background: transparent;
    }
    .top nav a[aria-current="page"] {
        background: transparent;
    }
    .top-actions {
        justify-self: auto;
        order: 3;
    }
}

/* Hero */
.hero {
    margin: 0 0 var(--space-5);
}
.hero-frame {
    border: 4px solid var(--stone-m);
    border-radius: 0;
    background: var(--outline);
    overflow: hidden;
    box-shadow:
        var(--rune-inset),
        0 0 0 1px var(--outline),
        5px 7px 0 rgba(0, 0, 0, 0.5);
    outline: 2px solid var(--stone-d);
    outline-offset: -8px;
    /* copper base, bone top - stone lip, not neon */
    border-top-color: var(--shine);
    border-bottom-color: var(--shine-2);
}
.hero-banner {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(180px, 38vw);
    object-fit: cover;
    object-position: center 42%;
    background: var(--outline);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    /* mute cyber glow on hero art slightly */
    filter: saturate(0.82) contrast(1.05) brightness(0.95);
}
@media (min-width: 560px) {
    .hero-banner {
        max-height: min(220px, 36vw);
    }
}
@media (min-width: 720px) {
    .hero-banner {
        max-height: 260px;
    }
}
.hero-body {
    margin-top: var(--space-5);
    max-width: 40rem;
}
.eyebrow {
    margin: 0 0 var(--space-2);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.sigil-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15em 0;
    margin: 0 0 var(--space-4);
    font-size: clamp(0.75rem, 2.8vw, var(--text-sm));
    color: var(--text-faint);
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}
.dot-sep {
    margin: 0 0.35em;
    color: var(--stone-l);
    opacity: 0.8;
    flex-shrink: 0;
}

/* Seal count - carved tally, not neon progress HUD */
.status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
    font-size: clamp(0.8rem, 3.2vw, var(--text-sm));
    line-height: 1.35;
    border: 2px solid var(--stone-d);
    background: var(--surface);
    box-shadow: var(--rune-inset), var(--rune-shadow);
}
.status-label {
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
    font-size: 0.7rem;
}
.status-value {
    color: var(--shine-bright);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.status-sep {
    color: var(--stone-l);
}
.status-total {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.status-track {
    flex: 1 1 100%;
    height: 6px;
    margin-top: var(--space-1);
    background:
        repeating-linear-gradient(
            90deg,
            var(--crack) 0 10px,
            var(--stone-d) 10px 11px
        );
    border: 1px solid var(--stone-d);
    border-radius: 0;
    overflow: hidden;
    min-width: 48px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55);
}
.status-track.wide {
    margin-top: var(--space-3);
    height: 8px;
}
.status-fill {
    height: 100%;
    width: 0%;
    background: var(--shine-2);
    border-radius: 0;
    transition: width 0.4s steps(16, end);
    opacity: 0.9;
}

/* Mint list */
.mint-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: min(60vh, 480px);
    overflow: auto;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
}
.mint-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "name design"
        "id id";
    gap: 2px var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--hairline);
    color: var(--text);
    text-decoration: none;
    font-size: var(--text-sm);
    min-height: 44px;
    align-items: center;
}
@media (min-width: 560px) {
    .mint-row {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas: "name id design";
        gap: var(--space-2) var(--space-3);
        padding: var(--space-3) var(--space-4);
    }
}
.mint-row:last-child {
    border-bottom: 0;
}
.mint-row:hover {
    background: var(--surface-strong);
    color: var(--shine);
    text-decoration: none;
}
.mint-name {
    grid-area: name;
    font-weight: 500;
    overflow-wrap: anywhere;
    min-width: 0;
}
.mint-id {
    grid-area: id;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    font-size: 0.8em;
    overflow-wrap: anywhere;
}
@media (min-width: 560px) {
    .mint-id {
        font-size: inherit;
    }
}
.mint-design {
    grid-area: design;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.mono-break {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    word-break: break-all;
    color: var(--text-muted);
    margin: 0 0 var(--space-3);
}

/* Type */
h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    min-height: 1.15em;
    line-height: 1.1;
    margin: 0 0 var(--space-3);
    color: var(--text);
    max-width: var(--measure);
    overflow-wrap: anywhere;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-shadow: 0 2px 0 var(--outline);
}

h2 {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 0 0 var(--space-3);
}

.lede {
    max-width: var(--measure);
    color: var(--text-muted);
    margin: 0 0 var(--space-5);
    font-size: clamp(var(--text-base), 2.8vw, var(--text-lg));
    overflow-wrap: break-word;
}

.note {
    font-size: var(--text-sm);
    color: var(--text-faint);
    margin: 0 0 var(--space-4);
    overflow-wrap: break-word;
}

/* Panels - chiseled tablets */
.panel {
    border: var(--rune-ridge);
    border-color: var(--stone-d);
    background: var(--surface);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    max-width: 100%;
    overflow: hidden;
    box-shadow: var(--rune-inset), var(--rune-shadow);
    position: relative;
}
.panel::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--stone-l);
    opacity: 0.7;
}
@media (min-width: 560px) {
    .panel {
        padding: var(--space-5);
    }
}

/* Brand buttons - stamped seals, not soft pills */
.h-btn,
.h-btn-primary,
.h-btn-quiet {
    border-radius: 0 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
}
.h-btn-primary {
    background: var(--shine-2) !important;
    color: var(--on-shine-2) !important;
    border: 2px solid var(--shine-2-strong) !important;
    font-weight: 600;
    box-shadow: 2px 2px 0 var(--outline);
}
.h-btn-primary:hover {
    background: var(--shine-2-bright) !important;
    color: var(--on-shine-2) !important;
    border-color: var(--shine-2) !important;
}
.h-btn-quiet {
    border: 2px solid var(--stone-m) !important;
    color: var(--text-muted) !important;
    background: var(--surface-strong) !important;
    box-shadow: 2px 2px 0 var(--outline);
}
.h-btn-quiet:hover {
    border-color: var(--shine) !important;
    color: var(--shine-bright) !important;
}

/* Trait color strip */
.trait-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: var(--space-3) 0 var(--space-4);
    list-style: none;
    padding: 0;
}
.trait-strip li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 4px 8px 4px 6px;
    border: 1px solid var(--stone-d);
    border-radius: 0;
    background: var(--crack);
}
.trait-strip .dot {
    width: 10px;
    height: 10px;
    border-radius: 1px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}
.trait-strip .dot.ember { background: var(--rune-ember); }
.trait-strip .dot.frost { background: var(--rune-frost); }
.trait-strip .dot.venom { background: var(--rune-venom); }
.trait-strip .dot.void { background: var(--rune-void); }
.trait-strip .dot.gold { background: var(--rune-gold); }
.trait-strip .dot.none { background: var(--rune-none); }
/* mute neon feel on tiny chips */
.trait-strip .dot {
    opacity: 0.9;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.grid-2 {
    display: grid;
    gap: var(--space-4);
}
@media (min-width: 880px) {
    .grid-2 {
        grid-template-columns: 1.1fr 0.9fr;
    }
}

/* Facts */
.facts {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--text-sm);
}
.facts li {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--hairline);
}
@media (min-width: 480px) {
    .facts li {
        grid-template-columns: 7.5rem 1fr;
        gap: var(--space-3);
        padding: var(--space-2) 0;
    }
}
.facts li:last-child {
    border-bottom: 0;
}
.facts .k {
    color: var(--text-faint);
}
.facts .v {
    color: var(--text);
    overflow-wrap: anywhere;
}

/* Tables - scroll on narrow screens */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0 calc(-1 * var(--space-2));
    padding: 0 var(--space-2);
}
table.traits {
    width: 100%;
    min-width: 280px;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
table.traits th,
table.traits td {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--hairline);
    vertical-align: top;
}
table.traits th {
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: var(--text-sm);
    white-space: nowrap;
}
table.traits td .sw {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: var(--radius);
    margin-right: var(--space-2);
    vertical-align: middle;
    border: 1px solid var(--hairline);
}

/* Trait visual tiles */
.trait-visuals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}
@media (min-width: 560px) {
    .trait-visuals {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: var(--space-3);
    }
}
.trait-visuals-house {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (min-width: 720px) {
    .trait-visuals-house {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}
.trait-tile {
    margin: 0;
    border: 2px solid var(--stone-d);
    background: var(--outline);
    box-shadow: var(--rune-inset), 2px 2px 0 var(--outline);
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.trait-tile:hover,
.trait-tile:focus-visible {
    border-color: var(--shine-2);
    outline: none;
}
.trait-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--outline);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.trait-tile figcaption {
    padding: 6px 8px 8px;
    background: var(--surface);
    border-top: 1px solid var(--stone-d);
    font-size: 11px;
    line-height: 1.3;
}
.trait-tile figcaption strong {
    display: block;
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.trait-tile figcaption span {
    color: var(--text-faint);
    font-size: 10px;
}
.trait-tile-sm figcaption {
    padding: 4px 6px 6px;
    text-align: center;
}

.trait-sheets {
    display: grid;
    gap: var(--space-4);
}
.trait-sheet-card {
    margin: 0;
    border: 2px solid var(--stone-d);
    background: var(--surface-strong);
    box-shadow: var(--rune-shadow);
    padding: var(--space-3);
}
.trait-sheet-card figcaption {
    font-size: var(--text-sm);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: var(--space-2);
}
.trait-sheet,
.trait-sheet-wrap .trait-sheet {
    display: block;
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    object-position: left center;
    background: var(--outline);
    border: 1px solid var(--stone-d);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.trait-sheet-wrap {
    margin-top: var(--space-2);
}

/* Houses */
.houses {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr;
}
@media (min-width: 900px) {
    .houses {
        grid-template-columns: 1fr 1fr;
    }
}
.house {
    border: 2px solid var(--stone-d);
    border-radius: 0;
    padding: var(--space-4);
    background: var(--surface-strong);
    box-shadow: var(--rune-inset);
}
.house h3 {
    margin: 0 0 var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--shine-2-bright);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.house:nth-child(1) h3 { color: var(--shine); }
.house:nth-child(2) h3 { color: var(--shine-2-bright); }
.house:nth-child(3) h3 { color: var(--text-muted); }
.house:nth-child(4) h3 { color: var(--rune-gold); }
.house ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.7;
}

/* Filters - stacked / 2-col phone, row desktop */
.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    align-items: end;
}
@media (min-width: 400px) {
    .filters {
        grid-template-columns: 1fr 1fr;
    }
}
.filters label {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: var(--text-sm);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 500;
    min-width: 0;
}
.filters label:has(#f-q),
.filters label:has(input[type="search"]) {
    grid-column: 1 / -1;
}
.filters select,
.filters input {
    font: 500 var(--text-sm) / 1.2 var(--font-mono);
    color: var(--text);
    background: var(--crack);
    border: 2px solid var(--stone-d);
    border-radius: 0;
    padding: var(--space-2) var(--space-3);
    width: 100%;
    min-width: 0;
    min-height: 44px;
    /* ≥16px avoids iOS focus zoom */
    font-size: max(16px, var(--text-sm));
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
    appearance: none;
}
.filters select:focus,
.filters input:focus {
    outline: 1px solid var(--shine-2);
    outline-offset: 1px;
}
.filters button {
    font: 500 0.75rem / 1.2 var(--font-mono);
    color: var(--text-muted);
    background: var(--surface-strong);
    border: 2px solid var(--stone-m);
    border-radius: 0;
    padding: 0 var(--space-4);
    cursor: pointer;
    min-height: 44px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    grid-column: 1 / -1;
    width: 100%;
    box-shadow: 2px 2px 0 var(--outline);
}
.filters button:hover {
    border-color: var(--shine-2);
    color: var(--shine-bright);
}
@media (min-width: 720px) {
    .filters {
        display: flex;
        flex-wrap: wrap;
        align-items: end;
    }
    .filters label:has(#f-q),
    .filters label:has(input[type="search"]),
    .filters button {
        grid-column: auto;
        width: auto;
    }
    .filters select,
    .filters input {
        min-width: 120px;
        width: auto;
        font-size: var(--text-sm);
    }
}

.count {
    font-size: var(--text-sm);
    color: var(--text-faint);
    margin: 0 0 var(--space-3);
}

/* Cards - 2-up phones, 3-up mid, auto-fill desktop */
.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}
@media (min-width: 400px) {
    .cards {
        grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    }
}
@media (min-width: 720px) {
    .cards {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
        gap: var(--space-3);
    }
}
@media (min-width: 1100px) {
    .cards {
        grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    }
}
.card {
    position: relative;
    border: 2px solid var(--stone-d);
    border-radius: 0;
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 120ms steps(2), box-shadow 120ms steps(2);
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--rune-inset), 3px 3px 0 var(--outline);
}
.card:hover {
    border-color: var(--shine-2);
    box-shadow: var(--rune-inset), 3px 3px 0 var(--shine-2-strong);
}
.card-minted {
    border-color: var(--stone-m);
}
.card-minted::after {
    content: "✦";
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 11px;
    color: var(--shine-2-bright);
    line-height: 1;
    pointer-events: none;
    text-shadow: 1px 1px 0 var(--outline);
}
.card-owned {
    border-color: var(--shine-2);
    box-shadow: var(--rune-inset), 2px 2px 0 var(--shine-2-strong);
}
.card-owned::after {
    content: "◆";
    color: var(--shine-bright);
}
.card:focus-visible {
    outline: 2px solid var(--shine);
    outline-offset: 2px;
}
.card img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--outline);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    /* seals keep color; slight desat so UI does not feel neon arcade */
    filter: saturate(0.88) contrast(1.04);
}
.card .cap {
    padding: var(--space-2) var(--space-3) var(--space-3);
    font-size: 12px;
    line-height: 1.35;
}
@media (min-width: 480px) {
    .card .cap {
        font-size: var(--text-sm);
    }
}
.card .cap strong {
    display: block;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}
.card .cap span {
    color: var(--text-faint);
}

.samples {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}
@media (min-width: 560px) {
    .samples {
        grid-template-columns: repeat(4, 1fr);
    }
}
.samples img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--bg);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    image-rendering: pixelated;
}

.muted-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-muted);
    font-size: var(--text-sm);
}
.muted-list li {
    margin: var(--space-1) 0;
}

.view[hidden] {
    display: none !important;
}

/* Primary actions full-width on small screens */
.panel .h-btn {
    max-width: 100%;
}
@media (max-width: 559px) {
    .panel .h-btn,
    .panel a.h-btn {
        width: 100%;
        box-sizing: border-box;
    }
}

.footer {
    margin-top: var(--space-8);
    padding-top: var(--space-4);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--stone-d);
    font-size: var(--text-sm);
    color: var(--text-faint);
    overflow-wrap: anywhere;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15em 0;
}
.footer-mark {
    color: var(--shine-2);
    margin-right: 0.35em;
}
.panel-tight {
    padding-top: var(--space-4);
}
.panel h2 {
    letter-spacing: 0.12em;
}

/* Color table swatches get a stone frame */
table.traits td .sw {
    box-shadow: 0 0 0 1px var(--outline);
    border-radius: 1px;
}

/* Status bar brand frame */
.status-bar {
    border-color: var(--stone-d) !important;
    box-shadow: var(--rune-inset);
    background: var(--surface) !important;
}

/* Lightbox */
.lb {
    position: fixed;
    inset: 0;
    background: rgba(14, 21, 22, 0.88);
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    z-index: 40;
    overscroll-behavior: contain;
}
@media (min-width: 560px) {
    .lb {
        align-items: center;
        padding: var(--space-5);
    }
}
.lb.open {
    display: flex;
}
.lb-inner {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius) var(--radius) 0 0;
    width: min(420px, 100%);
    max-height: min(92dvh, 100%);
    overflow: auto;
    padding: var(--space-4);
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 560px) {
    .lb-inner {
        border-radius: var(--radius);
        max-width: min(420px, 100%);
        width: auto;
        max-height: min(90vh, 900px);
    }
}
.lb-inner img {
    width: 100%;
    max-height: 50dvh;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--bg);
    image-rendering: pixelated;
    border-radius: var(--radius);
}
.lb-inner h3 {
    margin: var(--space-3) 0 var(--space-2);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: 500;
    overflow-wrap: anywhere;
}
.lb-inner dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(4.5rem, 30%) minmax(0, 1fr);
    gap: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
}
.lb-inner dt {
    color: var(--text-faint);
}
.lb-inner dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
    min-width: 0;
}
.lb-inner .h-btn {
    width: 100%;
    margin-top: var(--space-3);
    min-height: 44px;
}

/* Collector readout: one carved ledger, drawn only from the connected Bag. */
.bag-readout {
    margin: var(--space-4) 0;
    padding: var(--space-4);
    border: 2px solid var(--stone-d);
    background: linear-gradient(135deg, var(--surface-strong), var(--surface));
    box-shadow: var(--rune-inset), var(--rune-shadow);
}
.bag-readout h2 {
    margin: 0 0 var(--space-2);
}
.bag-readout > .note {
    margin: 0 0 var(--space-4);
}
.bag-readout-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
}
.bag-readout-stats > div {
    padding: var(--space-2);
    border-left: 2px solid var(--shine-2-strong);
    background: var(--bg);
}
.bag-readout-stats dt {
    color: var(--text-faint);
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.bag-readout-stats dd {
    margin: var(--space-1) 0 0;
    color: var(--text);
    font: 700 var(--text-lg)/1 var(--font-display);
}
@media (max-width: 520px) {
    .bag-readout-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Extra-narrow phones (iPhone SE / 320–360) */
@media (max-width: 359px) {
    .cards {
        gap: var(--space-1);
    }
    .card .cap {
        padding: var(--space-1) var(--space-2) var(--space-2);
        font-size: 11px;
    }
    .trait-visuals {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .status-bar {
        padding: var(--space-2) var(--space-3);
    }
    .hero-banner {
        max-height: min(160px, 48vw);
    }
}

/* Landscape phones: keep sticky chrome compact */
@media (max-height: 420px) and (orientation: landscape) {
    .top {
        position: static;
    }
    .hero-banner {
        max-height: 120px;
    }
    .lb {
        align-items: stretch;
    }
    .lb-inner {
        max-height: 100dvh;
        border-radius: 0;
        width: 100%;
    }
    .lb-inner img {
        max-height: 40dvh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .h-btn,
    .ox-theme-toggle {
        transition: none;
    }
}
