/* Bubble Pop (Newel Labs Play). Self-contained: no shared stylesheet, system fonts only. */
:root {
  color-scheme: light dark;
  --bg: #f6f3fb;
  --card: #ffffff;
  --card-edge: #e3dff0;
  --ink: #1b2440;
  --ink-2: #3a4566;
  --muted: #56617f;
  --line: #e2deee;
  --accent: #2b62c4;
  --accent-hi: #2357b3;
  --on-accent: #ffffff;
  --focus: #b25e00;
  --glass: rgba(255, 255, 255, 0.9);
  --glass-edge: rgba(255, 255, 255, 0.95);
  --seg: #eeebf6;
  --lock-bg: rgba(255, 255, 255, 0.6);
  --lock-ink: #3a4566;
  --tip-bg: rgba(27, 36, 64, 0.85);
  --tip-ink: #ffffff;
  --hold-fill: rgba(10, 27, 61, 0.4); /* the hold button's fill bar: darker under white text (9:1) */
  --hold-fill-soft: rgba(43, 98, 196, 0.24); /* the fill bar on the plain hold buttons (Stop, Share): a tint under dark text */
  --shadow: 0 1px 2px rgba(27, 36, 64, 0.06), 0 14px 36px -20px rgba(27, 36, 64, 0.38);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --card: #182136;
    --card-edge: #26314b;
    --ink: #eef2fa;
    --ink-2: #c8d0e2;
    --muted: #9ea9c3;
    --line: #26314b;
    --accent: #8db6ff;
    --accent-hi: #a6c6ff;
    --on-accent: #0b1730;
    --focus: #f2b765;
    --glass: rgba(17, 25, 44, 0.88);
    --glass-edge: rgba(120, 150, 210, 0.22);
    --seg: #212c45;
    --lock-bg: rgba(20, 30, 52, 0.6);
    --lock-ink: #c8d0e2;
    --tip-bg: rgba(238, 242, 250, 0.92);
    --tip-ink: #1b2440;
    --hold-fill: rgba(255, 255, 255, 0.55); /* lighter under dark text (13:1) */
    --hold-fill-soft: rgba(141, 182, 255, 0.28);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -18px rgba(0, 0, 0, 0.75);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hi); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { fill: currentColor; }
.wrap { width: 100%; max-width: 1040px; margin-left: auto; margin-right: auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
kbd { font: 600 0.92em/1 ui-monospace, Menlo, Consolas, monospace; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--card); }

