/* ─────────────────────────────────────────────────────────────────────────
   UPATREE — Stream Info
   Editorial-meets-terminal: serif display, mono triggers, deep ink-purple.
   ───────────────────────────────────────────────────────────────────────── */

:root {
    /* Background palette — never pure black */
    --bg-deep:      #0c0815;
    --bg-base:      #11091c;
    --bg-elevated:  #18102b;
    --bg-card:      #1d1535;
    --bg-card-hi:   #251a3f;

    /* Text */
    --text-cream:   #f0e8e2;
    --text-soft:    #d6c9d4;
    --text-mute:    #9a8fae;
    --text-faint:   #6b6378;

    /* Brand accents */
    --pp-1:         #ce7aff;  /* primary */
    --pp-2:         #a888cc;  /* secondary */
    --pp-3:         #c8a8e8;  /* tertiary, soft */
    --pp-4:         #e8c8ff;  /* lightest */
    --pp-hot:       #ff77e0;  /* hot accent, rare */
    --pp-deep:      #5b3784;  /* deep for borders */

    /* Borders & lines */
    --rule:         #261b46;
    --rule-soft:    #1f1638;

    /* Status colors */
    --warn:         #ff8a5b;
    --cap:          #ff6b8a;

    /* Fonts */
    --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
    --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'Menlo', 'Courier New', monospace;

    /* Layout */
    --max-w:        76rem;
    --gutter:       clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    background: var(--bg-deep);
    color-scheme: dark;
    scroll-behavior: smooth;
}

html::before {
    /* Soft gradient atmosphere — pulled to top, fades into ink */
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 100% 60% at 80% -10%, rgba(206, 122, 255, 0.10), transparent 60%),
        radial-gradient(ellipse 80% 50% at 10% 20%, rgba(168, 136, 204, 0.07), transparent 55%),
        linear-gradient(180deg, var(--bg-base) 0%, var(--bg-deep) 100%);
    pointer-events: none;
    z-index: -2;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-soft);
    font-feature-settings: 'ss01', 'ss02';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Grain overlay — subtle, gives the page tooth */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.2 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

::selection {
    background: var(--pp-1);
    color: var(--bg-deep);
}

/* ─────────────────────────────────────────────────────────────────────────
   SHELL — top bar and breadcrumbs, drawn by site.js on every page
   ───────────────────────────────────────────────────────────────────────── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(17, 9, 28, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rule);
}

.topbar-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0.7rem var(--gutter);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mainnav {
    display: flex;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: -0.7rem;
}

.mainnav::-webkit-scrollbar { display: none; }

.mainnav a,
.watch {
    font-size: 0.92rem;
    color: var(--text-mute);
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease;
}

.mainnav a:hover,
.mainnav a:focus-visible {
    color: var(--text-cream);
    background: var(--bg-card);
}

.mainnav a[aria-current="page"] {
    color: var(--text-cream);
    background: var(--bg-card-hi);
}

.watch {
    flex: none;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    border: 1px solid var(--rule);
    border-radius: 99px;
    padding: 0.3rem 0.75rem;
}

.watch:hover,
.watch:focus-visible {
    color: var(--text-cream);
    border-color: var(--pp-deep);
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-faint);
}

.crumbs a {
    color: var(--pp-1);
    text-decoration: none;
}

.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─────────────────────────────────────────────────────────────────────────
   HOME — a directory of sections, grouped
   ───────────────────────────────────────────────────────────────────────── */

.home-hero {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: clamp(2.5rem, 7vw, 4.5rem) var(--gutter) clamp(2rem, 5vw, 3rem);
    display: grid;
    gap: 1.1rem;
}

.home-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    font-weight: 400;
    line-height: 1.02;
    letter-spacing: -0.02em;
    color: var(--text-cream);
    font-variation-settings: 'opsz' 144, 'SOFT' 50;
    max-width: 16ch;
    text-wrap: balance;
}

.home-title em {
    font-style: italic;
    color: var(--pp-3);
}

.home-lede {
    font-size: 1.05rem;
    color: var(--text-mute);
    max-width: 38rem;
}

.home-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.75rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-faint);
}

.home-facts b {
    color: var(--text-cream);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.home-groups {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--gutter) clamp(2rem, 6vw, 4rem);
}

.group {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1.5rem;
    padding: 1.6rem 0;
    border-top: 1px solid var(--rule);
}

.group-label h2 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--pp-3);
    margin-bottom: 0.25rem;
}

