        :root {
            --term-bg: #0a0a0a;
            --term-panel: #111;
            --term-fg: #f2f2f2;
            --term-dim: #a7a7a7;
            --term-muted: #4a4a4a;
            --term-line: #2f2f2f;
            --term-soft: #181818;
        }

        * { box-sizing: border-box; }

        html { background: var(--term-bg); }

        body.home-page {
            min-height: 100vh;
            margin: 0;
            padding: 0;
            display: block;
            overflow-x: hidden;
            background:
                linear-gradient(rgba(255, 255, 255, 0.018) 50%, transparent 50%) 0 0 / 100% 4px,
                var(--term-bg);
            color: var(--term-fg);
            font-family: "JetBrains Mono", Consolas, monospace;
            line-height: 1.55;
        }

        body.home-page::after {
            content: "";
            position: fixed;
            inset: 0;
            pointer-events: none;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.018), transparent);
            mix-blend-mode: screen;
        }

        .terminal-shell {
            width: calc(100vw - 2rem);
            max-width: 1120px;
            min-height: 100vh;
            margin: 0 auto;
            padding: clamp(0.75rem, 2.5vw, 1.5rem) 0 1.5rem;
            display: grid;
            grid-template-rows: auto 1fr auto;
            gap: 1rem;
        }

        .term-bar,
        .term-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            border: 1px solid var(--term-line);
            background: rgba(17, 17, 17, 0.86);
            padding: 0.65rem 1rem;
            color: var(--term-dim);
            font-size: clamp(0.72rem, 1.8vw, 0.86rem);
            letter-spacing: 0;
        }

        .term-bar > span:first-child,
        .term-footer > span:first-child { white-space: nowrap; }

        .status-ok { color: var(--term-fg); }
        .status-warn { color: var(--term-dim); }

        .top-links {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin: 0;
        }

        .top-links a {
            min-height: 34px;
            display: inline-flex;
            align-items: center;
            color: var(--term-fg);
            border: 1px solid var(--term-line);
            padding: 0 0.55rem;
            text-decoration: none;
            font-weight: 500;
        }

        .top-links a:hover,
        .top-links a:focus-visible {
            color: #050505;
            background: var(--term-fg);
            outline: 0;
        }

        .terminal-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1rem;
            align-items: stretch;
        }

        .terminal-main {
            border: 1px solid var(--term-line);
            background: rgba(10, 10, 10, 0.92);
            min-width: 0;
        }

        .term-window {
            border: 1px solid var(--term-line);
            background: rgba(10, 10, 10, 0.9);
            min-width: 0;
        }

        .term-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.55rem 0.8rem;
            background: var(--term-soft);
            border-bottom: 1px solid var(--term-line);
            color: var(--term-dim);
            font-size: 0.78rem;
            font-weight: 600;
        }

        .term-body { padding: clamp(1rem, 3vw, 1.5rem); }

        .terminal-main .term-body {
            display: grid;
            gap: clamp(1rem, 2.4vw, 1.5rem);
        }

        .identity-block {
            min-width: 0;
        }

        .prompt {
            margin: 0 0 0.9rem;
            color: var(--term-dim);
            font-size: clamp(0.78rem, 2vw, 0.95rem);
        }

        .prompt strong { color: var(--term-fg); }

        .hero-name {
            margin: 0;
            padding: 0;
            border: 0;
            color: var(--term-fg);
            font-family: inherit;
            font-size: clamp(2rem, 6.8vw, 4.8rem);
            line-height: 1.02;
            letter-spacing: 0;
            overflow-wrap: anywhere;
            word-break: normal;
        }

        .cursor {
            display: inline-block;
            width: 0.58em;
            height: 0.82em;
            margin-left: 0.08em;
            background: var(--term-fg);
            vertical-align: -0.06em;
            animation: blink 1s steps(1) infinite;
        }

        .hero-copy {
            max-width: 66ch;
            margin: 1rem 0 0;
            color: var(--term-dim);
            font-size: clamp(0.92rem, 2vw, 1.05rem);
            overflow-wrap: anywhere;
        }

        .inline-status {
            display: grid;
            gap: 1rem;
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid var(--term-line);
        }

        .command-panel {
            border-top: 1px solid var(--term-line);
            padding-top: clamp(0.9rem, 2vw, 1.2rem);
            margin: 0;
        }

        .command-panel-title {
            margin: 0 0 0.75rem;
            color: var(--term-dim);
            font-size: 0.88rem;
        }

        .command-list {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 0.85rem;
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .command-link {
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.8rem;
            align-items: start;
            min-height: 7rem;
            padding: 0.9rem;
            border: 1px solid var(--term-line);
            color: var(--term-fg);
            background: #080808;
            text-decoration: none;
            font-weight: 600;
            transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
        }

        .command-link:hover,
        .command-link:focus-visible {
            background: var(--term-fg);
            color: #050505;
            outline: 0;
            text-decoration: none;
            border-color: var(--term-fg);
        }

        .command-link:focus-visible { box-shadow: 0 0 0 2px #050505, 0 0 0 4px var(--term-fg); }

        .cmd-index,
        .cmd-exec {
            font-size: 0.78rem;
            color: var(--term-dim);
        }

        .cmd-index {
            display: block;
        }

        .cmd-exec {
            align-self: end;
        }

        .command-link:hover .cmd-index,
        .command-link:hover .cmd-exec,
        .command-link:focus-visible .cmd-index,
        .command-link:focus-visible .cmd-exec { color: #050505; }

        .cmd-title {
            display: block;
            font-size: 1rem;
        }

        .cmd-meta {
            display: block;
            margin-top: 0.2rem;
            color: var(--term-dim);
            font-size: 0.78rem;
            font-weight: 400;
            overflow-wrap: anywhere;
        }

        .command-link:hover .cmd-meta,
        .command-link:focus-visible .cmd-meta { color: #050505; }

        .system-list {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 0.6rem;
            margin: 0;
            padding: 0;
            list-style: none;
            color: var(--term-dim);
            font-size: 0.86rem;
        }

        .system-list li {
            display: grid;
            gap: 1rem;
            padding: 0.75rem;
            border: 1px solid var(--term-line);
            background: #080808;
        }

        .system-list b { color: var(--term-fg); font-weight: 700; }

        .meter {
            display: block;
            width: 100%;
            margin-top: 1rem;
            color: var(--term-dim);
            font-size: 0.82rem;
        }

        .skill-meter {
            margin-top: 0;
        }

        .skill-meter-top {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            color: var(--term-dim);
            font-size: 0.78rem;
        }

        .skill-track {
            position: relative;
            height: 1.2rem;
            margin-top: 0.45rem;
            border: 1px solid var(--term-line);
            background: #050505;
            overflow: hidden;
        }

        .skill-fill {
            position: absolute;
            inset: 0 auto 0 0;
            width: 78%;
            background: repeating-linear-gradient(
                90deg,
                var(--term-fg) 0 0.58rem,
                transparent 0.58rem 0.78rem
            );
            animation: barShift 1.2s steps(4, end) infinite;
        }

        .skill-sweep {
            position: absolute;
            inset: 0;
            transform: translateX(-100%);
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
            animation: sweep 1.8s linear infinite;
            animation-delay: 0.2s;
        }

        .skill-meter code {
            display: block;
            margin-top: 0.45rem;
            color: var(--term-dim);
            font-family: inherit;
            font-size: 0.74rem;
            overflow-wrap: anywhere;
        }

        .term-footer a {
            display: inline-block;
            padding: 0.15rem 0.2rem;
            color: var(--term-fg);
            text-decoration: none;
        }

        .term-footer a:hover,
        .term-footer a:focus-visible {
            background: var(--term-fg);
            color: #050505;
            outline: 0;
        }

        @keyframes blink { 50% { opacity: 0; } }
        @keyframes barShift { to { background-position: 0.78rem 0; } }
        @keyframes sweep { to { transform: translateX(100%); } }

        @media (max-width: 940px) {
            .command-list { grid-template-columns: 1fr; }
            .command-link { min-height: 0; }
            .system-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        }

        @media (max-width: 700px) {
            .term-bar,
            .term-footer {
                align-items: flex-start;
                flex-direction: column;
                gap: 0.55rem;
            }
        }

        @media (max-width: 520px) {
            .hero-name { font-size: clamp(1.55rem, 11vw, 2.7rem); }
            .terminal-shell {
                width: 100vw;
                max-width: 100vw;
                padding-left: 0.5rem;
                padding-right: 0.5rem;
            }
            .term-bar,
            .term-footer,
            .terminal-main,
            .term-window {
                width: calc(100vw - 1rem);
                max-width: calc(100vw - 1rem);
                overflow: hidden;
            }
            .term-bar,
            .term-footer { padding: 0.6rem 0.65rem; }
            .top-links {
                width: 100%;
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .top-links a { justify-content: center; }
            .term-body { padding: 1rem; }
            .term-title span:last-child { display: none; }
            .hero-copy {
                width: 34ch;
                max-width: calc(100vw - 3rem);
            }
            .command-link,
            .skill-meter,
            .system-list {
                max-width: calc(100vw - 3rem);
            }
            .hero-copy,
            .cmd-meta,
            .skill-meter code {
                overflow-wrap: anywhere;
                word-break: normal;
            }
            .cmd-meta,
            .skill-meter code { max-width: 34ch; }
            .system-list { grid-template-columns: 1fr; }
        }

        @media (prefers-reduced-motion: reduce) {
            .cursor { animation: none; }
            .command-link { transition: none; }
            .skill-fill { animation: none; width: 78%; }
            .skill-sweep { display: none; }
        }

/* Problem-setting page shares the original terminal shell. */
.problem-setting-page .hero-name { font-size: clamp(1.8rem, 6vw, 3rem); }
.problem-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.problem-tools input { width: min(100%, 400px); padding: .7rem; border: 1px solid var(--term-line); background: var(--term-panel); color: var(--term-fg); font: inherit; font-size: .9rem; }
.problem-tools input:focus-visible { outline: 2px solid var(--term-fg); outline-offset: 3px; }
.problem-tools span { color: var(--term-dim); font-size: .85rem; }
.problem { padding: 1.4rem 0; border-top: 1px solid var(--term-line); }
.problem h2, .empty-state h2 { border: 0; margin: 0 0 .6rem; color: var(--term-fg); font: inherit; font-weight: 700; }
.problem h3 { margin: 0 0 .6rem; color: var(--term-fg); font: inherit; font-weight: 700; }
.problem-group { margin-top: 2rem; }
.problem-group-title, .problem-private-note h2 { margin: 0 0 .7rem; color: var(--term-fg); font: inherit; font-size: 1.05rem; font-weight: 700; }
.problem-difficulty-note, .problem-group-empty { color: var(--term-dim); font-size: .85rem; }
.problem-private-note { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--term-line); }
.problem-private-note p { max-width: 75ch; color: var(--term-dim); font-size: .9rem; }
.problem-private-note a { color: var(--term-fg); text-decoration: underline; text-underline-offset: 4px; }
.problem p { overflow-wrap: anywhere; }
.problem .problem-meta, .empty-state p { color: var(--term-dim); font-size: .85rem; }
.inline-links { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-top: 1rem; }
.problem a { color: var(--term-fg); font-size: .85rem; text-decoration: underline; text-underline-offset: 4px; }
.problem a:focus-visible { outline: 2px solid var(--term-fg); outline-offset: 4px; }
.empty-state { border-top: 1px solid var(--term-line); margin-top: 1.5rem; padding: 1.5rem 0; }
[hidden] { display: none !important; }

/* Interactive site explorer. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.explorer-body { padding: clamp(1rem, 3vw, 1.5rem); }
.explorer-hint { margin: 0 0 1rem; color: var(--term-dim); font-size: .85rem; }
.explorer-hint code { color: var(--term-fg); font: inherit; }
.explorer-output { max-height: 350px; min-height: 2.5rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--term-muted) var(--term-bg); color: var(--term-dim); font-size: .85rem; line-height: 1.7; }
.explorer-output p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.explorer-result { margin: 0 0 1rem; }
.explorer-output .explorer-echo { color: var(--term-fg); margin-bottom: .35rem; }
.explorer-output a { color: var(--term-fg); font-weight: 400; text-decoration: underline; text-decoration-color: var(--term-muted); text-underline-offset: 3px; }
.explorer-output a:hover { text-decoration-color: var(--term-fg); }
.explorer-output .explorer-error { color: #e2c6b4; }
.explorer-form { display: flex; align-items: center; gap: .6rem; border-top: 1px solid var(--term-line); margin-top: .5rem; padding-top: .9rem; }
.explorer-form label { color: var(--term-fg); font-size: .85rem; white-space: nowrap; }
.explorer-form input { width: 100%; min-width: 0; min-height: 44px; border: 0; border-bottom: 1px solid var(--term-muted); border-radius: 0; padding: .4rem .2rem; background: transparent; color: var(--term-fg); caret-color: var(--term-fg); font: inherit; font-size: .9rem; }
.explorer-form input::placeholder { color: var(--term-dim); }
.explorer-form button, .explorer-examples button { border: 1px solid var(--term-line); background: transparent; color: var(--term-fg); font: inherit; font-size: .8rem; cursor: pointer; }
.explorer-form button { min-height: 44px; padding: .4rem .85rem; }
.explorer-examples { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.explorer-examples button { min-height: 36px; padding: .3rem .6rem; color: var(--term-dim); }
.explorer-form button:hover, .explorer-examples button:hover { background: var(--term-soft); color: var(--term-fg); }
.explorer-terminal :focus-visible { outline: 2px solid var(--term-fg); outline-offset: 3px; }
@media (max-width: 600px) {
    .explorer-form { flex-wrap: wrap; }
    .explorer-form label { width: 100%; }
    .explorer-form input { flex: 1; width: 0; font-size: 16px; }
    .explorer-output { max-height: 300px; font-size: .8rem; }
}
