/* =========================================================
   Next-Gen Readers · styles.css
   "Space explorers" look: deep-space background, chunky sticker cards
   (thick outline + hard shadow), Lilita One logo, Fredoka headings, Nunito body.
   Sections: tokens · base · space background · logo · layout · cards & controls ·
             rocket mascot · welcome · dashboard · reports · admin · dialogs ·
             keyframes · hover · responsive · reduced motion · PIN issued
   ========================================================= */

/* ---------- 1. TOKENS ---------- */
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }

:root {
  --space-950: #070b26;
  --space-900: #0b1033;
  --space-800: #131a4a;
  --space-700: #1f2866;
  --space-600: #2c3786;

  --paper: #ffffff;
  --paper-2: #f5f3ff;
  --lav: #ebe6ff;
  --lav-2: #d9d0ff;
  --ink: #141a45;
  --ink-soft: #5b618f;
  --line: #0b1033;

  --yellow: #ffd23f;
  --yellow-2: #fff0b3;
  --orange: #ff9f1c;
  --coral: #ff6b8b;
  --coral-2: #ffd6df;
  --sky: #4cc9f0;
  --sky-2: #cdf2fd;
  --purple: #7b5cff;
  --purple-2: #5b3fe6;
  --mint: #2fd5a0;
  --mint-2: #c9f6e7;

  --font-logo: "Lilita One", "Fredoka", system-ui, sans-serif;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 14px; --r-md: 20px; --r-lg: 28px;
  --stroke: 3px;
  --pop: 0 6px 0 var(--line);
  --pop-sm: 0 4px 0 var(--line);
  --shadow-lg: 0 30px 60px -28px rgba(0, 0, 0, .6);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--space-900); overflow-x: hidden; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  font: 400 1rem/1.55 var(--font-body); color: var(--ink);
  background:
    radial-gradient(120vmax 80vmax at 85% -10%, #3a2a8f 0%, transparent 55%),
    radial-gradient(90vmax 70vmax at -10% 110%, #123a7a 0%, transparent 60%),
    linear-gradient(180deg, var(--space-800), var(--space-900));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.005em; line-height: 1.15; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 10px; }
.icon { width: 1.35em; height: 1.35em; flex: none; display: inline-block; vertical-align: -.28em; }

/* ---------- 3. SPACE BACKGROUND (three twinkling star layers) ---------- */
.stars { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.stars span { position: absolute; inset: -10%; background-repeat: repeat; }
.stars span:nth-child(1) {
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 120px 80px, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 200px 160px, #cdd6ff 50%, transparent 52%),
    radial-gradient(1px 1px at 60px 190px, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 250px 40px, #fff 50%, transparent 52%);
  background-size: 280px 220px; opacity: .7; animation: twinkleLayer 5s ease-in-out infinite;
}
.stars span:nth-child(2) {
  background-image:
    radial-gradient(2px 2px at 40px 60px, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 300px 200px, #ffe58a 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 180px 300px, #fff 50%, transparent 52%);
  background-size: 380px 360px; opacity: .55; animation: twinkleLayer 7s ease-in-out infinite 1.5s;
}
.stars span:nth-child(3) {
  background-image:
    radial-gradient(3px 3px at 90px 120px, #fff 50%, transparent 55%),
    radial-gradient(2.5px 2.5px at 420px 380px, #b8f0ff 50%, transparent 55%);
  background-size: 520px 480px; opacity: .8; animation: drift 90s linear infinite;
}

/* ---------- 4. LOGO ---------- */
.logo { display: inline-flex; align-items: center; gap: .55rem; margin: 0; line-height: 1; }
.logo__mark { display: grid; place-items: center; flex: none; width: 2.6em; aspect-ratio: 1; border-radius: 30%; background: var(--purple); border: var(--stroke) solid var(--line); box-shadow: var(--pop-sm); transform: rotate(-6deg); }
.logo__mark svg { width: 82%; height: 82%; overflow: visible; }
.logo__text { display: grid; justify-items: start; gap: .18em; }
.logo__top {
  font: 400 1.9em/0.9 var(--font-logo); letter-spacing: .02em; text-transform: uppercase;
  background: linear-gradient(180deg, #fff3a8 0%, var(--yellow) 45%, var(--orange) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1.5px var(--line); paint-order: stroke fill;
  filter: drop-shadow(0 .09em 0 var(--line));
}
.logo__dash { padding: 0 .04em; }
.logo__bottom {
  display: inline-block; padding: .22em .6em .18em; border-radius: 999px;
  font: 700 .62em/1 var(--font-display); letter-spacing: .38em; text-transform: uppercase; color: #fff;
  background: var(--coral); border: 2px solid var(--line); box-shadow: 0 .14em 0 var(--line);
  transform: rotate(-2.5deg); margin-left: .25em;
}
.logo--sm { font-size: 14px; }
.logo--xl { font-size: clamp(22px, 6.6vw, 38px); flex-direction: column; gap: .5rem; text-align: center; }
.logo--xl .logo__text { justify-items: center; }
.logo--xl .logo__mark { width: 2.4em; animation: floaty 4s ease-in-out infinite; }
.logo--xl .logo__top { font-size: 2.3em; }
.logo--xl .logo__bottom { font-size: .78em; margin-left: 0; }

/* ---------- 5. APP LAYOUT ---------- */
.app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 1rem 1rem calc(7.5rem + var(--safe-b)); outline: none; }
body[data-view="welcome"] .topbar,
body[data-view="welcome"] .tabbar { display: none; }
body[data-view="welcome"] .main { max-width: 1180px; padding-top: calc(1.2rem + var(--safe-t)); padding-bottom: 2rem; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .6rem;
  padding: calc(.55rem + var(--safe-t)) 1rem .55rem;
  background: rgba(11, 16, 51, .78);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand { color: #fff; }
.topbar__user {
  margin-left: auto; display: flex; align-items: center; gap: .45rem; padding: .25rem .3rem;
  border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
}
.topbar__name { font-weight: 800; color: #fff; display: none; }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.topnav { display: none; }

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink);
  transition: background .2s, transform .25s var(--spring);
}
.icon-btn:hover { background: var(--lav); }
.icon-btn:active { transform: scale(.88); }

.avatar {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 16px;
  font: 700 1.25rem var(--font-display);
  background: hsl(var(--h, 250) 90% 78%); color: var(--line);
  border: var(--stroke) solid var(--line); box-shadow: 0 3px 0 var(--line);
}
.avatar--sm { width: 36px; height: 36px; border-radius: 12px; font-size: 1rem; border-width: 2px; box-shadow: none; }

/* Bottom dock (phones) */
.tabbar {
  position: fixed; z-index: 40; left: 50%; bottom: calc(.8rem + var(--safe-b)); transform: translateX(-50%);
  width: min(94vw, 440px); display: flex; padding: .45rem;
  background: var(--space-950); border: 2px solid rgba(255, 255, 255, .14); border-radius: 26px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .7);
  animation: dockIn .8s var(--spring) .2s both;
}
.tabbar__glow {
  position: absolute; top: .45rem; bottom: .45rem; left: 0;
  transform: translateX(var(--x, 0)); width: var(--w, 25%);
  border-radius: 18px; background: var(--yellow); border: 2px solid var(--line);
  transition: transform .55s var(--spring), width .55s var(--spring);
}
.tabbar__link {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .5rem .25rem; border-radius: 18px; font-size: .74rem; font-weight: 800; color: #aab2e6;
  transition: color .25s;
}
.tabbar__link .icon { transition: transform .4s var(--spring); }
.tabbar__link.is-active { color: var(--line); }
.tabbar__link.is-active .icon { transform: translateY(-2px) scale(1.15); }

.topnav__link {
  display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; border-radius: 16px;
  font-weight: 800; color: #c3c9f0; border: 2px solid transparent;
  transition: background .25s, color .25s, transform .25s var(--spring);
}
.topnav__link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topnav__link.is-active { background: var(--yellow); color: var(--line); border-color: var(--line); box-shadow: var(--pop-sm); }

/* ---------- 6. SCREENS, CARDS & CONTROLS ---------- */
.screen:not([hidden]) { animation: screenIn .6s var(--ease) both; }
.dash > *, .page > *, .welcome > * { animation: rise .7s var(--ease) both; }
.dash > :nth-child(2), .page > :nth-child(2), .welcome > :nth-child(2) { animation-delay: .08s; }
.dash > :nth-child(3), .page > :nth-child(3), .welcome > :nth-child(3) { animation-delay: .16s; }
.dash > :nth-child(4), .page > :nth-child(4) { animation-delay: .24s; }
.dash > :nth-child(5), .page > :nth-child(5) { animation-delay: .32s; }
.dash > :nth-child(n+6), .page > :nth-child(n+6) { animation-delay: .4s; }

.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.15rem; }
.page__head--split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page__title { font-size: clamp(2rem, 5.5vw, 2.8rem); color: #fff; }
.page__sub { color: #b9c0ee; margin-top: .25rem; font-weight: 600; }

/* Sticker cards: thick outline + hard shadow */
.card {
  position: relative; padding: 1.25rem; border-radius: var(--r-lg);
  background: var(--paper); border: var(--stroke) solid var(--line); box-shadow: var(--pop), var(--shadow-lg);
}
.card__row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; }
.card__title { display: flex; align-items: center; gap: .55rem; font-size: 1.2rem; color: var(--ink); }
.card__title .icon { color: var(--purple); }
.card__meta { color: var(--ink-soft); font-weight: 700; font-size: .92rem; }

.pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: 999px;
  background: var(--lav); color: var(--ink); font-size: .82rem; font-weight: 800; white-space: nowrap;
  border: 2px solid var(--line);
}
.pill--warm { background: var(--yellow); }
.link-btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; padding: .4rem .2rem;
  font-weight: 800; color: var(--purple-2); text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 4px; transition: text-decoration-color .2s, color .2s;
}
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }

/* Buttons: chunky and pressable */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 50px; padding: .7rem 1.35rem; border: var(--stroke) solid var(--line); border-radius: 18px;
  font-weight: 900; line-height: 1.1; box-shadow: var(--pop-sm);
  transition: transform .15s, box-shadow .15s, background .25s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.btn--lg { min-height: 62px; padding: 1rem 1.8rem; font-size: 1.15rem; border-radius: 22px; }
.btn--sm { min-height: 42px; padding: .45rem 1rem; font-size: .92rem; border-radius: 14px; }
.btn--primary { color: var(--line); background: var(--yellow); }
.btn--primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .6) 50%, transparent 65%);
  transform: translateX(-130%); animation: shimmer 5s ease-in-out infinite 1.5s;
}
.btn--stop { color: #fff; background: var(--coral); }
.btn--soft { background: var(--lav); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: transparent; box-shadow: none; }
.btn--ghost:active { transform: scale(.96); }
.btn--danger { background: var(--coral); color: #fff; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .55); transform: scale(0); animation: ripple .65s ease-out forwards; pointer-events: none; }
.page__head .btn--primary, .report__actions .btn--soft { box-shadow: 0 4px 0 #000; }

/* Search, chips, fields */
.search {
  display: flex; align-items: center; gap: .7rem; padding: 0 1.1rem; min-height: 56px;
  background: var(--paper-2); border: var(--stroke) solid var(--line); border-radius: 18px;
  transition: box-shadow .25s, transform .3s var(--spring);
}
.search:focus-within { box-shadow: 0 0 0 5px rgba(123, 92, 255, .25); transform: translateY(-1px); }
.search .icon { color: var(--purple); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1.05rem; font-weight: 700; }
.search--compact { min-height: 48px; margin-bottom: .75rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  padding: .5rem 1rem; border: 2px solid var(--line); border-radius: 999px; background: var(--paper);
  font-weight: 800; font-size: .9rem; color: var(--ink);
  transition: background .25s, color .25s, transform .3s var(--spring), box-shadow .2s;
}
.chip:active { transform: scale(.92); }
.chip.is-active { background: var(--purple); color: #fff; box-shadow: 0 3px 0 var(--line); transform: translateY(-2px); }
.chips--tight { margin-top: .6rem; }

.field { display: grid; gap: .4rem; }
.field > label, .field > span { font-weight: 800; font-size: .92rem; color: var(--ink); }
.optional { font-weight: 600; color: var(--ink-soft); }
.field__hint { display: flex; gap: .4rem; align-items: flex-start; font-size: .84rem; color: var(--ink-soft); }
.field input, .field select {
  width: 100%; min-height: 50px; padding: .6rem 1rem; border: 2.5px solid var(--lav-2); border-radius: var(--r-sm);
  background: var(--paper); outline: 0; font-weight: 700; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(123, 92, 255, .2); }
.field input:disabled { background: var(--paper-2); color: var(--ink-soft); }
.form-error { padding: .7rem 1rem; border-radius: var(--r-sm); background: var(--coral-2); color: #b0173c; font-weight: 800; border: 2px solid #b0173c; animation: shake .45s; }

/* Empty states */
.empty { display: grid; justify-items: center; gap: .3rem; padding: 2rem 1rem; text-align: center; }
.empty__emoji { font-size: 2.6rem; animation: floaty 3s ease-in-out infinite; }
.empty__title { font: 700 1.2rem var(--font-display); color: var(--ink); }
.empty__text { color: var(--ink-soft); max-width: 30ch; }

/* ---------- 7. JESUS MASCOT ---------- */
.mascot { position: relative; display: grid; place-items: center; padding: 0; border: 0; background: none; }
.mascot svg { width: 100%; height: auto; overflow: visible; animation: sway 4s ease-in-out infinite; transform-origin: 50% 100%; }
.mascot__arm { transform-box: view-box; transform-origin: 128px 112px; animation: wave 2.4s ease-in-out infinite; }
.mascot__glow { transform-box: fill-box; transform-origin: center; animation: glow 3.5s ease-in-out infinite; }
.mascot__eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.mascot__cheek { animation: blush 3.2s ease-in-out infinite; }
.mascot--xl { width: min(180px, 44vw); z-index: 2; cursor: pointer; }
.mascot--md { width: 82px; flex: none; }
.mascot--sm { width: 54px; flex: none; }
.mascot.is-excited svg { animation: cheer .7s var(--spring) 2; }
.mascot.is-excited .mascot__arm { animation-duration: .6s; }
.mascot-shadow { width: min(170px, 44vw); height: 18px; margin-top: -1.3rem; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 210, 63, .45), rgba(255, 210, 63, .12) 60%, transparent); animation: padGlow 3.5s ease-in-out infinite; }

/* Speech bubbles */
.bubble {
  position: relative; padding: .85rem 1.25rem; border-radius: 22px; background: var(--paper);
  border: var(--stroke) solid var(--line); box-shadow: var(--pop-sm);
  font-weight: 800; color: var(--ink);
  animation: pop .8s var(--spring) .3s both;
}
.bubble::after { content: ""; position: absolute; width: 18px; height: 18px; background: inherit; border: inherit; border-width: 0 var(--stroke) var(--stroke) 0; transform: rotate(45deg); border-radius: 0 0 4px 0; }
.bubble--center { text-align: center; font: 700 clamp(1.05rem, 3.6vw, 1.3rem) var(--font-display); max-width: 24ch; transform-origin: bottom center; }
.bubble--center::after { left: calc(50% - 9px); bottom: -11px; }
.bubble.is-swapping { animation: pop .6s var(--spring) both; }

/* ---------- 8. WELCOME ---------- */
.welcome { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
.welcome__hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1rem .5rem 0; }
.welcome__hero > * { position: relative; z-index: 1; }
.welcome__sub { margin-top: .9rem; color: #d6dbff; font-weight: 700; max-width: 30ch; font-size: 1.05rem; }
.welcome__launch { display: grid; justify-items: center; gap: .9rem; margin-top: 1.4rem; }

.space-deco { position: absolute !important; inset: 0; z-index: 0 !important; pointer-events: none; overflow: hidden; }
.planet { position: absolute; border-radius: 50%; border: var(--stroke) solid var(--line); }
.planet--ring { width: 56px; height: 56px; top: 46%; right: 30px; background: radial-gradient(circle at 35% 30%, #ffb3c4, var(--coral) 60%, #d9446b); animation: floaty 7s ease-in-out infinite; }
.planet--ring::after { content: ""; position: absolute; left: -24px; right: -24px; top: 40%; height: 14px; border-radius: 50%; border: var(--stroke) solid var(--line); background: var(--yellow); transform: rotate(-18deg); z-index: -1; }
.planet--moon { width: 40px; height: 40px; top: 66%; left: 5%; background: radial-gradient(circle at 35% 30%, #fff, #c9cff5 70%); animation: floaty 6s ease-in-out infinite 1s; }
.planet--moon::before { content: ""; position: absolute; width: 9px; height: 9px; top: 9px; left: 16px; border-radius: 50%; background: #aab2e6; }
.shooting-star { position: absolute; top: 12%; left: -20%; width: 110px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, #fff); transform: rotate(18deg); animation: shoot 7s ease-in infinite 2s; opacity: 0; }
.shooting-star--2 { top: 4%; animation-delay: 5.5s; }

.welcome__panel { padding: 1.2rem; }
.panel__title { font-size: 1.4rem; margin-bottom: .8rem; }
.member-list {
  margin-top: 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem;
  max-height: 52vh; overflow-y: auto; padding: .2rem .2rem .5rem; scrollbar-width: thin; scrollbar-color: var(--lav-2) transparent;
}
.member-list li { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.member {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .95rem .5rem .8rem; text-align: center;
  border: var(--stroke) solid var(--line); border-radius: var(--r-md); background: var(--paper-2); box-shadow: var(--pop-sm);
  transition: transform .15s, box-shadow .15s, background .2s;
}
.member .avatar { width: 58px; height: 58px; font-size: 1.5rem; border-radius: 50%; }
.member > span:last-child { display: grid; gap: .1rem; }
.member__name { font-weight: 900; font-size: 1.02rem; line-height: 1.2; overflow-wrap: anywhere; }
.member__meta { display: block; font-size: .78rem; color: var(--ink-soft); font-weight: 700; }
.member:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.member[aria-busy="true"] { background: var(--yellow); }

/* ---------- 9. DASHBOARD ---------- */
.dash { display: grid; gap: 1.1rem; }
.greet {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem;
  border-radius: var(--r-lg); border: var(--stroke) solid var(--line); box-shadow: var(--pop);
  background: linear-gradient(120deg, var(--purple) 0%, #5b3fe6 55%, #3a2aa8 100%); color: #fff;
}
.greet::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background: radial-gradient(circle at 80% 22%, #fff 0 2px, transparent 3px), radial-gradient(circle at 66% 76%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 93% 64%, #ffe58a 0 2.5px, transparent 3.5px), radial-gradient(circle at 50% 15%, #fff 0 1px, transparent 2px);
  animation: twinkleLayer 4s ease-in-out infinite;
}
.greet .mascot { z-index: 1; }
.greet__copy { flex: 1; z-index: 1; }
.greet__title { font-size: clamp(1.5rem, 5vw, 2rem); color: #fff; }
.greet__text { font-weight: 700; color: #e4defe; margin-top: .15rem; }

/* Timer */
.timer { display: grid; justify-items: center; gap: .9rem; text-align: center; }
.timer__head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.timer[data-state="running"] .pill { background: var(--mint); animation: pulsePill 1.6s ease-in-out infinite; }
.timer__dial { position: relative; width: min(270px, 72vw); aspect-ratio: 1; margin: .3rem auto; }
.timer__dial::before, .timer__dial::after { content: ""; position: absolute; inset: 8%; border-radius: 50%; border: 3px solid var(--sky); opacity: 0; pointer-events: none; }
.timer[data-state="running"] .timer__dial::before { animation: ping 2.8s ease-out infinite; }
.timer[data-state="running"] .timer__dial::after { animation: ping 2.8s ease-out infinite 1.4s; }
.timer__ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.timer__track, .timer__progress { fill: none; stroke-width: 10; }
.timer__track { stroke: var(--lav); }
.timer__progress {
  stroke: var(--purple); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: var(--ring-offset, 339.3);
  transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 6px rgba(123, 92, 255, .55));
}
.timer__readout {
  position: absolute; inset: 15%; display: grid; place-content: center; gap: .3rem; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--space-700), var(--space-900)); border: var(--stroke) solid var(--line);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .06);
}
.timer[data-state="running"] .timer__readout { animation: breathe 3s ease-in-out infinite; }
.timer__time { font: 700 clamp(1.8rem, 7.5vw, 2.4rem) var(--font-display); font-variant-numeric: tabular-nums; color: var(--yellow); }
.timer__hint { font-size: .78rem; font-weight: 700; color: #c3c9f0; max-width: 15ch; margin: 0 auto; line-height: 1.3; }
.timer__actions { width: 100%; display: grid; }
.timer__secondary { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }

/* Totals: three coloured stickers */
.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.totals--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat {
  position: relative; overflow: hidden; padding: .9rem .6rem; border-radius: var(--r-md); text-align: center;
  background: var(--paper); border: var(--stroke) solid var(--line); box-shadow: var(--pop-sm);
  transition: transform .4s var(--spring);
}
.stat--day { background: var(--yellow); }
.stat--month { background: var(--sky); }
.stat--year { background: var(--coral); }
.totals--4 .stat:nth-child(1) { background: var(--yellow); }
.totals--4 .stat:nth-child(2) { background: var(--sky); }
.totals--4 .stat:nth-child(3) { background: var(--mint); }
.totals--4 .stat:nth-child(4) { background: var(--coral); }
.stat__icon { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-bottom: .3rem; border-radius: 12px; background: rgba(255, 255, 255, .6); border: 2px solid var(--line); color: var(--line); animation: floaty 4s ease-in-out infinite; }
.stat--month .stat__icon { animation-delay: .6s; }
.stat--year .stat__icon { animation-delay: 1.2s; }
.stat__label { font-size: .76rem; font-weight: 900; color: var(--line); opacity: .75; text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font: 700 clamp(1.15rem, 4.6vw, 1.7rem) var(--font-display); color: var(--line); font-variant-numeric: tabular-nums; }
.stat__sub { font-size: .76rem; color: var(--line); opacity: .75; font-weight: 700; }

/* Week bars + streak */
.week__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.week__bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: .45rem; height: 150px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: .4rem; min-height: 0; }
.bar__track { flex: 1; width: 100%; max-width: 36px; display: flex; align-items: flex-end; overflow: hidden; border-radius: 12px; background: var(--paper-2); border: 2px solid var(--line); }
.bar__fill { width: 100%; height: var(--h, 0%); min-height: 6px; background: linear-gradient(180deg, var(--sky), var(--purple)); transform-origin: bottom; animation: grow 1s var(--spring) both; animation-delay: calc(var(--i, 0) * 80ms + .3s); }
.bar.is-today .bar__fill { background: linear-gradient(180deg, var(--yellow), var(--orange)); }
.bar__label { font-size: .76rem; font-weight: 900; color: var(--ink-soft); }
.bar.is-today .bar__label { color: var(--purple-2); }
.pill--warm .flame, .flame { display: inline-block; animation: flicker 1.4s ease-in-out infinite; transform-origin: bottom; }
.trophy { background: linear-gradient(180deg, var(--yellow-2), var(--paper) 70%); }

/* History list */
.history { display: grid; gap: .55rem; }
.history__item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .85rem; padding: .65rem .85rem;
  border-radius: var(--r-md); background: var(--paper-2); border: 2px solid var(--lav-2);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms);
  transition: transform .3s var(--spring), border-color .2s;
}
.history__item:hover { border-color: var(--line); transform: translateX(3px); }
.history__date { display: grid; place-items: center; width: 52px; padding: .3rem 0; border-radius: 14px; background: var(--purple); color: #fff; border: 2px solid var(--line); line-height: 1.05; }
.history__date b { font: 700 1.25rem var(--font-display); }
.history__date small { font-size: .68rem; font-weight: 900; color: var(--yellow); text-transform: uppercase; }
.history__note { font-weight: 900; }
.history__sub { display: block; font-size: .82rem; color: var(--ink-soft); font-weight: 700; }
.history__dur { font: 700 1.05rem var(--font-display); color: var(--purple-2); white-space: nowrap; }
.history--full { max-height: none; }

/* ---------- 10. REPORTS ---------- */
.segmented { position: relative; display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); padding: .3rem; border-radius: 20px; background: var(--space-950); border: 2px solid rgba(255, 255, 255, .14); max-width: calc(var(--n, 2) * 190px); }
.segmented__btn { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; border: 0; border-radius: 16px; background: none; font-weight: 800; color: #aab2e6; transition: color .3s; }
.segmented__btn.is-active { color: var(--line); }
.segmented__thumb { position: absolute; top: .3rem; bottom: .3rem; left: .3rem; width: calc((100% - .6rem) / var(--n, 2)); border-radius: 16px; background: var(--yellow); border: 2px solid var(--line); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .55s var(--spring); }
@media (max-width: 560px) { .segmented--many .segmented__btn { font-size: .85rem; gap: .25rem; padding: 0 .2rem; } .segmented--many .segmented__btn .icon { display: none; } }

.filters { display: grid; gap: .9rem; }
.filters__row { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters__row input, .filters__row select { min-width: 0; width: 100%; }
.filters__row .field:first-child { grid-column: 1 / -1; }

.report { overflow: hidden; display: grid; gap: 1.2rem; }
.report::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 10px; background: linear-gradient(90deg, var(--purple), var(--sky), var(--mint), var(--yellow), var(--coral)); }
.report__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .5rem; }
.report__kicker { font-weight: 900; font-size: .86rem; color: var(--purple-2); text-transform: uppercase; letter-spacing: .05em; }
.report__title { font-size: clamp(1.5rem, 5vw, 2.1rem); color: var(--ink); }
.report__range { color: var(--ink-soft); font-weight: 700; }
.report__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.report__stats .stat { box-shadow: none; }
.report__stats .stat:nth-child(1) { background: var(--yellow-2); }
.report__stats .stat:nth-child(2) { background: var(--sky-2); }
.report__stats .stat:nth-child(3) { background: var(--coral-2); }
.report__chart { display: flex; align-items: flex-end; gap: clamp(2px, 1vw, 8px); height: 150px; padding: .75rem .75rem 0; border-radius: var(--r-md); background: var(--paper-2); border: 2px solid var(--lav-2); }
.report__chart .rbar { flex: 1; height: var(--h, 10%); min-width: 3px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--sky), var(--purple)); transform-origin: bottom; animation: grow .9s var(--spring) both; animation-delay: calc(var(--i, 0) * 25ms); }
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 2px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { padding: .75rem 1rem; text-align: left; background: var(--lav); font-weight: 900; color: var(--ink); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-top: 1px solid var(--lav-2); white-space: nowrap; font-weight: 600; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: var(--paper-2); }
.table td:last-child, .table th:last-child { text-align: right; }
.table--grid th, .table--grid td, .table--grid td:last-child, .table--grid th:last-child { text-align: center; white-space: normal; line-height: 1.3; padding: .55rem .6rem; min-width: 5.2rem; }
.table--grid th:first-child, .table--grid td:first-child { text-align: left; font-weight: 800; white-space: nowrap; min-width: 9rem; position: sticky; left: 0; background: var(--paper); }
.table--grid .is-red { color: #b42318; font-weight: 800; }
.table--grid .is-x { color: var(--ink-soft); opacity: .7; }
.table--grid td div { white-space: nowrap; }
.table--grid .arr { display: block; font-size: .8em; line-height: 1; opacity: .75; }
.report__note { display: flex; gap: .5rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r-sm); background: var(--yellow-2); border: 2px solid var(--line); color: var(--ink); font-size: .88rem; font-weight: 700; }
.report__actions { display: flex; justify-content: center; }
.report__actions--left { justify-content: flex-start; }
.report__actions .btn--lg { width: min(100%, 360px); }
.report__actions .btn--primary { box-shadow: 0 5px 0 #000; }
.report.is-refreshing { animation: refresh .6s var(--ease); }

/* ---------- 11. ADMIN ---------- */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.progress-group { display: grid; gap: .95rem; margin-top: .6rem; }
.pg__top { display: flex; justify-content: space-between; gap: .5rem; font-weight: 900; font-size: .94rem; }
.pg__top span:last-child { color: var(--ink-soft); font-weight: 700; }
.pg__bar { height: 14px; margin-top: .35rem; overflow: hidden; border-radius: 999px; background: var(--paper-2); border: 2px solid var(--line); }
.pg__fill { height: 100%; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--purple)); animation: fillbar 1.3s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + .3s); position: relative; overflow: hidden; }
.pg__fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 3.5s ease-in-out infinite 1.6s; }
.pg__fill.is-goal { background: linear-gradient(90deg, var(--yellow), var(--mint)); }
.group-ring { display: flex; align-items: center; gap: 1.2rem; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 2px dashed var(--lav-2); }
.donut {
  position: relative; flex: none; width: 112px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--purple) calc(var(--p) * 1%), var(--lav) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 15px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 15px));
  transition: --p 1.6s var(--ease);
}
.donut-wrap { position: relative; flex: none; display: grid; place-items: center; }
.donut-wrap b { position: absolute; font: 700 1.4rem var(--font-display); color: var(--ink); }
.admin-members { display: grid; gap: .5rem; max-height: 480px; overflow-y: auto; padding: .2rem; scrollbar-width: thin; }
.am { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; padding: .55rem .65rem; border-radius: var(--r-md); background: var(--paper-2); border: 2px solid var(--lav-2); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); transition: border-color .2s, transform .3s var(--spring); }
.am:hover { border-color: var(--line); transform: translateX(3px); }
.am.is-removing { animation: removeOut .5s var(--ease) forwards; }
.am__name { font-weight: 900; }
.am__meta { display: block; font-size: .82rem; color: var(--ink-soft); font-weight: 700; }
.am__actions { display: flex; gap: .15rem; }
.am__actions .icon-btn { width: 40px; height: 40px; }
.am__actions .icon-btn[data-act="remove"]:hover { background: var(--coral-2); color: #b0173c; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--yellow); border: 1.5px solid var(--line); color: var(--ink); font-size: .72rem; font-weight: 900; margin-left: .4rem; vertical-align: middle; }
.badge--off { background: var(--paper-2); color: var(--ink-soft); }

/* ---------- 12. DIALOGS ---------- */
.sheet { width: 100%; max-width: none; height: fit-content; max-height: 100dvh; margin: auto 0 0; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
.sheet::backdrop { background: rgba(7, 11, 38, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet[open]::backdrop { animation: fade .35s both; }
.sheet__body {
  display: grid; gap: 1rem; width: 100%; max-width: 540px; max-height: 92dvh; overflow-y: auto; margin: 0 auto;
  padding: 1.3rem 1.3rem calc(1.3rem + var(--safe-b)); border-radius: 30px 30px 0 0; background: var(--paper);
  border: var(--stroke) solid var(--line); border-bottom: 0;
}
.sheet[open] .sheet__body { animation: sheetUp .55s var(--spring) both; }
.sheet--small .sheet__body { max-width: 420px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; }
.sheet__head h2 { font-size: 1.5rem; color: var(--ink); }
.sheet__foot { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.sheet__foot--stack { flex-direction: column-reverse; }
.sheet__foot--stack .btn { width: 100%; }
.duration { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.duration__box { display: flex; align-items: center; gap: .6rem; padding: .3rem 1rem .3rem .3rem; border: 2.5px solid var(--lav-2); border-radius: var(--r-md); background: var(--paper); transition: border-color .2s; }
.duration__box:focus-within { border-color: var(--purple); }
.duration__box input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; text-align: center; font: 700 1.8rem var(--font-display); }
.duration__box span { font-weight: 800; color: var(--ink-soft); }
.switch { display: flex; align-items: center; gap: .8rem; font-weight: 800; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch__track { position: relative; width: 54px; height: 32px; border-radius: 999px; background: var(--lav-2); border: 2px solid var(--line); transition: background .3s; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--line); transition: transform .4s var(--spring); }
.switch input:checked + .switch__track { background: var(--mint); }
.switch input:checked + .switch__track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--purple); outline-offset: 3px; }
.confirm__emoji { justify-self: center; font-size: 3rem; animation: floaty 2.5s ease-in-out infinite; }
.confirm__title { text-align: center; font-size: 1.5rem; }
.confirm__text { text-align: center; color: var(--ink-soft); font-weight: 600; }

/* PIN pad */
.pin__who { text-align: center; font: 700 1.25rem var(--font-display); }
.pin__dots { display: flex; justify-content: center; gap: .8rem; }
.pin__dots span { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); transition: background .2s, transform .35s var(--spring); }
.pin__dots span.is-filled { background: var(--purple); transform: scale(1.2); }
.pin__dots.is-error { animation: shake .45s; }
.pin__pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 300px; width: 100%; margin: 0 auto; }
.pin__key { min-height: 60px; border: var(--stroke) solid var(--line); border-radius: 18px; background: var(--paper-2); box-shadow: var(--pop-sm); font: 700 1.5rem var(--font-display); transition: transform .12s, box-shadow .12s, background .2s; }
.pin__key:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); background: var(--yellow); }
.pin__key--ghost { background: transparent; border-color: transparent; box-shadow: none; }
.pin__hint { justify-content: center; text-align: center; }

