/* ===================== ZYVA · cute design system =====================
   White + pastel, rounded Fredoka letters, sticker-style shadows.
   Performance: no backdrop blur anywhere (it is very slow on phones over an
   animating canvas); everything that moves only uses transform + opacity. */
:root {
  --cream: #fffaf6;
  --white: #ffffff;
  --ink: #2d2350;
  --ink2: #6b6388;
  --ink3: #a39bbd;
  --line: #efe6f6;
  --purple: #7c5cff;
  --pink: #ff6fae;
  --orange: #ffa94d;
  --teal: #2ec4c9;
  --yellow: #ffc94d;
  --accent: #7c5cff;
  --accent2: #2a1d5c;
  --round: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, sans-serif;
  --arabic: 'Amiri', 'Noto Naskh Arabic', 'Geeza Pro', serif;
  --sticker: 0 4px 0 rgba(45, 35, 80, 0.13), 0 10px 26px rgba(45, 35, 80, 0.13);
  --sticker-sm: 0 3px 0 rgba(45, 35, 80, 0.12), 0 6px 14px rgba(45, 35, 80, 0.12);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--cream); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { display: grid; place-items: center; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
svg { width: 1.2em; height: 1.2em; flex: none; }

/* desktop surroundings: soft pastel blobs (static, no filters) */
.backdrop {
  position: fixed; inset: 0;
  background:
    radial-gradient(40% 50% at 15% 20%, #ffe1ef 0%, transparent 70%),
    radial-gradient(40% 50% at 85% 80%, #e3e6ff 0%, transparent 70%),
    radial-gradient(30% 40% at 80% 15%, #fff1d6 0%, transparent 70%),
    var(--cream);
}

/* ---------- the 9:16 stage ---------- */
.stage {
  position: relative;
  width: 100vw; height: 100vh; height: 100dvh;
  overflow: hidden;
  container-type: size;
  --u: min(1cqh, 1.7778cqw);
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: #0d0a1c;
  cursor: pointer;
}
@media (min-aspect-ratio: 3/5) {
  .stage {
    width: auto; height: min(94dvh, 1920px); aspect-ratio: 9 / 16;
    border-radius: 36px;
    box-shadow: 0 0 0 8px #fff, 0 10px 0 8px rgba(45,35,80,.08), 0 40px 90px rgba(80, 60, 140, 0.28);
  }
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(10,6,30,0.55), rgba(10,6,30,0.3) 14%, rgba(10,6,30,0) 27%, rgba(10,6,30,0) 74%, rgba(10,6,30,0.45));
}
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(55% 28% at 50% 84%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%); }
.flash.pulse { animation: flash 0.8s var(--ease); }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* ---------- top bar ---------- */
.topbar {
  position: absolute; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(calc(var(--u) * 1.8), env(safe-area-inset-top)) calc(var(--u) * 2.2) 0;
  cursor: default;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  position: relative; display: inline-flex; align-items: baseline; gap: 0.01em;
  padding: 0.14em 0.45em 0.22em; border-radius: 0.6em; background: var(--white);
  font-family: var(--round); font-weight: 600; font-size: max(22px, calc(var(--u) * 3.1)); line-height: 1; letter-spacing: -0.02em;
  box-shadow: var(--sticker-sm);
}
.logo .l { display: inline-block; text-shadow: 0 2px 0 rgba(60, 30, 120, 0.12); }
.logo .z { color: var(--purple); transform: rotate(-6deg); }
.logo .y { color: var(--pink); transform: rotate(4deg) translateY(-0.04em); }
.logo .v { color: var(--orange); transform: rotate(-3deg); }
.logo .a { color: var(--teal); transform: rotate(5deg) translateY(-0.02em); }
.logo.pulse .l { animation: lgHop 0.55s var(--spring); }
.logo.pulse .y { animation-delay: .05s; } .logo.pulse .v { animation-delay: .1s; } .logo.pulse .a { animation-delay: .15s; }
@keyframes lgHop { 40% { translate: 0 -0.18em; scale: 1.12; } }
.logo .spark { position: absolute; width: 0.42em; height: 0.42em; animation: twinkle 2.6s ease-in-out infinite; }
.logo .s1 { left: -0.14em; top: -0.18em; fill: var(--yellow); }
.logo .s2 { right: -0.1em; bottom: -0.1em; width: 0.3em; height: 0.3em; fill: var(--pink); animation-delay: 1.3s; }
@keyframes twinkle { 50% { scale: 0.55; rotate: 45deg; } }
.streak {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--round); font-weight: 600; font-size: max(13px, calc(var(--u) * 1.5));
  padding: 5px 11px 5px 8px; border-radius: 999px; color: #ff7a3d; background: var(--white); box-shadow: var(--sticker-sm);
}
.streak svg { width: 1.1em; height: 1.1em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.board-btn {
  display: inline-flex; align-items: center; gap: 6px; height: max(42px, calc(var(--u) * 4.8)); padding: 0 14px 0 11px;
  border: 0; border-radius: 999px; background: var(--yellow); color: var(--ink); box-shadow: var(--sticker-sm);
  font-family: var(--round); font-weight: 600; font-size: max(13.5px, calc(var(--u) * 1.5)); transition: transform 0.25s var(--spring);
}
.board-btn svg { width: 1.25em; height: 1.25em; }
.board-btn:active { transform: scale(0.9) rotate(-3deg); }
.board-btn svg { animation: trophy 4s ease-in-out infinite; }
@keyframes trophy { 0%, 85%, 100% { rotate: 0deg; } 89% { rotate: -14deg; } 93% { rotate: 10deg; } 97% { rotate: -4deg; } }
.icon-btn {
  display: grid; place-items: center;
  width: max(42px, calc(var(--u) * 4.8)); aspect-ratio: 1; border-radius: 50%; border: 0;
  background: var(--white); color: var(--ink); box-shadow: var(--sticker-sm);
  transition: transform 0.25s var(--spring), background 0.3s, color 0.3s;
}
.icon-btn:active { transform: scale(0.88); }
.icon-btn.small { width: 38px; }
.icon-btn .i-on { display: none; }
.icon-btn[aria-pressed="true"] { background: var(--purple); color: #fff; }
.icon-btn[aria-pressed="true"] .i-on { display: block; }
.icon-btn[aria-pressed="true"] .i-off { display: none; }

/* ---------- counting HUD ---------- */
.hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; transition: opacity 0.5s var(--ease); }
.stage.is-setup .hud, .stage.is-done .hud .bottom, .stage.is-done .counter { opacity: 0; }
.phrase { text-align: center; padding: 10.5cqh 6% 0; display: flex; flex-direction: column; align-items: center; }
.ar {
  font-family: var(--arabic); font-weight: 700; margin: 0;
  font-size: calc(var(--u) * 5.4); line-height: 1.5; color: #fff;
  text-shadow: 0 3px 0 rgba(20, 10, 50, 0.35), 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: floaty 5s ease-in-out infinite;
}
.ar.mid { font-size: calc(var(--u) * 4.1); }
.ar.long { font-size: calc(var(--u) * 3.1); line-height: 1.7; }
.ar.pulse { animation: arPop 0.6s var(--spring), floaty 5s 0.6s ease-in-out infinite; }
@keyframes arPop { 0% { transform: scale(1); } 35% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes floaty { 50% { transform: translateY(-4px); } }
.phrase-card {
  margin-top: 0.7em; padding: 0.5em 1.1em 0.55em; border-radius: 18px;
  background: rgba(255, 255, 255, 0.92); box-shadow: var(--sticker-sm); max-width: 92%;
}
.tr { margin: 0; font-family: var(--round); font-weight: 600; font-size: max(14px, calc(var(--u) * 1.75)); color: var(--ink); }
.en { margin: 0.15em 0 0; font-weight: 600; font-size: max(12.5px, calc(var(--u) * 1.4)); color: var(--ink2); }
.hint { font-family: var(--round); font-weight: 500; font-size: max(12px, calc(var(--u) * 1.3)); color: rgba(255,255,255,.8); margin: 0.9em 0 0; transition: opacity 0.8s; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.hint.gone { opacity: 0; }

.counter { position: absolute; left: 0; right: 0; top: 86cqh; z-index: 2; display: flex; justify-content: center; pointer-events: none; transition: top 0.5s var(--ease); }
.stage.no-tasbih .counter { top: 79cqh; }
.bubble {
  position: relative; display: inline-flex; align-items: baseline; gap: 0.3em;
  padding: 0.18em 0.75em 0.42em; border-radius: 999px; background: var(--white); box-shadow: var(--sticker);
}
.bubble .num { display: inline-block; font-family: var(--round); font-weight: 700; font-size: calc(var(--u) * 5); line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.bubble .of { font-family: var(--round); font-weight: 600; font-size: max(13px, calc(var(--u) * 1.6)); color: var(--ink3); }
.bubble .mini { position: absolute; left: 22%; right: 22%; bottom: 0.32em; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bubble .mini i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--purple), var(--pink), var(--orange)); transition: width 0.6s var(--spring); }
.bubble.pop { animation: bubblePop 0.5s var(--spring); }
@keyframes bubblePop { 30% { transform: scale(1.12) rotate(-2deg); } 60% { transform: scale(0.97) rotate(1deg); } }

.bottom { text-align: center; padding: 0 4% max(calc(var(--u) * 2.2), env(safe-area-inset-bottom)); }
.controls { display: flex; gap: 8px; justify-content: center; pointer-events: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: max(42px, calc(var(--u) * 4.6)); padding: 0 max(15px, calc(var(--u) * 1.8)); min-width: max(42px, calc(var(--u) * 4.6)); justify-content: center;
  border-radius: 999px; border: 0; background: var(--white); color: var(--ink); box-shadow: var(--sticker-sm);
  font-family: var(--round); font-weight: 600; font-size: max(13px, calc(var(--u) * 1.45));
  transition: transform 0.25s var(--spring);
}
.chip svg { color: var(--accent); }
.chip:active { transform: scale(0.9) translateY(2px); box-shadow: 0 1px 0 rgba(45,35,80,.13); }

.type-form { pointer-events: auto; display: flex; gap: 8px; align-items: center; margin: 0 auto 12px; max-width: 460px; animation: rise .4s var(--spring); }
.type-form input {
  flex: 1; min-width: 0; height: 46px; padding: 0 18px; border-radius: 999px; border: 3px solid var(--white);
  background: var(--white); outline: none; font-family: var(--round); font-weight: 500; font-size: 16px; text-align: center; color: var(--ink);
  box-shadow: var(--sticker-sm); user-select: text; -webkit-user-select: text;
}
.type-form input:focus { border-color: color-mix(in srgb, var(--accent) 60%, white); }
.type-form.ok input { border-color: #6fdc9c; }
.type-form.no { animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-7px) rotate(-1deg); } 75% { transform: translateX(7px) rotate(1deg); } }

/* ---------- tap effects (DOM, transform/opacity only) ---------- */
.fx { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.fx .p { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; animation: burst 0.75s var(--ease) forwards; }
.fx .p.star { clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.fx .p.heart { clip-path: path('M7 13 C-4 6 1 -2 7 3 C13 -2 18 6 7 13 Z'); }
.fx .p.dot { border-radius: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; }
@keyframes burst { 0% { transform: translate(0, 0) scale(0.3) rotate(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--r)); opacity: 0; } }
.fx .ring { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 3px solid #fff; animation: ring 0.6s var(--ease) forwards; }
@keyframes ring { from { transform: scale(0.15); opacity: 0.9; } to { transform: scale(1); opacity: 0; } }
.fx .plus {
  position: absolute; margin: -20px 0 0 -24px; font-family: var(--round); font-weight: 700; font-size: 26px; color: var(--accent);
  padding: 2px 10px 4px; border-radius: 999px; background: #fff; box-shadow: var(--sticker-sm);
  animation: plus 0.9s var(--spring) forwards;
}
@keyframes plus { 0% { transform: translateY(0) scale(0.4); opacity: 0; } 25% { transform: translateY(-34px) scale(1.1); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-90px) scale(0.9); opacity: 0; } }

/* every 10: a sticker pops in the middle */
.milestone { position: absolute; z-index: 5; left: 50%; top: 44%; pointer-events: none; opacity: 0; }
.milestone.show { animation: mile 1.5s var(--spring) forwards; }
.milestone b {
  display: block; translate: -50% -50%; padding: 0.25em 0.7em 0.35em; border-radius: 0.7em; white-space: nowrap;
  font-family: var(--round); font-weight: 700; font-size: calc(var(--u) * 6); color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink) 60%, var(--orange)); box-shadow: var(--sticker), 0 0 0 6px #fff;
  rotate: -4deg;
}
.milestone small { display: block; font-size: 0.32em; font-weight: 600; opacity: 0.95; text-align: center; }
@keyframes mile { 0% { opacity: 0; transform: scale(0.2) rotate(-20deg); } 20% { opacity: 1; transform: scale(1.1) rotate(4deg); } 32% { transform: scale(1) rotate(0); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.8) translateY(-30px); } }

