/* The landing page: the 3D board in the hero and the sections under it. */

.landing {
    padding-top: 0;
    /* The tilted ribbon reaches past the edges of the window. */
    overflow-x: clip;
}

/* ---------- hero ---------- */

.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: var(--nav-height);
    overflow: hidden;
}
.hero__stage {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.hero__stage canvas {
    width: 100%;
    height: 100%;
    touch-action: pan-y;
}
/* The stage fades into the page on the left and at the bottom. */
.hero__stage::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, var(--ink-0) 8%, transparent 46%),
        linear-gradient(0deg, var(--ink-0) 0%, transparent 20%);
}
/* Shown when WebGL is missing: a flat board in the same colours. */
.hero__fallback {
    display: none;
    position: absolute;
    right: 8%;
    top: 50%;
    width: min(46vw, 560px);
    aspect-ratio: 1;
    transform: translateY(-50%) perspective(900px) rotateX(52deg) rotateZ(-32deg);
    border: 6px solid var(--gold-deep);
    border-radius: 6px;
    background: repeating-conic-gradient(#43392c 0% 25%, #e9dfc8 0% 50%) 0 0 / 25% 25%;
    box-shadow: 0 60px 80px -30px rgba(0, 0, 0, 0.8);
}
.hero.is-flat .hero__stage canvas {
    display: none;
}
.hero.is-flat .hero__fallback {
    display: block;
}
.hero__copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 22px;
    pointer-events: none;
}
.hero__copy > * {
    pointer-events: auto;
}
.hero__copy .lede {
    max-width: 38ch;
}
.hero__ticker {
    position: absolute;
    left: 50%;
    bottom: 26px;
    z-index: 1;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12.5px;
}
.hero__ticker[hidden] {
    display: none;
}
.ticker {
    display: flex;
    gap: 6px;
    margin: 0 auto 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
}
.ticker li {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    white-space: nowrap;
    animation: ticker-in 0.4s var(--ease-spring) both;
}
.ticker li:last-child {
    border-color: var(--gold);
    color: var(--gold);
}
@keyframes ticker-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.9);
    }
}

/* The hero's own entrance: one line after another. */
.hero-in {
    animation: hero-in 0.9s var(--ease-out) both;
    animation-delay: calc(0.15s + var(--i, 0) * 0.11s);
}
@keyframes hero-in {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
}
.hero__ticker.hero-in {
    animation-name: hero-fade;
}
@keyframes hero-fade {
    from {
        opacity: 0;
    }
}

@media (max-width: 900px) {
    .hero {
        justify-content: flex-start;
        padding-top: calc(var(--nav-height) + 28px);
        padding-bottom: 58vh;
    }
    .hero__stage {
        inset: auto 0 0 0;
        height: 62vh;
    }
    .hero__stage::after {
        background: linear-gradient(180deg, var(--ink-0) 0%, transparent 26%), linear-gradient(0deg, var(--ink-0) 0%, transparent 18%);
    }
    .hero__fallback {
        right: 50%;
        top: auto;
        bottom: 8%;
        width: 74vw;
        transform: translateX(50%) perspective(900px) rotateX(52deg) rotateZ(-32deg);
    }
    .hero__ticker > span {
        display: none;
    }
    .ticker li:nth-last-child(n + 5) {
        display: none;
    }
}
/* A phone held sideways: the board stands beside the words, as it does on
   a desktop. Stacked under them it was below the first screen, and by the
   time it scrolled into view the camera had pulled away and it was tiny.
   The title is a size smaller so the two buttons are on the first screen. */
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
    .hero {
        justify-content: center;
        padding-top: var(--nav-height);
        padding-bottom: 0;
    }
    /* The stage starts part of the way across and under the navbar, so in
       the light theme the dark scene is not behind the navbar's buttons.
       Its left and top edges are faded with a mask: a painted fade would
       show as a seam against the glow at the top of the page. */
    .hero__stage {
        inset: var(--nav-height) 0 0 42%;
        height: auto;
        -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 34%), linear-gradient(180deg, transparent 0%, #000 24%);
        -webkit-mask-composite: source-in;
        mask-image: linear-gradient(90deg, transparent 0%, #000 34%), linear-gradient(180deg, transparent 0%, #000 24%);
        mask-composite: intersect;
    }
    .hero__stage::after {
        background: linear-gradient(0deg, var(--ink-0) 0%, transparent 20%);
    }
    .hero__fallback {
        right: 6%;
        top: 54%;
        bottom: auto;
        width: min(36vw, 300px);
        transform: translateY(-50%) perspective(900px) rotateX(52deg) rotateZ(-32deg);
    }
    .hero__copy {
        gap: 14px;
    }
    .hero__copy .display {
        font-size: 44px;
    }
    .hero__copy .lede {
        max-width: 40ch;
        font-size: 16px;
    }
    .ticker {
        margin: 0 0 0 auto;
    }
}
/* Between the phone layout and a full desktop the board comes up behind
   the last words of the paragraph, white pieces under light text. The
   fade on the left reaches further across so the words stay readable. */