/* Toasts + confetti */
.toasts { position: fixed; z-index: 120; top: calc(.9rem + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(92vw, 400px); display: grid; gap: .5rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .7rem; padding: .85rem 1.1rem; border-radius: 18px; background: var(--space-950); color: #fff; font-weight: 800; border: 2px solid var(--yellow); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); animation: toastIn .6s var(--spring) both; }
.toast.is-leaving { animation: toastOut .4s var(--ease) forwards; }
.toast .icon { color: var(--yellow); }
.confetti { position: fixed; inset: 0; z-index: 110; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -16px; left: var(--x, 50%); width: 10px; height: 14px; border-radius: 3px; background: var(--c, var(--yellow)); animation: fall var(--t, 2.6s) cubic-bezier(.25, .6, .4, 1) var(--d, 0s) forwards; }
.confetti i:nth-child(3n) { border-radius: 50%; width: 10px; height: 10px; }
.confetti i:nth-child(5n) { clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); width: 14px; height: 14px; border-radius: 0; }

/* ---------- 12b. BIBLE STORIES + READER ---------- */
/* Dashboard: big "Read a Bible story" button */
.read-cta { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; background: var(--yellow); transition: transform .15s, box-shadow .15s; }
.read-cta:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.read-cta__icon { display: grid; place-items: center; width: 54px; height: 54px; flex: none; border-radius: 16px; background: var(--paper); border: var(--stroke) solid var(--line); color: var(--purple); font-size: 1.35rem; }
.read-cta__copy { flex: 1; display: grid; gap: .1rem; }
.read-cta__title { font: 700 1.3rem var(--font-display); color: var(--line); }
.read-cta__text { font-weight: 800; font-size: .88rem; color: var(--line); opacity: .75; }
.read-cta__go, .continue__go { font: 700 2rem var(--font-display); color: var(--line); }

/* Bible list */
.stars-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; }
.stars-card__copy { flex: 1; display: grid; gap: .5rem; }
.stars-card__count { font-weight: 800; color: var(--ink-soft); }
.stars-card__count b { font: 700 1.6rem var(--font-display); color: var(--ink); }
.stars-card__bar { height: 16px; border-radius: 999px; background: var(--paper-2); border: 2px solid var(--line); overflow: hidden; }
.stars-card__bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow), var(--orange)); transition: width 1s var(--ease); }

