:root {
  color-scheme: dark;
  --ink: #ece9fb;
  --muted: #a9a3c8;
  --dim: #7e78a0;
  --violet: #a78bfa;
  --panel: #15122b;
  --line: rgba(255,255,255,0.10);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #0d0c22; color: var(--ink);
  font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
/* The title screen is taller than a phone viewport, so the shell must not
   clip it. During play the canvas is position:fixed and body scrolling is
   locked instead (body.is-playing). */
.root { min-height: 100dvh; position: relative; }
body.is-playing { overflow: hidden; height: 100%; }
body.is-playing .root { height: 100dvh; overflow: hidden; }
a { color: var(--violet); }

/* ------------------------------------------------------------------ title */

.screen--title {
  min-height: 100dvh; display: flex; align-items: flex-start; justify-content: center;
  text-align: center;
  padding: 2rem 1rem calc(3rem + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 22%, #2a1f5c 0%, #0d0c22 68%);
}
.title-inner { width: 100%; max-width: 30rem; }
.title { font-size: clamp(2.1rem, 9vw, 3rem); letter-spacing: 0.24em; margin: 0; font-weight: 800; }
.subtitle { color: var(--violet); letter-spacing: 0.3em; margin: 0.2rem 0 1.1rem; font-size: 0.9rem; }
.lead { color: #b9b3d6; margin: 0 auto 1.6rem; line-height: 1.55; }

.continue {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  background: rgba(167,139,250,0.10); border: 1px solid rgba(167,139,250,0.3);
  border-radius: 16px; padding: 1rem; margin-bottom: 1.6rem;
}
.continue__label { color: var(--muted); font-size: 0.85rem; }
.continue__hint { color: var(--dim); font-size: 0.74rem; line-height: 1.4; }

.field { text-align: left; margin-bottom: 1.4rem; }
.field label, .field__label {
  display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.45rem;
  color: var(--ink); text-align: left;
}
.field__label { text-align: center; margin-bottom: 0.6rem; }
.name-input {
  width: 100%; font: inherit; font-size: 1.05rem;
  background: rgba(255,255,255,0.07); border: 2px solid rgba(255,255,255,0.16);
  border-radius: 12px; padding: 0.8rem 1rem; color: var(--ink); min-height: 52px;
}
.name-input:focus { outline: none; border-color: var(--violet); background: rgba(167,139,250,0.12); }
.name-input::placeholder { color: #6b6690; }
.field__hint { display: block; color: var(--dim); font-size: 0.75rem; margin-top: 0.4rem; line-height: 1.45; }

.hero-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 1.5rem; }
.hero-card {
  background: rgba(255,255,255,0.05); border: 3px solid transparent; border-radius: 16px;
  padding: 0.6rem; cursor: pointer; color: inherit; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
}
.hero-card img, .hero-card__art { width: 100%; max-width: 130px; border-radius: 10px; display: block; }
.hero-card__art { aspect-ratio: 12 / 13; }
.hero-card span { color: var(--muted); font-size: 0.76rem; }
.hero-card--chosen { border-color: var(--violet); background: rgba(167,139,250,0.14); }

.controls-hint { margin-top: 1.6rem; color: var(--dim); font-size: 0.8rem; line-height: 1.7; }
.controls-hint b { color: var(--muted); font-weight: 700; }
.age-hint { color: #5d5880; font-size: 0.75rem; margin-top: 0.8rem; line-height: 1.5; }
.brand-hint { color: #5d5880; font-size: 0.75rem; margin-top: 0.6rem; }

/* ------------------------------------------------------------------ buttons */

.btn {
  font: inherit; font-size: 1rem; font-weight: 700;
  background: rgba(255,255,255,0.10); color: #fff; border: none;
  padding: 0.85rem 1.6rem; cursor: pointer; border-radius: 999px; min-height: 50px;
  width: 100%; margin-top: 0.55rem;
}
.btn--primary { background: linear-gradient(135deg, #8b5cf6, #2563eb); }
.btn--ghost { background: rgba(255,255,255,0.09); font-weight: 600; }
.btn--big { font-size: 1.08rem; min-height: 56px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

/* --------------------------------------------------------------------- game */

.game-wrap { position: fixed; inset: 0; background: #000; }
.game-canvas { display: block; width: 100%; height: 100%; }

.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 0.8rem; padding-top: max(0.65rem, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(0,0,0,0.55), transparent);
  pointer-events: none;
  z-index: 6;
}
.hud > * { pointer-events: auto; }
.hud-chapter {
  font-weight: 800; font-size: 0.78rem; color: #cfc7f0;
  background: rgba(255,255,255,0.10); border-radius: 8px; padding: 0.25rem 0.5rem;
}
.hud-hearts { color: #f87171; font-size: 1.1rem; letter-spacing: 0.06em; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.hud-caption {
  flex: 1; text-align: center; color: rgba(255,255,255,0.95); font-weight: 600;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9); font-size: 0.85rem;
  opacity: 0; transition: opacity 0.25s;
}
.hud-caption.is-on { opacity: 1; }
.hud-coins { font-weight: 800; color: #fde047; text-shadow: 0 2px 4px rgba(0,0,0,0.8); font-size: 0.9rem; }
.icon-btn {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 2.9rem; height: 2.9rem; border-radius: 50%; cursor: pointer; font-size: 0.8rem;
  touch-action: manipulation;
}

/* Touch: floating analogue stick on the left, actions bottom right.
   The stick layer covers the whole play area so a thumb can land anywhere
   in the left half; the right-hand buttons sit above it in z-order. */
.touch-controls { position: absolute; inset: 0; pointer-events: none; }
/* Starts below the HUD strip: covering the full screen swallowed every tap
   meant for the pause button, which made the game unpausable on a phone. */
.stick-zone {
  position: absolute; left: 0; right: 0; top: 76px; bottom: 0;
  pointer-events: auto; touch-action: none;
}

.stick-layer { position: absolute; inset: 0; pointer-events: none; }
.stick-layer[hidden] { display: none; }
.stick-base {
  position: absolute; width: 132px; height: 132px; margin: -66px 0 0 -66px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.30);
  background: radial-gradient(circle, rgba(255,255,255,0.14), rgba(255,255,255,0.05) 70%, transparent);
  backdrop-filter: blur(2px);
}
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 62px; height: 62px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.45);
  background: radial-gradient(circle at 35% 30%, rgba(196,181,253,0.95), rgba(139,92,246,0.75));
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  transform: translate(-50%, -50%);
}

.touch-right {
  position: absolute; right: max(0.9rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex; gap: 0.7rem; align-items: flex-end; pointer-events: auto;
}
.touch-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.14); color: #fff; font-size: 1.3rem;
  -webkit-user-select: none; user-select: none; touch-action: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.touch-btn:active { transform: scale(0.93); }
.touch-btn--jump { width: 84px; height: 84px; background: rgba(139,92,246,0.5); font-size: 1.7rem; }
.touch-btn--fire { width: 74px; height: 74px; background: rgba(37,99,235,0.5); font-size: 1.5rem; }

/* ----------------------------------------------------------------- overlay */

.overlay {
  position: fixed; inset: 0; background: rgba(8,6,22,0.94);
  display: flex; align-items: center; justify-content: center; z-index: 20;
  padding: 1rem; overflow-y: auto;
}
.overlay[hidden] { display: none; }
.overlay__panel {
  width: 100%; max-width: 27rem; text-align: center;
  max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 0.5rem;
}
.overlay__panel h2 { margin: 0 0 0.8rem; font-size: 1.5rem; }
.overlay__panel p { color: #c3bde0; line-height: 1.65; }
.eyebrow {
  display: block; text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.7rem; color: var(--violet); font-weight: 700; margin-bottom: 0.5rem;
}

/* illustrated scenes */
.scene {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 18px; overflow: hidden; margin-bottom: 1rem;
  background: #171233; border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}
.scene--tall { aspect-ratio: 4 / 3; max-width: 17rem; margin-inline: auto; }
.scene--wide { aspect-ratio: 21 / 9; }
.scene__canvas { display: block; width: 100%; height: 100%; }

/* story */
.panel--story { max-width: 32rem; }
.story__body p { margin: 0 0 0.9rem; font-size: 1.02rem; }
.story h2 { font-size: 1.6rem; }
.dots { display: flex; justify-content: center; gap: 0.4rem; margin: 1.2rem 0 0.4rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.2); }
.dot--on { background: var(--violet); }

/* quiz */
.panel--quiz { max-width: 30rem; }
.quiz__q { font-size: 1.15rem; line-height: 1.45; margin-bottom: 1.1rem; }
.quiz__opts { display: flex; flex-direction: column; gap: 0.55rem; }
.quiz__opt {
  display: flex; align-items: flex-start; gap: 0.7rem; text-align: left;
  font: inherit; font-size: 0.95rem; line-height: 1.45; color: var(--ink);
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.10);
  border-radius: 14px; padding: 0.85rem 1rem; cursor: pointer; min-height: 56px;
}
.quiz__opt:hover, .quiz__opt:focus-visible {
  border-color: var(--violet); background: rgba(167,139,250,0.14); outline: none;
}
.quiz__letter {
  flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: rgba(167,139,250,0.3); color: #fff; font-weight: 800; font-size: 0.78rem;
  display: grid; place-items: center;
}
.quiz__foot { color: var(--dim); font-size: 0.78rem; margin-top: 1rem; }
.verdict { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.7rem; }
.verdict--ok { color: #6ee7a8; }
.verdict--no { color: #ffc46b; }
.quiz__correct {
  background: rgba(110,231,168,0.10); border: 1px solid rgba(110,231,168,0.25);
  border-radius: 12px; padding: 0.7rem 0.9rem; font-size: 0.93rem; text-align: left;
}
.quiz__why { text-align: left; font-size: 0.95rem; }

/* level done + rescue */
.tally { margin: 1rem 0 0.4rem; }
.tally > div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--line); font-size: 0.92rem;
}
.tally span { color: var(--muted); }
.tally b { color: #fde047; font-size: 1.05rem; }
.rescue__glow { font-size: 3rem; color: #ffe08a; text-shadow: 0 0 30px rgba(255,224,138,0.7); }

/* shop */
.panel--shop { max-width: 30rem; }
.shop__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.shop__head h2 { margin: 0; }
.purse { font-weight: 800; color: #fde047; font-size: 1.05rem; }
.shop__list { display: flex; flex-direction: column; gap: 0.55rem; }
.item {
  display: flex; align-items: center; gap: 0.75rem; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 14px; padding: 0.7rem 0.8rem;
}
.item--afford { border-color: rgba(167,139,250,0.45); background: rgba(167,139,250,0.08); }
.item--owned { opacity: 0.55; }
.item__icon {
  flex: 0 0 auto; width: 2.2rem; height: 2.2rem; border-radius: 10px;
  background: rgba(167,139,250,0.22); display: grid; place-items: center; font-size: 1.1rem;
}
.item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.item__body b { font-size: 0.94rem; }
.item__body span { color: var(--muted); font-size: 0.79rem; line-height: 1.4; }
.item__body small { color: var(--dim); font-size: 0.71rem; }
.item__buy {
  flex: 0 0 auto; font: inherit; font-weight: 800; font-size: 0.83rem;
  background: linear-gradient(135deg, #8b5cf6, #2563eb); color: #fff; border: none;
  border-radius: 999px; padding: 0.55rem 0.85rem; cursor: pointer; min-height: 42px;
}
.item__buy:disabled { background: rgba(255,255,255,0.10); color: #7e78a0; cursor: not-allowed; }
.item__max { flex: 0 0 auto; color: #6ee7a8; font-weight: 800; font-size: 0.85rem; padding: 0 0.5rem; }

.shop__sub {
  margin: 1.1rem 0 0.5rem; font-size: 0.92rem; text-align: left;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
}
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.swatch {
  font: inherit; cursor: pointer; border: 2px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05); border-radius: 12px;
  padding: 0.45rem 0.5rem 0.35rem; min-width: 4.1rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  color: var(--muted);
}
.swatch__dot {
  width: 26px; height: 26px; border-radius: 50%; background: var(--sw);
  box-shadow: 0 0 12px var(--sw);
}
.swatch__label { font-size: 0.7rem; font-weight: 700; }
.swatch--have { color: var(--ink); }
.swatch--worn { border-color: var(--violet); background: rgba(167,139,250,0.16); }
.swatch--locked { opacity: 0.45; }

/* the sentence carried out of each rescue */
.creed {
  margin: 1rem 0 0.2rem; padding: 0.85rem 1rem;
  background: rgba(255,224,138,0.12); border: 1px solid rgba(255,224,138,0.32);
  border-radius: 14px; color: #ffe6a8 !important; font-weight: 700;
  font-size: 1.02rem !important; line-height: 1.55 !important;
}

/* map */
.panel--map { max-width: 28rem; }
.map__list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.9rem; }
.chap {
  display: flex; align-items: center; gap: 0.7rem; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.55rem 0.7rem;
}
.chap--done { border-color: rgba(110,231,168,0.35); }
.chap--now { border-color: var(--violet); background: rgba(167,139,250,0.12); }
.chap--locked { opacity: 0.42; }
.chap__no {
  flex: 0 0 auto; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: rgba(255,255,255,0.10); display: grid; place-items: center;
  font-weight: 800; font-size: 0.78rem;
}
.chap__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chap__body b { font-size: 0.9rem; }
.chap__body span { color: var(--muted); font-size: 0.76rem; }
.chap__mark { color: #6ee7a8; font-weight: 800; font-size: 0.85rem; }
.map__stat { font-size: 0.82rem; color: var(--muted); }

/* credits */
.panel--credits { max-width: 31rem; }
.credits__lead { font-size: 1.02rem; }
.credits__kids { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin: 1rem 0; }
.credits__kids span {
  background: rgba(255,224,138,0.14); border: 1px solid rgba(255,224,138,0.3);
  color: #ffe08a; border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem; font-weight: 700;
}
.credits__stats { display: flex; justify-content: center; gap: 1.4rem; margin: 1.2rem 0; }
.credits__stats div { display: flex; flex-direction: column; }
.credits__stats b { font-size: 1.25rem; color: #fde047; }
.credits__stats span { font-size: 0.72rem; color: var(--muted); }
.credits__note {
  background: rgba(167,139,250,0.09); border: 1px solid rgba(167,139,250,0.28);
  border-radius: 16px; padding: 1rem; margin: 1.2rem 0; text-align: left;
}
.credits__note h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.credits__note p { font-size: 0.9rem; margin: 0 0 0.7rem; }
.credits__help { margin: 0; padding-left: 1.1rem; color: #c3bde0; font-size: 0.85rem; line-height: 1.7; }
.credits__brand { margin-top: 1.2rem; }
.credits__brand p { font-size: 0.82rem; margin: 0.3rem 0; }
.credits__link {
  display: inline-block; font-weight: 800; font-size: 1.05rem; letter-spacing: 0.04em;
  color: #fff; background: linear-gradient(135deg, #d946ef, #8b5cf6);
  padding: 0.6rem 1.3rem; border-radius: 999px; text-decoration: none; margin: 0.4rem 0;
}
.credits__small { color: var(--dim); font-size: 0.73rem !important; line-height: 1.5; }

/* pause */
.pause__who { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }

@media (min-width: 700px) {
  .overlay__panel { max-width: 32rem; }
  .quiz__opt { font-size: 1rem; }
}

/* ------------------------------------------------- reporting & helplines */

.report-cta {
  margin-top: 2.2rem; padding: 1.2rem 1.1rem;
  background: rgba(255,122,156,0.08);
  border: 1px solid rgba(255,122,156,0.32);
  border-radius: 18px; text-align: left;
}
.report-cta h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.report-cta p { color: #c3bde0; font-size: 0.88rem; line-height: 1.6; margin: 0 0 0.9rem; }
.btn--report { background: linear-gradient(135deg, #e0457b, #b0347f); }
.report-cta__note { color: var(--dim); font-size: 0.75rem !important; margin: 0.7rem 0 0 !important; }

.helpline { margin-top: 2rem; text-align: left; }
.helpline h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
.helpline__list { display: flex; flex-direction: column; gap: 0.45rem; }
.hl {
  display: grid; grid-template-columns: auto 1fr; column-gap: 0.8rem;
  align-items: baseline; text-decoration: none; color: var(--ink);
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.6rem 0.8rem;
}
.hl b { font-size: 1rem; color: var(--violet); white-space: nowrap; }
.hl span { font-weight: 700; font-size: 0.86rem; }
.hl small { grid-column: 2; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.hl--urgent { border-color: rgba(248,113,113,0.45); background: rgba(248,113,113,0.10); }
.hl--urgent b { color: #ff8f8f; font-size: 1.15rem; }
.hl--link b { color: #6ee7a8; }

.sources {
  margin-top: 2rem; color: #5d5880; font-size: 0.7rem; line-height: 1.6;
  text-align: left; border-top: 1px solid var(--line); padding-top: 0.9rem;
}
.sources a { color: #7e78a0; }
.sources code {
  background: rgba(255,255,255,0.07); padding: 0.05rem 0.3rem; border-radius: 4px;
  font-size: 0.95em;
}

/* the report form itself */
.panel--report { max-width: 34rem; text-align: left; }
.rep h2 { text-align: left; }
.rep__lead { font-size: 0.92rem; }
.rep__warn {
  background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.4);
  border-radius: 14px; padding: 0.85rem 1rem; margin: 1rem 0;
  font-size: 0.86rem; line-height: 1.6; color: #ffd8d8;
}
.rep__privacy { color: var(--dim); font-size: 0.78rem !important; }
.rep__form { margin: 1.2rem 0 0.4rem; }
.rep__section {
  margin: 1.4rem 0 0.7rem; font-size: 0.8rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--violet);
  border-bottom: 1px solid var(--line); padding-bottom: 0.35rem;
}
.rep__field { display: block; margin-bottom: 0.9rem; }
.rep__label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.2rem; }
.rep__hint { display: block; color: var(--dim); font-size: 0.72rem; line-height: 1.45; margin-bottom: 0.35rem; }
.rep__field input, .rep__field textarea {
  width: 100%; font: inherit; font-size: 0.95rem;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px; padding: 0.6rem 0.75rem; color: var(--ink); resize: vertical;
}
.rep__field input { min-height: 44px; }
.rep__field input:focus, .rep__field textarea:focus {
  outline: none; border-color: var(--violet); background: rgba(167,139,250,0.10);
}
.rep__contacts { margin-top: 1.6rem; }
.rep__contacts h3 { font-size: 0.95rem; margin: 0 0 0.6rem; }
.rep__contact {
  display: flex; gap: 0.7rem; align-items: baseline;
  padding: 0.45rem 0; border-bottom: 1px solid var(--line);
}
.rep__contact a { text-decoration: none; white-space: nowrap; }
.rep__contact b { color: var(--violet); font-size: 0.92rem; }
.rep__contact span { display: block; font-size: 0.84rem; font-weight: 700; }
.rep__contact small { display: block; color: var(--muted); font-size: 0.73rem; line-height: 1.45; }
.rep__contact--urgent b { color: #ff8f8f; }