.group-label p {
    font-size: 0.85rem;
    color: var(--text-faint);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
    gap: 0.9rem;
}

.home-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 0.45rem;
    min-width: 0;
    padding: 1.15rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.home-card:hover,
.home-card:focus-visible {
    border-color: var(--pp-deep);
    background: var(--bg-card-hi);
}

.home-card h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-cream);
}

.home-card p {
    font-size: 0.92rem;
    color: var(--text-mute);
}

.home-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-faint);
}

.home-card-meta span:last-child { color: var(--pp-3); }

@media (max-width: 720px) {
    .group { grid-template-columns: 1fr; gap: 0.8rem; }
}

/* Five nav links fill a phone; the footer still links to Twitch */
@media (max-width: 560px) {
    .watch { display: none; }
    .mainnav a { padding: 0.4rem 0.55rem; }
}

/* ─────────────────────────────────────────────────────────────────────────
   SECTIONS — shared
   ───────────────────────────────────────────────────────────────────────── */

.section {
    padding: clamp(3rem, 8vw, 5.5rem) var(--gutter);
    max-width: var(--max-w);
    margin: 0 auto;
    scroll-margin-top: 1.5rem;
}

/* A section that is the whole page sits closer to the top bar */
.section--page {
    padding-top: clamp(2rem, 5vw, 3rem);
}

.section + .section {
    border-top: 1px solid var(--rule-soft);
}

.section-head {
    margin-bottom: clamp(2rem, 5vw, 3rem);
    max-width: 48rem;
}

.section-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.eyebrow-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--pp-1);
    letter-spacing: 0.05em;
}

.eyebrow-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--pp-1) 0%, var(--rule) 30%, transparent 100%);
    max-width: 9rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.015em;
    color: var(--text-cream);
    font-variation-settings: 'opsz' 100, 'SOFT' 40;
    margin-bottom: 0.85rem;
}

.section-lede {
    font-size: 1.05rem;
    color: var(--text-mute);
    line-height: 1.55;
    max-width: 38rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   COMMANDS
   ───────────────────────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    background: var(--bg-elevated);
    border: 1px solid var(--rule);
    border-radius: 4px;
    margin-bottom: 1.5rem;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.filter-bar:focus-within {
    border-color: var(--pp-1);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(206, 122, 255, 0.08);
}

.filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-mute);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: text;
}

.filter-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-cream);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    padding: 0;
    min-width: 0;
}

.filter-bar input::placeholder { color: var(--text-faint); }

.filter-count {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-mute);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.commands-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
    padding: 1.5rem 0;
    text-align: center;
}

.commands-status[hidden] { display: none; }

/* Scrollable container — caps the commands list at ~20 rows tall */
.commands-scroll {
    background: var(--bg-elevated);
    border: 1px solid var(--rule);
    border-radius: 6px;
    max-height: clamp(28rem, 60vh, 40rem);
    overflow-y: auto;
    position: relative;

    /* Themed scrollbar — Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--pp-deep) transparent;
}

/* Themed scrollbar — Webkit */
.commands-scroll::-webkit-scrollbar { width: 8px; }
.commands-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-left: 1px solid var(--rule-soft);
}
.commands-scroll::-webkit-scrollbar-thumb {
    background: var(--pp-deep);
    border-radius: 4px;
    transition: background 0.18s ease;
}
.commands-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--pp-2);
}

/* Edge fade — soft cue that there's more content below */
.commands-scroll::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    display: block;
    height: 1.5rem;
    margin-top: -1.5rem;
    background: linear-gradient(180deg, transparent, var(--bg-elevated));
    pointer-events: none;
}

.scroll-hint {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-faint);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    justify-content: center;
}

.scroll-hint svg {
    animation: hint-bob 2.2s ease-in-out infinite;
}

@keyframes hint-bob {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50%      { transform: translateY(2px); opacity: 1; }
}

/* Compact terminal-row style — IRC-log feeling, ~20 visible at a time */
.commands-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.cmd {
    display: grid;
    grid-template-columns: minmax(7rem, 11rem) 1fr auto;
    align-items: baseline;
    gap: 0 1.1rem;
    padding: 0.65rem 1.15rem;
    border-bottom: 1px solid var(--rule-soft);
    cursor: pointer;
    transition: background 0.12s ease;
    position: relative;
}

.cmd:last-child {
    border-bottom: none;
}

.cmd::before {
    /* Left edge accent on hover / expand */
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--pp-1);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.18s ease;
}

.cmd:hover,
.cmd:focus-within {
    background: var(--bg-card);
}

