/* ------------------------------------------------------------------
   Fragments of the LoopBreak app, redrawn for the web from the app's own
   styles (mobile/src/theme.ts and the mockup's app.css). Markup comes from
   shared/ui.js. Sizes are the app's; scale a fragment with `zoom`.
------------------------------------------------------------------- */

.ui { font-family: var(--font-display); color: var(--ink); line-height: 1.3; text-align: left; }
.ui img { -webkit-user-drag: none; user-select: none; }

/* ---------- Cards ---------- */

.ui-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px;
}
.ui-tile {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--pick);
}
.ui-tile img { width: 40px; height: 40px; }
.ui-label { color: var(--muted); font: 600 12px/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }
.ui-value { color: #fff; font: 700 22px/1.2 var(--font-display); letter-spacing: -0.02em; }

/* home-totalcard: Money saved, Time saved */
.ui-stat {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; min-height: 86px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: var(--r-card);
}
.ui-stat > div { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ui-stat-chevron { flex: none; width: 8px; opacity: 0.8; }

/* Tip of the day */
.ui-tip {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 20px;
  background: rgba(23, 41, 29, 0.1);
  border: 1px solid var(--line-green);
  border-radius: var(--r-card);
}
.ui-tip .ui-label { color: var(--green); font-weight: 800; }
.ui-tip p { color: var(--soft); font: 400 15px/1.4 var(--font-display); margin-top: 4px; }

/* Streak chip */
.ui-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px;
  background: rgba(57, 255, 110, 0.1);
  border: 1px solid rgba(57, 255, 110, 0.2);
  border-radius: 9999px;
  color: var(--green); font: 700 13px/1 var(--font-display);
}
.ui-chip img { width: 13px; height: 15px; }

/* ---------- Streak ring ---------- */

.ui-ring { position: relative; width: 190px; aspect-ratio: 1; }
.ui-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ui-ring-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 12; }
.ui-ring-arc {
  fill: none; stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 86));
  filter: drop-shadow(0 0 10px rgba(19, 236, 91, 0.45));
  transition: stroke-dashoffset 1.6s var(--ease-out);
}
html.js .ui-ring:not(.is-in) .ui-ring-arc { stroke-dashoffset: 100; }
.ui-ring-center { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding-bottom: 7%; }
.ui-ring-num {
  font: 700 60px/1 var(--font-display); letter-spacing: -0.04em;
  background: var(--grad-streak); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 0.05em 0.04em;
}
.ui-ring-label { color: var(--soft); font: 400 15px/1.2 var(--font-display); letter-spacing: 0.02em; }
.ui-ring-next { color: var(--muted); font: 400 11px/1.3 var(--font-display); margin-top: 5px; }
.ui-num-swap { animation: ui-num-in 0.5s var(--ease-out) both; }
@keyframes ui-num-in { from { opacity: 0; transform: translate3d(0, 38%, 0) scale(0.88); } }
.ui-ring.is-pulse::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  border: 2px solid var(--green);
  animation: ui-ring-pulse 0.9s var(--ease-out) both;
  pointer-events: none;
}
@keyframes ui-ring-pulse { from { opacity: 0.8; transform: scale(1); } to { opacity: 0; transform: scale(1.28); } }

/* ---------- Week strip ---------- */

