:root {
  --ink: #1b1b3a;
  --paper: #fff8e7;
  --sun: #ffd23f;
  --coral: #ff5d73;
  --mint: #3ddc97;
  --sky: #4d7cff;
  --white: #ffffff;
  --shadow: 5px 5px 0 var(--ink);
  --display: "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
h1, h2, h3, .btn, .logo, .status, .stat b, .tab, legend, label { font-family: var(--display); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px 10px; max-width: 880px; margin: 0 auto; }
.logo { display: flex; gap: 5px; text-decoration: none; }
.logo b {
  display: grid; place-items: center; width: 40px; height: 44px;
  font-size: 28px; font-weight: 800; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 10px; box-shadow: 3px 3px 0 var(--ink);
  animation: hop 2.4s infinite;
}
.logo b:nth-child(1) { background: var(--sun); }
.logo b:nth-child(2) { background: var(--coral); animation-delay: .15s; }
.logo b:nth-child(3) { background: var(--mint); animation-delay: .3s; }
.logo b:nth-child(4) { background: var(--sky); color: var(--white); animation-delay: .45s; }
.tag { font-family: var(--display); font-weight: 600; font-size: 18px; }
.tag u { text-decoration: none; color: var(--coral); font-weight: 800; }

.ticker { background: var(--ink); color: var(--sun); overflow: hidden; white-space: nowrap; font-family: var(--display); font-weight: 800; letter-spacing: .04em; padding: 6px 0; }
.ticker-run { display: inline-block; animation: slide 28s linear infinite; }

/* ---------- layout ---------- */
main { max-width: 880px; margin: 0 auto; padding: 16px; }
.stage { border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; background: #58c4ff; line-height: 0; }
#scene { width: 100%; height: auto; display: block; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; }
.tabs:empty { display: none; }
.tab {
  flex: none; font-size: 16px; font-weight: 600; color: var(--ink); cursor: pointer;
  background: var(--white); border: 3px solid var(--ink); border-radius: 999px; padding: 4px 14px;
}
.tab[aria-current="true"] { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); }
.tab.add { border-style: dashed; background: transparent; }

/* ---------- landing ---------- */
#landing, #dash { text-align: center; padding-top: 22px; }
h1 { font-size: clamp(40px, 9vw, 72px); line-height: 1; font-weight: 800; }
h1 em { font-style: normal; color: var(--coral); display: inline-block; animation: hop 1.8s infinite; }
h1 em:nth-of-type(2) { animation-delay: .2s; color: var(--sky); }
h1 em:nth-of-type(3) { animation-delay: .4s; color: var(--mint); }
.lead { font-size: 19px; margin: 12px auto 20px; max-width: 34em; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: 30px; }
.card { background: var(--white); border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 16px; }
.card h3 { font-size: 22px; }
.emo { font-size: 54px; line-height: 1.1; display: inline-block; }
.bounce { animation: hop 1.2s infinite; }
.wiggle { animation: wiggle 1s infinite; }
.spin { animation: spin 5s linear infinite; }

/* ---------- buttons ---------- */
.btn {
  font-size: 19px; font-weight: 800; color: var(--ink); cursor: pointer;
  background: var(--sun); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow);
  padding: 10px 20px; transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn.big { font-size: 24px; padding: 12px 28px; }
.btn.alt { background: var(--white); font-size: 17px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.link { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.link.danger { color: #b3243b; margin-top: 34px; font-size: 15px; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

/* ---------- dashboard ---------- */
#gTitle { font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.status { font-size: 30px; font-weight: 800; line-height: 1.1; margin-top: 4px; }
#gPct { font-size: clamp(64px, 16vw, 104px); color: var(--coral); text-shadow: 4px 4px 0 var(--ink); display: inline-block; }
#gPct.pop { animation: pop .5s; }
.line { font-size: 19px; margin: 4px 0 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--white); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 4px; min-width: 0; }
.stat small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; opacity: .7; }
.stat b { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; line-height: 1.2; display: block; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.eta { margin-top: 16px; font-size: 16px; min-height: 1.5em; }
.sec { font-size: 22px; text-align: left; margin: 30px 0 10px; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { background: var(--white); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 4px; font-size: 13px; line-height: 1.25; }
.badge i { font-style: normal; font-size: 34px; display: block; line-height: 1.2; }
.badge.off { opacity: .45; border-style: dashed; }
.badge.off i { filter: grayscale(1); }
.badge.on { background: #fff3c2; }

.log { list-style: none; margin: 0; padding: 0; text-align: left; position: relative; }
.log::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; border-left: 4px dashed var(--ink); opacity: .35; }
.log li { position: relative; display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: start; padding: 8px 0; }
.log .dot { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--sun); border: 3px solid var(--ink); position: relative; }
.log .start .dot { background: var(--mint); }
.log .what b { font-family: var(--display); font-size: 19px; }
.log .delta { font-size: 14px; font-weight: 700; margin-left: 6px; }
.log .delta.up { color: #0f8a55; }
.log .delta.down { color: #b3243b; }
.log time { display: block; font-size: 13px; opacity: .7; }
.log .note { overflow-wrap: anywhere; }
.log img { display: block; margin-top: 6px; max-width: min(240px, 100%); border: 3px solid var(--ink); border-radius: 10px; transform: rotate(-1.5deg); }
.log .del { font-size: 20px; line-height: 1; padding: 6px 8px; text-decoration: none; opacity: .5; }
.log .del:hover { opacity: 1; }

/* ---------- dialogs & forms ---------- */
dialog { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--ink); background: var(--paper); color: var(--ink); padding: 20px; }
dialog::backdrop { background: rgba(27, 27, 58, .6); }
dialog h2 { font-size: 26px; margin-bottom: 12px; padding-right: 36px; }
dialog form { display: grid; gap: 12px; position: relative; }
.x { position: absolute; right: -6px; top: -8px; font-size: 30px; line-height: 1; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 4px 10px; }
label, legend { font-weight: 600; font-size: 17px; display: block; }
.opt { font: 400 14px system-ui, sans-serif; opacity: .7; }
input[type="text"], input[type="number"], input:not([type]) {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 18px; color: var(--ink);
  background: var(--white); border: 3px solid var(--ink); border-radius: 12px; padding: 9px 12px;
}
input[type="file"] { display: block; margin-top: 4px; font: inherit; font-size: 14px; max-width: 100%; }
input[type="range"] { width: 100%; accent-color: var(--coral); height: 28px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.ends { display: flex; justify-content: space-between; font-size: 13px; margin-top: -10px; opacity: .75; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: 600 14px system-ui, sans-serif; color: var(--ink); background: var(--white); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.chip:hover { background: var(--sun); }
.pick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pick label { cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: grid; place-items: center; width: 46px; height: 46px; font-size: 26px; background: var(--white); border: 3px solid var(--ink); border-radius: 12px; }
.pick input:checked + span { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px); }
.pick input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
.err { color: #b3243b; font-weight: 700; font-size: 15px; }
.err:empty { display: none; }

/* ---------- footer & toast ---------- */
footer { text-align: center; font-size: 15px; padding: 36px 16px 48px; }
footer p + p { margin-top: 6px; }
.tiny { opacity: .6; font-size: 13px; }
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); z-index: 99;
  max-width: calc(100vw - 32px); font-family: var(--display); font-weight: 800; font-size: 18px; text-align: center;
  background: var(--ink); color: var(--sun); border-radius: 14px; padding: 10px 18px; transition: transform .25s;
  pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); }

/* ---------- motion ---------- */
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { to { transform: translateX(-50%); } }
@keyframes pop { 40% { transform: scale(1.25) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) {
  .logo b, h1 em, .emo, .ticker-run, #gPct.pop { animation: none; }
}

/* ---------- dimension card ---------- */
.dim { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; text-align: left; border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 24px; transition: background .6s; }
.dim-icon { font-size: 56px; line-height: 1; }
.dim-txt { min-width: 0; background: rgba(255, 255, 255, .8); border-radius: 10px; padding: 6px 10px; }
.dim-txt small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.dim-txt b { display: block; font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1.1; }
.dim #dNext { grid-column: 1 / -1; background: var(--ink); color: var(--sun); font-family: var(--display); font-weight: 600; border-radius: 10px; padding: 6px 10px; margin-top: 6px; }
.dim-strip { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 6px; }
.dim-strip span { flex: 1; text-align: center; font-size: 22px; background: var(--white); border: 3px solid var(--ink); border-radius: 10px; padding: 2px 0; }
.dim-strip .here { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); transform: translateY(-3px); }
.dim-strip .locked { opacity: .55; border-style: dashed; }

/* ---------- text pages ---------- */
footer a.link, .prose a.link { color: var(--ink); }
.prose { max-width: 640px; }
.prose h1 { font-size: 48px; margin-bottom: 8px; }
.prose h3 { font-size: 22px; margin-top: 22px; }
.prose p { margin-top: 6px; }
.prose .btn { display: inline-block; text-decoration: none; margin-top: 26px; }