@media (min-width: 901px) and (max-width: 1180px) {
    .hero__stage::after {
        background:
            linear-gradient(90deg, var(--ink-0) 22%, transparent 56%),
            linear-gradient(0deg, var(--ink-0) 0%, transparent 20%);
    }
}

/* ---------- ways to play ---------- */

.mode {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 300px;
    overflow: hidden;
}
.mode p {
    color: var(--muted);
}
.mode__go {
    margin-top: auto;
    padding-top: 14px;
    color: var(--gold);
    transition: letter-spacing 0.3s var(--ease-out);
}
.mode:hover .mode__go {
    letter-spacing: 0.04em;
}
.mode__art {
    position: relative;
    display: block;
    height: 96px;
    margin-bottom: 8px;
}
.mode__art i {
    position: absolute;
    display: block;
    border-radius: 6px;
    transition: transform 0.6s var(--ease-spring);
}
/* The engine: five candidate moves, one of them chosen. */
.mode__art--ai i {
    bottom: 8px;
    width: 14%;
    background: var(--ink-3);
}
.mode__art--ai i:nth-child(1) { left: 0; height: 34%; }
.mode__art--ai i:nth-child(2) { left: 18%; height: 58%; }
.mode__art--ai i:nth-child(3) { left: 36%; height: 88%; background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep)); }
.mode__art--ai i:nth-child(4) { left: 54%; height: 46%; }
.mode__art--ai i:nth-child(5) { left: 72%; height: 26%; }
.mode:hover .mode__art--ai i:nth-child(3) { transform: translateY(-8px); }
.mode:hover .mode__art--ai i:not(:nth-child(3)) { transform: scaleY(0.7); transform-origin: bottom; }
/* Two players: two discs that swap sides. */
.mode__art--pvp i {
    top: 18px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
}
.mode__art--pvp i:nth-child(1) { left: 0; background: linear-gradient(140deg, var(--gold-bright), var(--gold-deep)); }
.mode__art--pvp i:nth-child(2) { left: 46px; background: var(--ink-3); border: 1px solid var(--line-strong); }
.mode:hover .mode__art--pvp i:nth-child(1) { transform: translateX(46px); }
.mode:hover .mode__art--pvp i:nth-child(2) { transform: translateX(-46px); }
/* A puzzle: three squares, the last one drops into place. */
.mode__art--puzzle i {
    top: 20px;
    width: 56px;
    height: 56px;
    background: var(--ink-3);
}
.mode__art--puzzle i:nth-child(1) { left: 0; }
.mode__art--puzzle i:nth-child(2) { left: 62px; }
.mode__art--puzzle i:nth-child(3) { left: 124px; background: linear-gradient(140deg, var(--gold-bright), var(--gold-deep)); transform: translateY(-16px) rotate(12deg); }
.mode:hover .mode__art--puzzle i:nth-child(3) { transform: none; }

/* ---------- features ---------- */

