:root {
  --brand: #007291;
  --brand-dark: #006682;
  --lime: #b0cb1d;
  --lime-dark: #9bb51a;
  --ice: #0ea5e9;
  --sun: #d97706; --sun-soft: #fef3c7; /* Morning Learner */
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #ecfeff;
  --ok-bg: #f0fdf4; --ok-line: #bbf7d0; --ok-text: #15803d;
  --bad-bg: #fef2f2; --bad-line: #fecaca; --bad-text: #b91c1c;
  --warn-bg: #fffbeb; --warn-line: #fde68a; --warn-text: #92400e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1114; --card: #131c21; --text: #e5e7eb; --muted: #9ca3af; --line: #26323a;
    --soft: #0b2a33;
    --sun: #fbbf24; --sun-soft: #3a2a0a;
    --ok-bg: #0c2416; --ok-line: #14532d; --ok-text: #86efac;
    --bad-bg: #2a1212; --bad-line: #7f1d1d; --bad-text: #fca5a5;
    --warn-bg: #2a2109; --warn-line: #713f12; --warn-text: #fcd34d;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Roboto', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 76px;
}
.hidden { display: none !important; }
h1, h2, h3, .brand, .big-num { font-family: 'Quicksand', 'Roboto', sans-serif; }
a { color: var(--brand); }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--brand); text-decoration: none; white-space: nowrap; }
.tabs { display: none; gap: 4px; margin-left: 8px; }
.tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 500; }
.tabs a.active { background: var(--soft); color: var(--brand); }
.who-chip {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer;
  max-width: 55vw; overflow: hidden; white-space: nowrap;
}
.who-chip .nm { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.bottom-tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: .75rem; text-decoration: none; color: var(--muted); font-weight: 500;
}
.bottom-tabs a.active { color: var(--brand); }
@media (min-width: 640px) {
  .tabs { display: flex; }
  .bottom-tabs { display: none; }
  body { padding-bottom: 32px; }
}

