/* Mighty Minis — site styles. Night-city theme built from the game's own palette. */
:root {
  --night1: #120D1A; --night2: #1B1330; --night3: #241A3D;
  --card: #1E1636; --cardline: #352754;
  --ink: #EDE9F7; --muted: #A79BC4;
  --teal: #5CECDC; --teal-d: #14968C;
  --gold: #FFD23A; --gold-d: #C9941B;
  --ember: #EF5350; --ember-d: #B23A37;
  --mint: #35C96B; --ocean: #2E9BE6; --grape: #8B5CF6; --sunny: #FFA51F; --ghost: #E6E3F0;
  --deep: #22104A;
  --shadow: 0 8px 0 rgba(0,0,0,.38);
  --radius: 26px;
  --bg: linear-gradient(180deg, #0D0914 0%, var(--night1) 30%, var(--night2) 70%, var(--night3) 100%);
}
:root[data-theme="light"] {
  --card: #FFFFFF; --cardline: #E6DEF7;
  --ink: #241A3D; --muted: #6B5E88;
  --teal: #0C8F8A; --teal-d: #076662;
  --gold: #E8A800; --gold-d: #B07E00;
  --deep: #2E1E5C;
  --shadow: 0 8px 0 rgba(36,26,61,.16);
  --bg: linear-gradient(180deg, #EDE4FF 0%, #F6F1FF 55%, #FFFDF6 100%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: "Fredoka", "Baloo 2", system-ui, sans-serif;
  font-size: 18px; line-height: 1.65; background: var(--bg) fixed; overflow-x: hidden;
}
h1, h2, h3, .display { font-family: "Baloo 2", "Fredoka", system-ui, sans-serif; line-height: 1.12; margin: 0 0 .4em; }
a { color: var(--teal); font-weight: 600; }
img { max-width: 100%; }
.wrap { width: min(1120px, 92vw); margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* night sky: drifting shards + city glow */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
:root[data-theme="light"] #stars { opacity: .25; }
.glow { position: fixed; bottom: -120px; width: 520px; height: 300px; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(70px); opacity: .5; }
.glow.g1 { left: -80px; background: #3B1E6E; }
.glow.g2 { left: 42%; background: #0C8F8A; opacity: .3; }
.glow.g3 { right: -80px; background: #8B2F1A; opacity: .35; }
:root[data-theme="light"] .glow { opacity: .18; }
main, .topbar, footer { position: relative; z-index: 2; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(18,13,26,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--cardline); }
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.82); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding: 10px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: "Baloo 2"; font-size: 1.35rem; font-weight: 800; }
.brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 3px 0 rgba(0,0,0,.35); animation: wobble 4s ease-in-out infinite; }
nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
nav a { text-decoration: none; padding: 7px 16px; border-radius: 999px; color: var(--ink); font-weight: 600; transition: transform .15s, background .15s, color .15s; }
nav a:hover { background: var(--gold); color: #3B2700; transform: translateY(-3px) rotate(-2deg); }
nav a[aria-current="page"] { background: var(--ember); color: #fff; box-shadow: 0 4px 0 var(--ember-d); }
.theme-btn { border: 0; background: var(--card); border-radius: 50%; width: 40px; height: 40px; font-size: 1.15rem; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.35); }

/* scroll progress, with a Mini hopping along it */
#progress { position: fixed; left: 0; top: 0; height: 6px; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold), var(--ember)); z-index: 60; }
#runner { position: fixed; left: 0; top: 2px; z-index: 61; pointer-events: none; transition: left .1s linear; }
#runner .run-sprite { --s: .26; }

/* hero */
.hero { text-align: center; padding: 56px 0 40px; position: relative; }
.hero .logo { width: min(340px, 78vw); filter: drop-shadow(0 16px 26px rgba(0,0,0,.5)); animation: float 4s ease-in-out infinite; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); color: var(--ink); text-shadow: 0 4px 0 rgba(0,0,0,.35); margin-top: .3em; }
:root[data-theme="light"] .hero h1 { text-shadow: 0 4px 0 #fff; }
.hero h1 .hl { color: var(--teal); }
.hero p.lead { font-size: 1.22rem; max-width: 720px; margin: 0 auto 26px; color: var(--muted); }

/* running scene */
.scene { position: relative; height: 200px; overflow: hidden; border-radius: var(--radius); margin: 20px 0 0;
  background: linear-gradient(180deg, rgba(92,236,220,.05), rgba(139,92,246,.12)); border: 1px solid var(--cardline); }
.scene .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 48px;
  background: repeating-linear-gradient(90deg, #2A1F47 0 60px, #352754 60px 120px); border-top: 6px solid var(--teal); border-radius: 18px 18px 0 0; }
.scene .actor { position: absolute; bottom: 38px; }
.scene .actor img { width: 74px; display: block; animation: hop .62s ease-in-out infinite; }
.actor.run-1 { animation: cross 9s linear infinite; }
.actor.run-2 { animation: cross 13s linear infinite -3s; }
.actor.run-3 { animation: cross-rev 16s linear infinite -6s; }
.actor.run-3 img { transform: scaleX(-1); }
@keyframes cross { from { left: -120px; } to { left: 105%; } }
@keyframes cross-rev { from { left: 105%; } to { left: -140px; } }
.shard-float { position: absolute; width: 30px; height: 30px; background: url(../img/shard.svg) center/contain no-repeat; animation: bob 1.8s ease-in-out infinite; }

@keyframes float { 50% { transform: translateY(-14px) rotate(1.5deg); } }
@keyframes wobble { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes hop { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(3deg); } }

/* ---- run-cycle sprite (18 frames repacked to a uniform 207x156 grid) ---- */
.run-sprite {
  --fw: 207; --fh: 156; --n: 18; --s: .62;
  display: inline-block; flex: none;
  width: calc(var(--fw) * var(--s) * 1px);
  height: calc(var(--fh) * var(--s) * 1px);
  background-image: url(../img/run_strip.png);
  background-repeat: no-repeat;
  background-size: calc(var(--fw) * var(--n) * var(--s) * 1px) calc(var(--fh) * var(--s) * 1px);
  animation: run var(--dur, .9s) steps(var(--n)) infinite;
}
@keyframes run {
  from { background-position: 0 0; }
  to   { background-position: calc(var(--fw) * var(--n) * var(--s) * -1px) 0; }
}

/* ---- page loader ---- */
#loader {
  position: fixed; inset: 0; z-index: 200; background: var(--night1);
  display: grid; place-items: center; transition: opacity .45s ease, visibility .45s ease;
}
#loader.done { opacity: 0; visibility: hidden; }
#loader .inner { text-align: center; width: min(420px, 82vw); }
#loader .loader-logo { width: min(260px, 60vw); margin-bottom: 18px; animation: float 4s ease-in-out infinite; }
#loader .runbox { position: relative; height: 120px; display: flex; align-items: flex-end; justify-content: center; }
#loader .runline { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent); opacity: .8; }
#loader .track { position: absolute; left: 0; right: 0; bottom: 6px; height: 4px; overflow: hidden; }
#loader .track::before { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(92,236,220,.5) 0 14px, transparent 14px 34px);
  animation: tread .5s linear infinite; }
@keyframes tread { to { transform: translateX(-34px); } }
#loader p { color: var(--muted); margin: 14px 0 0; font-weight: 600; letter-spacing: .04em; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 28px; border-radius: 999px; border: 0; cursor: pointer;
  font: 700 1.05rem "Baloo 2", sans-serif; text-decoration: none; color: #fff; background: var(--ember); box-shadow: 0 6px 0 var(--ember-d);
  transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 9px 0 var(--ember-d); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ember-d); }
.btn.gold { background: var(--gold); color: #3B2700; box-shadow: 0 6px 0 var(--gold-d); }
.btn.gold:hover { box-shadow: 0 9px 0 var(--gold-d); }
.btn.teal { background: var(--teal); color: #06302C; box-shadow: 0 6px 0 var(--teal-d); }
.btn.teal:hover { box-shadow: 0 9px 0 var(--teal-d); }
.btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* cards + grids */
.card { background: var(--card); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow); border: 3px solid var(--cardline); position: relative; }
.grid { display: grid; gap: 22px; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card.tilt { transition: transform .2s, border-color .2s; }
.card.tilt:hover { transform: translateY(-6px) rotate(-.6deg); border-color: var(--teal); }
.reveal { opacity: 0; transform: translateY(40px) scale(.97); transition: opacity .6s, transform .6s cubic-bezier(.2,1.4,.4,1); }
.reveal.in { opacity: 1; transform: none; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; background: rgba(92,236,220,.16); color: var(--teal); font-size: .85rem; font-weight: 600; margin: 2px; }

section.block { padding: 36px 0; }
.title-ribbon { display: inline-block; padding: 8px 34px; background: var(--ember); color: #fff; border-radius: 14px; font: 800 clamp(1.5rem,3vw,2.1rem) "Baloo 2";
  box-shadow: 0 6px 0 var(--ember-d); position: relative; transform: rotate(-1.5deg); margin-bottom: 22px; }
.title-ribbon.teal { background: var(--teal); color: #06302C; box-shadow: 0 6px 0 var(--teal-d); }
.title-ribbon.gold { background: var(--gold); color: #3B2700; box-shadow: 0 6px 0 var(--gold-d); }

/* summary + cast cards */
.summary-card { text-align: center; }
.summary-card .ico { font-size: 3rem; display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.summary-card:nth-child(2) .ico { animation-delay: -.6s; }
.summary-card:nth-child(3) .ico { animation-delay: -1.2s; }
.summary-card:nth-child(4) .ico { animation-delay: -1.8s; }
.character { text-align: center; }
.character .stage { height: 150px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 10px; }
.character .stage img { height: 132px; width: auto; animation: bob 3s ease-in-out infinite; }
.character:nth-child(2) .stage img { animation-delay: -.5s; }
.character:nth-child(3) .stage img { animation-delay: -1s; }
.character:nth-child(4) .stage img { animation-delay: -1.5s; }
.character:nth-child(5) .stage img { animation-delay: -2s; }
.character:nth-child(6) .stage img { animation-delay: -2.5s; }
.character h3 { margin-bottom: 2px; }
.character .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
/* Screenshots are 16:9. As direct grid items they must not stretch: the default
   align-self:stretch sizes the row to the image's intrinsic height and squashes them. */
.shots { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.shot { border-radius: 20px; border: 4px solid var(--cardline); box-shadow: var(--shadow);
  width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
  align-self: start; display: block; transition: transform .25s, border-color .25s; }
.shot:hover { transform: scale(1.03) rotate(-1deg); border-color: var(--teal); }

/* doc pages */
.doc-layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start; }
.toc { position: sticky; top: 90px; padding: 18px; }
.toc h3 { font-size: 1.2rem; }
.toc ol { list-style: none; counter-reset: t; margin: 0; padding: 0; }
.toc li { counter-increment: t; }
.toc a { display: flex; gap: 8px; text-decoration: none; padding: 5px 8px; border-radius: 12px; font-size: .95rem; font-weight: 500; align-items: center; color: var(--ink); }
.toc a::before { content: counter(t); background: var(--teal); color: #06302C; width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.toc a:hover, .toc a.active { background: var(--gold); color: #3B2700; }
.doc-section { margin-bottom: 26px; scroll-margin-top: 90px; }
.doc-section .head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.doc-section .head h2 { margin: 0; font-size: 1.7rem; }
.doc-section .head .num { background: var(--ember); color: #fff; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font: 800 1.3rem "Baloo 2"; box-shadow: 0 4px 0 var(--ember-d); flex: none; transform: rotate(-6deg); }
.doc-section .mascot { margin-left: auto; align-self: flex-end; }
.doc-section .mascot img { height: 64px; animation: bob 3.4s ease-in-out infinite; }
.doc-section ul { padding-left: 1.2em; }
.doc-section li { margin: .35em 0; }
.doc-section li::marker { color: var(--teal); }
.note { background: rgba(255,210,58,.12); border: 3px dashed var(--gold); border-radius: 18px; padding: 14px 18px; margin: 14px 0; }
.safe { background: rgba(53,201,107,.12); border: 3px dashed var(--mint); border-radius: 18px; padding: 14px 18px; margin: 14px 0; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: .95rem; }
table.data th { text-align: left; padding: 8px 12px; font-family: "Baloo 2"; color: var(--muted); }
table.data td { background: rgba(92,236,220,.1); padding: 10px 12px; vertical-align: top; }
table.data td:first-child { border-radius: 14px 0 0 14px; font-weight: 700; }
table.data td:last-child { border-radius: 0 14px 14px 0; }
.table-scroll { overflow-x: auto; }

/* FAQ */
details.faq { background: var(--card); border-radius: 20px; border: 3px solid var(--cardline); box-shadow: var(--shadow); margin-bottom: 14px; padding: 4px 20px; }
details.faq summary { cursor: pointer; font: 700 1.15rem "Baloo 2"; padding: 12px 0; list-style: none; display: flex; align-items: center; gap: 10px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; margin-left: auto; color: var(--teal); font-size: 1.6rem; line-height: 1; transition: transform .25s; }
details.faq[open] summary::after { transform: rotate(135deg); }
details.faq[open] { animation: pop .35s; }

/* form */
.form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.form input, .form select, .form textarea { width: 100%; padding: 12px 16px; border-radius: 16px; border: 3px solid var(--cardline); font: inherit; background: var(--night2); color: var(--ink); }
:root[data-theme="light"] .form input, :root[data-theme="light"] .form select, :root[data-theme="light"] .form textarea { background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 5px rgba(255,210,58,.3); }
.form textarea { min-height: 140px; resize: vertical; }

/* footer */
footer { margin-top: 50px; background: var(--deep); color: #DCD3F5; padding: 40px 0 28px; border-top: 8px solid var(--gold); }
footer a { color: #fff; }
footer .cols { display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: flex-start; }
footer .links { display: flex; flex-direction: column; gap: 6px; }
footer small { display: block; margin-top: 24px; opacity: .75; text-align: center; }
footer .minis img { height: 34px; margin-right: 4px; }

@media (max-width: 860px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  nav { margin-left: 0; }
  .doc-section .mascot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