.cmd:hover::before,
.cmd:focus-within::before,
.cmd[data-expanded="true"]::before {
    transform: scaleY(1);
}

.cmd-title {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--pp-1);
    letter-spacing: -0.01em;
    word-break: break-all;
    line-height: 1.4;
}

.cmd-metas {
    justify-self: end;
    display: inline-flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cmd-meta {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text-faint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.12rem 0.45rem;
    background: var(--bg-card-hi);
    border: 1px solid transparent;
    border-radius: 2px;
    white-space: nowrap;
}

.cmd-meta--dynamic {
    color: var(--pp-3);
    background: rgba(206, 122, 255, 0.06);
    border-color: var(--pp-deep);
}

.cmd-meta--auto {
    color: var(--text-mute);
    background: rgba(168, 136, 204, 0.05);
    border-color: rgba(168, 136, 204, 0.18);
}

.cmd-response {
    font-size: 0.88rem;
    color: var(--text-soft);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.cmd[data-expanded="true"] {
    background: var(--bg-card);
}

.cmd[data-expanded="true"] .cmd-response {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    padding-top: 0.15rem;
}

.cmd-dynamic-note {
    color: var(--text-mute);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.88rem;
    font-variation-settings: 'opsz' 24;
}

/* On narrow screens, stack title + response */
@media (max-width: 620px) {
    .cmd {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 0.2rem 0.6rem;
    }
    .cmd-title    { grid-column: 1; grid-row: 1; }
    .cmd-metas    { grid-column: 2; grid-row: 1; }
    .cmd-response { grid-column: 1 / -1; grid-row: 2; }
}

.cmd-response a {
    color: var(--pp-3);
    text-decoration: underline;
    text-decoration-color: var(--pp-deep);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.16s ease, color 0.16s ease;
}

.cmd-response a:hover {
    color: var(--pp-1);
    text-decoration-color: var(--pp-1);
}

/* Match-highlight inside filter results */
.cmd mark {
    background: rgba(206, 122, 255, 0.18);
    color: var(--pp-4);
    padding: 0 2px;
    border-radius: 2px;
}

.empty-state {
    text-align: center;
    color: var(--text-mute);
    padding: 3rem 1rem;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.1rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   TIMEOUT
   ───────────────────────────────────────────────────────────────────────── */

.timeout-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.25rem;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 1.5rem 1.6rem 1.7rem;
    position: relative;
}

.card::after {
    /* Top-right corner notch — a small editorial tick */
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background:
        linear-gradient(135deg, transparent 50%, var(--pp-1) 50%);
    opacity: 0.55;
}

.card-head {
    margin-bottom: 1.25rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px dashed var(--rule);
}

.card-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--pp-2);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 600;
    color: var(--text-cream);
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variation-settings: 'opsz' 36;
}

.card-sub {
    margin-top: 0.4rem;
    font-size: 0.92rem;
    color: var(--text-mute);
}

/* Rules card */
.rules-card  { grid-column: 1 / span 5; }
.calc-card   { grid-column: 6 / span 7; }
.examples-card { grid-column: 1 / -1; }

@media (max-width: 880px) {
    .rules-card,
    .calc-card,
    .examples-card { grid-column: 1 / -1; }
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.rule {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.85rem;
    align-items: baseline;
}

.rule dt {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--pp-2);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-top: 0.18rem;
}

.rule dd {
    font-size: 0.96rem;
    color: var(--text-soft);
    line-height: 1.5;
}

.rule dd strong {
    color: var(--text-cream);
    font-weight: 500;
}

.rule dd code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-card-hi);
    color: var(--pp-3);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    border: 1px solid var(--rule);
}

@media (max-width: 540px) {
    .rule { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* Calculator */

.calc-input {
    margin-bottom: 1.4rem;
}

.calc-input > label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-mute);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.calc-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--pp-1);
    font-variation-settings: 'opsz' 36;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-transform: none;
}

.calc-value::after {
    content: ' bits';
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-faint);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-left: 0.35em;
}

/* Range slider — purple, lean */
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 28px;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(90deg, var(--pp-1) 0%, var(--pp-1) var(--fill, 17%), var(--rule) var(--fill, 17%), var(--rule) 100%);
    border-radius: 4px;
}

input[type="range"]::-moz-range-track {
    height: 4px;
    background: var(--rule);
    border-radius: 4px;
}