.continue { width: 100%; display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--mint-2); transition: transform .15s, box-shadow .15s; }
.continue:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.continue__icon { font-size: 1.8rem; }
.continue__copy { flex: 1; display: grid; }
.continue__kicker { font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.continue__title { font: 700 1.15rem var(--font-display); }

.bible-tools { display: grid; gap: .7rem; }
.bible-tools .search--compact { margin: 0; }
.bible-tools .chip:not(.is-active) { background: rgba(255, 255, 255, .94); }
.story-groups { display: grid; gap: 1.4rem; }
.story-group__title { color: var(--yellow); font-size: 1.15rem; margin: 0 0 .6rem .2rem; letter-spacing: .01em; }
.story-list { display: grid; gap: .55rem; }
.story-list li { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.story-row {
  display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; border-radius: var(--r-md);
  background: var(--paper); border: var(--stroke) solid var(--line); box-shadow: var(--pop-sm);
  transition: transform .15s, box-shadow .15s, background .2s;
}
.story-row:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.story-row.is-done { background: var(--yellow-2); }
.story-row__num {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: var(--lav); border: 2px solid var(--line); font: 700 1rem var(--font-display); color: var(--ink);
}
.story-row.is-done .story-row__num { background: var(--yellow); font-size: 1.3rem; }
.story-row__num i { position: absolute; inset: 5px; border-radius: 50%; background: conic-gradient(var(--purple) calc(var(--p) * 1%), var(--paper) 0); border: 2px solid var(--line); }
.story-row__copy { flex: 1; min-width: 0; display: grid; }
.story-row__title { font-weight: 900; line-height: 1.25; }
.story-row__ref { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.story-row__go { font: 700 1.6rem var(--font-display); color: var(--purple); }

/* Reader */
body.is-reading .tabbar { display: none; }
.reader { display: grid; gap: 1rem; max-width: 760px; margin: 0 auto; }
.reader__bar {
  position: sticky; top: calc(60px + var(--safe-t)); z-index: 20; display: grid; gap: .55rem; padding: .6rem .75rem;
  border-radius: 20px; background: var(--space-950); border: 2px solid rgba(255, 255, 255, .14); box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .7);
}
.reader__progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.reader__progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky), var(--mint), var(--yellow)); transition: width .4s var(--ease); }
.reader__tools { display: flex; align-items: center; gap: .5rem; }
.reader__time { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; font-weight: 800; font-variant-numeric: tabular-nums; }
.reader__time .icon { color: var(--yellow); }
.reader__tools .btn--sm { margin-left: auto; min-height: 40px; }
.reader__tools .btn[aria-pressed="true"] { background: var(--mint); }
.reader__size { display: flex; }
.reader__size .icon-btn { width: 40px; height: 40px; color: #fff; font: 700 .95rem var(--font-display); }
.reader__size .icon-btn:hover { background: rgba(255, 255, 255, .12); }

.story { padding: 1.4rem 1.25rem 1.6rem; }
.story__head { display: grid; gap: .35rem; padding-bottom: 1rem; margin-bottom: 1.1rem; border-bottom: 2px dashed var(--lav-2); }
.story__ref { justify-self: start; padding: .2rem .7rem; border-radius: 999px; background: var(--purple); color: #fff; border: 2px solid var(--line); font-weight: 900; font-size: .82rem; }
.story__title { font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.12; }
.story__meta { font-weight: 800; color: var(--ink-soft); font-size: .9rem; }
.story__body { --size: 1; font-size: calc(1.14rem * var(--size)); line-height: 1.8; font-weight: 600; color: #20264f; display: grid; gap: 1em; }
.story__body p { padding: .15em .35em; margin: 0 -.35em; border-radius: 10px; transition: background .3s; }
.story__body p:first-child::first-letter { float: left; font: 700 3.1em/0.85 var(--font-display); color: var(--purple); margin: .08em .12em 0 0; }
.story__body p.is-poem { white-space: pre-line; padding-left: 1em; border-left: 4px solid var(--yellow); border-radius: 0 10px 10px 0; font-style: italic; }
.story__body p.is-poem:first-child::first-letter { float: none; font: inherit; color: inherit; margin: 0; }
.story__body p.is-speaking { background: var(--yellow-2); box-shadow: 0 0 0 2px var(--yellow); }
.story__loading { color: var(--ink-soft); font-weight: 800; }
.story__end { display: grid; justify-items: center; gap: .5rem; margin-top: 2rem; padding: 1.4rem 1rem 1.2rem; border-radius: var(--r-md); background: var(--paper-2); border: 2px dashed var(--lav-2); text-align: center; }
.story__end-title { font: 700 1.6rem var(--font-display); }
.story__end-text { color: var(--ink-soft); font-weight: 700; max-width: 34ch; }
.story__end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .6rem; }
.story__credit { text-align: center; color: #aab2e6; font-size: .8rem; font-weight: 600; padding: 0 1rem; }
.idle__mascot { justify-self: center; }

@media (min-width: 900px) {
  .reader__bar { top: calc(70px + var(--safe-t)); }
  .story { padding: 2.2rem 2.6rem 2.4rem; }
  .story-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) { .reader__bar { top: 1rem; } }

/* ---------- 13. KEYFRAMES ---------- */
@keyframes sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg) translateY(-3px); } }
@keyframes wave { 0%, 40%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20% { transform: rotate(8deg); } }
@keyframes glow { 50% { transform: scale(1.08); opacity: .5; } }
@keyframes cheer { 40% { transform: translateY(-26px) scale(1.04); } 70% { transform: translateY(0) scale(1.02, .97); } }
@keyframes padGlow { 50% { transform: scaleX(1.12); opacity: .7; } }
@keyframes breathe { 50% { transform: scale(1.025); } }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(.08); } }
@keyframes blush { 50% { opacity: .95; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4) translateY(14px); } 100% { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes dockIn { from { opacity: 0; transform: translate(-50%, 90px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { 0%, 55% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes twinkleLayer { 50% { opacity: .25; } }
@keyframes drift { to { transform: translate(-260px, 120px); } }
@keyframes shoot { 0% { opacity: 0; transform: translate(0, 0) rotate(18deg); } 4% { opacity: 1; } 14% { opacity: 0; transform: translate(70vw, 23vw) rotate(18deg); } 100% { opacity: 0; transform: translate(70vw, 23vw) rotate(18deg); } }
@keyframes floaty { 50% { transform: translateY(-5px) rotate(-4deg); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 40% { transform: scale(1.18, 1.05) rotate(3deg); } 70% { transform: scale(.94, 1.12) rotate(-3deg); } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fillbar { from { width: 0; } to { width: var(--w, 0%); } }
@keyframes ping { 0% { opacity: .8; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.3); } }
@keyframes pulsePill { 50% { box-shadow: 0 0 0 7px rgba(47, 213, 160, .3); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes refresh { 0% { opacity: .4; transform: scale(.985); } 100% { opacity: 1; transform: none; } }
@keyframes removeOut { to { opacity: 0; transform: translateX(60px) scale(.9); height: 0; padding: 0; margin: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(70px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-30px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-20px) scale(.95); } }
@keyframes fall { to { transform: translate(var(--dx, 0), 112vh) rotate(var(--rot, 720deg)); opacity: .9; } }

/* ---------- 14. HOVER (pointer devices only) ---------- */
@media (hover: hover) {
  .stat:hover { transform: translateY(-4px) rotate(-1deg); }
  .btn--primary:hover, .btn--stop:hover, .btn--soft:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--line); }
  .btn--primary:active, .btn--stop:active, .btn--soft:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
  .member:hover { background: var(--yellow-2); transform: translateY(-3px); box-shadow: 0 7px 0 var(--line); }
  .pin__key:hover { background: var(--yellow-2); }
}

/* ---------- 15. RESPONSIVE ---------- */
@media (min-width: 480px) {
  .member-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 560px) {
  .totals--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters__row { grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); }
  .filters__row .field:first-child { grid-column: auto; }
  .sheet { margin: auto; }
  .sheet__body { border-radius: 30px; border-bottom: var(--stroke) solid var(--line); box-shadow: 0 8px 0 var(--line); }
  .topbar__name { display: inline; padding-right: .2rem; }
}

@media (min-width: 720px) {
  .main { padding: 1.5rem 1.5rem calc(7.5rem + var(--safe-b)); }
  .card { padding: 1.6rem; }
  .greet { padding: 1.3rem 1.6rem; }
  .mascot--md { width: 100px; }
}

/* Top navigation replaces the bottom dock once there is room for it */
@media (min-width: 900px) {
  .main { padding-bottom: 3rem; }
  .tabbar { display: none; }
  .topbar { padding-inline: 1.5rem; gap: 1.5rem; }
  .topnav { display: flex; gap: .4rem; margin-left: 1rem; }
  .welcome { grid-template-columns: 1.05fr 1fr; align-items: center; gap: 2.5rem; min-height: calc(100dvh - 3rem); }
  .welcome__hero { padding: 2rem 1rem; }
  .member-list { max-height: 56vh; }
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
  .dash > .greet, .dash > .totals, .dash > .recent { grid-column: 1 / -1; }
  .dash > .timer { grid-row: span 2; }
  .admin-grid { grid-template-columns: 1.05fr 1fr; gap: 1.25rem; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .topbar__name { display: none; }
}

/* Desktop: navigation becomes a dark side panel */
@media (min-width: 1100px) {
  .app { display: grid; grid-template-columns: 270px minmax(0, 1fr); }
  body[data-view="welcome"] .app { grid-template-columns: 1fr; }
  .topbar {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; align-items: stretch; gap: 1.8rem;
    padding: 1.8rem 1.1rem; border-bottom: 0; border-right: 2px solid rgba(255, 255, 255, .1); background: rgba(7, 11, 38, .85);
  }
  .topbar__back { display: none; }
  .brand { padding-left: .3rem; font-size: 16px; }
  .topnav { flex-direction: column; margin: 0; gap: .45rem; }
  .topnav__link { padding: .85rem 1.1rem; font-size: 1.02rem; }
  .topbar__user { margin: auto 0 0; padding: .55rem; border-radius: 18px; }
  .topbar__name { flex: 1; }
  .main { padding: 2.2rem 2.5rem 3rem; max-width: 1180px; }
  .totals--4 .stat { padding: 1.3rem 1rem; }
}

/* ---------- 16. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .shooting-star { display: none; }
}

/* ---------- 17. PIN ISSUED ---------- */
.field .btn { justify-self: start; }
.issued__digits { display: flex; justify-content: center; gap: .5rem; }
.issued__digit {
  width: clamp(42px, 12vw, 54px); aspect-ratio: 3 / 4; display: grid; place-items: center; border-radius: 14px;
  background: var(--yellow); border: var(--stroke) solid var(--line); box-shadow: var(--pop-sm);
  font: 700 2rem var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums;
  animation: flipIn .75s var(--spring) both; animation-delay: calc(var(--i, 0) * 90ms + .15s);
}
.issued__note { display: flex; gap: .5rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--r-sm); background: var(--yellow-2); border: 2px solid var(--line); color: var(--ink); font-size: .86rem; font-weight: 700; }
.btn.is-copied { background: var(--mint); }
@keyframes flipIn { from { opacity: 0; transform: perspective(300px) rotateX(-90deg) scale(.8); } to { opacity: 1; transform: none; } }

/* ---------- Phone polish ---------- */
button, .chip, .pin__key, .member, a { touch-action: manipulation; }
body:has(dialog[open]) { overflow: hidden; }
.sheet__body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
