:root {
    --ph-bg: #0a0a0a;
    --ph-bg-2: #0f0f0f;
    --ph-fg: #e4e4e7;
    --ph-muted: #71717a;
    --ph-dim: #3f3f46;
    --ph-amber: #ffb347;
    --ph-mint: #6ee7b7;
    --ph-border: rgba(255, 179, 71, 0.18);
    --ph-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.ph-body {
    background: var(--ph-bg);
    color: var(--ph-fg);
    font-family: var(--ph-mono);
    line-height: 1.7;
    font-size: 16px;
    background-image:
        linear-gradient(rgba(255, 179, 71, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 179, 71, 0.025) 1px, transparent 1px);
    background-size: 28px 28px;
    background-attachment: fixed;
}

.ph-wrap {
    max-width: 980px;
    margin: 0 auto;
    padding: 48px 24px 120px;
}

.ph-back {
    color: var(--ph-muted);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: inline-block;
    transition: color .2s;
}
.ph-back:hover { color: var(--ph-amber); }

.ph-hero {
    margin: 40px 0 48px;
    border-left: 2px solid var(--ph-amber);
    padding: 6px 0 6px 24px;
    position: relative;
}
.ph-hero::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 14px;
    width: 10px;
    height: 10px;
    background: var(--ph-amber);
    border-radius: 50%;
    box-shadow: 0 0 16px rgba(255, 179, 71, 0.6);
}
.ph-hero-eyebrow {
    color: var(--ph-amber);
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 14px;
    opacity: 0.85;
}
.ph-hero-title {
    font-size: clamp(32px, 5.5vw, 52px);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 18px;
    color: #fff;
    font-family: var(--ph-mono);
}
.ph-hero-title::before {
    content: '~/';
    color: var(--ph-muted);
    font-weight: 400;
    margin-right: 2px;
}
.ph-hero-tagline {
    color: var(--ph-muted);
    max-width: 64ch;
    font-size: 15px;
    line-height: 1.8;
}