input[type="range"]::-moz-range-progress {
    height: 4px;
    background: var(--pp-1);
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--bg-card-hi);
    border: 2px solid var(--pp-1);
    border-radius: 50%;
    margin-top: -7px;
    box-shadow: 0 0 0 0 rgba(206, 122, 255, 0.3);
    transition: box-shadow 0.18s ease, transform 0.12s ease;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--bg-card-hi);
    border: 2px solid var(--pp-1);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(206, 122, 255, 0.3);
    transition: box-shadow 0.18s ease, transform 0.12s ease;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px rgba(206, 122, 255, 0.18);
    outline: none;
}

input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.1);
}

.calc-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 0.65rem;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-faint);
    letter-spacing: 0.04em;
}

/* Fates — three slips of paper */
.fates {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

@media (max-width: 480px) {
    .fates { grid-template-columns: 1fr; }
}

.fate {
    padding: 1.05rem 1rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 4px;
    text-align: center;
    position: relative;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.fate::before {
    /* Perforation marks at the top — like a torn ticket */
    content: '';
    position: absolute;
    top: -1px;
    left: 8px;
    right: 8px;
    height: 1px;
    background-image: radial-gradient(circle, var(--rule) 1px, transparent 1.5px);
    background-size: 6px 1px;
    background-repeat: repeat-x;
}

.fate--possible {
    border-color: var(--pp-deep);
}

.fate--possible:hover {
    background: var(--bg-card-hi);
    border-color: var(--pp-1);
}

.fate--blocked {
    opacity: 0.5;
}

.fate-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-mute);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}

.fate-time {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-variation-settings: 'opsz' 60;
    font-weight: 400;
    color: var(--text-cream);
    line-height: 1;
    letter-spacing: -0.025em;
    margin-bottom: 0.35rem;
}

.fate-time .unit {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-faint);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-left: 0.15em;
    vertical-align: 0.4em;
    font-style: normal;
}

.fate-detail {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-mute);
    letter-spacing: 0.04em;
    margin-top: 0.3rem;
}

.fate-tag {
    display: inline-block;
    margin-top: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.18rem 0.5rem;
    border-radius: 2px;
}

.fate-tag--ok       { color: var(--pp-3); background: rgba(206, 122, 255, 0.08); border: 1px solid var(--pp-deep); }
.fate-tag--capped   { color: var(--warn); background: rgba(255, 138, 91, 0.08); border: 1px solid rgba(255, 138, 91, 0.3); }
.fate-tag--blocked  { color: var(--cap); background: rgba(255, 107, 138, 0.06); border: 1px solid rgba(255, 107, 138, 0.25); }

/* Examples */
.examples {
    list-style: none;
    counter-reset: ex;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.examples li {
    counter-increment: ex;
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.05rem;
    background: var(--bg-card);
    border: 1px solid var(--rule-soft);
    border-radius: 4px;
    position: relative;
}

.examples li::before {
    content: counter(ex, decimal-leading-zero);
    position: absolute;
    top: 0.5rem;
    right: 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-faint);
    letter-spacing: 0.06em;
}

.example-cmd {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--pp-3);
    background: var(--bg-deep);
    padding: 0.35rem 0.6rem;
    border-radius: 3px;
    border: 1px solid var(--rule);
    white-space: nowrap;
}

.example-arrow {
    font-family: var(--font-mono);
    color: var(--pp-2);
    font-size: 1rem;
}

.example-result {
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1.4;
}

@media (max-width: 580px) {
    .examples li {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }
    .example-arrow { display: none; }
    .examples li::before { right: 0.65rem; }
}

/* ─────────────────────────────────────────────────────────────────────────
   THEMES
   ───────────────────────────────────────────────────────────────────────── */

.themes-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-faint);
    padding: 1.5rem 0;
    text-align: center;
}

.themes-status[hidden] { display: none; }

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
    gap: 1.1rem;
}

/* Each card wears its own theme via inline CSS vars set in JS */
.theme-card {
    --t-text: #fff;
    --t-primary: #ce7aff;
    --t-secondary: #a888cc;
    --t-bar: #1a1e24;
    --t-dark: #12161c;
    --t-light: #1e2430;

    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(155deg, var(--t-dark) 0%, var(--t-light) 100%);
    color: var(--t-text);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    aspect-ratio: 5 / 4;
    min-height: 18rem;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.theme-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 16px 38px -18px rgba(0, 0, 0, 0.7);
}