.ui-week { display: flex; justify-content: space-between; gap: 4px; }
.ui-day { display: grid; justify-items: center; gap: 9px; }
.ui-day b { color: #6b7280; font: 700 11px/1 var(--font-display); }
.ui-day i {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: #262626; font-style: normal;
}
.ui-day.is-done i { background: var(--green); }
.ui-day.is-done i::before {
  content: ""; width: 12px; height: 7px; margin-top: -3px;
  border-left: 2.5px solid var(--btn-text); border-bottom: 2.5px solid var(--btn-text);
  transform: rotate(-45deg);
}
.ui-day.is-today b { color: var(--green); }
.ui-day.is-today:not(.is-done) i { background: transparent; border: 2px solid var(--green); }
.ui-day.is-today:not(.is-done) i::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.ui-day.is-pop i { animation: ui-day-pop 0.6s var(--ease-pop) both; }
@keyframes ui-day-pop { 0% { transform: scale(0.45); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ---------- Streak card (ring + line + week + protectors) ---------- */

.ui-streak {
  display: grid; justify-items: center; gap: 16px;
  padding: 24px 20px 20px;
  background: rgba(16, 34, 22, 0.35);
  border: 1px solid rgba(19, 236, 91, 0.35);
  border-radius: var(--r-card);
}
.ui-streak-line { color: var(--soft); font: 400 14px/1.3 var(--font-display); display: flex; align-items: center; gap: 6px; }
.ui-streak-line img { width: 13px; height: 15px; }
.ui-streak hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 0; }
.ui-streak .ui-week { width: 100%; }
.ui-protect {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 243, 255, 0.06);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 16px;
}
.ui-protect img { width: 32px; height: 32px; }
.ui-protect b { display: block; color: #fff; font: 700 15px/1.2 var(--font-display); }
.ui-protect span { display: block; color: var(--frozen); font: 400 11.5px/1.3 var(--font-display); }

/* ---------- Daily check-in card ----------
   The app's CheckInCard (mobile/src/screens/home/Home.tsx): on check-in the card shrinks, the question
   slides up and out, "Done!" fades in, the button drops away and the seal straightens and brightens. */

.ui-checkin {
  position: relative; overflow: hidden;
  max-height: 130px; padding: 14px 22px;
  background: linear-gradient(135deg, #13EC5B 10%, #0E7A3A);
  border-radius: var(--r-card);
  box-shadow: 0 6px 25px -10px rgba(19, 236, 91, 0.4);
  color: var(--deep);
  transition: max-height 0.4s ease-in-out;
}
.ui-checkin.is-done { max-height: 100px; cursor: pointer; }
.ui-checkin-mark { position: absolute; right: 0; top: 0; bottom: 0; width: 110px; overflow: hidden; border-radius: var(--r-card); pointer-events: none; }
.ui-checkin-mark img {
  position: absolute; right: -8px; bottom: -7px; width: 110px; height: 105px; max-width: none;
  opacity: 0.1; transform: rotate(12deg) scale(1);
  transition: opacity 0.3s ease, transform 0.4s ease;
}
.ui-checkin.is-done .ui-checkin-mark img { opacity: 0.8; transform: rotate(0deg) scale(1.1); }
.ui-checkin h4 { position: relative; font: 700 23px/28px var(--font-body); letter-spacing: -0.01em; }
.ui-checkin p { position: relative; max-width: 240px; overflow: hidden; }
.ui-checkin-q {
  font: 500 14px/18px var(--font-body); max-height: 18px;
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}
.ui-checkin.is-done .ui-checkin-q { opacity: 0; max-height: 0; transform: translateY(-10px); }
.ui-checkin-done { font: 700 16px/20px var(--font-body); max-height: 0; opacity: 0; transition: opacity 0.6s ease; }
.ui-checkin.is-done .ui-checkin-done { max-height: 40px; margin-top: 2px; opacity: 1; }
.ui-checkin-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 22px; margin-top: 12px;
  background: #121A14; color: var(--green);
  border-radius: 14px; font: 500 15px/1 var(--font-body);
  transition: opacity 0.3s ease, transform 0.3s ease, filter 0.2s ease;
}
.ui-checkin-btn:active { transform: scale(0.96); }
@media (hover: hover) { .ui-checkin-btn:hover { filter: brightness(1.25); } }
.ui-checkin.is-done .ui-checkin-btn { opacity: 0; transform: translateY(10px); pointer-events: none; }
.ui-swap { animation: ui-rise 0.45s var(--ease-out) both; }
@keyframes ui-rise { from { opacity: 0; transform: translate3d(0, 8px, 0); } }

/* ---------- Phone ---------- */

.phone {
  position: relative; flex: none;
  width: 372px; padding: 10px;
  background: #0B0D0C;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 54px;
  box-shadow: 0 0 0 1px #000, 0 50px 90px -30px rgba(0, 0, 0, 0.85), 0 0 80px -20px rgba(19, 236, 91, 0.28);
}
.phone::before {
  content: ""; position: absolute; left: 50%; top: 22px; z-index: 5;
  width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: #05070A;
  box-shadow: inset 0 0 0 2px #14181c;
}
.phone-screen {
  position: relative; overflow: hidden;
  height: 760px; border-radius: 44px;
  background: linear-gradient(180deg, #0F2219 0%, #121C17 45%, #0D1310 100%);
  isolation: isolate;
}
.phone-screen::before {
  content: ""; position: absolute; left: -190px; top: -210px; z-index: -1;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(19, 236, 91, 0.11) 0%, rgba(19, 236, 91, 0) 65%);
}
.phone-status {
  display: flex; align-items: center; justify-content: space-between;
  height: 40px; padding: 6px 26px 0;
  color: var(--ink); font: 600 13px/1 var(--font-display);
}
.phone-status svg { height: 11px; width: auto; fill: currentColor; }
.phone-body { display: grid; gap: 12px; padding: 6px 18px 0; }
.phone-hello { display: flex; align-items: center; gap: 12px; }
.phone-avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(19, 236, 91, 0.5); background: #1b2a20; padding: 2px; }
.phone-avatar img { width: 100%; height: 100%; border-radius: 50%; }
.phone-hello b { display: block; font: 700 17px/1.2 var(--font-display); letter-spacing: -0.01em; }
.phone-hello span { display: block; color: var(--muted); font: 400 12.5px/1.3 var(--font-display); margin-top: 2px; }
.phone-select {
  display: flex; align-items: center; justify-content: space-between;
  height: 42px; padding: 0 16px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px;
  color: var(--green); font: 600 14px/1 var(--font-display);
}
.phone-select small { color: var(--muted); font: 400 12px/1 var(--font-display); margin-right: 8px; }
.phone-select img { width: 9px; }
.phone .ui-streak { padding: 18px 16px 14px; gap: 12px; }
.phone .ui-ring { width: 168px; }
.phone .ui-ring-num { font-size: 54px; }
.phone .ui-ring-label { font-size: 14px; }
.phone .ui-ring-next { font-size: 10px; margin-top: 4px; }
.phone-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: 62px; padding-bottom: 6px;
  background: #15201A; border-top: 1px solid rgba(19, 236, 91, 0.35);
}
.phone-bar span { display: grid; place-items: center; }
.phone-bar img { height: 19px; width: auto; }
.phone-bar::before {
  content: ""; position: absolute; top: -1px; left: calc(10% - 14px);
  width: 28px; height: 2px; border-radius: 2px; background: var(--green); box-shadow: 0 0 10px rgba(19, 236, 91, 0.9);
}
.phone-sos {
  position: absolute; right: 14px; bottom: 76px; z-index: 3;
  display: grid; place-items: center;
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(145deg, #FFC21A, #F2A100);
  box-shadow: 0 8px 22px -6px rgba(255, 179, 0, 0.6);
}
.phone-sos svg { width: 20px; height: 22px; fill: #17130a; }
.phone-sos::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(255, 179, 0, 0.7);
  animation: ui-sos-ping 2.6s var(--ease-out) infinite;
}
@keyframes ui-sos-ping { 0% { opacity: 0.9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.55); } }

/* ---------- SOS tools ---------- */

.ui-sos { display: grid; gap: 12px; }
.ui-sos-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; min-height: 92px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.35s var(--ease-out);
}
.ui-sos-card img { flex: none; width: 62px; height: 62px; }
.ui-sos-card b { display: block; font: 700 16px/1.25 var(--font-display); }
.ui-sos-card span { display: block; color: var(--muted); font: 400 14px/1.4 var(--font-display); margin-top: 3px; }
@media (hover: hover) {
  .ui-sos-card:hover { border-color: var(--line-green); background: var(--pick); transform: translateX(6px); }
}

