:root {
    --paper: #f3eee3;
    --paper-2: #fffbf4;
    --ink: #1b1712;
    --ink-soft: #5c564c;
    --line: #d9d0c0;
    --teal: #0f6b56;
    --amber: #c07f00;
    --gray: #8d877c;
    --shadow: 0 18px 40px rgba(40, 28, 8, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(1200px 500px at 10% -10%, #efe4c8 0%, transparent 55%),
        var(--paper);
    color: var(--ink);
    font-family: Outfit, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

a {
    color: var(--teal);
}

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 18px 64px;
}

.crumb ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
}

.crumb li {
    display: inline-flex;
    align-items: center;
}

.crumb li:not(:last-child)::after {
    content: "/";
    margin: 0 8px;
    color: var(--gray);
}

.crumb a {
    text-decoration: none;
}

.crumb [aria-current="page"] {
    color: var(--ink-soft);
}

.eyebrow {
    margin: 0 0 8px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 560;
    color: var(--teal);
}

h1,
h2,
h3 {
    font-family: Fraunces, Georgia, serif;
    margin: 0;
}

h1 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 620;
    letter-spacing: -0.03em;
    line-height: 1.1;
    max-width: 28ch;
}

h2 {
    font-size: 22px;
    font-weight: 620;
}

h3 {
    font-size: 15px;
    font-weight: 620;
    margin: 0 0 6px;
}

.lede {
    max-width: 62ch;
    color: var(--ink-soft);
    margin: 12px 0 0;
}

.read {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 22px 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--paper-2);
}

.read div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.read b {
    font-size: 13px;
}

.read span {
    font-size: 13px;
    color: var(--ink-soft);
}

.stage {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 340px);
    gap: 20px;
    align-items: start;
}

.board {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper-2);
    padding: 16px 18px 18px;
}

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

.status {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    color: var(--teal);
}

.target {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 13px;
    color: var(--ink-soft);
    margin: 0 0 12px;
}

.target b {
    color: var(--ink);
    letter-spacing: 0.12em;
}

.score-formula {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0 0 6px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12.5px;
    color: var(--teal);
}

.score-formula-hint {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--ink-soft);
    max-width: 52rem;
}

.score-formula-hint strong {
    font-weight: 560;
    color: var(--ink);
}

.pop {
    display: grid;
    gap: 6px;
}

.row {
    display: grid;
    grid-template-columns: 1.6rem 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 8px;
}

.row.parent {
    background: #e7f4ee;
}

.row.child {
    background: #f7f0e2;
}

.row.drop {
    opacity: 0.45;
}

.row.keep {
    background: #e7f4ee;
}

.pop-label {
    margin: 12px 0 6px;
    font-size: 12px;
    font-weight: 560;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray);
}

.pop-label[hidden] {
    display: none;
}

.words {
    margin: 18px 0 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--paper-2);
}

.words h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.words dl {
    display: grid;
    gap: 8px 16px;
    margin: 0;
    grid-template-columns: 7.5rem 1fr;
}

.words dt {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12.5px;
    color: var(--teal);
}

.words dd {
    margin: 0;
    font-size: 14px;
    color: var(--ink-soft);
}

.words .note {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--ink-soft);
}

.pipe {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.pipe li {
    font-size: 12px;
    font-weight: 560;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--gray);
    background: var(--paper-2);
}

.pipe li.on {
    color: #f4fff9;
    background: var(--teal);
    border-color: var(--teal);
}

.beats {
    margin: 0;
    padding-left: 1.15em;
    font-size: 14.5px;
}

.beats li + li {
    margin-top: 6px;
}

.viz {
    margin-top: 10px;
}

.wheel {
    display: flex;
    height: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.wheel i {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    font-style: normal;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 10px;
    color: var(--ink);
}

.wheel i.pick {
    box-shadow: inset 0 0 0 2px var(--ink);
}

.darts {
    position: relative;
    height: 22px;
    margin-top: 4px;
}

.darts span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 10px;
    color: var(--teal);
    white-space: nowrap;
}

.idx {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    color: var(--gray);
}

.genes {
    display: flex;
    gap: 4px;
}

.gene {
    width: 1.7em;
    height: 1.7em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 13px;
    background: #fffdf8;
}

.gene.hit {
    background: #d7efe6;
    border-color: var(--teal);
}

.gene.swap {
    box-shadow: 0 0 0 2px var(--teal);
}

.gene.mut {
    background: #f7e4c4;
    border-color: var(--amber);
}

.fit {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    color: var(--ink-soft);
    white-space: nowrap;
}

.transport {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
}

button {
    appearance: none;
    cursor: pointer;
    font-family: Outfit, "Segoe UI", sans-serif;
    font-weight: 560;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fffdf8;
    color: var(--ink);
}

button.primary {
    background: var(--teal);
    border-color: var(--teal);
    color: #f4fff9;
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

.step-count {
    margin: 0 0 0 auto;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    color: var(--gray);
}

.panel {
    display: grid;
    gap: 16px;
}

.panel section {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper-2);
    padding: 12px 14px;
}

.say,
.why {
    margin: 0;
    font-size: 14.5px;
    color: var(--ink);
}

.why {
    margin-top: 8px;
    color: var(--ink-soft);
}

.detail {
    margin: 8px 0 0;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-soft);
    white-space: pre-wrap;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: var(--ink-soft);
}

.legend i {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    border: 1px solid var(--line);
    vertical-align: -1px;
}

.sw-hit {
    background: #d7efe6;
}
.sw-swap {
    box-shadow: inset 0 0 0 2px var(--teal);
}
.sw-mut {
    background: #f7e4c4;
}

@media (max-width: 860px) {
    .stage,
    .read,
    .words dl {
        grid-template-columns: 1fr;
    }

    .step-count {
        margin-left: 0;
        width: 100%;
    }
}
