:root {
    color-scheme: light;
    --paper: #fffdf8;
    --bg: #f4f0e6;
    --ink: #172a36;
    --muted: #485c60;
    --line: #d6ded6;
    --accent: #16574f;
    --mint: #e1efe7;
    --gold: #6c491c;
    --sand: #f7ebd1;
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.shell { width: min(100%, 62rem); padding: clamp(.8rem, 3vw, 2.25rem); margin-inline: auto; }
h1, h2, h3, p { margin: 0; }
.intro { margin: .25rem 0 1.35rem; }
.eyebrow { color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { font: 700 clamp(2.15rem, 6vw, 3.8rem)/1.08 Georgia, serif; letter-spacing: -.035em; margin: .35rem 0 .65rem; }
.lede { font-size: clamp(1rem, 2vw, 1.17rem); color: var(--muted); max-width: 47rem; }
.board, .guide { background: var(--paper); border: 1px solid var(--line); border-radius: 1.25rem; }
.board { box-shadow: 0 .6rem 1.75rem #172a360b; overflow: hidden; }
.toolbar, .play, .links, .solution, .guide { padding: clamp(.85rem, 3vw, 1.45rem); }
.toolbar, .play-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem 1rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
.small { color: var(--muted); font-size: .91rem; }
.chooser { display: grid; min-width: 0; gap: .2rem; }
.selectors { display: flex; flex-wrap: wrap; gap: .55rem .8rem; max-width: 100%; }
.selectors .chooser { flex: 1 1 12rem; }
.selectors select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.book-note { margin: 0 clamp(.85rem, 3vw, 1.45rem) .85rem; color: var(--muted); font-size: .9rem; }
.book-note a { color: var(--accent); font-weight: 700; }
.loose { font-weight: 750; color: var(--gold); }
label { color: var(--muted); font-size: .87rem; font-weight: 700; }
button, select { font: inherit; color: var(--ink); }
select { max-width: 100%; min-height: 44px; background: white; border: 1px solid #aabdb6; border-radius: .55rem; padding: .4rem .55rem; }
.endpoints {
    display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: stretch;
    gap: clamp(.35rem, 2vw, 1rem); padding: 0 clamp(.85rem, 3vw, 1.45rem);
}
.endpoint {
    display: grid; align-content: center; gap: .1rem; padding: .7rem clamp(.5rem, 2vw, 1rem);
    border: 1px solid #bad7c9; border-radius: .85rem; background: var(--mint); overflow-wrap: anywhere;
}
.endpoint > span { color: var(--accent); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.endpoint strong { font: 700 clamp(1.22rem, 3.6vw, 2rem)/1.15 Georgia, serif; }
.original-word { display: block; margin-top: .12rem; font: 500 .79rem/1.25 system-ui, sans-serif; opacity: .86; }
.tile { max-width: 100%; overflow-wrap: anywhere; }
.target { background: var(--sand); border-color: #e1cea6; }
.target > span { color: var(--gold); }
.arrow { align-self: center; color: var(--accent); font-size: 1.2rem; font-weight: 800; }
.moves { color: var(--accent); font-size: .9rem; font-weight: 800; }
.path { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: .65rem 0 1rem; padding: 0; list-style: none; }
.path li { position: relative; background: var(--mint); border-radius: .55rem; padding: .28rem .65rem; font-weight: 750; overflow-wrap: anywhere; }
.path li + li::before { content: "›"; position: absolute; left: -.64rem; color: var(--muted); }
.path .origin { background: var(--accent); color: white; }
.path .destination { background: var(--sand); color: var(--gold); }
.path .blank { border: 1px dashed #8baba1; background: transparent; color: var(--muted); }
.bank-help { margin: .25rem 0 .65rem; }
.bank, .actions { display: flex; flex-wrap: wrap; gap: .55rem; }
button, summary { cursor: pointer; }
button { min-height: 44px; padding: .47rem .85rem; border: 1px solid #aabdb6; border-radius: .65rem; font-weight: 700; background: white; }
button:hover:not(:disabled):not([aria-disabled="true"]) { border-color: var(--accent); background: var(--mint); }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #115b99; outline-offset: 3px; }
button:disabled, button[aria-disabled="true"] { opacity: .58; cursor: default; }
.tile.goal { border-color: #a97c35; background: #fff9eb; }
.tile.suggested { background: var(--mint); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tile.used { text-decoration: line-through; }
.actions { margin-top: .7rem; }
button.primary, button#next { background: var(--accent); border-color: var(--accent); color: white; }
button.primary:hover:not(:disabled), button#next:hover { background: #11463e; color: white; }
.status { min-height: 3rem; margin-top: .9rem; padding: .62rem .75rem; border-radius: .65rem; background: #f0f5f2; color: #274943; }
.status[data-state="tip"], .status[data-state="retry"] { background: var(--sand); color: var(--gold); }
.status[data-state="win"] { background: var(--mint); color: var(--accent); font-weight: 800; }
.links, .solution { border-top: 1px solid var(--line); }
.links { padding-top: .8rem; padding-bottom: .8rem; }
.link-list { margin: .55rem 0 0; padding-left: 1.3rem; }
.link-list li + li { margin-top: .55rem; }
.link-list p { color: var(--muted); }
.solution { background: #f8f6ee; }
summary { color: var(--accent); font-weight: 800; min-height: 44px; align-content: center; }
#solution-body { padding: .35rem 0 .1rem; }
.guide { margin-top: 1.15rem; }
.guide p { margin-top: .6rem; }
.example { background: var(--sand); color: #513615; padding: .7rem .85rem; border-radius: .65rem; }
.source { margin: 1.25rem .15rem .35rem; color: var(--muted); font-size: .9rem; }
.source p + p { margin-top: .35rem; }
@media (max-width: 350px) {
    .toolbar { align-items: stretch; flex-direction: column; }
    .endpoint { padding-inline: .4rem; }
    .endpoints { gap: .25rem; }
}