.features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.feature {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    transition: border-color 0.25s, transform 0.4s var(--ease-out);
}
.feature:hover {
    border-color: color-mix(in srgb, var(--gold) 50%, transparent);
    transform: translateY(-3px);
}
.feature p {
    color: var(--muted);
}
.feature--wide {
    grid-column: span 2;
}
.clock {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
}
.clock__face {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--ink-2);
}
.clock__face b {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
    color: var(--muted);
}
.clock__face small {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.clock__face--on {
    border-color: var(--gold);
    background: var(--gold-wash);
}
.clock__face--on b {
    color: var(--gold);
}
.badges {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
}
.badges span {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--ink-3);
    transition: transform 0.5s var(--ease-spring);
    transition-delay: calc(var(--n, 0) * 60ms);
}
.badges span:nth-child(1),
.badges span:nth-child(2) {
    border: 0;
    background: radial-gradient(circle at 30% 25%, var(--gold-bright), var(--gold-deep));
}
.badges span:nth-child(2) { --n: 1; }
.badges span:nth-child(3) { --n: 2; }
.badges span:nth-child(4) { --n: 3; }
.feature:hover .badges span {
    transform: translateY(-6px) rotate(10deg);
}
@media (max-width: 960px) {
    .features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 560px) {
    .features {
        grid-template-columns: minmax(0, 1fr);
    }
    .feature--wide {
        grid-column: auto;
    }
}

/* ---------- the engine ---------- */

.engine {
    border-block: 1px solid var(--line);
    background: color-mix(in srgb, var(--ink-1) 55%, transparent);
}
.engine__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
}
.tree {
    margin: 0;
}
.tree svg {
    width: 100%;
    height: auto;
    overflow: visible;
}
.tree figcaption {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
}
.tree figcaption b {
    font-weight: 500;
    color: var(--gold);
}
.tree .edge {
    stroke: var(--line-strong);
    stroke-width: 1.5;
    transition: stroke 0.3s, opacity 0.3s;
}
.tree .node circle,
.tree .node rect {
    fill: var(--ink-3);
    stroke: var(--line-strong);
    stroke-width: 1.5;
    transition: fill 0.3s, stroke 0.3s, opacity 0.3s;
}
.tree .node text {
    fill: var(--muted);
    font-family: var(--font-mono);
    font-size: 13px;
    text-anchor: middle;
    dominant-baseline: central;
    transition: fill 0.3s, opacity 0.3s;
}
.tree .label {
    fill: var(--muted);
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
}
.tree .is-seen circle,
.tree .is-seen rect {
    stroke: var(--gold);
}
.tree .is-seen text {
    fill: var(--title);
}
.tree .edge.is-seen {
    stroke: var(--gold);
}
.tree .is-best circle,
.tree .is-best rect {
    fill: var(--gold);
    stroke: var(--gold);
}
.tree .is-best text {
    fill: var(--on-gold);
}
.tree .edge.is-best {
    stroke: var(--gold);
    stroke-width: 3;
}
.tree .is-pruned {
    opacity: 0.28;
}
.tree .edge.is-pruned {
    stroke-dasharray: 4 5;
}
@media (max-width: 900px) {
    .engine__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- open source, questions, closing ---------- */

.open {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: clamp(26px, 5vw, 60px);
    background:
        radial-gradient(60% 120% at 100% 0%, var(--gold-wash), transparent 70%),
        var(--ink-1);
}

.faq details {
    border-bottom: 1px solid var(--line);
}
.faq details:first-child {
    border-top: 1px solid var(--line);
}
.faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 4px;
    font-size: clamp(17px, 1.6vw, 20px);
    font-weight: 600;
    color: var(--title);
    cursor: pointer;
    list-style: none;
    transition: color 0.2s;
}
.faq summary::-webkit-details-marker {
    display: none;
}
.faq summary::after {
    content: '+';
    flex: none;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    font-family: var(--font-mono);
    font-weight: 400;
    color: var(--gold);
    transition: transform 0.35s var(--ease-spring), background 0.2s;
}
.faq summary:hover {
    color: var(--gold);
}
.faq details[open] summary::after {
    transform: rotate(45deg);
    background: var(--gold-wash);
}
.faq details p {
    max-width: 62ch;
    padding: 0 4px 24px;
    color: var(--text);
}