/* ---------- sheets (opaque cream, so the scene can pause behind them) ---------- */
.sheet {
  position: absolute; inset: 0; z-index: 10; cursor: default;
  display: flex; flex-direction: column;
  background:
    radial-gradient(60% 30% at 0% 0%, #ffe3f0 0%, transparent 70%),
    radial-gradient(60% 30% at 100% 100%, #e5e8ff 0%, transparent 70%),
    radial-gradient(40% 20% at 100% 20%, #fff1d4 0%, transparent 70%),
    var(--cream);
  color: var(--ink);
  animation: sheetIn 0.5s var(--spring);
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(40px) scale(0.98); } }
.sheet-scroll { flex: 1; overflow-y: auto; padding: calc(var(--u) * 9.5) 5.5% calc(var(--u) * 2); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sheet-scroll::-webkit-scrollbar { display: none; }
.sheet-scroll > * { animation: rise 0.55s var(--spring) both; }
.sheet-scroll > *:nth-child(2) { animation-delay: .04s } .sheet-scroll > *:nth-child(3) { animation-delay: .08s }
.sheet-scroll > *:nth-child(4) { animation-delay: .12s } .sheet-scroll > *:nth-child(5) { animation-delay: .16s }
.sheet-scroll > *:nth-child(6) { animation-delay: .2s } .sheet-scroll > *:nth-child(7) { animation-delay: .24s }
.sheet-scroll > *:nth-child(n+8) { animation-delay: .28s }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head.end { justify-content: flex-end; }
.sheet-scroll.center { text-align: center; }
.sheet h1 { font-family: var(--round); font-weight: 700; font-size: max(30px, calc(var(--u) * 4.4)); margin: 0; line-height: 1.1; color: var(--ink); }
.sheet h1 .hl { color: var(--pink); position: relative; display: inline-block; rotate: -3deg; }
.sheet h1 .hl::after { content: ''; position: absolute; left: -4%; right: -4%; bottom: 0.02em; height: 0.28em; border-radius: 0.2em; background: #ffe066; z-index: -1; rotate: 2deg; }
.lede { color: var(--ink2); font-weight: 600; font-size: max(14px, calc(var(--u) * 1.6)); line-height: 1.5; margin: 0.5em 0 1.2em; }
.sheet h2 {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--round); font-size: max(15px, calc(var(--u) * 1.8)); font-weight: 600; color: var(--ink);
  margin: calc(var(--u) * 3) 0 calc(var(--u) * 1.3);
}
.sheet h2 span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; color: #fff; font-size: 14px; rotate: -6deg; box-shadow: var(--sticker-sm); }
.sheet h2:nth-of-type(1) span { background: var(--purple); } .sheet h2:nth-of-type(2) span { background: var(--pink); } .sheet h2:nth-of-type(3) span { background: var(--orange); }
.sheet .icon-btn { box-shadow: var(--sticker-sm); }

.goals { display: flex; flex-wrap: wrap; gap: 10px; }
.goal {
  min-width: 74px; height: 58px; padding: 0 18px; border-radius: 20px; border: 0;
  background: var(--white); box-shadow: var(--sticker-sm); color: var(--ink);
  font-family: var(--round); font-size: 24px; font-weight: 700;
  transition: transform 0.3s var(--spring), background 0.3s, color 0.3s;
}
.goal:active { transform: scale(0.9); }
.goal-custom { flex: 1; min-width: 120px; height: 58px; border-radius: 20px; border: 0; background: var(--white); box-shadow: var(--sticker-sm); text-align: center; font-family: var(--round); font-weight: 600; font-size: 17px; outline: none; color: var(--ink); user-select: text; -webkit-user-select: text; }
.goal-custom::placeholder { color: var(--ink3); }
.goal.on { background: var(--purple); color: #fff; transform: rotate(-4deg) scale(1.06); }
.goal-custom.on { box-shadow: 0 0 0 3px var(--purple), var(--sticker-sm); }

.recs { display: grid; gap: 10px; }
.rec {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: left;
  padding: 12px 16px; border-radius: 20px; border: 0; background: var(--white); box-shadow: var(--sticker-sm); color: var(--ink);
  transition: transform 0.3s var(--spring), background 0.3s;
}
.rec:active { transform: scale(0.97); }
.rec b { display: block; font-family: var(--round); font-weight: 600; font-size: 15.5px; }
.rec small { display: block; color: var(--ink2); font-weight: 600; font-size: 12.5px; margin-top: 2px; line-height: 1.35; }
.rec .rar { font-family: var(--arabic); font-weight: 700; font-size: 22px; line-height: 1.5; color: var(--purple); text-align: right; flex: 0 1 auto; max-width: 55%; }
.rec.on { background: linear-gradient(135deg, #fff0f7, #f1edff); box-shadow: 0 0 0 3px var(--pink), var(--sticker-sm); transform: scale(1.015); }

.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@container (min-aspect-ratio: 3/5) { .themes { grid-template-columns: repeat(3, 1fr); } }
.theme-card {
  position: relative; display: flex; flex-direction: column; padding: 6px; text-align: left; border: 0;
  border-radius: 22px; background: var(--white); box-shadow: var(--sticker-sm); color: var(--ink);
  transition: transform 0.3s var(--spring), box-shadow 0.3s;
}
.theme-card:nth-child(odd) { rotate: -1deg; } .theme-card:nth-child(even) { rotate: 1deg; }
.theme-card canvas { display: block; width: 100%; aspect-ratio: 3 / 4; border-radius: 16px; background: #1a1430; }
.theme-card .meta { padding: 8px 6px 4px; }
.theme-card .meta b { display: block; font-family: var(--round); font-weight: 600; font-size: 14.5px; }
.theme-card .meta small { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink2); margin-top: 1px; line-height: 1.3; }
.theme-card .tag { position: absolute; top: 12px; left: 12px; font-family: var(--round); font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--yellow); color: var(--ink); box-shadow: var(--sticker-sm); rotate: -5deg; }
.theme-card.on { box-shadow: 0 0 0 4px var(--purple), var(--sticker); transform: scale(1.03); rotate: 0deg; }
.theme-card:active { transform: scale(0.95); }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; margin-bottom: 10px;
  padding: 14px 16px; border-radius: 20px; border: 0; color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink)); box-shadow: var(--sticker);
}
.resume b { display: block; font-family: var(--round); font-weight: 600; font-size: 15px; }
.resume small { opacity: 0.9; font-weight: 600; font-size: 12.5px; }
.resume .go { font-family: var(--round); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.25); white-space: nowrap; }
.promo {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 14px 10px 10px; border-radius: 20px; border: 0; background: var(--white); color: var(--ink); box-shadow: var(--sticker-sm);
}
.promo img { border-radius: 14px; box-shadow: var(--sticker-sm); animation: wiggle 3s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { rotate: 0deg; } 85% { rotate: -8deg; } 90% { rotate: 6deg; } 95% { rotate: -3deg; } }
.promo span { flex: 1; } .promo b { display: block; font-family: var(--round); font-weight: 600; font-size: 15px; } .promo small { color: var(--ink2); font-weight: 600; font-size: 12px; }
.promo i { font-style: normal; color: var(--pink); font-weight: 800; }

.sheet-foot { padding: 12px 5.5% max(calc(var(--u) * 2.2), env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--cream) 60%, rgba(255,250,246,0)); }
.primary {
  width: 100%; height: max(56px, calc(var(--u) * 6.2)); border: 0; border-radius: 999px;
  font-family: var(--round); font-weight: 600; font-size: max(17px, calc(var(--u) * 2)); color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--pink) 70%, var(--orange));
  box-shadow: 0 5px 0 #5a3fd1, 0 14px 30px rgba(124, 92, 255, 0.35);
  transition: transform 0.25s var(--spring), box-shadow 0.25s;
}
.primary:active { transform: translateY(4px) scale(0.98); box-shadow: 0 1px 0 #5a3fd1, 0 6px 14px rgba(124, 92, 255, 0.3); }
.primary.small { width: auto; height: 42px; padding: 0 20px; font-size: 15px; box-shadow: 0 3px 0 #5a3fd1; }
.primary:disabled { filter: grayscale(0.6) opacity(0.6); cursor: not-allowed; }
.primary.as-btn { display: grid; place-items: center; text-decoration: none; max-width: 420px; margin: 0 auto; }
.ghost { width: 100%; height: 50px; border-radius: 999px; border: 0; background: var(--white); color: var(--ink); font-family: var(--round); font-weight: 600; font-size: 15px; box-shadow: var(--sticker-sm); transition: transform 0.25s var(--spring); }
.ghost:active { transform: scale(0.95); }

/* ---------- menu, leaderboard, app, code ---------- */
.fine { color: var(--ink2); font-size: 12.5px; font-weight: 600; line-height: 1.5; margin: 12px 0 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.tile { text-align: left; padding: 16px 14px; border-radius: 22px; border: 0; background: var(--white); color: var(--ink); box-shadow: var(--sticker-sm); min-height: 100px; transition: transform 0.25s var(--spring); }
.tile:active { transform: scale(0.94) rotate(-1deg); }
.tile b { display: block; font-family: var(--round); font-weight: 600; font-size: 16px; }
.tile small { display: block; color: var(--ink2); font-weight: 600; font-size: 12px; margin-top: 4px; line-height: 1.35; }
.tile::before { content: ''; display: block; width: 30px; height: 30px; border-radius: 10px; margin-bottom: 10px; rotate: -6deg; }
.tile:nth-child(1)::before { background: var(--purple); } .tile:nth-child(2)::before { background: var(--yellow); }
.tile:nth-child(3)::before { background: var(--teal); } .tile:nth-child(4)::before { background: var(--pink); }
.tile:nth-child(5)::before { background: var(--orange); } .tile:nth-child(6)::before { background: #9fd6ff; }
.tile.gold { background: linear-gradient(135deg, #fff0f7, #fff6e4); box-shadow: 0 0 0 3px var(--pink), var(--sticker-sm); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 5px; border-radius: 999px; background: var(--white); box-shadow: var(--sticker-sm); margin: 16px 0; }
.tab { height: 42px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font-family: var(--round); font-weight: 600; font-size: 15px; transition: background 0.3s, color 0.3s; }
.tab.on { background: var(--purple); color: #fff; }
.join { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--white); box-shadow: var(--sticker-sm); }
.join .at { color: var(--pink); font-family: var(--round); font-weight: 700; font-size: 18px; }
.join input { flex: 1; min-width: 0; height: 42px; border: 0; outline: none; background: transparent; font-weight: 600; font-size: 16px; color: var(--ink); user-select: text; -webkit-user-select: text; }
.joined { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-radius: 20px; background: var(--white); box-shadow: 0 0 0 3px var(--teal), var(--sticker-sm); font-weight: 600; font-size: 14.5px; }
.link { border: 0; background: none; color: var(--pink); font-weight: 700; text-decoration: underline; font-size: 13.5px; }
.board { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.board li { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 18px; background: var(--white); box-shadow: var(--sticker-sm); font-weight: 700; font-size: 15px; animation: rise 0.5s var(--spring) both; }
.board li:nth-child(2) { animation-delay: .05s } .board li:nth-child(3) { animation-delay: .1s } .board li:nth-child(n+4) { animation-delay: .15s }
.board .rank { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-family: var(--round); font-size: 15px; background: var(--line); color: var(--ink); }
.board li:nth-child(1) .rank { background: var(--yellow); } .board li:nth-child(2) .rank { background: #dfe4f0; } .board li:nth-child(3) .rank { background: #ffcfa8; }
.board .cnt { font-family: var(--round); font-weight: 600; color: var(--purple); font-variant-numeric: tabular-nums; }
.board li.me { box-shadow: 0 0 0 3px var(--pink), var(--sticker-sm); }
.board li.muted { display: block; color: var(--ink2); text-align: center; font-weight: 600; }
.app-icon { width: 120px; height: 120px; border-radius: 30px; margin: 0 auto 18px; display: block; box-shadow: var(--sticker); animation: bob 3.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
.perks { list-style: none; padding: 0; margin: 0 auto 20px; display: grid; gap: 10px; max-width: 340px; text-align: left; }
.perks li { padding: 10px 14px 10px 42px; position: relative; font-weight: 700; font-size: 14.5px; border-radius: 16px; background: var(--white); box-shadow: var(--sticker-sm); }
.perks li::before { content: ''; position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.perks li:nth-child(1)::before { background: var(--purple); } .perks li:nth-child(2)::before { background: var(--pink); }
.perks li:nth-child(3)::before { background: var(--orange); } .perks li:nth-child(4)::before { background: var(--teal); }
.price { display: flex; flex-direction: column; align-items: center; margin: 8px 0 14px; }
.price b { font-family: var(--round); font-weight: 700; font-size: 32px; color: var(--purple); }
.price small { color: var(--ink2); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.pay { display: grid; gap: 12px; max-width: 420px; margin: 0 auto; }
.pay input, .restore input { height: 52px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--white); box-shadow: var(--sticker-sm); outline: none; font-weight: 600; font-size: 16px; text-align: center; color: var(--ink); user-select: text; -webkit-user-select: text; }
.pay input:focus, .restore input:focus { box-shadow: 0 0 0 3px var(--purple), var(--sticker-sm); }
.notlive { margin: 12px auto 0; max-width: 420px; padding: 10px 14px; border-radius: 16px; font-size: 13px; font-weight: 700; color: #b5651d; background: #fff1dc; border: 2px dashed #ffc98a; }
.ok { color: #1f9d5a; font-family: var(--round); font-weight: 600; font-size: 17px; margin: 4px 0 16px; }
.restore { margin: 18px auto 0; max-width: 420px; text-align: center; }
.restore summary { cursor: pointer; color: var(--ink2); font-weight: 700; font-size: 13.5px; text-decoration: underline; list-style: none; }
.restore form { display: grid; gap: 10px; margin-top: 12px; }
.steps { text-align: left; max-width: 340px; margin: 0 auto; padding-left: 20px; display: grid; gap: 10px; font-weight: 600; font-size: 14.5px; }
.steps svg { vertical-align: -3px; color: var(--purple); }
#appSheet { z-index: 16; }
.keybox { max-width: 420px; margin: 16px auto 0; display: grid; gap: 8px; }

/* ---------- goal reached ---------- */
.done {
  position: absolute; inset: 0; z-index: 12; cursor: default;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 4.5% max(calc(var(--u) * 2.4), env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent 40%, rgba(20, 10, 50, 0.45));
  animation: fadeIn 0.8s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.done-card {
  width: 100%; max-width: 520px; text-align: center; color: var(--ink);
  padding: calc(var(--u) * 2.4) 20px 18px; border-radius: 32px; background: var(--white); box-shadow: var(--sticker);
  animation: cardPop 0.8s 0.1s var(--spring) both;
}
@keyframes cardPop { from { opacity: 0; transform: translateY(80px) scale(0.85) rotate(-3deg); } }
.eyebrow { margin: 0; font-family: var(--round); font-weight: 700; font-size: max(38px, calc(var(--u) * 5.6)); line-height: 1; letter-spacing: -0.01em; }
.eyebrow span { display: inline-block; animation: letter 0.7s var(--spring) both, wave 2.4s 1.2s ease-in-out infinite; }
.eyebrow span:nth-child(5n+1) { color: var(--purple); } .eyebrow span:nth-child(5n+2) { color: var(--pink); } .eyebrow span:nth-child(5n+3) { color: var(--orange); }
.eyebrow span:nth-child(5n+4) { color: var(--teal); } .eyebrow span:nth-child(5n) { color: #ffb400; }
.eyebrow span:nth-child(2) { animation-delay: .35s, 1.3s } .eyebrow span:nth-child(3) { animation-delay: .4s, 1.4s } .eyebrow span:nth-child(4) { animation-delay: .45s, 1.5s }
.eyebrow span:nth-child(5) { animation-delay: .5s, 1.6s } .eyebrow span:nth-child(6) { animation-delay: .55s, 1.7s } .eyebrow span:nth-child(7) { animation-delay: .6s, 1.8s }
.eyebrow span:nth-child(8) { animation-delay: .65s, 1.9s } .eyebrow span:nth-child(9) { animation-delay: .7s, 2s } .eyebrow span:nth-child(1) { animation-delay: .3s, 1.2s }
@keyframes letter { from { opacity: 0; transform: translateY(30px) scale(0.3) rotate(-20deg); } }
@keyframes wave { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
.done-card .ar { font-size: max(26px, calc(var(--u) * 3.4)); margin-top: 0.3em; color: var(--purple); text-shadow: none; animation: none; }
.done-card .ar.long { font-size: max(19px, calc(var(--u) * 2.3)); }
.done-count { margin: 0.1em 0 0; color: var(--ink2); font-weight: 700; font-size: 14px; }
.done-count b { color: var(--pink); font-family: var(--round); font-size: 22px; font-weight: 700; }
.meaning { font-weight: 700; font-size: max(16px, calc(var(--u) * 1.9)); margin: 0.5em 0 0; line-height: 1.35; color: var(--ink); }
.done-streak { display: inline-block; color: #ff7a3d; font-family: var(--round); font-weight: 600; font-size: 14px; margin: 0.7em 0 0; min-height: 1em; }
.done-actions { display: grid; gap: 10px; margin-top: 16px; }
.done-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- toast ---------- */
.toast {
  position: absolute; z-index: 30; left: 50%; top: calc(var(--u) * 9.5);
  transform: translate(-50%, -12px) scale(0.9); opacity: 0; pointer-events: none;
  max-width: 88%; padding: 11px 18px; border-radius: 999px; text-align: center;
  font-family: var(--round); font-weight: 500; font-size: 14px; color: var(--ink); background: var(--white); box-shadow: var(--sticker);
  transition: opacity 0.3s, transform 0.4s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
