/* CSOT contest — DESIGN.md tokens, PRODUCT.md tone */

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
    --bg:              oklch(0.13 0.014 150);
    --surface:         oklch(0.17 0.014 150);
    --surface-raised:  oklch(0.21 0.016 150);
    --border:          oklch(0.28 0.014 150);
    --border-strong:   oklch(0.36 0.016 150);

    --fg:              oklch(0.94 0.008 150);
    --fg-secondary:    oklch(0.72 0.012 150);
    --muted:           oklch(0.58 0.012 150);

    --accent:          oklch(0.72 0.14 150);
    --accent-hover:    oklch(0.78 0.14 150);
    --accent-soft:     oklch(0.28 0.07 150);
    --accent-fg:       oklch(0.14 0.014 150);

    --success:         oklch(0.72 0.12 145);
    --danger:          oklch(0.65 0.18 25);
    --warning:         oklch(0.78 0.12 85);

    --code-bg:         oklch(0.11 0.012 150);
    --row-you:         oklch(0.22 0.05 150);

    --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --shell-max: 1120px;
    --prose-max: 68ch;
}

/* ── reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

html, body { margin: 0; padding: 0; }

body {
    font: 400 0.9375rem/1.6 var(--font-sans);
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* subtle grid atmosphere (not glassmorphism) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(oklch(0.28 0.014 150 / 0.4) 1px, transparent 1px),
        linear-gradient(90deg, oklch(0.28 0.014 150 / 0.4) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 70%);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 160ms var(--ease);
}
a:hover { color: var(--accent-hover); }
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--fg); }

/* ── shell ────────────────────────────────────────────────────────────────── */
.shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 56px;
    padding: 0 clamp(16px, 4vw, 28px);
    background: oklch(0.17 0.014 150 / 0.92);
    border-bottom: 1px solid var(--border);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.app-brand:hover { color: var(--fg); text-decoration: none; }

.brand-glyph {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    background: var(--accent-soft);
    border: 1px solid oklch(0.72 0.14 150 / 0.35);
    border-radius: var(--r-sm);
    font: 600 0.75rem/1 var(--font-mono);
    color: var(--accent);
}

.brand-meta { color: var(--muted); font-weight: 400; }

.app-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.app-nav a {
    color: var(--fg-secondary);
    padding: 7px 12px;
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 160ms var(--ease), color 160ms var(--ease);
}
.app-nav a:hover {
    background: var(--surface-raised);
    color: var(--fg);
    text-decoration: none;
}
.app-nav a.is-active {
    color: var(--accent);
    background: var(--accent-soft);
}

.app-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-chip {
    font: 500 0.75rem/1 var(--font-mono);
    color: var(--muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-actions form { margin: 0; }

/* ── layout ───────────────────────────────────────────────────────────────── */
.main {
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 28px) clamp(48px, 8vw, 72px);
    flex: 1;
}

.main--narrow { max-width: 780px; }

.app-footer {
    position: relative;
    z-index: 1;
    padding: 20px clamp(16px, 4vw, 28px);
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--fg-secondary); }

/* ── page header ──────────────────────────────────────────────────────────── */
.page-head {
    margin-bottom: 32px;
}
.page-head--lg { margin-bottom: 40px; }

.eyebrow {
    display: inline-block;
    margin: 0 0 10px;
    font: 500 0.6875rem/1 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.page-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.page-desc {
    margin: 0;
    color: var(--fg-secondary);
    font-size: 0.9375rem;
    max-width: var(--prose-max);
}

/* ── hero (landing) ───────────────────────────────────────────────────────── */
.hero {
    display: grid;
    grid-template-columns: 1fr minmax(240px, 300px);
    gap: clamp(32px, 6vw, 56px);
    align-items: start;
    padding-bottom: 48px;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--border);
}

.hero-title {
    margin: 0 0 14px;
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.08;
}