.closing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    text-align: center;
}

/* ---------- Discord ---------- */

.discord {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(24px, 5vw, 72px);
    align-items: center;
}
.discord__chat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: clamp(18px, 3vw, 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--ink-1);
}
.discord__bubble {
    align-self: flex-start;
    max-width: 84%;
    padding: 10px 16px;
    border-radius: 18px 18px 18px 6px;
    background: var(--ink-3);
    color: var(--title);
    font-size: 15px;
    opacity: 0;
    translate: 0 12px;
    transition: opacity 0.5s var(--ease-out), translate 0.6s var(--ease-spring);
    transition-delay: calc(0.25s + var(--i, 0) * 0.45s);
}
.discord__bubble--me {
    align-self: flex-end;
    border-radius: 18px 18px 6px 18px;
    background: var(--gold);
    color: var(--on-gold);
}
/* The messages arrive one after another once the section is in view. */
.discord.is-in .discord__bubble {
    opacity: 1;
    translate: none;
}
.no-js .discord__bubble {
    opacity: 1;
    translate: none;
}
@media (max-width: 860px) {
    .discord {
        grid-template-columns: minmax(0, 1fr);
    }
    .discord__chat {
        order: 2;
    }
}
@media (prefers-reduced-motion: reduce) {
    .discord__bubble {
        opacity: 1;
        translate: none;
    }
}

/* ---------- the low performance tier ----------
   data-perf="low" is set by perf.js; see the end of app.css. The board in
   the hero is drawn more cheaply by scene3d.js, or is the flat board above
   when the GPU is a software one. Here the page's own motion is cut down. */

/* The hero's lines fade in together, with no rise. */
[data-perf='low'] .hero-in {
    animation-name: hero-fade;
    animation-duration: 0.3s;
    animation-delay: 0s;
}
[data-perf='low'] .ticker li {
    animation: none;
}
[data-perf='low'] .hero__fallback {
    box-shadow: 0 26px 30px -20px rgba(0, 0, 0, 0.8);
}
/* The chat still arrives line by line, without the hop. */
[data-perf='low'] .discord__bubble {
    translate: none;
    transition: opacity 0.2s linear;
    transition-delay: calc(var(--i, 0) * 0.15s);
}

/* ---------- decoration ---------- */

/* Gold dust drifting up through the hero. */
.hero__dust {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Two bands of notation crossing the page under the hero. */
.ribbon {
    position: relative;
    z-index: 1;
    margin: clamp(8px, 2vw, 24px) 0 0;
    padding: 10px 0;
    overflow: hidden;
    rotate: -1.6deg;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-bright), var(--gold), var(--gold-deep));
    box-shadow: 0 18px 40px -22px var(--gold);
}
.ribbon__row {
    overflow: hidden;
    white-space: nowrap;
}
.ribbon__row + .ribbon__row {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid color-mix(in srgb, var(--on-gold) 22%, transparent);
}
.ribbon__track {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    padding-right: 18px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--on-gold);
    animation: ribbon-run 70s linear infinite;
}
.ribbon__row--reverse .ribbon__track {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    letter-spacing: 0;
    animation-direction: reverse;
    animation-duration: 90s;
}
.ribbon__track i {
    width: 7px;
    height: 7px;
    rotate: 45deg;
    background: var(--on-gold);
    opacity: 0.55;
}
.ribbon:hover .ribbon__track {
    animation-play-state: paused;
}
@keyframes ribbon-run {
    to {
        translate: -50% 0;
    }
}