/* ---------- Breathing exercise ---------- */

.ui-breath { display: grid; justify-items: center; gap: 22px; text-align: center; }
.ui-breath-stage { position: relative; display: grid; place-items: center; width: 240px; aspect-ratio: 1; }
.ui-breath-halo, .ui-breath-orb { position: absolute; border-radius: 50%; }
.ui-breath-halo {
  inset: 0; border: 1px solid rgba(19, 236, 91, 0.22);
  background: radial-gradient(circle, rgba(19, 236, 91, 0.1) 0%, rgba(19, 236, 91, 0) 70%);
}
.ui-breath-halo:nth-child(2) { inset: 12%; border-color: rgba(19, 236, 91, 0.3); }
.ui-breath-orb {
  inset: 22%;
  background: radial-gradient(circle at 35% 30%, #5cf59a 0%, #13EC5B 45%, #0c8f3b 100%);
  box-shadow: 0 0 60px rgba(19, 236, 91, 0.5), inset 0 -10px 30px rgba(0, 0, 0, 0.25);
  transform: scale(0.62);
}
.ui-breath-halo { transform: scale(0.72); opacity: 0.5; }
.ui-breath[data-phase="in"] .ui-breath-orb, .ui-breath[data-phase="hold"] .ui-breath-orb { transform: scale(1); }
.ui-breath[data-phase="in"] .ui-breath-halo, .ui-breath[data-phase="hold"] .ui-breath-halo { transform: scale(1); opacity: 1; }
.ui-breath[data-phase="in"] .ui-breath-orb, .ui-breath[data-phase="in"] .ui-breath-halo { transition: transform 4s cubic-bezier(0.4, 0, 0.2, 1), opacity 4s ease; }
.ui-breath[data-phase="out"] .ui-breath-orb, .ui-breath[data-phase="out"] .ui-breath-halo { transition: transform 6s cubic-bezier(0.4, 0, 0.2, 1), opacity 6s ease; }
.ui-breath[data-phase="hold"] .ui-breath-orb { animation: ui-breath-hold 2s ease-in-out infinite alternate; }
@keyframes ui-breath-hold { to { box-shadow: 0 0 84px rgba(19, 236, 91, 0.7), inset 0 -10px 30px rgba(0, 0, 0, 0.25); } }
.ui-breath-short { position: relative; z-index: 1; color: var(--btn-text); font: 800 15px/1 var(--font-display); letter-spacing: 0.16em; }
.ui-breath-copy { min-height: 58px; }
.ui-breath-copy b { display: block; font: 700 24px/1.2 var(--font-display); letter-spacing: -0.02em; }
.ui-breath-copy span { display: block; color: var(--muted); font: 400 15px/1.4 var(--font-display); margin-top: 4px; }
.ui-phase-swap { animation: ui-phase 0.55s var(--ease-out) both; }
@keyframes ui-phase { from { filter: blur(6px); opacity: 0; transform: translate3d(0, 6px, 0); } }

/* ---------- Insights ---------- */

.ui-insights { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ui-insight {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; min-height: 132px;
  background: rgba(15, 17, 21, 0.9); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: var(--r-card);
}
.ui-insight-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font: 400 13px/1.2 var(--font-display); }
.ui-insight-head img { height: 15px; width: auto; }
.ui-insight b { flex: 1; display: flex; align-items: center; color: #fff; font: 700 17px/1.25 var(--font-display); letter-spacing: -0.01em; }
.ui-pattern {
  grid-column: 1 / -1; display: grid; gap: 6px;
  padding: 16px 20px;
  background: rgba(23, 41, 29, 0.35); border: 1px solid #00E676; border-radius: var(--r-card);
  box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
}
.ui-pattern p { color: var(--ink); font: 600 15px/1.4 var(--font-display); }
.ui-pattern small { color: var(--muted); font: 400 13px/1.4 var(--font-display); }

.ui-bars {
  display: grid; gap: 14px; padding: 18px 18px 16px;
  background: rgba(23, 41, 29, 0.1); border: 1px solid rgba(51, 65, 85, 0.5); border-radius: var(--r-card);
}
.ui-bars-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ui-bars-head b { font: 700 15px/1.2 var(--font-display); }
.ui-bars-head span { color: var(--muted); font: 400 12px/1.2 var(--font-display); }
.ui-bars-plot { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 118px; }
.ui-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.ui-bar-slot { flex: 1; display: flex; align-items: flex-end; justify-content: center; width: 100%; }
.ui-bar i {
  display: block; width: min(26px, 100%); height: calc(var(--h) * 1%); min-height: 4px; border-radius: 8px;
  background: #0f9d45; transform-origin: 50% 100%;
  transition: transform 0.9s var(--ease-out); transition-delay: calc(var(--n) * 70ms);
}
.ui-bar.is-empty i { background: rgba(255, 255, 255, 0.09); border-radius: 3px; }
.ui-bar.is-top i { background: var(--green); box-shadow: 0 6px 18px -6px rgba(19, 236, 91, 0.6); }
.ui-bar span { color: var(--muted); font: 400 12px/1 var(--font-display); }
.ui-bar.is-top span { color: var(--green); font-weight: 700; }
html.js .ui-bars:not(.is-in) .ui-bar i { transform: scaleY(0.04); }

/* ---------- Community ---------- */

.ui-post { display: grid; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.ui-post-head { display: flex; align-items: center; gap: 10px; }
.ui-post-head img { width: 40px; height: 40px; border-radius: 50%; background: #20302a; }
.ui-post-head b { display: block; font: 700 15px/1.2 var(--font-display); }
.ui-post-head small { display: block; color: var(--muted); font: 400 12px/1.3 var(--font-display); }
.ui-post-tag { margin-left: auto; height: 28px; padding: 0 12px; font-size: 12px; }
.ui-post p { color: var(--ink); font: 400 15px/1.5 var(--font-display); }
.ui-post-foot { display: flex; align-items: center; gap: 18px; color: var(--soft); font: 600 13px/1 var(--font-display); }
.ui-post-foot span, .ui-like { display: inline-flex; align-items: center; gap: 7px; }
.ui-post-foot svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ui-like { color: inherit; font: inherit; transition: color 0.2s ease; }
.ui-like.is-on { color: var(--green); }
.ui-like.is-on svg { fill: currentColor; animation: ui-heart 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
@keyframes ui-heart { 0% { transform: scale(0.55); } 60% { transform: scale(1.28); } 100% { transform: scale(1); } }

.ui-leaders { display: grid; gap: 8px; }
.ui-leader {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
}
.ui-leader i { width: 22px; text-align: center; color: var(--muted); font: 700 14px/1 var(--font-display); font-style: normal; }
.ui-leader img { width: 36px; height: 36px; border-radius: 50%; background: #20302a; }
.ui-leader b { flex: 1; font: 700 15px/1.2 var(--font-display); }
.ui-leader b small { display: block; color: var(--muted); font: 400 12px/1.3 var(--font-display); }
.ui-leader span { color: var(--green); font: 700 15px/1 var(--font-display); }
.ui-leader.is-first { background: var(--pick); border-color: var(--line-green); box-shadow: 0 10px 26px -14px rgba(19, 236, 91, 0.45); }
.ui-leader.is-first i { color: var(--green); }

/* ---------- Badges ---------- */

.ui-hex { position: relative; flex: none; width: var(--hex, 72px); aspect-ratio: 8 / 9; display: grid; place-items: center; }
.ui-hex::before, .ui-hex::after {
  content: ""; position: absolute; inset: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.ui-hex::before { background: rgba(255, 255, 255, 0.1); }
.ui-hex::after { inset: 2px; background: #1F1F1F; }
.ui-hex svg { position: relative; z-index: 1; width: 42%; height: auto; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ui-hex.is-next::before { background: rgba(19, 236, 91, 0.4); }
.ui-hex.is-next::after { background: var(--surface); }
.ui-hex.is-next svg { stroke: var(--soft); }
.ui-hex.is-on::before { background: linear-gradient(135deg, #13EC5B, #34D399, #2FE6D2); }
.ui-hex.is-on::after { background: linear-gradient(160deg, #17291D, #102216); }
.ui-hex.is-on svg { stroke: var(--green); }
.ui-hex-glow {
  position: absolute; inset: -30%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle closest-side, rgba(19, 236, 91, 0.35) 0%, rgba(19, 236, 91, 0) 100%);
}
.ui-badge { display: grid; justify-items: center; gap: 10px; text-align: center; }
.ui-badge b { font: 700 14px/1.2 var(--font-display); }
.ui-badge small { color: var(--muted); font: 400 12px/1.2 var(--font-display); }
.ui-badge:not(.is-on):not(.is-next) b { color: var(--muted); }

/* ---------- Learn ---------- */

.ui-lesson {
  display: grid; gap: 14px; padding: 20px;
  background: var(--deep); border: 1px solid rgba(19, 236, 91, 0.25); border-radius: var(--r-card);
}
.ui-lesson h4 { font: 700 20px/1.25 var(--font-display); letter-spacing: -0.02em; }
.ui-lesson p { color: var(--soft); font: 400 14px/1.45 var(--font-display); }
.ui-lesson-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-pill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--soft); font: 600 12px/1 var(--font-display);
}
.ui-pill.is-on { background: var(--green); border-color: var(--green); color: var(--btn-text); }
.ui-track { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.ui-track i { display: block; height: 100%; width: calc(var(--p) * 1%); border-radius: 6px; background: linear-gradient(90deg, #13EC5B, #2FE6D2); transform-origin: 0 50%; transition: transform 1.2s var(--ease-out) 0.2s; }
html.js .ui-lesson:not(.is-in) .ui-track i { transform: scaleX(0); }
.ui-units { display: grid; gap: 8px; }
.ui-unit { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 16px; font: 600 14px/1.3 var(--font-display); }
.ui-unit small { display: block; color: var(--muted); font: 400 12px/1.3 var(--font-display); }
.ui-unit i { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); color: var(--ink); font: 700 12px/1 var(--font-display); font-style: normal; }
.ui-unit.is-done i { background: var(--green); color: var(--btn-text); }
.ui-unit.is-current { background: var(--pick); border-color: var(--line-green); }
.ui-unit.is-locked { opacity: 0.55; }

/* ---------- Habits ---------- */

.ui-habit {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 16px; min-height: 114px;
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: var(--r-card);
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.35s var(--ease-out);
}
.ui-habit img { width: 40px; height: 40px; }
.ui-habit b { display: block; font: 700 16px/1.2 var(--font-display); }
.ui-habit span { display: block; color: var(--muted); font: 400 13.5px/1.3 var(--font-display); margin-top: 2px; }
@media (hover: hover) {
  .ui-habit:hover { background: var(--pick); border-color: var(--line-green); box-shadow: 0 10px 26px -14px rgba(19, 236, 91, 0.45); transform: translateY(-4px); }
}

/* ---------- Savings calculator ---------- */

.ui-calc { display: grid; gap: 22px; }
.ui-calc-row { display: grid; gap: 10px; }
.ui-calc-row label, .ui-calc-row .ui-calc-label { color: var(--soft); font: 600 14px/1.3 var(--font-display); display: flex; justify-content: space-between; gap: 12px; }
.ui-calc-row output { color: var(--green); font-weight: 700; }
.ui-calc select {
  appearance: none; width: 100%; height: 52px; padding: 0 44px 0 16px;
  background: #1f1f1f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2313EC5B' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  border: 1px solid var(--line); border-radius: 14px;
  color: var(--green); font: 600 16px/1 var(--font-display);
}
.ui-calc select option { background: #1f1f1f; color: var(--ink); }
.ui-calc input[type="range"] { appearance: none; width: 100%; height: 28px; background: none; cursor: pointer; }
.ui-calc input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, #13EC5B, #2FE6D2) 0 / var(--fill, 30%) 100% no-repeat, rgba(255, 255, 255, 0.12); }
.ui-calc input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); }
.ui-calc input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: linear-gradient(90deg, #13EC5B, #2FE6D2); }
.ui-calc input[type="range"]::-webkit-slider-thumb { appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--green); border: 4px solid #0f1a13; box-shadow: 0 0 0 1px rgba(19, 236, 91, 0.6), 0 0 16px rgba(19, 236, 91, 0.5); }
.ui-calc input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--green); border: 4px solid #0f1a13; box-shadow: 0 0 0 1px rgba(19, 236, 91, 0.6), 0 0 16px rgba(19, 236, 91, 0.5); }
.ui-calc-out { display: grid; gap: 6px; }
.ui-calc-kicker { color: var(--soft); font: 600 13px/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }
.ui-calc-year {
  font: 800 clamp(48px, 7vw, 76px)/1.05 var(--font-display); letter-spacing: -0.04em;
  background: var(--grad-streak); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 0.06em; font-variant-numeric: tabular-nums;
}
.ui-calc-note { color: var(--muted); font: 400 14px/1.4 var(--font-display); }
.ui-calc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ui-calc-split .ui-stat { min-height: 0; padding: 14px 16px; }
.ui-calc-split .ui-value { font-size: 19px; font-variant-numeric: tabular-nums; }

/* ---------- Brote, the mascot ----------
   A box the size of Rive's 200 × 232 artboard; shared/brote.js draws into it. With data-trim it is laid
   out by its drawing, like `trim` in mobile/src/ui/Brote.tsx: the empty artboard above the crown (which
   shrinks as Brote grows) and below the feet stops counting. */

.brote { position: relative; flex: none; height: var(--h, 124px); aspect-ratio: 200 / 232; pointer-events: none; }
.brote[data-trim] {
  margin-top: calc(var(--h, 124px) * var(--brote-top, 0.27) * -1);
  margin-bottom: calc(var(--h, 124px) * var(--brote-bottom, 0.09) * -1);
  transition: margin-top 0.4s var(--ease-out);
}
.brote canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.5s ease; }
.brote.is-ready canvas { opacity: 1; }

/* What Brote says: mobile/src/ui/SpeechBubble.tsx. The tail points at Brote, so advice and
   encouragement read as Brote talking; data never goes in a bubble. */
.bubble {
  --tail-at: 50%;
  position: relative;
  padding: 12px 16px;
  background: #16251B; border: 1px solid rgba(19, 236, 91, 0.35); border-radius: 18px;
  color: var(--ink); font: 600 15px/1.35 var(--font-display); letter-spacing: -0.005em;
}
.bubble small { display: block; margin-top: 2px; color: var(--soft); font: 400 13.5px/1.4 var(--font-display); }
.bubble em { font-style: normal; color: var(--green); font-weight: 600; }
.bubble::before {
  content: ""; position: absolute; width: 14px; height: 14px;
  background: #16251B; border: 0 solid rgba(19, 236, 91, 0.35); transform: rotate(45deg);
}
.bubble-up::before { left: var(--tail-at); top: -8px; margin-left: -7px; border-left-width: 1px; border-top-width: 1px; }
.bubble-down::before { left: var(--tail-at); bottom: -8px; margin-left: -7px; border-right-width: 1px; border-bottom-width: 1px; }
.bubble-left::before { left: -8px; top: var(--tail-at); margin-top: -7px; border-left-width: 1px; border-bottom-width: 1px; }
.bubble-right::before { right: -8px; top: var(--tail-at); margin-top: -7px; border-right-width: 1px; border-top-width: 1px; }

/* Home's streak card as it is now: Brote lives in the ring above the number, says the day's message
   and the next badge in a bubble under it, and the protectors fold into a chip in the corner. */
.ui-streak { position: relative; }
.ui-ring.has-brote { width: 204px; }
.ui-ring.has-brote .ui-ring-center { padding-bottom: 0; }
.ui-ring.has-brote .ui-ring-num { font-size: 50px; line-height: 1.05; }
.ui-ring-caps { color: var(--soft); font: 600 12px/1.2 var(--font-display); letter-spacing: 2px; margin: 2px 0 14px; }
.ui-streak-say { width: min(100%, 270px); margin-top: 6px; text-align: center; }
.ui-streak-say b { display: block; font-weight: 700; }
.ui-protect-chip {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 10px 0 6px; border-radius: 15px;
  border: 1px solid rgba(0, 243, 255, 0.4); background: rgba(16, 39, 40, 0.95);
  color: var(--frozen); font: 700 14px/18px var(--font-display);
}
.ui-protect-chip img { width: 20px; height: 20px; }

/* Stats' coach: Brote beside the advice, the data cards stay without it. */
.ui-coach { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 8px 4px 0; }
.ui-coach .bubble { flex: 1; --tail-at: 56%; }

@media (prefers-reduced-motion: reduce) {
  .phone-sos::after { display: none; }
  .ui-ring-arc, .ui-bar i, .ui-track i { transition: none; }
}
