:root {
  --ground: #0a0a0a;
  --bar: #0d0d0d;
  --panel: #121212;
  --raised: #171717;
  --line: #222;
  --line-soft: #1a1a1a;
  --text: #d6d6d6;
  --strong: #ececec;
  --dim: #9a9a9a;
  --faint: #868686;
  --gold: #d4a017;
  --gold-soft: #2b2310;
  --gold-line: #5a4612;
  --green: #4caf50;
  --green-soft: #13251a;
  --red: #ef5350;
  --red-soft: #2a1414;
  --violet: #b48ad8;
  --violet-soft: #221a2c;
  --land-0: #141412;
  --land-1: #23221d;
  --land-2: #34322a;
  --land-3: #46433a;
  --display: 'Pirata One', 'Iowan Old Style', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --r: 10px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--gold); color: #120e02; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-color: #33302a var(--ground); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #33302a; border-radius: 10px; border: 2px solid var(--ground); }
::-webkit-scrollbar-track { background: var(--ground); }
a { color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select { font: inherit; color: inherit; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Top bar ── */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; height: 64px; padding: 0 24px; background: rgba(13, 13, 13, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--strong); flex: none; }
.brand .mark { display: block; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .6)); }  /* the casket inventory icon, © Jagex */
.wordmark { font: 400 30px/1 var(--display); letter-spacing: .5px; color: #e0e0e0; }
.wordmark b { font-weight: 400; color: var(--gold); }
.wordmark i { font: 13px var(--sans); font-family: 'Pacifico', cursive; font-style: normal; color: #858585; margin-left: 1px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper select { appearance: none; background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; border: 1px solid #2c2c2c; border-radius: 8px; padding: 8px 34px 8px 12px; font: 13px var(--mono); color: var(--strong); max-width: 280px; cursor: pointer; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; background: var(--raised); border: 1px solid #2c2c2c; border-radius: 8px; color: var(--dim); cursor: pointer; transition: color .15s, border-color .15s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--strong); border-color: #444; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.search { position: relative; margin-left: auto; width: min(420px, 38vw); }
.search > svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; background: var(--raised); border: 1px solid #2c2c2c; border-radius: 8px; padding: 9px 40px 9px 36px; color: var(--strong); }
.search input::placeholder, .toolbar input::placeholder { color: #808080; }
.search input:focus { border-color: var(--gold-line); outline: none; box-shadow: 0 0 0 3px rgba(212, 160, 23, .12); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 11px var(--mono); color: var(--faint); border: 1px solid #333; border-radius: 4px; padding: 0 5px; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 560px); overflow: auto; background: #141414; border: 1px solid #2e2e2e; border-radius: var(--r); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .8); padding: 6px; }
.results button { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-radius: 7px; padding: 7px 8px; cursor: pointer; }
.results button:hover, .results button[aria-selected="true"] { background: #1f1d17; }
.results .k { font: 600 10px var(--mono); text-transform: uppercase; color: var(--faint); letter-spacing: .06em; }
.results b { display: block; font-weight: 600; color: var(--strong); font-size: 14px; }
.results small { font: 11px var(--mono); color: var(--dim); }
.results time { font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
.results .none { padding: 10px; color: var(--dim); }

/* ── Shell ── */
.shell { --rail: 520px; display: grid; grid-template-columns: var(--rail) 0 minmax(0, 1fr); min-height: calc(100vh - 64px); }
.rail-grip { position: sticky; top: 64px; z-index: 6; width: 12px; height: calc(100vh - 64px); margin-left: -6px; cursor: col-resize; touch-action: none; outline: none; }
.rail-grip::before { content: ''; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px; background: transparent; transition: background .15s; }
.rail-grip::after { content: ''; position: absolute; top: 50%; left: 2px; width: 8px; height: 40px; margin-top: -20px; border-radius: 4px; background: #2a2a2a; border: 1px solid #3a3a3a; opacity: 0; transition: opacity .15s, background .15s; }
.rail-grip:hover::before, .rail-grip:focus-visible::before, body.resizing .rail-grip::before { background: var(--gold); }
.rail-grip:hover::after, .rail-grip:focus-visible::after, body.resizing .rail-grip::after { opacity: 1; background: var(--gold); border-color: var(--gold); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing #map { pointer-events: none; }
.world { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow: auto; padding: 24px 24px 32px; border-right: 1px solid var(--line-soft); }
.world h1 { margin: 0; font: 400 34px/1.1 var(--display); color: var(--strong); letter-spacing: .3px; }
.meta { margin: 6px 0 18px; font: 12px/1.6 var(--mono); color: var(--dim); }
.meta .beta { color: var(--violet); }
.meta .hot { color: var(--gold); }
.map { margin: 0 0 18px; }
.map-head { margin: 0 0 10px; }
.map-head h2 { margin: 0; font: 400 22px/1.15 var(--display); color: var(--gold); letter-spacing: .3px; }
.map-head p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--dim); max-width: 60ch; }
.map-frame { position: relative; height: clamp(320px, calc(var(--rail) * .8), calc(100vh - 240px));  /* grows as the sidebar is dragged wider */ border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #000; }
#map { position: absolute; inset: 0; background: #000; font: 13px var(--sans); outline: none; }
#map .leaflet-tile { image-rendering: pixelated; }
#map img.leaflet-tile { mix-blend-mode: normal; }  /* Leaflet adds plus-lighter; with our 1px tile overlap (app.js) that would brighten the seams */
#map .leaflet-pane.dim { filter: brightness(.42) saturate(.55); }
.map-ctl { position: absolute; z-index: 800; display: flex; gap: 6px; }
.map-ctl.top-left { top: 10px; left: 10px; } .map-ctl.top-right { top: 10px; right: 10px; } .map-ctl.bottom-left { bottom: 12px; left: 10px; }
.floors { display: flex; background: rgba(10, 10, 10, .86); border: 1px solid #333; border-radius: 8px; padding: 2px; backdrop-filter: blur(6px); }
.floors .map-btn { border: 0; background: none; min-width: 34px; }
.floors .map-btn[aria-pressed="true"] { background: var(--gold); color: #120e02; }
.map-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; background: rgba(10, 10, 10, .86); border: 1px solid #333; border-radius: 7px; color: var(--text); font: 600 12px var(--sans); cursor: pointer; backdrop-filter: blur(6px); transition: color .15s, border-color .15s, background .15s; }
.map-btn:hover { color: var(--strong); border-color: var(--gold-line); }
.map-btn[aria-pressed="true"] { color: var(--gold); border-color: var(--gold-line); }
.map-btn.icon { width: 30px; padding: 0; justify-content: center; }
.map-btn.icon svg { width: 16px; height: 16px; }
.map-btn span { font: 600 10px var(--mono); color: #120e02; background: var(--gold); border-radius: 4px; padding: 0 4px; line-height: 15px; }
.floors .map-btn[aria-pressed="true"] span { background: #120e02; color: var(--gold); }
.map-btn:not(.has) { color: var(--faint); }
.floors .map-btn[aria-pressed="true"]:not(.has) { color: #120e02; }
.map-coord { position: absolute; z-index: 800; right: 52px; bottom: 12px; margin: 0; font: 11px var(--mono); color: var(--strong); text-shadow: 0 1px 2px #000, 0 0 4px #000; pointer-events: none; }
#map .leaflet-control-zoom { border: 1px solid #333; border-radius: 8px; overflow: hidden; margin: 0 10px 12px 0; box-shadow: none; }
#map .leaflet-control-zoom a { background: rgba(10, 10, 10, .86); color: var(--text); border-bottom-color: #333; width: 30px; height: 30px; line-height: 28px; }
#map .leaflet-control-zoom a:hover { color: var(--gold); background: #111; }
#map .leaflet-control-zoom a.leaflet-disabled { color: #555; }
#map .sqbox.ch { stroke: var(--gold); fill: var(--gold); }
#map .sqbox.nw { stroke: var(--green); fill: var(--green); }
#map .sqbox.elsewhere { stroke-opacity: .75; }
#map .sqbox:hover { stroke: #ffd34d; fill-opacity: .2; }
#map .chtiles { stroke: #ffd34d; fill: var(--gold); stroke-opacity: .9; }
#map .mlabel { width: 0; height: 0; }
#map .mlabel span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; text-align: center; font: 700 11px/1.15 var(--sans); text-shadow: 1px 1px 0 #000, -1px 0 2px #000, 0 0 3px #000; }
#map .mlabel.s1 span { font-size: 13px; }
#map .mlabel.s2 span { font: 400 19px/1.05 var(--display); letter-spacing: .4px; }
#map[data-lz="far"] .mlabel.s0, #map[data-lz="far"] .mlabel.s1, #map[data-lz="mid"] .mlabel.s0 { display: none; }
#map[data-lz="near"] .mlabel.s2 { opacity: .55; }
.map-tip { background: rgba(12, 12, 12, .95); border: 1px solid var(--gold-line); color: var(--text); border-radius: 7px; font: 12px/1.45 var(--sans); padding: 7px 9px; box-shadow: 0 8px 20px -6px #000; }
.map-tip b { color: var(--strong); } .map-tip span { color: var(--dim); }
.map-tip.leaflet-tooltip-top::before { border-top-color: var(--gold-line); }
.map.wide { position: fixed; z-index: 30; inset: 64px 0 0 0; margin: 0; padding: 14px 18px 12px; background: var(--ground); display: flex; flex-direction: column; }
.map.wide .map-head p { display: none; }
.map.wide .map-frame { flex: 1; height: auto; }
body.map-open { overflow: hidden; }
body.map-open .world { z-index: 25; }  /* the sticky rail is its own stacking context: lift it over the work area */
.legend { display: flex; gap: 16px; margin-top: 9px; font: 12px var(--mono); color: var(--dim); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sw.changed { background: var(--gold); } .sw.added { background: var(--green); } .sw.other { border: 1.5px dashed var(--gold); background: none; }

.squares h2 { margin: 22px 0 8px; font: 600 13px var(--sans); color: var(--strong); display: flex; justify-content: space-between; }
.squares h2 span { font: 12px var(--mono); color: var(--dim); font-weight: 400; }
.sq { border-top: 1px solid var(--line-soft); }
.sq summary { list-style: none; cursor: pointer; padding: 11px 2px; display: grid; gap: 2px; }
.sq summary::-webkit-details-marker { display: none; }
.sq summary b { color: var(--strong); font-weight: 600; font-size: 14px; }
.sq summary span { color: var(--dim); font-size: 13px; }
.sq summary .co { font: 11px var(--mono); color: var(--faint); }
.sq summary .fl { font: 600 11px var(--mono); color: var(--gold); letter-spacing: .02em; }
.sq[open] summary b { color: var(--gold); }
.sq.flash summary { animation: flash 1.2s cubic-bezier(.16, 1, .3, 1); }
@keyframes flash { from { background: var(--gold-soft); } to { background: transparent; } }
.sq ul { margin: 0 0 12px; padding: 0 0 0 16px; font-size: 13px; color: var(--text); }
.sq li { margin: 4px 0; line-height: 1.5; }
.sq li .dim { color: var(--dim); }
.sq .unread { color: #c9a04a; }
.note { font-size: 13px; color: var(--dim); margin: 10px 0 0; }
.all-sq { display: none; margin-top: 10px; width: 100%; }

/* ── Work area ── */
.work { min-width: 0; padding: 18px 28px 40px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 14px 10px; color: var(--dim); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button span { font: 12px var(--mono); color: var(--faint); margin-left: 6px; font-weight: 400; }
.tabs button:hover { color: var(--strong); }
.tabs button[aria-selected="true"] { color: var(--strong); border-bottom-color: var(--gold); }
.tabs button.mob { display: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.toolbar input { flex: 0 1 300px; background: var(--raised); border: 1px solid #2c2c2c; border-radius: 8px; padding: 8px 12px; color: var(--strong); }
.toolbar input:focus { outline: none; border-color: var(--gold-line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--raised); border: 1px solid #2c2c2c; border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--text); cursor: pointer; }
.chips button span { font: 11px var(--mono); color: var(--faint); margin-left: 4px; }
.chips button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.card { position: relative; display: flex; flex-direction: column; text-align: left; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; padding: 0; cursor: pointer; transition: border-color .18s, transform .18s cubic-bezier(.16, 1, .3, 1), box-shadow .18s; }
.card:hover { border-color: #3a3424; transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .9); }
.card .main { display: flex; flex-direction: column; flex: 1; width: 100%; background: none; border: 0; padding: 0; margin: 0; text-align: left; color: inherit; cursor: pointer; }
.card .main:focus-visible { outline-offset: -2px; border-radius: var(--r); }
.vars { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 11px 11px; }
.vlabel { width: 100%; font: 11px var(--mono); color: var(--dim); margin-bottom: 1px; }
.vb, .vv { width: 28px; height: 28px; padding: 0; border: 1px solid #2c2c2c; border-radius: 6px; background: #141414; cursor: pointer; overflow: hidden; display: grid; place-items: center; transition: border-color .15s; }
.vb:hover, .vv:hover { border-color: #555; }
.vb[aria-pressed="true"], .vv[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.mini { display: block; width: 100%; height: 100%; background-repeat: no-repeat; background-color: #111; }
.mini.none { display: grid; place-items: center; font: 11px var(--mono); color: var(--dim); }
.card.multi { border-color: #2a261b; }
.note.grp { margin: 0 0 14px; }
.v-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; max-height: 70px; overflow: auto; }
.v-vars[hidden] { display: none; }
.v-vars .vlabel { width: auto; margin: 0 6px 0 0; }
.v-vars .vv { width: 32px; height: 32px; }
.thumb { aspect-ratio: 1; background-color: #111; background-repeat: no-repeat; }
.thumb.none { display: grid; place-items: center; color: var(--faint); font: 12px var(--mono); }
.card .t { padding: 9px 11px 11px; display: grid; gap: 2px; }
.card b { color: var(--strong); font-weight: 600; font-size: 14px; line-height: 1.3; }
.card b.unnamed { color: var(--dim); font-weight: 500; font-style: italic; }
.card code { font: 11px/1.4 var(--mono); color: var(--dim); word-break: break-all; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { font: 11px var(--mono); padding: 1px 6px; border-radius: 4px; background: #1d1d1d; color: var(--dim); }
.tag.np { background: var(--gold-soft); color: var(--gold); }
.tag.on { background: var(--green-soft); color: #7ccf80; }
.tag.ch { background: var(--red-soft); color: #f08a88; }
.empty { padding: 48px 0; color: var(--dim); max-width: 60ch; }
.empty b { display: block; color: var(--strong); font-size: 16px; margin-bottom: 4px; }
/* ── Sounds ── */
.snd-note { margin: 16px 0 12px; font-size: 13px; color: var(--dim); max-width: 75ch; }
.sounds { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.snd { display: grid; grid-template-columns: 40px minmax(0, 1.4fr) minmax(90px, 1fr) 62px 36px; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 8px 10px; }
.snd:hover { border-color: #2c2c2c; }
.snd.on { border-color: var(--gold-line); background: #15130d; }
.snd .play { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--gold); cursor: pointer; transition: background .15s, color .15s; }
.snd .play:hover { background: var(--gold); color: #120e02; }
.snd .play svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.snd .i-stop, .snd.on .i-play { display: none; } .snd.on .i-stop { display: block; }
.snd.on .play { background: var(--gold); color: #120e02; }
.snd .play:disabled { opacity: .3; cursor: default; background: none; }
.snd .sn { min-width: 0; }
.snd .sn b { display: block; font: 600 13px var(--mono); color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd .sn code { font: 11px var(--mono); color: var(--faint); }
.snd .wave { display: flex; align-items: center; gap: 2px; height: 30px; }
.snd .wave i { flex: 1; min-width: 1px; background: #3d3a30; border-radius: 1px; }
.snd.on .wave i { background: #5a5236; } .snd .wave i.lit { background: var(--gold); }
.snd .dur { font: 12px var(--mono); color: var(--dim); text-align: right; }
.snd.silent .dur { color: var(--faint); font-size: 11px; }
.snd .dl { width: 32px; height: 32px; }
.snd .dl svg { width: 16px; height: 16px; }
.more { display: block; margin: 22px auto 0; background: var(--raised); border: 1px solid #2c2c2c; border-radius: 8px; padding: 9px 18px; color: var(--strong); cursor: pointer; }

.lists details { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 0 14px; margin-bottom: 8px; }
.lists summary { cursor: pointer; padding: 12px 0; color: var(--strong); font-weight: 600; }
.lists summary span { font: 12px var(--mono); color: var(--dim); font-weight: 400; margin-left: 8px; }
.lists .first { display: block; font-weight: 400; font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.cols { columns: 3 230px; column-gap: 24px; padding: 0 0 14px; font: 12px/1.7 var(--mono); color: #bdbdbd; }
.cols div { break-inside: avoid; }
table.ren { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ren td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.ren td:first-child { font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
table.ren .to { color: var(--strong); font-weight: 600; }

/* ── Footer ── */
.foot { border-top: 1px solid var(--line); padding: 26px 24px 34px; display: grid; gap: 10px; justify-items: center; text-align: center; background: var(--bar); }
.discord { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; color: var(--text); }
.discord .dc { width: 22px; height: 22px; fill: #8c93f7; stroke: none; }
.discord strong { color: var(--strong); font-family: var(--mono); }
.ghost { background: transparent; border: 1px solid #333; border-radius: 8px; padding: 6px 12px; color: var(--text); cursor: pointer; font-size: 13px; }
.ghost:hover { border-color: var(--gold-line); color: var(--strong); }
.fine { margin: 0; font-size: 13px; color: var(--dim); }

/* ── 3D viewer ── */
dialog#viewer { width: min(1320px, 94vw); height: min(940px, 90vh); padding: 0; border: 1px solid #2e2e2e; border-radius: 14px; background: #0e0e0e; color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9); display: none; flex-direction: column; }
dialog#viewer[open] { display: flex; animation: rise .32s cubic-bezier(.16, 1, .3, 1); }
dialog#changelog { width: min(640px, 92vw); max-height: min(760px, 86vh); padding: 0; border: 1px solid #2e2e2e; border-radius: 14px; background: #0e0e0e; color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9); flex-direction: column; }
dialog#changelog[open] { display: flex; animation: rise .32s cubic-bezier(.16, 1, .3, 1); }
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); }
.log-head h2 { margin: 0; font: 400 26px/1.1 var(--display); color: var(--strong); }
.log-body { overflow: auto; padding: 6px 22px 20px; }
.log-body h3 { margin: 18px 0 8px; font: 600 12px var(--mono); color: var(--gold); letter-spacing: .04em; text-transform: uppercase; }
.log-body ul { margin: 0; padding: 0 0 0 18px; }
.log-body li { margin: 0 0 9px; font-size: 14px; line-height: 1.55; color: var(--text); }
.log-body li b { color: var(--strong); font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; }
dialog::backdrop { background: rgba(5, 5, 5, .72); backdrop-filter: blur(3px); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.v-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); }
.v-head h2 { margin: 0; font: 400 26px/1.1 var(--display); color: var(--strong); }
.v-sub { margin: 4px 0 0; font: 12px var(--mono); color: var(--dim); }
.v-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.v-light { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 8px; border: 1px solid #333; border-radius: 8px; color: var(--dim); cursor: pointer; }
.v-light:hover, .v-light:focus-within { border-color: var(--gold-line); color: var(--gold); }
.v-light svg { width: 16px; height: 16px; flex: none; }
.v-light input { width: 132px; accent-color: #6d6d6d; cursor: pointer; margin: 0; }
.v-light.moved { color: var(--gold); } .v-light.moved input { accent-color: var(--gold); }  /* grey at the game's default, gold when changed */
.v-stage { position: relative; flex: 1; min-height: 0; background: radial-gradient(ellipse at 50% 40%, #1b1a16 0%, #0e0e0e 70%); }
.v-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.v-stage canvas:active { cursor: grabbing; }
.v-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--dim); font: 13px var(--mono); pointer-events: none; }
.v-hint { margin: 0; padding: 10px 18px 12px; font: 12px var(--mono); color: var(--faint); border-top: 1px solid var(--line-soft); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: #1d1b15; border: 1px solid var(--gold-line); color: var(--strong); padding: 9px 16px; border-radius: 8px; font-size: 13px; transition: opacity .2s, transform .3s cubic-bezier(.16, 1, .3, 1); pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── Small screens ── */
@media (max-width: 960px) {
  .bar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 14px; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .stepper { margin-left: auto; }
  .stepper select { max-width: calc(100vw - 230px); }
  .squares.clip .sq:nth-of-type(n+6) { display: none; }
  .squares.clip .all-sq { display: block; }
  .shell { display: block; }
  .rail-grip { display: none; }
  .world { position: static; max-height: none; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 20px 16px; }
  .work { padding: 14px 16px 32px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  dialog#viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; }
  .v-head { flex-wrap: wrap; }
  .map.wide { inset: 0; z-index: 40; }
  .snd { grid-template-columns: 40px minmax(0, 1fr) 56px 34px; }
  .snd .wave { display: none; }
}
@media (max-width: 520px) {
  .wordmark { font-size: 26px; }
    .world h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