/* Top bar mock — mimics the dashboard's navigation strip */
.theme-card-bar {
    height: 1.85rem;
    background: var(--t-bar);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.theme-card-bar::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--t-primary);
    box-shadow:
        7px 0 0 0 color-mix(in srgb, var(--t-text) 35%, transparent),
        14px 0 0 0 color-mix(in srgb, var(--t-text) 35%, transparent);
}

.theme-card-bar-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--t-text) 12%, transparent), transparent);
    margin: 0 0.4rem;
}

.theme-card-bar-tick {
    width: 6px;
    height: 6px;
    border-radius: 1px;
    background: var(--t-secondary);
    opacity: 0.7;
}

/* Body — name, button, accent stripe */
.theme-card-body {
    flex: 1;
    padding: 1.1rem 1.15rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
}

.theme-card-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--t-text) 45%, transparent);
}

.theme-card-name {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 2.5vw, 2.1rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--t-text);
    font-variation-settings: 'opsz' 80, 'SOFT' 30;
    text-transform: lowercase;
    margin-top: -0.1rem;
}

.theme-card-tools {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: auto;
}

.theme-card-button {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.4rem 0.85rem;
    background: var(--t-primary);
    color: var(--t-dark);
    border-radius: 3px;
    font-weight: 700;
    border: none;
    pointer-events: none; /* decorative */
}

.theme-card-bar-accent {
    flex: 1;
    height: 2px;
    background: var(--t-secondary);
    border-radius: 1px;
    opacity: 0.85;
}

/* Swatch row — actual hex codes for the design-curious */
.theme-swatches {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    padding: 0.85rem 1.15rem 1rem;
    background: color-mix(in srgb, var(--t-dark) 70%, black 30%);
    border-top: 1px solid color-mix(in srgb, var(--t-text) 6%, transparent);
}

.theme-swatches li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
}

.theme-swatches .sw-color {
    width: 100%;
    height: 1rem;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.theme-swatches .sw-hex {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.02em;
    color: color-mix(in srgb, var(--t-text) 55%, transparent);
    line-height: 1;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .theme-card { aspect-ratio: auto; min-height: 17rem; }
}

/* ─────────────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────────────── */

.footer {
    padding: 2.5rem 0;
    border-top: 1px solid var(--rule-soft);
    margin-top: 2rem;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: grid;
    gap: 2rem;
}

.sitemap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1.25rem;
}

.sitemap-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    margin-bottom: 0.4rem;
}

.sitemap a {
    display: block;
    padding: 0.12rem 0;
    font-size: 0.9rem;
    color: var(--text-mute);
    text-decoration: none;
}

.sitemap a:hover { color: var(--pp-3); }

.footer-line {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-mark {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-style: italic;
    color: var(--pp-1);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.footer-text {
    font-size: 0.9rem;
    color: var(--text-mute);
}

.footer-text a {
    color: var(--text-cream);
    text-decoration: underline;
    text-decoration-color: var(--pp-deep);
    text-underline-offset: 4px;
    transition: text-decoration-color 0.18s ease, color 0.18s ease;
}

.footer-text a:hover {
    color: var(--pp-1);
    text-decoration-color: var(--pp-1);
}


/* ─────────────────────────────────────────────────────────────────────────
   ACCESSIBILITY
   ───────────────────────────────────────────────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--pp-1);
    outline-offset: 3px;
    border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print — austere */
@media print {
    html::before, .grain, .topbar { display: none; }
    body { background: white; color: black; }
}

/* ─────────────────────────────────────────────────────────────────────────
   SC2 GAMES — data from sc2/, rebuilt nightly by the Overlay box
   ───────────────────────────────────────────────────────────────────────── */

.sc2-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-mute);
}

.sc2-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow: hidden;
}

.sc2-stat {
    background: var(--bg-elevated);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.sc2-stat b {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.9rem;
    line-height: 1.1;
    color: var(--text-cream);
    font-variant-numeric: tabular-nums;
}

.sc2-stat small { font-size: 0.8rem; color: var(--text-mute); }

.sc2-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
}

@media (max-width: 880px) {
    .sc2-grid { grid-template-columns: minmax(0, 1fr); }
}

.sc2-wide { margin-top: 1.25rem; }

.sc2-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
}

.sc2-chart svg { display: block; width: 100%; height: auto; }
.sc2-chart text { font-family: var(--font-mono); font-size: 10px; fill: var(--text-faint); }
.sc2-chart .sc2-last { fill: var(--text-cream); }
.sc2-chart .sc2-grid { stroke: var(--rule); stroke-width: 1; }

