/* Nibi website, "Pastel Arcade" version (concepts/concept-4.html).
   A cute 8-bit game in soft pastels. Light by default, "night arcade" in dark (system, or the
   visitor's pick: html[data-theme]). Calm mode (html.calm) and prefers-reduced-motion give a still page.
   Strict CSP: everything is in this file; pixel art is drawn on canvas by arcade.js. */

:root {
  --bg: #fdf6ec; --panel: #ffffff; --panel-2: #f3ecff; --text: #3a2f5b; --muted: #625783; --edge: #3a2f5b;
  --on: #3a2f5b; --shade: rgba(58, 47, 91, .25); --grid: rgba(58, 47, 91, .05); --scan: rgba(58, 47, 91, .035);
  --idle: #b9a7ff; --thinking: #8fb8ff; --working: #6fd6c2; --needs: #ffc56b; --done: #8be38b; --error: #ff8a80; --sleeping: #cfc6ec;
  --pink: #ff9cc6; --hot: #b8336a; --code: #f6f0ff; --sh1: #ff9cc6; --sh2: #b9a7ff;
  --sky: #e9f6ff; --grass-a: #8be38b; --grass-b: #6fcf6f; --win: #ffffff; --win-line: #e6e0f5;
  --px: 4px;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "Lucida Console", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13102a; --panel: #221d43; --panel-2: #2b2552; --text: #f3edff; --muted: #c0b6e4; --edge: #9d8ff0;
    --shade: rgba(0, 0, 0, .5); --grid: rgba(185, 167, 255, .07); --scan: rgba(0, 0, 0, .22);
    --hot: #ff9cc6; --code: #1a1636; --sh1: #8a2f63; --sh2: #3f3480; --sky: #1d1a44; --grass-a: #3d7d63; --grass-b: #326b54; --win: #2b2552; --win-line: #3d3570;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #13102a; --panel: #221d43; --panel-2: #2b2552; --text: #f3edff; --muted: #c0b6e4; --edge: #9d8ff0;
  --shade: rgba(0, 0, 0, .5); --grid: rgba(185, 167, 255, .07); --scan: rgba(0, 0, 0, .22);
  --hot: #ff9cc6; --code: #1a1636; --sh1: #8a2f63; --sh2: #3f3480; --sky: #1d1a44; --grass-a: #3d7d63; --grass-b: #326b54; --win: #2b2552; --win-line: #3d3570;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background-color: var(--bg); color: var(--text); font: 500 16px/1.6 var(--mono); overflow-x: hidden;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px;
}
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; background: repeating-linear-gradient(0deg, var(--scan) 0 2px, transparent 2px 4px); }
h1, h2, h3, h4 { font-family: var(--mono); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: clamp(2.1rem, 1.2rem + 3.8vw, 3.8rem); text-shadow: 4px 4px 0 var(--sh1), 8px 8px 0 var(--sh2); }
h1 span { display: inline-block; }
h2 { font-size: clamp(1.25rem, .95rem + 1.5vw, 2rem); text-shadow: 3px 3px 0 var(--sh1); max-width: 30em; }
h3 { font-size: 1rem; }
h4 { font-size: .92rem; margin-bottom: 6px; }
p { margin: 0 0 12px; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .9em; background: var(--code); padding: 1px 5px; overflow-wrap: anywhere; }
mark { background: var(--needs); color: var(--on); padding: 0 4px; }
:focus-visible { outline: 4px solid var(--hot); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--needs); color: var(--on); padding: 10px 14px; font-weight: 800; }
.skip:focus { top: 12px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 820px; }
.muted, .sub, .note { color: var(--muted); }
.note { font-size: .9rem; }
.center { text-align: center; }
canvas.spr { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }

/* pixel frame: a stepped border from box-shadows */
.px {
  background: var(--panel); margin: var(--px);
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--edge), 0 var(--px) 0 0 var(--edge), calc(var(--px) * -1) 0 0 0 var(--edge), var(--px) 0 0 0 var(--edge), calc(var(--px) * 2) calc(var(--px) * 2) 0 0 var(--shade);
}