.ph-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--ph-border);
    border: 1px solid var(--ph-border);
    margin-bottom: 56px;
}
.ph-stat {
    background: var(--ph-bg);
    padding: 18px 22px;
}
.ph-stat-label {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ph-muted);
}
.ph-stat-value {
    font-size: 26px;
    color: var(--ph-amber);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

.ph-tree { font-size: 15px; }
.ph-tree-root {
    color: var(--ph-muted);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.ph-tree-root.dim {
    color: #52525b;
    text-transform: none;
    letter-spacing: 0;
    font-size: 15px;
    margin-bottom: 22px;
}

.ph-bucket { margin-bottom: 32px; }
.ph-bucket-head {
    color: var(--ph-mint);
    margin-bottom: 8px;
    font-size: 15px;
}
.ph-bucket-head .ph-bucket-count {
    color: var(--ph-muted);
    margin-left: 10px;
    font-size: 13px;
}

.ph-row {
    display: grid;
    grid-template-columns: 64px 52px 56px 1fr auto;
    gap: 16px;
    padding: 8px 10px 8px 0;
    align-items: baseline;
    color: var(--ph-fg);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: background .15s, border-color .15s;
}
.ph-row:hover {
    background: rgba(255, 179, 71, 0.05);
    border-left-color: var(--ph-amber);
}
.ph-row:hover .ph-row-title { color: var(--ph-amber); }

.ph-row-branch {
    color: var(--ph-dim);
    user-select: none;
    white-space: pre;
    font-size: 14px;
}
.ph-row-idx {
    color: var(--ph-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.ph-row-year {
    color: var(--ph-mint);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}
.ph-row-title {
    color: var(--ph-fg);
    transition: color .15s;
    font-size: 15px;
}
.ph-row-authors {
    display: block;
    color: var(--ph-muted);
    font-size: 13px;
    margin-top: 4px;
}
.ph-row-hash {
    color: var(--ph-amber);
    font-size: 13px;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ph-legend {
    margin-top: 72px;
    padding-top: 24px;
    border-top: 1px solid var(--ph-border);
    font-size: 13px;
    color: var(--ph-muted);
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
.ph-legend-item::before {
    content: '■ ';
    color: var(--ph-amber);
    margin-right: 4px;
}
.ph-legend-item.mint::before { color: var(--ph-mint); }
.ph-legend-item.dim::before { color: var(--ph-dim); }

/* ── Paper page ──────────────────────────────────────────────────────────── */
.ph-paper {
    max-width: 76ch;
    margin: 0 auto;
    padding: 48px 24px 120px;
}
.ph-paper-head {
    border-left: 2px solid var(--ph-amber);
    padding: 6px 0 6px 24px;
    margin: 40px 0 48px;
    position: relative;
}
.ph-paper-head::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    width: 10px;
    height: 10px;
    background: var(--ph-amber);
    border-radius: 50%;
    box-shadow: 0 0 14px rgba(255, 179, 71, 0.6);
}
.ph-paper-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--ph-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 14px;
    align-items: center;
}
.ph-paper-meta .ph-paper-year { color: var(--ph-amber); }
.ph-paper-meta .ph-paper-hash { margin-left: auto; color: var(--ph-mint); }
.ph-paper-title {
    font-size: clamp(22px, 3.4vw, 32px);
    font-weight: 600;
    color: #fff;
    margin: 0 0 14px;
    line-height: 1.28;
    letter-spacing: -0.015em;
    font-family: var(--ph-mono);
}
.ph-paper-authors { color: var(--ph-muted); font-size: 14px; }

.ph-content {
    color: var(--ph-fg);
    font-size: 16px;
    line-height: 1.85;
}
.ph-content h1,
.ph-content h2,
.ph-content h3,
.ph-content h4 {
    color: var(--ph-amber);
    font-weight: 600;
    margin: 2.4em 0 0.6em;
    letter-spacing: -0.01em;
    font-family: var(--ph-mono);
}
.ph-content h1 { font-size: 24px; }
.ph-content h2 { font-size: 20px; }
.ph-content h3 { font-size: 17px; color: var(--ph-mint); }
.ph-content h4 { font-size: 16px; color: var(--ph-mint); opacity: 0.85; }
.ph-content h1::before,
.ph-content h2::before { content: '# '; color: var(--ph-muted); font-weight: 400; }
.ph-content h3::before,
.ph-content h4::before { content: '## '; color: var(--ph-dim); font-weight: 400; }

.ph-content p { margin: 0 0 1.1em; }
.ph-content a {
    color: var(--ph-amber);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}
.ph-content a:hover { color: #ffcb7a; }
.ph-content strong { color: #fff; font-weight: 600; }
.ph-content em { color: var(--ph-mint); font-style: italic; }
.ph-content code {
    background: rgba(255, 179, 71, 0.08);
    padding: 1px 6px;
    border-radius: 2px;
    color: var(--ph-amber);
    font-size: 14px;
    border: 1px solid var(--ph-border);
}
.ph-content pre {
    background: var(--ph-bg-2);
    border: 1px solid var(--ph-border);
    border-left: 2px solid var(--ph-amber);
    padding: 18px 20px;
    overflow-x: auto;
    font-size: 14px;
    margin: 1.4em 0;
    line-height: 1.6;
}
.ph-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--ph-fg);
}
.ph-content blockquote {
    border-left: 2px solid var(--ph-mint);
    padding: 2px 0 2px 20px;
    color: var(--ph-muted);
    margin: 1.4em 0;
    font-style: italic;
}
.ph-content ul,
.ph-content ol { padding-left: 24px; margin: 0 0 1.1em; }
.ph-content li { margin: 0.35em 0; }
.ph-content ul li::marker { color: var(--ph-amber); }
.ph-content ol li::marker { color: var(--ph-mint); }
.ph-content hr {
    border: none;
    border-top: 1px dashed var(--ph-border);
    margin: 2.4em 0;
}
.ph-content img { max-width: 100%; height: auto; border: 1px solid var(--ph-border); }
.ph-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.4em 0;
    font-size: 14px;
}
.ph-content th,
.ph-content td {
    border: 1px solid var(--ph-border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.ph-content th {
    background: rgba(255, 179, 71, 0.06);
    color: var(--ph-amber);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ph-paper-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 80px;
    padding-top: 28px;
    border-top: 1px solid var(--ph-border);
}
.ph-paper-nav a {
    color: var(--ph-muted);
    text-decoration: none;
    font-size: 14px;
    display: block;
    line-height: 1.5;
    transition: color .15s;
}
.ph-paper-nav a.next { text-align: right; }
.ph-paper-nav a:hover { color: var(--ph-amber); }
.ph-paper-nav .label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.55;
    margin-bottom: 6px;
    color: var(--ph-amber);
}

@media (max-width: 680px) {
    .ph-row {
        grid-template-columns: auto 48px 1fr;
        gap: 10px;
    }
    .ph-row-idx,
    .ph-row-hash { display: none; }
    .ph-legend { gap: 14px; }
}