.sc2-bars { display: flex; flex-direction: column; gap: 0.75rem; }

.sc2-bar {
    display: grid;
    grid-template-columns: 2.6rem 1fr 6.4rem;
    gap: 0.7rem;
    align-items: center;
}

.sc2-bar-k { font-family: var(--font-mono); color: var(--text-cream); }
.sc2-bar-v { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-mute); text-align: right; }

.sc2-track {
    height: 8px;
    border-radius: 4px;
    background: var(--rule);
    position: relative;
    overflow: hidden;
}

.sc2-track span { position: absolute; inset: 0 auto 0 0; background: var(--pp-1); border-radius: 4px; }

.sc2-track::after {
    /* 50% mark */
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--text-faint);
}

.sc2-sub { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px dashed var(--rule); }

.sc2-grades { display: flex; align-items: flex-end; gap: 4px; height: 64px; margin-top: 0.6rem; }
.sc2-grades div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.sc2-grades i { display: block; width: 100%; background: var(--pp-2); border-radius: 2px 2px 0 0; }
.sc2-grades span { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-mute); }

.sc2-toggle {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-mute);
    background: none;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
}

.sc2-months { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.4rem; scrollbar-width: thin; }

.sc2-months button {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-mute);
    background: var(--bg-base);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
}

.sc2-months button small { font-size: 0.62rem; color: var(--text-faint); }
.sc2-months button[aria-pressed="true"] { border-color: var(--pp-1); color: var(--text-cream); background: var(--bg-card-hi); }

#data-body .sc2-tablewrap { max-height: none; margin-top: 0; }
#data-body a { color: var(--pp-3); text-decoration: none; }
#data-body a:hover { color: var(--pp-1); }
#data-body .sc2-fmt { color: var(--pp-1); }

.sc2-tablewrap {
    overflow: auto;
    max-height: 28rem;
    margin-top: 0.8rem;
    border: 1px solid var(--rule-soft);
    border-radius: 4px;
}

.sc2-table { border-collapse: collapse; width: 100%; min-width: 44rem; font-size: 0.86rem; }

.sc2-table th {
    position: sticky;
    top: 0;
    background: var(--bg-card-hi);
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-mute);
    padding: 0.55rem 0.7rem;
    white-space: nowrap;
}

.sc2-table td {
    padding: 0.5rem 0.7rem;
    border-top: 1px solid var(--rule-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sc2-table td.mono { font-family: var(--font-mono); font-size: 0.8rem; }
.sc2-table tr.is-off td { color: var(--text-faint); }
.sc2-faint { color: var(--text-faint); }
.sc2-empty { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.8rem; padding: 1rem; }

.sc2-res { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; padding: 0.12rem 0.4rem; border-radius: 3px; color: var(--bg-deep); background: var(--text-mute); }
.sc2-res--W { background: #7fe0b0; }
.sc2-res--L { background: var(--cap); }
.sc2-delta.up { color: #7fe0b0; }
.sc2-delta.down { color: var(--cap); }

.sc2-race { font-weight: 700; }
.sc2-race--T { color: #7cb8ff; }
.sc2-race--P { color: #f5d36b; }
.sc2-race--Z { color: #d58cff; }

.sc2-tag {
    font-size: 0.6rem;
    color: var(--text-faint);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 0 0.3rem;
    margin-left: 0.4rem;
}

.sc2-dls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.8rem; }

.sc2-dl {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
    background: var(--bg-base);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.8rem 1rem;
    color: var(--text-soft);
    text-decoration: none;
}

.sc2-dl:hover { border-color: var(--pp-deep); background: var(--bg-card-hi); }
.sc2-dl b { display: block; font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--text-cream); overflow-wrap: anywhere; }
.sc2-dl small { font-size: 0.78rem; color: var(--text-mute); }
.sc2-fmt { flex: 0 0 auto; font-family: var(--font-mono); font-size: 0.66rem; color: var(--pp-1); border: 1px solid var(--pp-deep); border-radius: 4px; padding: 0.15rem 0.4rem; }

.sc2-details { margin-top: 1rem; }
.sc2-details summary { cursor: pointer; }

.sc2-pre {
    margin-top: 0.6rem;
    padding: 1rem;
    overflow-x: auto;
    background: var(--bg-deep);
    border: 1px solid var(--rule-soft);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.6;
    color: var(--text-soft);
}

.sc2-fine { margin-top: 1rem; font-size: 0.85rem; color: var(--text-mute); max-width: 70ch; }
.sc2-fine code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--pp-3); }
