:root {
  color-scheme: dark; font-family: system-ui,sans-serif; line-height: 1.45;
  background: #171b32; color: #eef1ff;
  --muted: #bfc5e1; --line: #7c89ad84; --panel: #222943; --teal: #a7ebe8; --gold: #ffd68b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse 70rem 50rem at 50% -15rem,#494070,transparent),#171b32; }
a { color: #b7ecff; text-underline-offset: 3px; }
h1,h2,h3,p { margin: 0; }
h1,h2 { font: 500 clamp(1.8rem,5vw,3rem)/1.1 Georgia,serif; }
.shell { width: min(65rem,calc(100% - 2rem)); margin-inline: auto; }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .2rem .72rem; min-height: 54px; }
.bar a { display: inline-flex; align-items: center; min-height: 44px; font-size: .86rem; font-weight: 670; }
button { min-height: 44px; font: inherit; font-weight: 690; border: 1px solid #8b9bb8; border-radius: .53rem; padding: .5rem .76rem; color: #f1f4ff; background: #353e65; cursor: pointer; touch-action: manipulation; }
button:hover:not(:disabled) { background: #464f7e; }
button:disabled { opacity: .68; cursor: default; }
button.primary { color: #271b2d; background: #ffd68b; border-color: #fff0c0; }
button.primary:hover:not(:disabled) { background: #ffe4a7; }
button:focus-visible,a:focus-visible { outline: 3px solid #b6f6ff; outline-offset: 3px; }
.eyebrow { color: var(--chapter,var(--teal)); font-size: .84rem; font-weight: 770; letter-spacing: .06em; }
.hero { display: grid; align-items: end; position: relative; isolation: isolate; overflow: hidden; background: #352e58; min-height: clamp(22rem,47vw,29rem); border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 1rem 3rem #080c21a8; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 50%; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg,#171b32,#171b32ad 37%,transparent 80%),linear-gradient(90deg,#171b329e,transparent 80%); }
.hero-copy { padding: clamp(1.1rem,4vw,2.6rem); }
.hero h1 { font-size: clamp(3rem,11.2vw,6.15rem); margin-block: .23rem .42rem; }
.hero-copy p:not(.eyebrow) { max-width: 31rem; margin-bottom: .9rem; }
.board,.card { padding: clamp(.68rem,2.25vw,1.35rem); background: var(--panel); border: 1px solid var(--line); border-radius: .88rem; }
.board-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .52rem .9rem; margin-bottom: .72rem; }
.board-heading h2 { margin-top: .2rem; }
.score { display: flex; align-items: center; gap: .62rem; }
.score span { color: #ffdc91; white-space: nowrap; font-weight: 770; }
.play { display: grid; grid-template-columns: 1.2fr minmax(15rem,1fr); align-items: start; gap: 1rem; }
.landscape { padding: clamp(.32rem,1.4vw,.82rem); border: 1px solid #9296c1; border-radius: .64rem; background: linear-gradient(#201e35db,#272a43a8),url(cover.webp) center/cover; }
#maze { display: grid; grid-template-columns: repeat(var(--width),minmax(0,1fr)); gap: 2px; width: min(100%,calc(var(--width) * 3rem)); margin-inline: auto; }
.tile { aspect-ratio: 1; min-width: 0; position: relative; display: grid; place-items: center; border: 1px solid #787da888; border-radius: .25rem; background: #3a4560; font-weight: 780; font-size: clamp(.62rem,3.8vw,1.2rem); line-height: 1; color: #e8deaf; }
.tile[data-type="#"] { background: repeating-linear-gradient(135deg,#1d2039 0 4px,#252942 4px 8px); border-color: #363a57; }
.tile[data-trace="yes"] { background: radial-gradient(circle at center,#50787d,#394b65); }
.tile[data-type="A"],.tile[data-type="B"] { color: #a2fff1; background: #315d6d; border-color: #97dfd7; }
.tile[data-type="a"],.tile[data-type="b"] { color: #ffe1b0; background: repeating-linear-gradient(90deg,#6b4b58 0 4px,#584457 4px 7px); border-color: #ceaa86; }
.tile[data-open="yes"] { color: #b8ffd8; background: #305c5c; border-color: #b9f8c3; }
.tile[data-type="*"] { color: #ffc1ed; }
.tile[data-type="G"] { color: #fff1a9; background: #665671; border-color: #f3d7a1; }
.tile .ruby,.tile .ghost { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.04em; pointer-events: none; }
.tile .ruby { color: #ffe0a2; text-shadow: 0 0 9px #ffc061; }
.tile .ghost { color: #9dfbf5; text-shadow: 0 0 8px #6ffffe; }
.tile[data-visitor="yes"] .terrain { opacity: .28; }
.tile[data-both="yes"] .ruby { transform: translate(-15%,7%); }
.tile[data-both="yes"] .ghost { transform: translate(15%,-12%); }
.controls { display: grid; align-content: start; gap: .63rem; }
.telemetry { display: grid; gap: .35rem; background: #303957; border-radius: .55rem; padding: .69rem; }
#brief { color: #f2e8dc; }
#timings,#location { color: #d1ddf0; font-size: .84rem; }
.move-pad,.actions { display: flex; flex-wrap: wrap; gap: .36rem; }
.move-pad button { min-width: 2.8rem; min-height: 51px; padding-inline: .55rem; }
.move-pad button[aria-label] { font-size: 1.31rem; }
#feedback { min-height: 2.65em; color: #dae8fa; font-size: .9rem; font-weight: 650; }
#feedback[data-kind="warn"] { color: #ffc7ad; }
#feedback[data-kind="win"] { color: #b8f3c1; }
.legend { list-style: none; display:flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .65rem 0 0; padding: .5rem 0 0; border-top: 1px solid var(--line); font-size: .82rem; color: #d0d8ef; }
.legend span { color: #ffe0a2; font-weight: 750; }
.legend li:nth-child(2) span { color: #a1fcf8; }
.lower { display: grid; grid-template-columns: 1.05fr 1fr; gap: .7rem; margin-top: .7rem; }
.card h2 { font-size: 1.62rem; margin-bottom: .62rem; }
.card ol { padding-left: 1.22rem; margin: 0 0 .62rem; }
.card li + li { margin-top: .36rem; }
.muted,footer { color: var(--muted); font-size: .85rem; }
.map { display: grid; gap: .48rem; margin-bottom: .55rem; }
.cluster h3 { font-size: .82rem; color: var(--cluster); margin-bottom: .24rem; }
.tiles { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: .32rem; }
.tiles button { padding: .22rem; font-variant-numeric: tabular-nums; }
.tiles button.done { background: #355767; }
.tiles button[aria-current="step"] { box-shadow: inset 0 -3px var(--cluster); border-color: var(--cluster); }
footer { padding-block: 1rem; }
@media(max-width:735px) {
  .shell { width: calc(100% - 1.05rem); }
  .play,.lower { grid-template-columns: 1fr; }
  .play { gap: .65rem; }
  .move-pad,.actions { gap: .31rem; }
  .move-pad button { flex: 1 0 auto; min-width: 44px; }
}
@media(max-width:360px) { .bar a { font-size: .76rem; } }