.hero-lead {
    margin: 0 0 28px;
    color: var(--fg-secondary);
    font-size: 1.0625rem;
    max-width: 52ch;
    line-height: 1.55;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-aside {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
}

.hero-aside dt {
    margin: 0 0 4px;
    font: 500 0.6875rem/1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.hero-aside dd {
    margin: 0 0 16px;
    font-size: 0.9375rem;
    color: var(--fg);
}
.hero-aside dd:last-child { margin-bottom: 0; }
.hero-aside dd strong {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── sections ─────────────────────────────────────────────────────────────── */
.section { margin-bottom: 48px; }
.section:last-child { margin-bottom: 0; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.section-meta {
    font-size: 0.8125rem;
    color: var(--muted);
}

/* ── steps ─────────────────────────────────────────────────────────────────── */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.step {
    position: relative;
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}
.step:first-child { padding-top: 0; }
.step:last-child { border-bottom: none; padding-bottom: 0; }

.step::before {
    counter-increment: step;
    content: counter(step, decimal-leading-zero);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font: 600 0.75rem/1 var(--font-mono);
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--r-sm);
}

.step-body { color: var(--fg-secondary); }
.step-body p { margin: 0 0 10px; }
.step-body p:last-child { margin-bottom: 0; }

/* ── callout ───────────────────────────────────────────────────────────────── */
.callout {
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.8125rem;
    color: var(--fg-secondary);
}
.callout strong { color: var(--fg); font-weight: 500; }

.callout--accent {
    border-color: oklch(0.72 0.14 150 / 0.35);
    background: var(--accent-soft);
}

.callout--success {
    border-color: oklch(0.72 0.12 145 / 0.4);
    background: oklch(0.22 0.05 145);
    margin-bottom: 16px;
}

.callout--error {
    border-color: oklch(0.65 0.18 25 / 0.4);
    background: oklch(0.22 0.06 25);
    margin-bottom: 16px;
}

.callout--warning {
    border-color: oklch(0.78 0.12 85 / 0.45);
    background: oklch(0.24 0.05 85);
    margin-bottom: 16px;
}

/* ── mini-project form ─────────────────────────────────────────────────────── */
.mini-project-status { margin-bottom: 16px; }

.mini-project-current {
    margin: 0 0 8px;
    font-size: 0.875rem;
    color: var(--fg-secondary);
    word-break: break-all;
}

.mini-project-meta {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.folder-suggest-status {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
}

.folder-suggest-status--ok { color: var(--success); }
.folder-suggest-status--error { color: var(--danger); }

.folder-autocomplete {
    position: relative;
}

.folder-autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: 0 12px 32px oklch(0.08 0.01 150 / 0.45);
    max-height: 240px;
    overflow-y: auto;
}

.folder-autocomplete-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--fg-secondary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
}

.folder-autocomplete-item:hover,
.folder-autocomplete-item:focus-visible {
    background: var(--accent-soft);
    color: var(--fg);
    outline: none;
}

.mini-project-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 720px;
}

.mini-project-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mini-project-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mini-project-label {
    font: 500 0.75rem/1 var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.mini-project-hint {
    font-size: 0.75rem;
    color: var(--muted);
}

.mini-project-input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--code-bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.mini-project-input::placeholder { color: var(--muted); }

.mini-project-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.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;
}

/* ── platform setup (landing) ──────────────────────────────────────────────── */
.section-lead {
    margin: -8px 0 20px;
    color: var(--fg-secondary);
    font-size: 0.9375rem;
    max-width: var(--prose-max);
    line-height: 1.55;
}

.platform-setups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.platform-setup {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}

.platform-setup summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--fg);
    list-style: none;
}
.platform-setup summary::-webkit-details-marker { display: none; }
.platform-setup summary::before {
    content: "▸ ";
    color: var(--accent);
    font-family: var(--font-mono);
}
.platform-setup[open] summary::before { content: "▾ "; }

.platform-setup[open] summary {
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
}

.platform-body {
    padding: 16px 18px 18px;
    color: var(--fg-secondary);
    font-size: 0.875rem;
}

.platform-note {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.platform-note:last-child { margin-bottom: 0; }

.do-steps {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.55;
}
.do-steps li { margin-bottom: 14px; }
.do-steps li:last-child { margin-bottom: 0; }
.do-steps pre {
    margin: 8px 0 0;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.do-steps pre code {
    font-family: var(--font-mono);
    color: var(--fg);
    white-space: pre;
}

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--fg);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
    text-decoration: none;
    user-select: none;
}
.btn:hover {
    background: var(--surface-raised);
    border-color: oklch(0.72 0.14 150 / 0.5);
    text-decoration: none;
    color: var(--fg);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
    font-weight: 600;
}
.btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-fg);
}