/* buttons */
.btn {
  font: 800 1rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--on); background: var(--needs);
  border: 0; padding: 14px 20px; cursor: pointer; text-decoration: none; display: inline-block; margin: 4px; text-align: center;
  box-shadow: 0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge), inset -4px -4px 0 rgba(58, 47, 91, .22), 6px 8px 0 2px var(--shade);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(4px); box-shadow: 0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge), inset 4px 4px 0 rgba(58, 47, 91, .22); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.pink { background: var(--pink); } .btn.mint { background: var(--working); } .btn.white { background: #ffffff; }
.btn-sm { padding: 9px 12px; font-size: .82rem; }
.btn-xl { padding: 18px 28px; font-size: 1.15rem; }
.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* header */
.top { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 4px solid var(--edge); }
.top-row { display: flex; align-items: center; gap: 14px; min-height: 68px; }
.logo { font: 800 1.35rem/1 var(--mono); letter-spacing: .12em; text-decoration: none; color: var(--text); display: flex; gap: 10px; align-items: center; }
.logo-spr { width: 40px; height: 36px; }
.nav { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 6px 8px; font-size: .78rem; font-weight: 800; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--text); background: var(--panel-2); }
.hud { margin-left: auto; display: flex; gap: 12px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.hud b { color: var(--text); }
.tools { display: flex; align-items: center; gap: 6px; }
.tbtn {
  font: 800 .72rem/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--text); background: var(--panel);
  border: 0; padding: 8px 8px; cursor: pointer; text-decoration: none; margin: 3px; min-height: 32px; display: inline-flex; align-items: center;
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge);
}
.tbtn:hover { background: var(--panel-2); }
.tbtn.ver { background: var(--idle); color: var(--on); }
.t-sun, .t-play { display: none; }
.is-dark .t-sun { display: inline; } .is-dark .t-moon { display: none; }
.calm .t-play { display: inline; } .calm .t-pause { display: none; }
.coin-top { margin-left: 4px; }
@media (max-width: 1080px) { .top nav { display: none; } }
@media (max-width: 760px) { .hud { display: none; } .tools { margin-left: auto; } }

