:root {
    color-scheme: light;
    --ink: #183b34;
    --pine: #173f35;
    --muted: #4d6355;
    --line: #c3c8b5;
    --paper: #fbf8ec;
    --ochre: #99532d;
    --serif: Baskervville, "Iowan Old Style", Georgia, serif;
    font: 100%/1.45 Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: #e8e9dd;
    -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body, h1, h2, p, dl, dd, ul { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .2em; }
button, select { font: inherit; color: inherit; }
button, select, nav a { min-height: 44px; }
button {
    border: 1px solid #9ba995; border-radius: .35rem; padding: .4rem .85rem; background: var(--paper);
    font-size: .89rem; font-weight: 680; cursor: pointer;
}
button:disabled { opacity: .53; cursor: default; }
button:hover:enabled { border-color: var(--ink); }
:focus-visible { outline: 3px solid #a5552b; outline-offset: 2px; }
.masthead {
    background: var(--pine); color: #f8f3dd; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: calc(.68rem + env(safe-area-inset-top)) max(4vw, env(safe-area-inset-right)) .68rem max(4vw, env(safe-area-inset-left));
    border-bottom: 3px solid #be975e;
}
h1 { display: flex; align-items: center; gap: .65rem; font: 600 clamp(1.65rem, 3vw, 2.15rem)/1 var(--serif); letter-spacing: -.045em; }
.masthead h1 small { display: block; font: 650 .68rem/1.2 system-ui, sans-serif; letter-spacing: 0; }
.compass { display: grid; place-items: center; height: 2.25rem; width: 2.25rem; border: 1.5px solid #e6cb90; border-radius: 50%; position: relative; }
.compass::before, .compass::after { content: ''; position: absolute; width: .55rem; height: 1.55rem; clip-path: polygon(50% 0, 100% 58%, 50% 100%, 0 42%); }
.compass::before { background: #d7e2cd; transform: rotate(-60deg) scale(.74); }
.compass::after { background: linear-gradient(to bottom, #e9b879 51%, #9ab5a4 51%); transform: rotate(30deg); }
nav { display: flex; align-items: center; gap: clamp(.35rem, 2vw, 1rem); }
nav a { display: inline-flex; align-items: center; padding: .35rem .6rem; font-size: .87rem; font-weight: 650; }
#explorer-account { border: 1px solid #91a394; border-radius: .35rem; text-decoration: none; padding-inline: .85rem; }
main { max-width: 95rem; margin: auto; padding: clamp(1.1rem,3vw,3rem) max(3.5vw,env(safe-area-inset-left)) max(2rem,env(safe-area-inset-bottom)); }
.notebook { display: grid; grid-template-columns: minmax(18rem, .78fr) minmax(0, 1.65fr); grid-template-areas: 'chapter map' 'album map'; align-items: start; gap: 1.1rem clamp(1.25rem, 3vw, 3rem); }
.chapter { grid-area: chapter; }
.chapter-number { color: var(--ochre); font: 700 .76rem/1.3 ui-monospace, monospace; letter-spacing: .09em; text-transform: uppercase; }
h2 { font: 550 clamp(1.45rem, 2.3vw, 2.1rem)/1.13 var(--serif); letter-spacing: -.035em; }
.chapter h2 { font-size: clamp(2.3rem,4.5vw,4.6rem); margin-block: .3rem .6rem; }
.lead { max-width: 38ch; color: var(--muted); margin-bottom: 1rem; }
.primary { display: inline-flex; gap: .9rem; align-items: center; justify-content: center; background: var(--pine); border-color: var(--pine); color: #fff8df; font-weight: 720; min-height: 46px; padding-inline: 1.2rem; }
.primary i { color: #efd393; font: inherit; }
.hint, #album-status, #walk-status, #saved-selection, #album-empty { font-size: .86rem; color: var(--muted); }
.hint { margin: .55rem 0 0; }
#walk-panel { border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .75rem; }
#walk-panel label { display: block; font-size: .8rem; font-weight: 680; margin: .55rem 0 .16rem; }
#walk-target { width: 100%; max-width: 32rem; background: var(--paper); border: 1px solid #91a08d; border-radius: .35rem; padding: .35rem; }
#walk-discover { margin-top: .4rem; }
.walk-controls { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .55rem; }
.map { grid-area: map; min-width: 0; align-self: stretch; }
.stage { position: relative; isolation: isolate; min-height: 25rem; height: min(69vh, 45rem); overflow: hidden;
    border: 1px solid #8e9e8b; border-radius: .6rem; background: #dae2cf; box-shadow: 0 4px 18px #284b3515; }
.stage:has(canvas[hidden]) { display: none; }
@media (min-width: 731px) {
    .notebook:has(canvas[hidden]) { grid-template-columns: minmax(18rem, .78fr) minmax(0, 1.1fr); grid-template-areas: 'chapter album' 'map album'; }
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
canvas:focus-visible { outline-offset: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.map-tools { display: grid; position: absolute; top: .7rem; right: .7rem; border: 1px solid #a1ab96; border-radius: .4rem; overflow: hidden; box-shadow: 0 1px 6px #24453620; }
.map-tools button { border: 0; border-radius: 0; width: 44px; height: 44px; font-size: 1.45rem; font-weight: 600; line-height: 1; padding: 0; }
.map-tools button + button { border-top: 1px solid var(--line); }
.map-tools button:focus-visible { outline-offset: -3px; }
.map-scale { position: absolute; bottom: .6rem; left: .68rem; padding: .16rem .45rem .3rem; border: 1px solid var(--line);
    border-radius: .25rem; background: var(--paper); font-size: .73rem; text-align: center; font-weight: 650; pointer-events: none; }
#scale-line { display: block; height: 4px; border: solid currentColor; border-width: 0 1px 1px; }
#walk-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#walk-overlay i { position: absolute; display: block; transform: translate(-50%, -50%); border-radius: 50%; }
#walk-accuracy { border: 1.5px solid #067ba1a6; background: #107e9f24; }
#walk-player { width: 15px; height: 15px; border: 2px solid white; background: #096c91; box-shadow: 0 0 0 1.5px #134e65; }
#walk-goal { width: 23px; height: 23px; border: 3px solid #9b4925; background: #f5dfa7b5; box-shadow: 0 0 0 1.5px white; }
#walk-goal::after { content: ''; display: block; width: 7px; height: 7px; margin: 5px; border-radius: 50%; background: #9b4925; }
.map-caption, .credits { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .7rem; margin-top: .45rem; font-size: .76rem; color: var(--muted); }
#position { font-variant-numeric: tabular-nums; font-weight: 670; }
#status[data-state="error"], #album-status[data-error="true"] { color: #873d23; }
.credits { margin-top: .2rem; }
#album { grid-area: album; margin-top: .4rem; background: var(--paper); border: 1px solid var(--line); border-radius: .45rem; padding: clamp(.85rem, 2vw, 1.5rem); box-shadow: 2px 3px 0 #cdd2c2; }
.album-heading { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; }
#album-chapter { color: var(--muted); font-size: .78rem; font-weight: 650; }
.totals { display: flex; margin-top: .85rem; border-block: 1px solid var(--line); }
.totals > div { display: flex; align-items: baseline; gap: .45rem; padding: .5rem .9rem .5rem 0; }
.totals > div + div { padding-left: .9rem; border-left: 1px solid var(--line); }
.totals dt { color: var(--muted); font-size: .8rem; }
.totals dd { order: -1; font: 600 1.48rem/1.2 var(--serif); }
#album-empty, #saved-selection, #album-status:not(:empty), #album-retry { margin-top: .65rem; }
#album-cards, #album-achievements { list-style: none; padding: 0; }
#album-cards li { display: grid; grid-template-columns: 3.8rem 1fr; align-items: center; gap: .65rem; padding: .65rem 0; border-bottom: 1px dashed var(--line); }
#album-cards strong { display: block; font: 600 1.1rem/1.2 var(--serif); }
#album-cards small { display: block; padding-top: .17rem; color: var(--muted); }
.card-art { display: block; width: 3.8rem; height: 3.8rem; border-radius: .2rem; object-fit: contain; }
.card-stamp { display: grid; place-items: center; border: 1px solid var(--ochre); color: var(--ochre); border-radius: 50%; font: 1.75rem/1 var(--serif); }
#album-achievements { display: flex; flex-wrap: wrap; gap: .35rem; }
#album-achievements li { margin-top: .6rem; padding: .16rem .48rem; border: 1px solid #b2a075; border-radius: .2rem; color: #765025; font: 650 .77rem/1.45 ui-monospace, monospace; }
#clear-selection { min-height: 34px; margin-left: .2rem; }
@media (max-width: 730px) {
    main { padding-block: 1.05rem 2rem; }
    .notebook { grid-template-columns: 1fr; grid-template-areas: 'chapter' 'map' 'album'; gap: .85rem; }
    .chapter h2 { margin: .15rem 0 .35rem; }
    .lead { max-width: none; margin-bottom: .55rem; }
    .stage { min-height: 16rem; height: clamp(16rem, 39dvh, 29rem); }
    #album { margin-top: .1rem; }
}
@media (max-height: 440px) and (min-width: 731px) { .stage { min-height: 15rem; } }