.btn--ghost {
    border-color: transparent;
    background: transparent;
}
.btn--ghost:hover {
    background: var(--surface-raised);
    border-color: transparent;
}

.btn--sm { height: 30px; padding: 0 12px; font-size: 0.75rem; }

/* legacy class names */
.btn.primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
    font-weight: 600;
}
.btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-fg);
}
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-raised); border-color: transparent; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 0.75rem; }

/* ── stat strip (not hero metrics) ─────────────────────────────────────────── */
.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 36px;
}

.stat-cell {
    flex: 1 1 160px;
    background: var(--surface);
    padding: 16px 20px;
}

.stat-label {
    font: 500 0.6875rem/1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-value {
    margin: 8px 0 4px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-value--dim { color: var(--muted); font-size: 1.25rem; }
.stat-value .stat-denom { color: var(--muted); font-size: 1rem; font-weight: 500; }

.stat-note { font-size: 0.8125rem; color: var(--muted); }

/* legacy .stats */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 36px;
}
.stat { flex: 1 1 160px; background: var(--surface); padding: 16px 20px; }
.stat-value.dim { color: var(--muted); }
.stat-sub { font-size: 0.8125rem; color: var(--muted); }

/* ── tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 10px 14px;
    color: var(--fg-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── data table ────────────────────────────────────────────────────────────── */
.data-table,
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td,
table.data th,
table.data td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th,
table.data th {
    font: 500 0.6875rem/1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    padding-bottom: 12px;
}

.data-table td.num,
.data-table th.num,
table.data td.num,
table.data th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table td.rank,
.data-table th.rank,
table.data td.rank,
table.data th.rank {
    width: 52px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.data-table td.mono,
table.data td.mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.tag {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    font: 500 0.625rem/1.4 var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    vertical-align: middle;
}

.tag--muted {
    color: var(--muted);
    border: 1px solid var(--border);
}

.data-table tbody tr,
table.data tbody tr {
    transition: background 160ms var(--ease);
}
.data-table tbody tr:hover,
table.data tbody tr:hover {
    background: var(--surface-raised);
}

.data-table tr.row-you,
table.data tr.me {
    background: var(--row-you);
}
.data-table tr.row-you td,
table.data tr.me td { color: var(--fg); }
.data-table tr.row-you td.rank,
table.data tr.me td.rank {
    color: var(--accent);
    font-weight: 600;
}

.player-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
}
.player-name {
    font-weight: 500;
    color: var(--fg);
}
.player-handle {
    font-size: 0.75rem;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
}

.table-wrap .data-table,
.table-wrap table.data { margin: 0; }
.table-wrap .data-table th:first-child,
.table-wrap .data-table td:first-child,
.table-wrap table.data th:first-child,
.table-wrap table.data td:first-child { padding-left: 18px; }
.table-wrap .data-table th:last-child,
.table-wrap .data-table td:last-child,
.table-wrap table.data th:last-child,
.table-wrap table.data td:last-child { padding-right: 18px; }

.stat-full {
    color: var(--success);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stat-partial {
    color: var(--warning);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.task-stats-table td a {
    color: var(--fg-secondary);
    font-weight: 500;
}
.task-stats-table td a:hover {
    color: var(--accent);
}
.table-wrap tbody tr:last-child td { border-bottom: none; }

/* ── task list links ───────────────────────────────────────────────────────── */
.task-link {
    font-weight: 500;
    color: var(--fg);
}
.task-link:hover { color: var(--accent); text-decoration: none; }

/* ── code ────────────────────────────────────────────────────────────────────── */
code, pre, kbd, .mono {
    font-family: var(--font-mono);
}

code {
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--fg);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 12px 0;
    line-height: 1.5;
}
pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8125rem;
}

/* ── badges ─────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    font: 500 0.6875rem/1 var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--r-sm);
    background: var(--surface-raised);
    color: var(--fg-secondary);
}
.badge.pass, .badge.graded { background: oklch(0.26 0.06 145); color: var(--success); }
.badge.partial { background: oklch(0.28 0.08 85); color: var(--warning); }
.badge.fail, .badge.failed { background: oklch(0.26 0.08 25); color: var(--danger); }
.badge.skip { color: var(--muted); }
.badge.queued, .badge.grading { background: oklch(0.26 0.06 230); color: oklch(0.75 0.1 230); }
.badge.duplicate { background: oklch(0.26 0.06 85); color: var(--warning); }

/* ── task pills ──────────────────────────────────────────────────────────────── */
.task-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.task-pills a,
.task-pills strong {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg-secondary);
}
.task-pills a:hover {
    border-color: oklch(0.72 0.14 150 / 0.5);
    color: var(--fg);
    text-decoration: none;
}
.task-pills strong {
    color: var(--accent);
    border-color: oklch(0.72 0.14 150 / 0.45);
    background: var(--accent-soft);
}