/* Crown dividers between sections. */
.ornament {
    display: flex;
    justify-content: center;
    padding-block: 8px;
    color: var(--gold);
}
.ornament svg {
    width: min(600px, 100%);
    height: auto;
    overflow: visible;
}
.ornament__line,
.ornament__base {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-dasharray: 260;
    stroke-dashoffset: 260;
    transition: stroke-dashoffset 1.4s var(--ease-out) 0.2s;
}
.ornament__line {
    opacity: 0.8;
}
.ornament__gem,
.ornament__crown {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linejoin: round;
    transform-box: fill-box;
    transform-origin: center;
    scale: 0.4;
    opacity: 0;
    transition: scale 0.7s var(--ease-spring) 0.5s, opacity 0.4s 0.5s, fill 0.6s 1s;
}
.ornament.is-in .ornament__line,
.ornament.is-in .ornament__base {
    stroke-dashoffset: 0;
}
.ornament.is-in .ornament__gem,
.ornament.is-in .ornament__crown {
    scale: 1;
    opacity: 1;
}
.ornament.is-in .ornament__crown {
    fill: var(--gold-wash);
}
.no-js .ornament__line,
.no-js .ornament__base {
    stroke-dashoffset: 0;
}
.no-js .ornament__gem,
.no-js .ornament__crown {
    scale: 1;
    opacity: 1;
}

/* A faint board pattern behind a section, fading out at its edges. */
.section--checker {
    position: relative;
    isolation: isolate;
}
.section--checker::before {
    content: '';
    position: absolute;
    inset: 0 calc(-1 * var(--pad));
    z-index: -1;
    pointer-events: none;
    background: repeating-conic-gradient(color-mix(in srgb, var(--gold) 7%, transparent) 0 25%, transparent 0 50%) 0 0 / 72px 72px;
    -webkit-mask-image: radial-gradient(60% 55% at 50% 50%, #000 0%, transparent 75%);
    mask-image: radial-gradient(60% 55% at 50% 50%, #000 0%, transparent 75%);
}

/* The three ways in: a large numeral behind each card, and gold corners on hover. */
.mode {
    position: relative;
}
.mode__num {
    position: absolute;
    top: 6px;
    right: 18px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 96px;
    line-height: 1;
    color: var(--gold);
    opacity: 0.12;
    pointer-events: none;
    transition: opacity 0.3s, translate 0.5s var(--ease-out);
}
.mode:hover .mode__num {
    opacity: 0.28;
    translate: -6px 4px;
}
.mode::before {
    content: '';
    position: absolute;
    inset: 14px;
    pointer-events: none;
    opacity: 0;
    background:
        linear-gradient(var(--gold), var(--gold)) top left / 20px 1.5px no-repeat,
        linear-gradient(var(--gold), var(--gold)) top left / 1.5px 20px no-repeat,
        linear-gradient(var(--gold), var(--gold)) top right / 20px 1.5px no-repeat,
        linear-gradient(var(--gold), var(--gold)) top right / 1.5px 20px no-repeat,
        linear-gradient(var(--gold), var(--gold)) bottom left / 20px 1.5px no-repeat,
        linear-gradient(var(--gold), var(--gold)) bottom left / 1.5px 20px no-repeat,
        linear-gradient(var(--gold), var(--gold)) bottom right / 20px 1.5px no-repeat,
        linear-gradient(var(--gold), var(--gold)) bottom right / 1.5px 20px no-repeat;
    transition: opacity 0.3s, inset 0.45s var(--ease-spring);
}
.mode:hover::before,
.mode:focus-visible::before {
    opacity: 1;
    inset: 8px;
}

/* ---------- meet the pieces ---------- */

.pieces__grid {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: clamp(18px, 3vw, 36px);
    align-items: start;
}
.pieces__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.piece-pick {
    position: relative;
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--ink-1);
    text-align: left;
    transition: border-color 0.2s, background 0.2s, translate 0.35s var(--ease-spring);
}
.piece-pick img {
    grid-row: span 2;
    width: 56px;
    height: 56px;
    object-fit: contain;
    transition: scale 0.45s var(--ease-spring), rotate 0.45s var(--ease-spring);
}
.piece-pick span {
    font-size: 17px;
    font-weight: 600;
    color: var(--title);
    align-self: end;
}
.piece-pick small {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    align-self: start;
}
.piece-pick:hover {
    border-color: color-mix(in srgb, var(--gold) 55%, transparent);
    translate: 0 -2px;
}
.piece-pick:hover img {
    scale: 1.08;
    rotate: -6deg;
}
.piece-pick[aria-pressed='true'] {
    border-color: var(--gold);
    background: var(--gold-wash);
}
.piece-pick[aria-pressed='true'] img {
    scale: 1.12;
}
.pieces__stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: clamp(18px, 3vw, 32px);
    align-items: center;
}
.pieces__text {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pieces__text h3 {
    font-size: clamp(26px, 2.6vw, 34px);
}
.pieces__text p {
    color: var(--text);
}
.mini-board {
    --mini-light: #d9c39b;
    --mini-dark: #6b4f36;
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    aspect-ratio: 1;
    width: 100%;
    padding: 6px;
    border-radius: 12px;
    background: linear-gradient(145deg, #4a3523, #2a1d12);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 55%, transparent), var(--shadow);
}
.mini-board span {
    position: relative;
    display: grid;
    place-items: center;
    background: var(--mini-light) url('../board/maple.webp') center / 800% auto;
}
.mini-board span.is-dark {
    background: var(--mini-dark) url('../board/walnut.webp') center / 800% auto;
}
.mini-board span:first-child {
    border-top-left-radius: 6px;
}
.mini-board span:nth-child(8) {
    border-top-right-radius: 6px;
}
.mini-board span:nth-child(57) {
    border-bottom-left-radius: 6px;
}
.mini-board span:last-child {
    border-bottom-right-radius: 6px;
}
.mini-board img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: mini-land 0.5s var(--ease-spring) both;
}
@keyframes mini-land {
    from {
        translate: 0 -40%;
        opacity: 0;
    }
}
/* A square the piece can move to: a dot that pops in, nearer squares first. */
.mini-board .is-target::after {
    content: '';
    width: 30%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent);
    animation: mini-dot 0.35s var(--ease-spring) both;
    animation-delay: calc(var(--d, 0) * 70ms + 200ms);
}
/* A capture square: a ring round the piece standing there. */
.mini-board .is-capture::after {
    content: '';
    position: absolute;
    inset: 6%;
    border: 3px solid var(--check);
    border-radius: 50%;
    animation: mini-dot 0.35s var(--ease-spring) both;
    animation-delay: calc(var(--d, 0) * 70ms + 200ms);
}
@keyframes mini-dot {
    from {
        scale: 0;
        opacity: 0;
    }
}