/* ---------- Layout ---------- */
.container { max-width: 760px; margin: 0 auto; padding: 20px 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; border: 1px solid var(--line); }
.card h2 { margin: 0 0 4px; font-size: 1.25rem; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,114,145,.18);
}
.field select:disabled { opacity: .6; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.readonly-who { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; font-size: .9rem; }
.readonly-who b { font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; border: 0; border-radius: 10px; padding: 12px 18px;
  cursor: pointer; text-decoration: none; color: #fff; background: var(--brand);
}
.btn:hover { background: var(--brand-dark); }
.btn.lime { background: var(--lime); color: #1a2400; }
.btn.lime:hover { background: var(--lime-dark); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn.link { background: none; color: var(--brand); padding: 4px 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.spinner { width: 20px; height: 20px; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--lime);
  border-radius: 50%; animation: spin .9s linear infinite; display: inline-block; vertical-align: middle; }
.center { text-align: center; }
.loading { padding: 32px; text-align: center; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { border-radius: 10px; padding: 12px 14px; font-size: .9rem; margin-bottom: 16px; border: 1px solid; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.notice.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-text); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.notice.ice { background: var(--soft); border-color: rgba(14,165,233,.35); color: var(--brand); }

/* ---------- Home ---------- */
.hero { display: flex; gap: 20px; align-items: center; }
.hero-flame { width: 120px; height: 120px; flex-shrink: 0; position: relative; }
.hero-flame img { width: 100%; height: 100%; object-fit: contain; }
.hero-flame.dim img { filter: grayscale(1); opacity: .45; }
.big-num { font-size: 3.4rem; font-weight: 700; line-height: 1; color: var(--brand); }
.big-label { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.stats { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .95rem; }
.cta-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.cta-row .btn { flex: 1 1 180px; }
@media (max-width: 420px) {
  .hero { flex-direction: column; text-align: center; }
  .stats { justify-content: center; }
}

.week-title { font-size: .75rem; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.week-row { display: flex; justify-content: space-between; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.week-day { font-size: .7rem; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.week-day.today { color: var(--brand); }
.week-icon { font-size: 1.5rem; line-height: 26px; height: 26px; }
.week-empty { width: 26px; height: 26px; border-radius: 50%; }
.week-empty.future { border: 2px dashed var(--line); }
.week-empty.missed { border: 2px solid var(--line); background: var(--bg); }
.week-off { height: 26px; line-height: 26px; color: var(--muted); font-weight: 700; opacity: .5; }

.rules { margin: 0; padding-left: 18px; color: var(--muted); font-size: .9rem; line-height: 1.6; }

/* ---------- Quiz ---------- */
.q-card .q-head { font-weight: 500; margin-bottom: 12px; line-height: 1.45; }
.opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer;
  transition: background-color .15s, border-color .15s; }
.opt:hover { background: var(--soft); }
.opt .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0; margin-top: 1px; }
.opt.selected { border-color: var(--brand); background: var(--soft); }
.opt.selected .dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px var(--card); }
.quiz-bar { position: sticky; bottom: 76px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; display: flex; align-items: center; gap: 12px; }
@media (min-width: 640px) { .quiz-bar { bottom: 16px; } }
.quiz-bar .progress { flex: 1; font-size: .9rem; color: var(--muted); }
.bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--lime); transition: width .2s; }

.review-item { padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; border: 1px solid; }
.review-item.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.review-item.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.review-item .rq { font-weight: 500; font-size: .95rem; }
.review-item .ra { font-size: .88rem; margin-top: 6px; }
.review-item.ok .ra { color: var(--ok-text); }
.review-item.bad .ra { color: var(--bad-text); }
.review-item .rc { font-size: .88rem; margin-top: 3px; color: var(--ok-text); }
.review-item .rc.hidden-key { color: var(--muted); }

/* ---------- Celebration (dark, like the original success page) ---------- */
.celebrate { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; padding: 24px 16px 40px; font-family: 'Quicksand', sans-serif; }
.celebrate .title { font-size: clamp(1.6rem, 7vw, 2.5rem); font-weight: 700; margin: 8px 0 12px; text-align: center; animation: fadeIn 1s both; }
.celebrate .gif-wrap { position: relative; width: 100%; max-width: 340px; aspect-ratio: 1/1; }
.celebrate .gif-wrap img { width: 100%; height: 100%; object-fit: contain; }
.celebrate .num { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: 700;
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
  animation: bounceIn 1s cubic-bezier(.68,-.55,.27,1.55) both; }
.celebrate .who { font-size: 1.5rem; font-weight: 600; margin-top: 14px; text-align: center; }
.celebrate .pills { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.celebrate .pills span { font-size: 1.6rem; font-weight: 700; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15);
  padding: 6px 18px; border-radius: 999px; }
.celebrate .saved { color: #7dd3fc; font-size: 1.15rem; font-weight: 600; margin-top: 14px; animation: fadeIn 1s both; }
.celebrate .week { width: 100%; max-width: 440px; margin-top: 20px; background: rgba(255,255,255,.05); border-radius: 16px; padding: 16px 14px; }
.celebrate .week .week-day { color: #9ca3af; }
.celebrate .week .week-day.today { color: #fff; }
.celebrate .week .week-empty.future { border-color: rgba(255,255,255,.25); }
.celebrate .week .week-empty.missed { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.03); }
.celebrate .actions { display: flex; gap: 10px; margin-top: 24px; width: 100%; max-width: 440px; flex-wrap: wrap; }
.celebrate .actions .btn { flex: 1 1 160px; }
@keyframes bounceIn {
  0% { transform: translateX(-50%) scale(0); opacity: 0; }
  60% { transform: translateX(-50%) scale(1.2); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; max-width: calc(100% - 32px); }

/* ---------- Home: Strava-style streak card ---------- */
.btn.sm { padding: 8px 14px; font-size: .9rem; }
.pill.sm { padding: 4px 10px; font-size: .85rem; }
.streak-card { padding: 16px 18px; }
.streak-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.streak-head h2 { font-size: 1.1rem; margin: 0; }
.streak-body { display: flex; align-items: center; gap: 14px; }
.streak-flame { display: flex; flex-direction: column; align-items: center; min-width: 62px; color: #f97316; }
.streak-flame .flame-ico { position: relative; font-size: 3rem; line-height: 1; }
.streak-flame .flame-num { position: absolute; left: 0; right: 0; bottom: .32em; text-align: center; font-family: 'Quicksand', sans-serif;
  font-weight: 700; font-size: .36em; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.streak-flame .flame-lbl { font-weight: 700; font-size: .85rem; margin-top: 2px; }
.streak-flame.dim { color: var(--muted); }
.streak-flame.dim .flame-ico { filter: grayscale(1); opacity: .5; }
.streak-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.sd { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sd-l { font-size: .8rem; color: var(--muted); }
.sd-c { width: min(38px, 9vw); aspect-ratio: 1/1; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 500; border: 1.5px solid var(--line); color: var(--text); }
.sd-c.on { background: #f97316; border-color: #f97316; color: #fff; }
.sd-c.ice { background: #e0f2fe; border-color: #7dd3fc; font-size: 1rem; }
.sd-c.miss { background: var(--bg); color: var(--muted); }
.sd-c.off { border-style: dashed; color: var(--muted); opacity: .55; }
.sd-c.today { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.streak-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.status { font-size: .88rem; flex: 1 1 200px; }
.status.ok { color: var(--ok-text); }
.status.warn { color: var(--warn-text); }
.status.ice { color: var(--brand); }
.how { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.how summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.how .rules { margin-top: 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sd-c.ice { background: #0c2a3a; border-color: #0369a1; } }

/* ---------- Home: feed ---------- */
.feed-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 2px 12px; flex-wrap: wrap; }
.feed-bar h2 { margin: 0; font-size: 1.15rem; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { font: inherit; font-size: .85rem; border: 0; background: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.seg button.active { background: var(--brand); color: #fff; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px; }
.post.mine { border-left: 4px solid var(--lime); }
.post-head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .02em; }
.post-who { min-width: 0; }
.post-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { font-size: .7rem; font-weight: 700; background: var(--lime); color: #1a2400; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.post-meta { font-size: .82rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-title { font-size: 1.25rem; margin: 14px 0 2px; line-height: 1.3; overflow-wrap: anywhere; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--brand); text-decoration: underline; }
.post-link { font-size: .82rem; color: var(--brand); text-decoration: none; }
.post-stats { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 24px; margin-top: 14px; }
.post-stats span { display: block; font-size: .78rem; color: var(--muted); }
.post-stats b { display: block; font-size: 1.05rem; margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 420px) { .post-stats { grid-template-columns: 1fr 1fr; } .post-stats > div:last-child { grid-column: 1 / -1; } }
.post-tag { display: inline-block; margin-top: 12px; font-size: .78rem; background: var(--soft); color: var(--brand); padding: 3px 10px; border-radius: 999px; }
.post-insight { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.insight-text { font-size: .93rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.insight-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.more { font: inherit; font-size: .85rem; color: var(--brand); background: none; border: 0; padding: 6px 0 0; cursor: pointer; font-weight: 500; }

/* ---------- Kudos ---------- */
.kudos { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--line); min-height: 44px; }
.kudos-who { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .88rem; color: var(--muted);
  background: none; border: 0; padding: 0; cursor: pointer; }
.kudos-who:hover { color: var(--text); }
.kudos-none { font-size: .85rem; color: var(--muted); }
.faces { display: inline-flex; }
.faces .avatar { width: 26px; height: 26px; font-size: .62rem; border: 2px solid var(--card); margin-left: -8px; }
.faces .avatar:first-child { margin-left: 0; }
.kudos-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .88rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 8px 14px; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .1s; }
.kudos-btn:hover { background: var(--soft); }
.kudos-btn:active { transform: scale(.95); }
.kudos-btn.on { background: #fff7ed; border-color: #f97316; color: #c2410c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kudos-btn.on { background: #2a1606; color: #fdba74; } }
@media (max-width: 380px) { .kudos-btn span { display: none; } }

/* ---------- Bottom sheet (kudos list) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 520px; max-height: 75vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  animation: sheetUp .2s ease-out; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { margin: 0; }
.sheet-body { overflow-y: auto; padding: 8px 18px 18px; }
.giver { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.giver:last-child { border-bottom: 0; }
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Nav icons (inline SVG line icons) ---------- */
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
.tabs .ico { width: 18px; height: 18px; }
.bottom-tabs a .ico { transition: transform .15s; }
.bottom-tabs a.active .ico { stroke-width: 2.2; transform: translateY(-1px); }
.bottom-tabs a.active { font-weight: 700; }
.bottom-tabs a { position: relative; }
.bottom-tabs a.active::before { content: ''; position: absolute; top: 4px; width: 56px; height: 32px; border-radius: 999px;
  background: var(--soft); z-index: -1; }
.bottom-tabs { isolation: isolate; }

/* ---------- Inline line icons (everything except 🔥 / 🧊) ---------- */
.ico.inline { width: 1.15em; height: 1.15em; vertical-align: -0.22em; stroke-width: 2; }
.ico.inline.sm { width: .95em; height: .95em; vertical-align: -0.12em; }
.ico.xl { width: 56px; height: 56px; stroke-width: 1.6; }
.big-ico { display: flex; justify-content: center; margin-bottom: 4px; }
.big-ico.ok { color: var(--ok-text); }
.post-meta .ico.inline { color: var(--brand); }
.kudos-btn .ico.inline { width: 1.2em; height: 1.2em; }
.kudos-btn.on .ico { fill: currentColor; fill-opacity: .18; }
.review-item.ok .rq .ico { color: var(--ok-text); }
.review-item.bad .rq .ico { color: var(--bad-text); }
.btn .ico.inline { vertical-align: -0.2em; }

/* ---------- Celebration as a TikTok-style pop-up ---------- */
body.no-scroll { overflow: hidden; }
.celebrate {
  background: rgba(0, 0, 0, .84);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  justify-content: center;
  animation: popFade .3s ease-out both;
}
.celebrate.closing { animation: popFadeOut .22s ease-in both; }
.celebrate .pop { width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center; margin: auto 0; }
.celebrate .pop-title { font-size: clamp(1.5rem, 6.5vw, 2.3rem); font-weight: 700; margin: 0 0 4px; text-align: center;
  animation: popRise .45s ease-out .15s both; }
.celebrate .pop-flame { max-width: 320px; animation: flamePop .6s cubic-bezier(.34, 1.56, .64, 1) .1s both; }
.celebrate .num { animation: bounceIn .6s cubic-bezier(.68, -.55, .27, 1.55) .45s both; font-variant-numeric: tabular-nums; }
.celebrate .num.bump { animation: numBump .45s cubic-bezier(.34, 1.56, .64, 1); }
.celebrate .pop-after { width: 100%; display: flex; flex-direction: column; align-items: center; }
.celebrate .pop-after > * { animation: popRise .45s ease-out both; }
.celebrate .pop-after > :nth-child(1) { animation-delay: 1.0s; }
.celebrate .pop-after > :nth-child(2) { animation-delay: 1.1s; }
.celebrate .pop-after > :nth-child(3) { animation-delay: 1.2s; }
.celebrate .pop-after > :nth-child(4) { animation-delay: 1.3s; }
.celebrate .pop-after > :nth-child(5) { animation-delay: 1.4s; }
.celebrate .actions .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.celebrate .actions .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.celebrate.reduced, .celebrate.reduced * { animation: none !important; }

@keyframes popFade { from { background-color: rgba(0, 0, 0, 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
                     to { background-color: rgba(0, 0, 0, .84); } }
@keyframes popFadeOut { to { opacity: 0; } }
@keyframes popRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes flamePop { 0% { opacity: 0; transform: scale(.3); } 70% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes numBump { 0% { transform: translateX(-50%) scale(1); } 45% { transform: translateX(-50%) scale(1.25); } 100% { transform: translateX(-50%) scale(1); } }

/* Flame blends into the backdrop: the GIFs have a solid black background,
   and `screen` makes black transparent while keeping the flame bright. */
.celebrate .pop-flame { position: relative; isolation: auto; }
.celebrate .pop-flame img { position: relative; z-index: 2; mix-blend-mode: screen; }
.celebrate .pop-flame .num { z-index: 3; }
.celebrate .pop-flame .glow {
  position: absolute; inset: -10%; z-index: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 186, 73, .42) 0%, rgba(255, 140, 40, .16) 38%, transparent 66%);
  animation: glowPulse 2.4s ease-in-out 1s infinite;
}
.celebrate .pop-flame .rays {
  position: absolute; inset: -38%; z-index: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, .22) 0deg 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 18%, rgba(0, 0, 0, .6) 38%, transparent 64%);
          mask: radial-gradient(circle, #000 18%, rgba(0, 0, 0, .6) 38%, transparent 64%);
  animation: raysIn .8s ease-out .2s both, raysSpin 24s linear 1s infinite;
}
.celebrate .pop-flame.flare img { animation: flare .6s ease-out; }
@keyframes flare { 0% { transform: scale(1); } 40% { transform: scale(1.1); filter: brightness(1.25); } 100% { transform: scale(1); } }
@keyframes glowPulse { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes raysIn { from { opacity: 0; transform: scale(.6) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes raysSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
/* Keep the wrapper free of transforms: an animated wrapper becomes an isolated
   group and `screen` would then blend against transparency (black stays). */
.celebrate { overflow-x: hidden; }
.celebrate .pop-flame { animation: none; }
.celebrate .pop-flame img { animation: flamePop .6s cubic-bezier(.34, 1.56, .64, 1) .1s both; }
/* `screen` can't see through the blurred backdrop, so also fade the GIF's
   rectangular edge out radially: no visible box over any background. */
.celebrate .pop-flame img {
  -webkit-mask: radial-gradient(ellipse 50% 50% at 50% 52%, #000 58%, transparent 100%);
          mask: radial-gradient(ellipse 50% 50% at 50% 52%, #000 58%, transparent 100%);
}
/* Number sits over the lower part of the flame so the flame stays visible */
.celebrate .pop-flame .num { bottom: -6%; }

/* Count-up: number appears plainly (no bounce), flame swaps tiers as it counts,
   details appear once the count finishes (.pop.done). */
.celebrate .num, .celebrate .num.bump { animation: none; }
.celebrate .pop-flame img { animation: simpleFade .25s ease-out both; }
.celebrate .pop-flame.flare img { animation: none; }
.celebrate .pop-after > * { animation: none; opacity: 0; }
.celebrate .pop.done .pop-after > * { animation: popRise .35s ease-out both; }
.celebrate .pop.done .pop-after > :nth-child(1) { animation-delay: 0s; }
.celebrate .pop.done .pop-after > :nth-child(2) { animation-delay: .05s; }
.celebrate .pop.done .pop-after > :nth-child(3) { animation-delay: .1s; }
.celebrate .pop.done .pop-after > :nth-child(4) { animation-delay: .15s; }
.celebrate .pop.done .pop-after > :nth-child(5) { animation-delay: .2s; }
.celebrate.reduced .pop-after > * { opacity: 1; }
@keyframes simpleFade { from { opacity: 0; } to { opacity: 1; } }
/* No rays or extra glow on any tier: just the flame */
.celebrate .pop-flame .rays, .celebrate .pop-flame .glow { display: none; }
/* Glow flames (orange 1–4, fire 5–9, blue 60+): real alpha with the glow baked
   into the file, so no blend or edge mask (and no CSS filter: inside the blurred
   backdrop Chrome draws a dark box behind it). Each file has 20% glow room on
   every side, so it's drawn at 140% to keep the flame itself the same size. */
.celebrate .pop-flame.theme-glow img {
  mix-blend-mode: normal; -webkit-mask: none; mask: none;
  position: absolute; left: -20%; top: -20%; width: 140%; height: 140%; max-width: none;
}
/* Slash effect (100+): not a flame, so it's drawn bigger (strokes span ~1.6× the
   box) behind the score text, and the number moves up into its middle. */
/* Number: white, no black outline, glowing in its flame's colour (--glow is set
   per tier from app.js). The tight layers keep it readable over bright cores. */
.celebrate .pop-flame .num {
  color: #fff;
  text-shadow: 0 0 2px var(--glow), 0 0 6px var(--glow), 0 0 14px var(--glow), 0 0 28px var(--glow);
  transition: bottom .3s ease, text-shadow .3s ease;
}
.celebrate .pop-flame.theme-slash img,
.celebrate .pop-flame.theme-lightning img {
  mix-blend-mode: normal; -webkit-mask: none; mask: none;
  position: absolute; left: -53%; top: -49%; width: 205%; height: 205%; max-width: none;
  z-index: -1;
}
.celebrate .pop-flame.theme-slash .num,
.celebrate .pop-flame.theme-lightning .num,
.celebrate .pop-flame.theme-final .num { bottom: 23%; }
/* 200+: the flame slot is empty (1×1 placeholder); the flower ball and gold backdrop
   take over. */
.celebrate .pop-flame.theme-final > img:first-child { display: none; }
/* Flowers (200+, from the moment the count reaches 200): the yellow flower ball, as big as the 100+
   slash (ball ≈ 1.6× the box), its core centred on the number (top is set from the
   number's position in app.js). File is 630×480 (pre-upscaled sharp); the ball is
   ~79% of its width and its glowing heart sits 52.9% down (measured). */
.celebrate .pop-flame img.flower {
  position: absolute; left: 50%; top: 67%; width: 204%; height: auto; max-width: none;
  transform: translate(-50%, -52.9%); z-index: -1; pointer-events: none;
  mix-blend-mode: normal; -webkit-mask: none; mask: none; animation: none;
  opacity: 0; transition: opacity .6s ease;
}
.celebrate.flowers .pop-flame img.flower { opacity: 1; }
/* Fire-demon video (200+): fills the whole popup behind everything, a little
   see-through. At its explosion the flowers take over and it fades out. */
.celebrate .final-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s ease;
}
.celebrate.bg-final .final-bg { opacity: .85; }
.celebrate.bg-final.flowers .final-bg { opacity: 0; transition: opacity .7s ease; }
/* With the flowers, a bright gold backdrop fades in: glowing gold behind the number
   plus golden rays slowly turning around it. */
.celebrate.flowers::before {
  background: radial-gradient(ellipse 90% 75% at 50% 37%, #fff0a8 0%, #ffd23f 22%, #f5a91b 48%, #b86a0a 75%, #5c3104 100%);
  opacity: .9; transition: opacity .8s ease;
}
/* Rays: a big square spun around the number's height; the wrapper clips it so it
   never adds scrollbars. */
.celebrate .gold-bg {
  position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none;
  opacity: 0; transition: opacity .8s ease;
}
.celebrate.flowers .gold-bg { opacity: 1; }
.celebrate .gold-rays {
  position: absolute; left: 50%; top: var(--gold-y, 37%); width: 260vmax; height: 260vmax;
  margin: -130vmax 0 0 -130vmax;
  /* golden rays wider than the gaps between them */
  background: repeating-conic-gradient(rgba(255, 218, 95, .5) 0deg 11deg, transparent 11deg 18deg);
  -webkit-mask: radial-gradient(circle, transparent 3%, #000 12%, rgba(0, 0, 0, .55) 30%, transparent 48%);
          mask: radial-gradient(circle, transparent 3%, #000 12%, rgba(0, 0, 0, .55) 30%, transparent 48%);
  animation: goldSpin 30s linear infinite;
}
@keyframes goldSpin { to { transform: rotate(360deg); } }
/* Big golden glow over the rays, centred behind the number, softly pulsing */
.celebrate .gold-bg::after {
  content: ''; position: absolute; left: 50%; top: var(--gold-y, 37%); width: 150vmax; height: 150vmax;
  margin: -75vmax 0 0 -75vmax; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 190, .95) 0%, rgba(255, 214, 70, .75) 12%, rgba(255, 180, 30, .38) 26%, rgba(255, 160, 20, .12) 40%, transparent 52%);
  animation: goldGlow 3s ease-in-out infinite;
}
@keyframes goldGlow { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
/* Keep the white score text readable on bright gold */
.celebrate.flowers .who,
.celebrate.flowers .pills span { text-shadow: 0 1px 6px rgba(70, 35, 0, .65); }
/* Lightning drawn 1.3× bigger than the slashes, growing around the impact point
   (canvas 281,345 → box 50%,77%) so the strike still lands on the number. */
.celebrate .pop-flame.theme-lightning img { left: -84%; top: -87%; width: 266.5%; height: 266.5%; }
/* Lightning (150+): the backdrop fades to a deep navy-purple storm glow like the
   original GIF. An overlay is used because popFade holds the background colour. */
.celebrate::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 80% 65% at 50% 38%, #4a1696 0%, #250a5c 40%, #0b0326 78%, #05010f 100%);
  opacity: 0; transition: opacity .6s ease;
}
.celebrate.bg-lightning::before { opacity: .8; } /* the blurred page still shows through a little */

/* ---------- Freeze: pick missed days to fill ---------- */
.btn.ice { background: var(--ice); color: #fff; }
.btn.ice:hover { background: #0284c7; }
.foot-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.fz h2 { margin-bottom: 4px; }
.fz-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.fz-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; justify-items: center; }
.fz-h { font-size: .75rem; color: var(--muted); font-weight: 600; }
.fz-c { position: relative; width: min(42px, 11vw); aspect-ratio: 1/1; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font: inherit; font-size: .85rem; font-weight: 500; line-height: 1;
  border: 1.5px solid var(--line); background: none; color: var(--text); padding: 0; }
.fz-c small { position: absolute; top: -.9em; font-size: .6rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.fz-c.on { background: #f97316; border-color: #f97316; color: #fff; }
.fz-c.ice { background: #e0f2fe; border-color: #7dd3fc; }
.fz-c.off { border-style: dashed; color: var(--muted); opacity: .5; }
.fz-c.out { border-color: transparent; color: transparent; }
.fz-c.fut { color: var(--muted); }
.fz-c.miss { background: var(--bg); color: var(--muted); }
.fz-c.na { opacity: .5; }
.fz-c.today { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.fz-c.locked { border: 2px dashed var(--ice); color: var(--ice); font-weight: 700; opacity: .7; } /* missed, no freeze: view only */
button.fz-c.pick { cursor: pointer; border: 2px dashed var(--ice); color: var(--ice); font-weight: 700;
  transition: transform .12s, background .12s; }
button.fz-c.pick:hover { transform: scale(1.08); background: rgba(14,165,233,.1); }
button.fz-c.pick.sel { background: #e0f2fe; border: 2px solid var(--ice); font-size: 1rem; animation: fzPop .25s; }
@keyframes fzPop { 50% { transform: scale(1.18); } }
.fz-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin: 16px 0 14px; font-size: .78rem; color: var(--muted); }
.fz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fz-legend .fz-c { width: 16px; font-size: .55rem; border-width: 1.5px; }
.fz-legend .fz-c.pick { border-style: dashed; border-color: var(--ice); }
.fz-preview { min-height: 1.4em; text-align: center; font-size: .92rem; color: var(--muted); margin-bottom: 14px; }
.fz-preview.good { color: #ea580c; font-weight: 600; }
.fz-preview.good b { font-size: 1.15em; }
.fz-preview.meh { color: var(--warn-text); }
.fz .row { justify-content: flex-end; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fz-c.ice,
  :root:not([data-theme="light"]) button.fz-c.pick.sel { background: #0c2a3a; border-color: #0369a1; }
}

/* ---------- Freeze icon: bold snowflake, ice-blue gradient ---------- */
.ico.inline.snow { width: 1.4em; height: 1.4em; vertical-align: -0.32em; }
.btn .ico.inline.snow { vertical-align: -0.34em; }
.btn.ice .ico.snow { --snow: #fff; }                 /* white on the blue button */
.celebrate .ico.snow { --snow: url(#g-snow-light); } /* lighter on the dark pop-up */
.week-icon .ico.snow { width: 26px; height: 26px; vertical-align: top; }
.sd-c.ice .ico.snow, .fz-c.ice .ico.snow, button.fz-c.pick.sel .ico.snow { width: 70%; height: 70%; vertical-align: 0; }
.fz-legend .fz-c.ice .ico.snow { width: 90%; height: 90%; }

/* ---------- Freeze menu: tap the pill beside "Your streak" ---------- */
.fz-menu { position: relative; }
.fz-menu > summary { list-style: none; cursor: pointer; user-select: none; transition: border-color .15s, box-shadow .15s; }
.fz-menu > summary::-webkit-details-marker { display: none; }
.fz-menu > summary:hover, .fz-menu[open] > summary { border-color: var(--ice); }
.fz-menu > summary.can { border-color: var(--ice); box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
.fz-menu .caret { width: 6px; height: 6px; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); opacity: .6; transition: transform .15s; }
.fz-menu[open] .caret { transform: rotate(-135deg) translateY(-1px); }
.fz-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; display: flex; flex-direction: column; gap: 8px;
  min-width: 190px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15); animation: fzMenuIn .14s ease-out; }
.fz-pop .btn { justify-content: center; width: 100%; }
.fz-pop-note { margin: 2px 2px 0; font-size: .78rem; color: var(--muted); text-align: center; }
@keyframes fzMenuIn { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Morning Learner (03:00–09:00 badges; 15 → 1 freeze) ---------- */
.ico.sun, .sun { color: var(--sun); }
.ml-card { padding: 16px 18px; }
.ml-head { display: flex; align-items: center; gap: 12px; }
.ml-badge { width: 44px; height: 44px; border-radius: 12px; background: var(--sun-soft); color: var(--sun);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ml-badge .ico { width: 30px; height: 30px; stroke-width: 1.9; }
.ml-title { flex: 1; min-width: 0; }
.ml-title h2 { font-size: 1.1rem; margin: 0; }
.ml-title .sub { margin: 2px 0 0; font-size: .85rem; }
.ml-count { font-family: 'Quicksand', sans-serif; font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--sun); text-align: right; }
.ml-count small { display: block; font-family: 'Roboto', sans-serif; font-size: .72rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.ml-track { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; margin: 14px 0 6px; }
.ml-track span { height: 8px; border-radius: 4px; background: var(--line); }
.ml-track span.on { background: var(--sun); }
.ml-next { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.ml-next b { color: var(--text); }
.ml-card .status { display: block; margin-top: 10px; }
.status.sun { color: var(--sun); font-weight: 500; }
.status.muted { color: var(--muted); }
.celebrate .morning { color: #fcd34d; font-size: 1.1rem; font-weight: 600; margin-top: 12px; max-width: 100%; padding: 0 12px; text-align: center; animation: fadeIn 1s both; }
.celebrate .morning .ico, .celebrate .pills .ico.sun { color: #fcd34d; width: 1.4em; height: 1.4em; vertical-align: -0.32em; }

/* Top streaks leaderboard (Home) */
.lb-card { padding: 16px 18px; }
.lb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lb-head .ico { width: 22px; height: 22px; color: var(--sun); }
.lb-head h2 { margin: 0; font-size: 1.1rem; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid var(--line); }
.lb-row:first-child { border-top: 0; }
.lb-row.mine { background: var(--soft); border-radius: 10px; }
.lb-row .avatar { width: 36px; height: 36px; font-size: .8rem; }
.lb-rank { width: 26px; text-align: center; font-weight: 700; color: var(--muted); flex-shrink: 0; font-size: .95rem; }
.lb-who { flex: 1; min-width: 0; }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-title { font-size: .82rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-title a { color: inherit; text-decoration: none; }
.lb-title a:hover { color: var(--brand); text-decoration: underline; }
.lb-title .ico.inline { color: var(--brand); }
.lb-streak { flex-shrink: 0; font-family: 'Quicksand', sans-serif; font-size: 1.05rem; white-space: nowrap; }
.lb-streak b { margin-left: 2px; }