/* ── markdown ────────────────────────────────────────────────────────────────── */
.markdown {
    line-height: 1.65;
    max-width: var(--prose-max);
}
.markdown.wide { max-width: none; }

.markdown h1 {
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    line-height: 1.2;
}
.markdown h2 {
    font-size: 1.125rem;
    margin: 36px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.markdown h3 { font-size: 1rem; margin: 24px 0 8px; }
.markdown p { margin: 12px 0; color: var(--fg-secondary); }
.markdown strong { color: var(--fg); }
.markdown ul, .markdown ol { padding-left: 1.25rem; margin: 12px 0; color: var(--fg-secondary); }
.markdown li { margin: 6px 0; }
.markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.875rem;
}
.markdown th, .markdown td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.markdown th {
    font: 500 0.6875rem/1 var(--font-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}
.markdown blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    color: var(--fg-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.markdown hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 28px 0;
}
.markdown a { font-weight: 500; }

.codehilite pre { background: var(--code-bg); }
.codehilite .k, .codehilite .kd, .codehilite .kn { color: oklch(0.78 0.12 150); }
.codehilite .s, .codehilite .s1, .codehilite .s2 { color: oklch(0.78 0.1 145); }
.codehilite .c, .codehilite .c1, .codehilite .cm { color: var(--muted); font-style: italic; }
.codehilite .nb, .codehilite .nf { color: oklch(0.8 0.1 85); }
.codehilite .o { color: var(--fg-secondary); }
.codehilite .nv, .codehilite .vi { color: oklch(0.78 0.08 195); }

/* ── auth ────────────────────────────────────────────────────────────────────── */
.auth-panel {
    max-width: 440px;
    margin: 48px auto 0;
    text-align: center;
}

.auth-panel h1 {
    font-size: 1.25rem;
    margin: 0 0 12px;
}

.auth-panel p { color: var(--fg-secondary); margin: 0 0 8px; }

.code-display {
    display: block;
    margin: 24px 0;
    padding: 24px 16px;
    font: 600 2rem/1.2 var(--font-mono);
    letter-spacing: 0.1em;
    color: var(--accent);
    background: var(--code-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    word-break: break-all;
}

.auth-code-page { max-width: 440px; margin: 48px auto 0; text-align: center; }
.auth-code-page h1 { font-size: 1.25rem; margin: 0 0 12px; }
.auth-code-page p { color: var(--fg-secondary); }

/* ── empty / error ───────────────────────────────────────────────────────────── */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--r-lg);
}
.empty strong {
    display: block;
    color: var(--fg);
    font-size: 1rem;
    margin-bottom: 8px;
}

.error-panel {
    max-width: 440px;
    margin: 48px auto 0;
    text-align: center;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.error-panel h1 {
    margin: 0 0 12px;
    font-size: 1.125rem;
    color: var(--danger);
}
.error-panel p { color: var(--fg-secondary); margin: 0 0 20px; }

.error-page { max-width: 440px; margin: 48px auto 0; text-align: center; }
.error-page h1 { color: var(--danger); font-size: 1.125rem; }

.back-nav {
    margin-bottom: 20px;
    font-size: 0.8125rem;
}
.back-nav a { color: var(--muted); }
.back-nav a:hover { color: var(--fg); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px 28px;
}

/* ── responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
    .hero {
        grid-template-columns: 1fr;
    }
    .hero-aside { order: -1; }
}

@media (max-width: 640px) {
    .app-header {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
        padding-top: 10px;
        padding-bottom: 10px;
        gap: 10px;
    }
    .app-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }
    .app-nav a { flex-shrink: 0; }
    .stat-strip, .stats { flex-direction: column; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
}