@media (max-width: 960px) {
    .pieces__grid,
    .pieces__stage {
        grid-template-columns: minmax(0, 1fr);
    }
    .pieces__list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 560px) {
    .pieces__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .piece-pick {
        grid-template-columns: 44px 1fr;
        padding: 10px;
    }
    .piece-pick img {
        width: 44px;
        height: 44px;
    }
    .mode__num {
        font-size: 72px;
    }
}

/* ---------- closing ---------- */

.closing {
    overflow: hidden;
}
.closing__king {
    position: absolute;
    top: 50%;
    width: clamp(120px, 16vw, 220px);
    opacity: 0.3;
    pointer-events: none;
    filter: drop-shadow(0 30px 30px rgba(0, 0, 0, 0.5));
    animation: king-float 7s ease-in-out infinite;
}
.closing__king--white {
    left: 4%;
    translate: 0 -50%;
    rotate: -8deg;
}
.closing__king--black {
    right: 4%;
    translate: 0 -50%;
    rotate: 8deg;
    animation-delay: -3.5s;
}
@keyframes king-float {
    50% {
        translate: 0 calc(-50% - 14px);
    }
}
@media (max-width: 760px) {
    .closing__king {
        display: none;
    }
}

/* Low tier and reduced motion: the decoration stays, the motion goes. */
[data-perf='low'] .ribbon__track,
[data-perf='low'] .closing__king {
    animation: none;
}
[data-perf='low'] .ribbon {
    box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
    .ribbon__track,
    .closing__king {
        animation: none;
    }
    .ornament__line,
    .ornament__base {
        stroke-dashoffset: 0;
    }
    .ornament__gem,
    .ornament__crown {
        scale: 1;
        opacity: 1;
    }
}