/* hero / title screen */
.hero { padding: 34px 0 30px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 34px; align-items: center; }
.hero-grid > * { min-width: 0; }
.byline { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.subtitle { font-size: 1.1rem; font-weight: 700; }
.lead { color: var(--muted); max-width: 34em; }
.start { font-size: 1.1rem; font-weight: 800; color: var(--hot); margin: 16px 0; }
.cta { display: flex; flex-wrap: wrap; gap: 6px; margin-left: -4px; }
.meta { font-size: .8rem; color: var(--muted); margin-top: 14px; }
.screen { padding: 0; overflow: hidden; position: relative; margin: 8px; }
.screen canvas { display: block; width: 100%; height: clamp(280px, 32vw, 400px); image-rendering: pixelated; cursor: pointer; }
.say { position: absolute; left: 14px; top: 14px; background: #ffffff; color: var(--on); padding: 6px 10px; font-size: .8rem; font-weight: 800; box-shadow: 0 -3px 0 0 var(--on), 0 3px 0 0 var(--on), -3px 0 0 0 var(--on), 3px 0 0 0 var(--on); }
.stage-cap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 4px solid var(--edge); font-size: .85rem; color: var(--muted); }
.stage-cap strong { color: var(--text); text-transform: uppercase; }
.dot { width: 12px; height: 12px; background: var(--working); box-shadow: 0 0 0 2px var(--edge); }
.dot.m-idle { background: var(--idle); } .dot.m-thinking { background: var(--thinking); } .dot.m-needs { background: var(--needs); }
.dot.m-done { background: var(--done); } .dot.m-error { background: var(--error); } .dot.m-sleeping { background: var(--sleeping); }
.bar { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; padding: 10px 8px 12px; background: var(--panel-2); border-top: 4px solid var(--edge); }
.bar-play { align-items: center; gap: 10px; }
.bar-play .hint { margin: 0; font-size: .78rem; color: var(--muted); }
.mbtn { font: 800 .72rem/1 var(--mono); text-transform: uppercase; padding: 8px 9px; border: 0; cursor: pointer; color: var(--on); margin: 3px; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.mbtn[aria-pressed="true"] { outline: 3px dashed var(--text); outline-offset: 5px; }
.c-idle { background: var(--idle); } .c-thinking { background: var(--thinking); } .c-working { background: var(--working); }
.c-needs { background: var(--needs); } .c-done { background: var(--done); } .c-error { background: var(--error); } .c-sleeping { background: var(--sleeping); }

/* sections */
section { padding: 44px 0; }
.stage-no { display: inline-block; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--on); background: var(--idle); padding: 4px 8px; margin-bottom: 14px; }
.sub { max-width: 46em; }
.sheet { margin-top: 26px; font-size: .9rem; color: var(--muted); }
.how { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { padding: 16px 16px 6px; }
.lvl { display: inline-block; font-weight: 800; font-size: .8rem; background: var(--needs); color: var(--on); padding: 2px 8px; margin-bottom: 10px; }
.tile p { color: var(--muted); font-size: .92rem; }

.select { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.card { padding: 14px 12px 16px; text-align: center; transition: transform .15s steps(3); min-width: 0; }
.card:hover { transform: translateY(-6px); }
.card canvas { width: 80px; height: 72px; margin: 2px auto 8px; }
.card p { font-size: .78rem; color: var(--muted); margin: 0 0 8px; }
.stat { font-size: .7rem; font-weight: 800; display: inline-block; padding: 2px 6px; background: var(--done); color: var(--on); }
.stat.q { background: transparent; color: var(--text); outline: 2px dashed var(--text); outline-offset: -2px; }
.honesty { padding: 14px 16px; margin-top: 26px; font-size: .9rem; }
.hs { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin: 0 4px 0 2px; background: var(--idle); }
.hs.solid { box-shadow: 0 0 0 2px var(--edge); }
.hs.dashed { background: transparent; outline: 2px dashed var(--text); }

.shot { margin: 30px auto 0; padding: 0; max-width: 760px; overflow: hidden; }
.shot img { display: block; width: 100%; height: auto; }
.shot .dk { display: none; }
.is-dark .shot .lt { display: none; } .is-dark .shot .dk { display: block; }
.shot figcaption { padding: 10px 14px; font-size: .82rem; color: var(--muted); border-top: 4px solid var(--edge); }
.narrow-shot { max-width: 620px; }

.moodgrid { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; }
.mcard { width: calc(100% - 8px); height: calc(100% - 8px); border: 0; cursor: pointer; font: inherit; color: var(--text); padding: 12px 8px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mcard canvas { width: 72px; height: 65px; }
.mcard strong { text-transform: uppercase; font-size: .85rem; }
.mcard span { font-size: .74rem; color: var(--muted); line-height: 1.45; }
.mcard:hover canvas, .mcard:focus-visible canvas, .mcard.awake canvas { animation: hop .5s steps(2) infinite; }
@keyframes hop { 50% { transform: translateY(-6px); } }

.quest { display: grid; grid-template-columns: 1fr 1.2fr; gap: 28px; align-items: start; margin-top: 10px; }
.quest > * { min-width: 0; }
.steps { padding-left: 22px; margin: 0 0 14px; }
.steps li { margin-bottom: 10px; }
.map { position: relative; height: 290px; padding: 0; background: var(--sky); overflow: hidden; }
.map::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; background: repeating-linear-gradient(90deg, var(--grass-a) 0 16px, var(--grass-b) 16px 32px); border-top: 4px solid var(--edge); }
.pwin { position: absolute; width: 30%; min-height: 118px; background: var(--win); top: 46px; box-shadow: 0 -4px 0 0 var(--edge), 0 4px 0 0 var(--edge), -4px 0 0 0 var(--edge), 4px 0 0 0 var(--edge); }
.pwin b { display: block; background: var(--idle); color: var(--on); font-size: .62rem; padding: 3px 6px; border-bottom: 4px solid var(--edge); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwin i { display: block; height: 6px; margin: 8px; background: var(--win-line); }
.pwin .ask { display: block; margin: 6px 8px 8px; font-size: .64rem; line-height: 1.3; color: var(--muted); visibility: hidden; }
.pwin.w1 { left: 3%; } .pwin.w2 { left: 35.5%; top: 30px; } .pwin.w3 { left: 67%; top: 58px; }
.pwin .mark { position: absolute; top: -40px; left: 50%; translate: -50% 0; font: 800 1.8rem/1 var(--mono); color: #e0901a; display: none; animation: hop .5s steps(2) infinite; }
.pwin.waiting .mark { display: block; } .pwin.waiting b { background: var(--needs); } .pwin.waiting .ask { visibility: visible; color: var(--text); font-weight: 800; }
.pwin.front { z-index: 3; transform: scale(1.08); } .pwin.front b { background: var(--done); }
.walker { position: absolute; bottom: 36px; left: 6px; width: 64px; height: 58px; padding: 0; border: 0; background: none; cursor: pointer; transition: left 1.2s steps(12); z-index: 4; }
.walker:disabled { cursor: default; }
.walker canvas { width: 64px; height: 58px; }
.ding { position: absolute; z-index: 5; bottom: 104px; left: 0; font-weight: 800; color: var(--hot); background: var(--panel); padding: 2px 6px; visibility: hidden; }
.ding.on { visibility: visible; animation: hop .4s steps(2) 3; }
.log { padding: 12px 14px; font-size: .85rem; min-height: 110px; margin-top: 14px; }
.log p { margin: 0 0 4px; }
.qrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0 -4px; }
.score { font-weight: 800; margin-top: 10px; }

.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.rule { padding: 16px; }
.rule p { color: var(--muted); font-size: .9rem; margin: 0; }
.pill { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; padding: 3px 8px; margin-bottom: 10px; color: var(--on); }
.r-a .pill { background: var(--done); } .r-b .pill { background: var(--needs); } .r-c .pill { background: var(--error); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; margin-top: 10px; }
.split > * { min-width: 0; }
.split .shot { margin-top: 0; }
.slot { padding: 18px; min-width: 0; }
.checks, .changes { margin: 0 0 8px; padding: 0; list-style: none; }
.checks li, .changes li { position: relative; padding-left: 24px; margin-bottom: 8px; font-size: .92rem; }
.checks li::before, .changes li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 10px; height: 10px; background: var(--working); box-shadow: 0 0 0 2px var(--edge); }
.checks.no li::before { background: var(--error); }
.changes li::before { background: var(--pink); }
.tray { margin: 0; padding: 0; list-style: none; }
.tray li { padding: 7px 10px; font-size: .9rem; border-bottom: 2px dashed var(--win-line); }
.tray li:hover { background: var(--panel-2); }
.tray li::before { content: "> "; color: var(--hot); font-weight: 800; }

.day { padding: 18px; margin-top: 20px; }
.day-stage { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.day-spr { width: 112px; height: 101px; }
.day-say { flex: 1 1 260px; background: var(--panel-2); padding: 12px 14px; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); margin: 3px; }
.day-time { font-weight: 800; font-size: 1.2rem; margin: 0 0 4px; color: var(--hot); }
.day-text { margin: 0; }
.day-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.moment { width: 100%; height: 100%; font: inherit; color: var(--text); background: var(--panel); border: 0; cursor: pointer; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.moment canvas { width: 40px; height: 36px; }
.moment .m-time { font-size: .72rem; font-weight: 800; }
.moment .m-label { font-size: .64rem; color: var(--muted); text-transform: uppercase; }
.moment[aria-pressed="true"] { background: var(--needs); color: var(--on); }
.moment[aria-pressed="true"] .m-label { color: var(--on); }

.night-band { background: rgba(58, 47, 91, .06); border-top: 4px dashed var(--edge); border-bottom: 4px dashed var(--edge); }
.save { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.save > * { min-width: 0; }
.hp-l { font-size: .78rem; font-weight: 800; margin: 0 0 2px; }
.hp { height: 20px; margin: 4px 0 14px; background: repeating-linear-gradient(90deg, var(--c) 0 14px, transparent 14px 18px); animation: fill 1.6s steps(12) both; }
.hp-14 { --c: var(--working); width: 16%; } .hp-90 { --c: var(--idle); width: 100%; }
@keyframes fill { from { width: 0; } }
.kv { list-style: none; padding: 0; margin: 0 0 10px; }
.kv li { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; padding: 8px 0; border-bottom: 2px dashed var(--win-line); font-size: .86rem; }
.kv li > span:first-child { font-weight: 800; }
.kv li > span:last-child { color: var(--muted); }

.code { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; margin-top: 18px; margin-bottom: 18px; background: var(--code); }
.code pre { margin: 0; flex: 1; min-width: 0; overflow-x: auto; padding: 6px 0; }
.code pre code { background: none; padding: 0; overflow-wrap: normal; white-space: pre; font-size: .88rem; }
.copy { flex: none; }

.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--needs); color: var(--on); padding: 12px; margin-top: 14px; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.callout p { margin: 0; font-size: .88rem; }
.warn { flex: none; width: 26px; height: 26px; display: grid; place-items: center; background: var(--on); color: var(--needs); font-weight: 800; }
.reqs { margin-top: 24px; }

.faq { display: grid; gap: 14px; margin-top: 18px; }
.faq details { padding: 0; }
.faq summary { cursor: pointer; padding: 14px 16px 14px 44px; font-weight: 800; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--needs); color: var(--on); font-weight: 800; }
.faq details[open] summary::before { content: "-"; background: var(--done); }
.faq details p { padding: 0 16px 14px 44px; margin: 0; color: var(--muted); font-size: .92rem; }

.coin { text-align: center; padding: 34px 18px; }
.coin p { color: var(--muted); max-width: 38em; margin: 0 auto 16px; }
.coin h2 { margin-left: auto; margin-right: auto; }
.coin-spr { width: 120px; height: 108px; margin: 0 auto 10px; animation: hop .7s steps(2) infinite; }
.seal { margin-top: 18px !important; font-size: .78rem; font-weight: 800; letter-spacing: .1em; color: var(--text) !important; }
.oneliner { max-width: 680px; margin: 30px auto 0; }
.oneliner p { margin: 0 0 4px; }
.oneliner .code { margin: 8px 0 18px; }
.oneliner .note { margin: 0; }

/* hero demo: the real renderer's antics (a still frame in calm mode) */
.hero-demo { display: flex; align-items: center; gap: 14px; margin: 22px 0 0; padding: 8px 16px 8px 8px; max-width: 470px; }
.hero-demo picture, .hero-demo img { display: block; flex: none; }
.hero-demo img { width: 140px; height: auto; }
.hero-demo figcaption { font-size: .86rem; color: var(--muted); }
.hero-demo figcaption strong { color: var(--text); text-transform: uppercase; letter-spacing: .05em; }
.demo-still { display: none !important; }
.calm .demo-anim { display: none; }
.calm .demo-still { display: block !important; }
@media (prefers-reduced-motion: reduce) {
  html:not(.js) .demo-anim { display: none; }
  html:not(.js) .demo-still { display: block !important; }
}
.changes { margin-bottom: 18px; }
.foot { border-top: 4px solid var(--edge); padding: 22px 0 40px; font-size: .82rem; color: var(--muted); }
.foot-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.logo-sm { font-size: 1rem; } .logo-sm canvas { width: 30px; height: 27px; }
canvas.burst { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; image-rendering: pixelated; }

@media (max-width: 1000px) { .moodgrid { grid-template-columns: repeat(4, 1fr); } .day-strip { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 900px) {
  .hero-grid, .quest, .save, .split, .cols-3, .how { grid-template-columns: 1fr; }
  .select { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  html { scroll-padding-top: 70px; }
  .wrap { padding: 0 14px; }
  .top-row { gap: 6px; min-height: 58px; }
  .logo { font-size: 1.05rem; gap: 6px; } .logo-spr { width: 30px; height: 27px; }
  .tools { gap: 2px; } .tbtn { padding: 7px 6px; font-size: .66rem; }
  .coin-top { display: none; }
  .select { grid-template-columns: 1fr 1fr; gap: 12px; }
  .moodgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .day-strip { grid-template-columns: repeat(3, 1fr); }
  .screen canvas { height: 270px; }
  .btn { padding: 12px 14px; font-size: .88rem; }
  .btn-xl { padding: 16px 18px; font-size: 1rem; }
  .pwin b { font-size: .5rem; padding: 3px 3px; } .pwin .ask { font-size: .56rem; margin: 4px; }
  .kv li { grid-template-columns: 1fr; gap: 2px; }
  .code { flex-direction: column; align-items: stretch; }
  section { padding: 34px 0; }
}

/* "All versions on GitHub": the small link under the Download button */
.all-versions { margin: 0 auto 14px; font-size: .88rem; }
.all-versions a { color: var(--muted); }

/* ---------- the download dialog (arcade.js opens it; the browser downloads the file meanwhile) ----------
   Pixel Nibi carries a present to the computer (canvas) and hops; the bar marches, then fills (the real
   progress of a cross-origin download cannot be read, so there is no percentage). Calm: only the steps. */
.dl-dialog { width: 620px; max-width: calc(100% - 8px); max-height: calc(100% - 12px); padding: 12px 18px 18px 12px; border: 0; background: transparent; color: var(--text); overflow: auto; overscroll-behavior: contain; }
.dl-dialog::backdrop { background: rgba(19, 16, 42, .62); }
.dl-card { position: relative; padding: 18px 20px 14px; }
.dl-dialog[open] .dl-card { animation: dl-in .35s steps(4) both; }
.dl-x { position: absolute; top: 10px; right: 10px; min-width: 40px; min-height: 40px; z-index: 2; }
.dl-stage { display: block; width: calc(100% - 56px); height: auto; aspect-ratio: 128 / 48; image-rendering: pixelated; image-rendering: crisp-edges; margin: 0 0 12px; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.dl-card h2 { font-size: clamp(1.05rem, .9rem + .9vw, 1.4rem); margin: 14px 0 6px; }
.dl-status { color: var(--muted); margin: 0 0 12px; min-height: 1.6em; }
.dl-bar { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 22px; padding: 3px; margin: 3px 3px 8px; background: var(--code); box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); }
.dl-bar span { background: transparent; }
.dl-dialog.run .dl-bar span { animation: dl-seg 1.2s linear infinite; }
.dl-dialog.run .dl-bar span:nth-child(2) { animation-delay: .1s; } .dl-dialog.run .dl-bar span:nth-child(3) { animation-delay: .2s; }
.dl-dialog.run .dl-bar span:nth-child(4) { animation-delay: .3s; } .dl-dialog.run .dl-bar span:nth-child(5) { animation-delay: .4s; }
.dl-dialog.run .dl-bar span:nth-child(6) { animation-delay: .5s; } .dl-dialog.run .dl-bar span:nth-child(7) { animation-delay: .6s; }
.dl-dialog.run .dl-bar span:nth-child(8) { animation-delay: .7s; } .dl-dialog.run .dl-bar span:nth-child(9) { animation-delay: .8s; }
.dl-dialog.run .dl-bar span:nth-child(10) { animation-delay: .9s; } .dl-dialog.run .dl-bar span:nth-child(11) { animation-delay: 1s; }
.dl-dialog.run .dl-bar span:nth-child(12) { animation-delay: 1.1s; }
.dl-dialog.done .dl-bar span { background: var(--done); }
.dl-steps { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 10px; }
.dl-steps li { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: start; padding: 10px; background: var(--panel-2); font-size: .92rem; line-height: 1.5; }
.dl-n { display: grid; place-items: center; width: 28px; height: 28px; background: var(--idle); color: var(--on); font-weight: 800; box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge); margin: 3px; }
.dl-steps li:nth-child(2) .dl-n { background: var(--needs); } .dl-steps li:nth-child(3) .dl-n { background: var(--done); }
.dl-ic { width: 24px; height: 24px; margin-top: 5px; }
.dl-ic path { stroke: none; }
.dl-ic .i-folder { fill: var(--needs); } .dl-ic .i-shield { fill: var(--working); } .dl-ic .i-heart { fill: var(--pink); }
.dl-links { margin: 0 0 10px; font-weight: 800; }
.dl-alt { margin: 0; color: var(--muted); font-size: .9rem; }
.dl-card .code { margin-top: 10px; }
.dl-card .code { flex-direction: column; align-items: stretch; }
.dl-card .code pre code { font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.dl-card .code .copy { align-self: flex-end; }
.dl-close-row { margin: 0; text-align: right; }
.dl-dialog.still .dl-stage, .dl-dialog.still .dl-bar, .calm .dl-stage, .calm .dl-bar { display: none; }
.dl-dialog.still .dl-card h2, .calm .dl-card h2 { margin-top: 4px; padding-right: 52px; }
@keyframes dl-in { from { transform: scale(.8); opacity: 0; } }
@keyframes dl-seg { 0%, 24% { background: var(--pink); } 25%, 100% { background: transparent; } }
@media (max-width: 560px) {
  .dl-dialog { padding: 6px 12px 12px 6px; }
  .dl-card { padding: 14px 12px 12px; }
  .dl-steps li { grid-template-columns: auto 1fr; }
  .dl-ic { display: none; }
}

/* calm: the header toggle or prefers-reduced-motion */
.calm *, .calm *::before, .calm *::after { animation: none !important; transition: none !important; }
.calm .blink { visibility: visible; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html:not(.js) *, html:not(.js) *::before, html:not(.js) *::after { animation: none !important; transition: none !important; }
}

/* Arcade version switch (on). Turning it off goes back to the Storybook page. */
.ver-switch { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; color: inherit; text-decoration: none; font: inherit; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.ver-track { position: relative; width: 36px; height: 20px; background: var(--idle); border: 3px solid currentColor; flex: none; }
.ver-knob { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; background: var(--on, #fff); border: 2px solid currentColor; transform: translateX(16px); }
.ver-switch:hover .ver-knob, .ver-switch:focus-visible .ver-knob { transform: translateX(8px); }
.ver-switch:focus-visible { outline: 3px dashed currentColor; outline-offset: 3px; }
@media (max-width: 640px) { .ver-lbl { display: none; } }