/* ---- the toy ---- */
.toy {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 320px;
  overflow: hidden;
  touch-action: pan-y;               /* before play starts, a swipe still scrolls to the parents' section */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: linear-gradient(#dff2fa, #f5ecfb);
}
@media (prefers-color-scheme: dark) { .toy { background: linear-gradient(#0f2134, #211a3b); } }
.stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.intro {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 32px));
  padding: 22px 22px 18px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.kicker { margin: 0 0 6px; font-size: 0.86rem; font-weight: 600; letter-spacing: 0.01em; color: var(--muted); }
h1 { margin: 0; line-height: 1.05; }
.h1-name { display: block; font-size: clamp(2.5rem, 9vw, 3.7rem); font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.h1-sub { display: block; margin-top: 6px; font-size: clamp(1.02rem, 3.6vw, 1.2rem); font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.lede { margin: 12px auto 0; max-width: 30em; color: var(--ink-2); font-size: 1rem; line-height: 1.45; }
.starts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.start {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 64px; min-width: 150px; padding: 0 26px;
  border-radius: 999px; border: 2px solid transparent;
  font: 700 1.3rem/1.1 var(--font); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.start svg { width: 30px; height: 30px; flex: none; }
.start-main { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -10px rgba(43, 98, 196, 0.8); }
.start-main:hover { background: var(--accent-hi); }
.start-bath { background: var(--card); color: var(--ink); border-color: var(--card-edge); }
.start-bath svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.start-bath small { display: block; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-align: left; }
.start-bath span { text-align: left; }
.intro-foot { margin: 14px 0 0; font-size: 0.88rem; color: var(--muted); line-height: 1.4; }
.more-cue {
  position: absolute; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%);
  margin: 0; display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: var(--glass); color: var(--muted); font-size: 0.86rem; font-weight: 600; pointer-events: none;
}
.more-cue svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* the grown-up lock (shown only while playing): 24 px in from the top and right edges, clear of the corner where a
   gripping thumb rests. Only a touch inside the circle itself counts (see bubble-app.js). */
.lock {
  position: absolute; top: calc(24px + var(--safe-t)); right: calc(24px + var(--safe-r));
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%;
  display: none; place-items: center;
  background: var(--lock-bg); color: var(--lock-ink);
  cursor: pointer; touch-action: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.lock-ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; position: relative; }
.lock-ring { position: absolute; inset: 0; width: 52px; height: 52px; transform: rotate(-90deg); fill: none; }
.lock-track { stroke: currentColor; stroke-opacity: 0.18; stroke-width: 3; }
.lock-fill { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; opacity: 0; }
.lock.holding .lock-fill { opacity: 1; }
.lock.holding { background: var(--card); }
.lock-tip {
  position: absolute; top: calc(32px + var(--safe-t)); right: calc(86px + var(--safe-r));
  margin: 0; max-width: calc(100% - 110px); padding: 6px 12px; border-radius: 999px;
  background: var(--tip-bg); color: var(--tip-ink); font-size: 0.88rem; font-weight: 600; line-height: 1.3;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.lock-tip.show { opacity: 1; }

/* playing: the toy covers the screen and nothing else is reachable */
html.playing, html.playing body { overflow: hidden; overscroll-behavior: none; height: 100%; }
html.playing .toy { position: fixed; inset: 0; height: auto; min-height: 0; z-index: 50; touch-action: none; }
html.playing .intro, html.playing .more-cue { display: none; }
html.playing .lock { display: grid; }

@media (max-height: 520px) {
  .intro { top: 50%; padding: 12px 18px 10px; width: min(620px, calc(100% - 140px)); border-radius: 22px; }
  .kicker, .lede-more, .intro-foot-more { display: none; }
  .h1-name { font-size: 2.1rem; }
  .h1-sub { margin-top: 2px; font-size: 1rem; }
  .lede { margin-top: 6px; font-size: 0.93rem; }
  .starts { margin-top: 10px; }
  .start { min-height: 64px; font-size: 1.15rem; }
  .intro-foot { margin-top: 8px; }
  .more-cue { display: none; }
}
@media (max-width: 360px) {
  .intro { padding: 16px 14px 14px; }
  .start { min-width: 0; padding: 0 20px; }
}

/* short phones held upright (for example 375 x 548): a smaller card, lower down, so a picture bubble shows above it */
@media (max-height: 600px) and (max-aspect-ratio: 3/4) {
  .intro { top: 59%; padding: 14px 14px 12px; }
  .lede-more, .intro-foot-more { display: none; }
  .h1-name { font-size: 2.3rem; }
  .lede { margin-top: 8px; }
  .starts { flex-wrap: nowrap; gap: 10px; margin-top: 12px; }
  .start { min-width: 0; padding: 0 16px; font-size: 1.12rem; gap: 8px; }
  .intro-foot { margin-top: 10px; }
}

/* ---- for parents ---- */
.parents { padding-top: 40px; }
.parents h2 { font-size: clamp(1.7rem, 5vw, 2.1rem); font-weight: 800; letter-spacing: -0.01em; margin: 0 0 12px; }
.parents h3 { font-size: 1.25rem; font-weight: 750; margin: 30px 0 10px; }
.parents h4 { font-size: 1.05rem; margin: 0 0 8px; }
.parents p, .parents li { color: var(--ink-2); }
.parents p { margin: 0 0 12px; max-width: 46em; }
.parents .big { font-size: 1.12rem; color: var(--ink); }
.parents .fine { margin: 8px 0 6px; font-size: 0.92rem; color: var(--muted); }
.parents ul, .parents ol { padding-left: 1.25em; margin: 0; }
.parents li { margin: 0 0 8px; }
.parents li strong, .parents li b { color: var(--ink); }
.cols { display: grid; gap: 0 40px; }
@media (min-width: 820px) { .cols { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--card-edge); border-radius: 18px; padding: 16px 20px 10px; margin: 0 0 14px; }
.pin { margin-top: 10px; }
.parents details { border-top: 1px solid var(--line); max-width: 46em; }
.parents details:last-of-type { border-bottom: 1px solid var(--line); }
.parents summary { cursor: pointer; padding: 12px 0; font-weight: 650; min-height: 44px; color: var(--ink); }
.parents details p { margin: 0 0 14px; }
.note { padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-edge); }

.more-toys { margin-top: 48px; }
.more-toys h2 { font-size: 1.4rem; font-weight: 800; margin: 0 0 6px; }
.more-note { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.more-toys ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); max-width: 820px; }
.more-toys a { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; column-gap: 14px; min-height: 44px; padding: 10px; border: 1px solid var(--card-edge); border-radius: 16px; background: var(--card); color: var(--ink); text-decoration: none; }
.more-toys a:hover { border-color: var(--accent); color: var(--ink); }
.more-toys img { grid-row: 1 / 3; display: block; width: 112px; height: 63px; border-radius: 10px; object-fit: cover; background: var(--line); }
.more-toys b { align-self: end; font-weight: 700; }
.more-toys span { align-self: start; font-size: 0.88rem; line-height: 1.35; color: var(--muted); }
.foot { margin-top: 40px; padding-top: 8px; padding-bottom: calc(24px + var(--safe-b)); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 20px; }
.foot p { margin: 0; }
.foot a { color: var(--muted); display: inline-block; padding: 12px 0; }
.foot a:hover { color: var(--ink); }

/* ---- grown-ups panel ---- */
.panel {
  width: min(540px, calc(100% - 24px)); max-height: calc(100% - 24px);
  margin: auto; padding: 0; border: 0; border-radius: 24px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
  overflow: auto; overscroll-behavior: contain;
}
/* The box and the dimmed backdrop fade in and out over 0.3 s, so the screen never changes in one frame (where a browser
   can't animate a dialog, they simply appear). They fade with reduced motion too (see the end of this file): a fade is
   the gentle way. */
.panel { opacity: 0; transition: opacity 0.3s ease, overlay 0.3s ease allow-discrete, display 0.3s ease allow-discrete; }
.panel[open] { opacity: 1; }
.panel:not([open]), .panel:not([open])::backdrop { pointer-events: none; }
.panel::backdrop { background: rgba(10, 18, 34, 0); transition: background-color 0.3s ease, overlay 0.3s ease allow-discrete, display 0.3s ease allow-discrete; }
.panel[open]::backdrop { background: rgba(10, 18, 34, 0.32); }
@starting-style {
  .panel[open] { opacity: 0; }
  .panel[open]::backdrop { background: rgba(10, 18, 34, 0); }
}
.panel-in { padding: 18px 20px 16px; }
/* for its first second the settings ignore taps (the finger that opened them, or a stray one) */
.panel.settling .panel-in { pointer-events: none; }
/* Stop and Keep stay in view at the bottom of the settings, however short the screen, with the line that answers a tap
   or a hold right above them. Where the settings are taller than the screen, the rows scroll behind this footer, and
   a fade with the words "More settings below" shows over their cut edge until the last row is in view (.more-rows is
   set from bubble-app.js). Full screen and Share sit in the second row, so they are in view on every phone. */
#panel .panel-in { padding-bottom: 0; }
#panel .panel-foot { position: sticky; bottom: 0; z-index: 1; margin: 0 -20px; padding: 0 20px 14px; background: var(--card); border-top: 1px solid var(--line); }
#panel .panel-foot .pmsg { padding: 5px 0 0; min-height: calc(1.3em + 5px); line-height: 1.3; }
#panel .prow-final { border-top: 0; padding: 6px 0 0; flex-wrap: nowrap; }
.more-below {
  position: absolute; left: 0; right: 0; bottom: 100%; margin: 0 0 1px; padding: 22px 0 3px; text-align: center;
  font-size: 0.8rem; font-weight: 650; color: var(--muted); pointer-events: none;
  background: linear-gradient(to top, var(--card) 45%, transparent);
  opacity: 0; transition: opacity 0.2s;
}
.more-below::after { content: " \2193"; }
#panel.more-rows .more-below { opacity: 1; }
/* side by side on every phone (a browser's own dialog margins leave 297 px for them at 375 px wide) */
#panel .prow-final .btn { flex: 1 1 0; min-width: 0; max-width: 200px; padding: 0 10px; white-space: nowrap; }
@media (max-width: 340px) { #panel .prow-final .btn { font-size: 0.95rem; padding: 0 6px; } }
.panel h2 { margin: 0; font-size: 1.45rem; font-weight: 800; line-height: 1.25; }
.panel-sub { margin: 4px 0 6px; color: var(--muted); font-size: 0.9rem; line-height: 1.4; text-wrap: balance; }
.prow { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
@media (min-width: 480px) { .prow { grid-template-columns: 150px minmax(0, 1fr); column-gap: 14px; } .prow .pnote { grid-column: 2; } }
/* phones: a label and its control share one line (the timer keeps its label above), and the rows are a little closer,
   so the whole panel fits a phone screen of 640 px or more without scrolling */
@media (max-width: 479.98px) {
  .prow { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 9px 0; }
  .prow-vol { grid-template-columns: auto minmax(0, 1fr); }
  .prow-wind { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .prow-actions .chip { flex: 1 1 0; min-width: 0; justify-content: center; gap: 6px; padding: 0 8px; font-size: 0.94rem; white-space: nowrap; }
  .panel-in { padding-top: 14px; }
}
/* the narrowest phones: the two chips keep their words and drop their little pictures */
@media (max-width: 369.98px) { .panel-sub { font-size: 0.85rem; } .prow-actions .chip svg { display: none; } }
/* short screens (a phone on its side, a small phone): the first sentence of the panel's note is left out */
@media (max-height: 700px) { .sub-more { display: none; } }
.hold-note { padding: 8px 0 10px; border-top: 1px solid var(--line); line-height: 1.35; }
.plabel { font-weight: 650; color: var(--ink); line-height: 1.3; }
.pctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.vol-row .range { flex: 1 1 140px; }
.range { width: 100%; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pnote { margin: 0; color: var(--muted); font-size: 0.88rem; min-height: 1.2em; }
.pmsg { padding: 0 0 4px; }
.vol-row { flex-wrap: nowrap; }
.vol-row .range { min-width: 64px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--seg); }
.seg button {
  min-height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); font: 650 0.98rem/1 var(--font); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg-wind { display: grid; grid-template-columns: repeat(5, minmax(44px, 1fr)); width: 100%; max-width: 340px; border-radius: 24px; }
.seg-wind button { padding: 0 6px; }
.seg small { font-size: 0.78em; font-weight: 600; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--card-edge); border-radius: 999px; background: transparent; color: var(--ink);
  font: 650 0.98rem/1 var(--font); cursor: pointer;
}
.chip svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chip[hidden] { display: none; }
.chip.btn-hold svg { position: relative; }
.hold-soft .hold-bar { background: var(--hold-fill-soft); }
.switch {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 6px;
  border: 1px solid var(--card-edge); border-radius: 999px; background: transparent; color: var(--ink);
  font: 650 0.98rem/1 var(--font); cursor: pointer;
}
.knob { width: 52px; height: 32px; border-radius: 999px; background: var(--seg); position: relative; transition: background 0.2s; }
.knob::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.switch[aria-checked="true"] .knob { background: var(--accent); }
.switch[aria-checked="true"] .knob::after { transform: translateX(20px); }
.prow-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 480px) { .prow-actions { padding-left: 164px; } } /* in line with the other rows' controls */
.prow-final { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-bottom: 0; }
.btn {
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--card-edge);
  background: transparent; color: var(--ink); font: 700 1.05rem/1 var(--font); cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hi); }

/* ---- the grown-up check before a link opens (before play starts) ---- */
.ask { width: min(460px, calc(100% - 24px)); }
.ask-text { margin: 8px 0 4px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.ask .prow-final { border-top: 0; padding-top: 10px; }
.btn-hold { position: relative; overflow: hidden; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.hold-bar { position: absolute; inset: 0; background: var(--hold-fill); transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.hold-label { position: relative; }
/* no iOS link preview on a long press, and no dragging links or pictures out of the page */
a[href] { -webkit-touch-callout: none; }
a[href], img { -webkit-user-drag: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  /* The two dialogs keep their fade: it is a change of brightness, not movement, and without it the box would appear
     and the dimmed backdrop would switch off in a single frame. */
  .panel { transition: opacity 0.3s ease, overlay 0.3s ease allow-discrete, display 0.3s ease allow-discrete !important; }
}

/* tall phones: the intro card sits lower, so the bubbles (and a picture bubble) show above it */
@media (max-aspect-ratio: 3/4) and (min-height: 600px) {
  .intro { top: 61%; }
}
