:root {
  /* navy + green, taken from the 1M&1 logo */
  --bg: #0b111c;
  --surface: #141c2a;
  --surface-2: #1b2536;
  --surface-3: #253045;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #eef2f7;
  --muted: #8a95a8;
  --faint: #5a6579;
  --accent: #34d399;
  --accent-2: #5eead4;
  --on-accent: #0b1622;
  --gold: #fbbf24;
  --danger: #f43f5e;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 20px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* light palette: follows the phone unless the user picked Dark; always used when they picked Light */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f6f8;
    --surface: #ffffff;
    --surface-2: #eef2f6;
    --surface-3: #e2e8ef;
    --border: rgba(15, 25, 40, 0.07);
    --border-strong: rgba(15, 25, 40, 0.14);
    --text: #111a2b;
    --muted: #5f6b80;
    --faint: #a0a9b8;
    --accent: #10b981;
    --accent-2: #14b8a6;
    --shadow: 0 10px 30px -14px rgba(30, 40, 80, 0.25);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --surface-3: #e2e8ef;
  --border: rgba(15, 25, 40, 0.07);
  --border-strong: rgba(15, 25, 40, 0.14);
  --text: #111a2b;
  --muted: #5f6b80;
  --faint: #a0a9b8;
  --accent: #10b981;
  --accent-2: #14b8a6;
  --shadow: 0 10px 30px -14px rgba(30, 40, 80, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(600px 400px at 0% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(500px 360px at 100% 0%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -0.02em; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(28px, calc(env(safe-area-inset-top) + 12px)) 16px calc(120px + var(--badge-h, 0px));
}

/* ---------- views & entrance animation ---------- */
.view { display: none; }
.view.active { display: block; }
.view.active .rise {
  animation: rise 0.55s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.page-title { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* ---------- hero ---------- */
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.hero h1 { font-size: 28px; font-weight: 800; margin-top: 4px; }

.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-weight: 700; font-size: 15px; box-shadow: var(--shadow);
  transition: transform 0.3s var(--spring);
}
.streak-chip .flame { display: inline-block; transform-origin: 50% 90%; }
.streak-chip.lit .flame { animation: flicker 1.8s ease-in-out infinite; }
.streak-chip.bump { animation: bump 0.5s var(--spring); }
.streak-chip.cold { color: var(--muted); }
.streak-chip.cold .flame { filter: grayscale(1); opacity: 0.6; }
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-3deg); }
  50% { transform: scale(1.12) rotate(3deg); }
}
@keyframes bump { 40% { transform: scale(1.18); } }

.level-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.level-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
  transform: translateX(-100%);
}
.level-card.shine::after { animation: shine 1.1s var(--ease); }
@keyframes shine { to { transform: translateX(100%); } }

.level-badge {
  position: relative; flex: none;
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--grad); color: var(--on-accent);
  font-weight: 800; font-size: 22px;
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.level-badge small { position: absolute; top: 5px; font-size: 8px; letter-spacing: 0.12em; opacity: 0.85; }
.level-badge span { margin-top: 6px; }
.level-body { flex: 1; min-width: 0; }
.level-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 8px; }
.level-title { font-weight: 700; font-size: 16px; }
.xp-text { color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xp-bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.xp-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: var(--grad);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent-2) 60%, transparent);
  transition: width 0.8s var(--ease);
}

/* ---------- section head ---------- */
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 2px 10px; }
.section-head h2 { font-size: 18px; font-weight: 700; }
.section-head span { color: var(--muted); font-size: 13px; font-weight: 600; }
.day-progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 0 2px 16px; }
.day-progress-fill { height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width 0.7s var(--ease); }

/* ---------- goal cards ---------- */
.goal-list { display: flex; flex-direction: column; gap: 12px; }
.goal-card {
  --c: var(--accent);
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 14px 14px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease), transform 0.3s var(--ease);
}
.goal-card.done {
  background: linear-gradient(120deg, color-mix(in srgb, var(--c) 16%, var(--surface)), var(--surface) 70%);
  border-color: color-mix(in srgb, var(--c) 35%, transparent);
}
.goal-card.pop { animation: pop 0.6s var(--spring); }
@keyframes pop { 35% { transform: scale(1.03); } }

.ring-wrap { position: relative; width: 54px; height: 54px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg {
  stroke: var(--c); stroke-linecap: round;
  stroke-dasharray: 125.66; stroke-dashoffset: 125.66;
  transition: stroke-dashoffset 0.8s var(--ease);
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--c) 50%, transparent));
}
.goal-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; transition: transform 0.4s var(--spring); }
.goal-card.done .goal-icon { transform: scale(1.1); }

.goal-body { flex: 1; min-width: 0; }
.goal-body h3 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.goal-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-width: 0; }
.goal-foot .goal-streak { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* significance: minor / moderate / major */
.sig-minor { --sc: #94a3b8; }
.sig-moderate { --sc: #38bdf8; }
.sig-major { --sc: #fbbf24; }
.sig-tag {
  flex: none; display: inline-flex; align-items: center;
  height: 19px; padding: 0 7px; border-radius: 99px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc) 30%, transparent);
  vertical-align: middle;
}
.sig-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sig-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px; border-radius: 15px;
  background: var(--surface-2); border: 2px solid transparent;
  transition: transform 0.25s var(--spring), border-color 0.2s, background 0.2s;
}
.sig-opt:hover { background: var(--surface-3); }
.sig-opt:active { transform: scale(0.95); }
.sig-opt .sig-name { font-weight: 800; font-size: 14px; }
.sig-opt .sig-xp { font-size: 12px; font-weight: 700; color: var(--muted); }
.sig-opt.sel { border-color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, var(--surface-2)); transform: scale(1.03); }
.sig-opt.sel .sig-name, .sig-opt.sel .sig-xp { color: var(--sc); }
.hint.warn { color: var(--gold); }
.goal-meta { color: var(--muted); font-size: 13px; font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.goal-meta b { color: var(--text); font-weight: 700; }
.amount-btn {
  display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% + 6px);
  margin-left: -6px; padding: 2px 6px; border-radius: 8px; text-align: left;
  white-space: nowrap; overflow: hidden;
  transition: background 0.2s, color 0.2s;
}
.amount-btn:hover { background: var(--surface-2); color: var(--text); }
.amount-btn:active { transform: scale(0.97); }
.amount-btn .pencil { width: 13px; height: 13px; flex: none; margin-left: 2px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linejoin: round; stroke-linecap: round; opacity: 0.55; }
.amount-btn:hover .pencil { opacity: 1; }

.amt-input { height: 64px; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.amt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 18px; }
.chip-fill { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.amt-preview { margin-bottom: 18px; }
.amt-bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.amt-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c); transition: width 0.45s var(--spring); }
.amt-preview span { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.amt-preview.complete span { color: var(--accent); }
.goal-streak {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.goal-streak.on { color: var(--gold); }

.icon-btn {
  width: 34px; height: 34px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
  transition: transform 0.2s var(--ease), opacity 0.3s var(--ease), background 0.2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(0.88); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.goal-card .minus {
  opacity: 0; pointer-events: none; transform: scale(0.6);
  width: 0; margin-left: -14px; overflow: hidden;
  transition: transform 0.2s var(--ease), opacity 0.3s var(--ease), width 0.3s var(--ease), margin 0.3s var(--ease), background 0.2s;
}
.goal-card.has-count .minus { opacity: 1; pointer-events: auto; transform: none; width: 34px; margin-left: 0; }

.plus {
  position: relative; overflow: hidden; flex: none;
  min-width: 52px; height: 52px; padding: 0 12px; border-radius: 17px;
  display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 8px 20px -8px var(--c);
  transition: transform 0.25s var(--spring), box-shadow 0.3s;
}
.plus:hover { transform: translateY(-1px); }
.plus:active { transform: scale(0.9); }
.plus > * { grid-area: 1 / 1; transition: transform 0.4s var(--spring), opacity 0.25s; }
.plus svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.plus .p-check { opacity: 0; transform: scale(0.3) rotate(-30deg); }
.goal-card.done .plus .p-add { opacity: 0; transform: scale(0.3) rotate(30deg); }
.goal-card.done .plus .p-check { opacity: 1; transform: none; }
.plus .ripple {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.5);
  animation: ripple 0.6s var(--ease) forwards; pointer-events: none;
}
@keyframes ripple { to { transform: scale(9); opacity: 0; } }

.float-xp {
  position: fixed; z-index: 60; pointer-events: none;
  font-weight: 800; font-size: 15px; color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  animation: floatUp 1.1s var(--ease) forwards;
}
.float-xp.neg { color: var(--muted); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}

.empty {
  text-align: center; padding: 40px 20px; border-radius: var(--radius);
  border: 1.5px dashed var(--border-strong); color: var(--muted);
}
.empty .big { font-size: 40px; margin-bottom: 10px; }
.empty p { margin-bottom: 16px; }

.perfect-banner {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(120deg, color-mix(in srgb, var(--gold) 22%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  font-size: 14px; font-weight: 600;
}
.perfect-banner .pb-icon { font-size: 24px; animation: flicker 2.2s ease-in-out infinite; }
.perfect-banner small { display: block; color: var(--muted); font-weight: 500; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 15px;
  font-weight: 700; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: transform 0.2s var(--spring), background 0.2s, opacity 0.2s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--grad); color: var(--on-accent); border: 0; box-shadow: 0 10px 24px -10px var(--accent); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }

/* ---------- cards / stats ---------- */
.card {
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.card h3 small { color: var(--muted); font-weight: 600; font-size: 12px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tile {
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.tile .t-icon { font-size: 18px; }
.tile .t-val { font-size: 26px; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tile .t-label { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 2px; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 140px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.bar-track { flex: 1; width: 100%; max-width: 30px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill {
  width: 100%; height: 0; border-radius: 10px;
  background: linear-gradient(to top, var(--accent), var(--accent-2));
  transition: height 0.9s var(--spring);
}
.bar-col.today .bar-label { color: var(--text); }
.bar-col.today .bar-track { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.bar-label { font-size: 11px; font-weight: 700; color: var(--muted); }

.heat-wrap { overflow-x: auto; scrollbar-width: none; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.heat i {
  display: block; width: 100%; aspect-ratio: 1; min-width: 12px; border-radius: 4px;
  background: var(--surface-2);
  animation: heatIn 0.5s var(--ease) both; animation-delay: calc(var(--d) * 22ms);
}
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.heat i.l3 { background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.heat i.l4 { background: var(--accent-2); box-shadow: 0 0 8px color-mix(in srgb, var(--accent-2) 50%, transparent); }
.heat i.future { opacity: 0.25; }
.heat i.today { outline: 1.5px solid var(--text); outline-offset: 1px; }
@keyframes heatIn { from { opacity: 0; transform: scale(0.4); } }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 12px; color: var(--muted); font-size: 11px; font-weight: 600; }
.heat-legend i { width: 10px; height: 10px; border-radius: 3px; display: block; background: var(--surface-2); }

.goal-stat { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.goal-stat + .goal-stat { border-top: 1px solid var(--border); }
.gs-icon {
  width: 40px; height: 40px; border-radius: 13px; flex: none; display: grid; place-items: center; font-size: 19px;
  background: color-mix(in srgb, var(--c) 18%, var(--surface-2));
}
.gs-body { flex: 1; min-width: 0; }
.gs-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; gap: 8px; }
.gs-top span:last-child { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.gs-bar { height: 6px; border-radius: 99px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.gs-bar div { height: 100%; width: 0; background: var(--c); border-radius: inherit; transition: width 1s var(--ease); }
.gs-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- badges ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.badge { --tc: var(--gold); }
.badge.tier-1 { --tc: #d08a4e; }
.badge.tier-2 { --tc: #c3cad8; }
.badge.tier-3 { --tc: #fbbf24; }
.badge.tier-4 { --tc: #67e8f9; }
.badge .b-icon { position: relative; }
.b-tier {
  position: absolute; right: -6px; bottom: -4px;
  min-width: 24px; height: 20px; padding: 0 6px; border-radius: 99px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: 0.02em; color: #111;
  background: var(--tc); box-shadow: 0 0 0 2px var(--surface);
}
.badge.tier-4 .b-tier { background: linear-gradient(135deg, #67e8f9, #a78bfa, #f0abfc); }
.b-bar { height: 5px; border-radius: 99px; background: var(--surface-3); margin: 10px 6px 0; overflow: hidden; }
.b-bar div { height: 100%; width: 0; border-radius: inherit; background: var(--tc); transition: width 0.9s var(--ease); }
.badge.locked .b-bar div { background: var(--accent); }
.b-count { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.t-val small { font-size: 15px; color: var(--muted); font-weight: 700; }
.badge {
  position: relative; overflow: hidden;
  padding: 18px 10px 14px; border-radius: var(--radius); text-align: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.badge .b-icon {
  width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px;
  background: var(--surface-2);
}
.badge .b-name { font-size: 13px; font-weight: 700; }
.badge .b-desc { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.badge.locked .b-icon { filter: grayscale(1); opacity: 0.35; }
.badge.locked .b-name { color: var(--muted); }
.badge.earned .b-icon {
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--tc) 45%, var(--surface-2)), var(--surface-2));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 45%, transparent), 0 8px 20px -6px color-mix(in srgb, var(--tc) 55%, transparent);
}
.badge.earned::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.08) 50%, transparent 65%);
  animation: badgeShine 4s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 300ms);
  transform: translateX(-100%);
}
@keyframes badgeShine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.badge-progress { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 18px; }

/* ---------- brand ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font-size: 13px; font-weight: 800; letter-spacing: -0.01em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand img { width: 20px; height: 20px; border-radius: 6px; }

/* ---------- daily check-in ---------- */
.checkin { --mc: var(--accent); margin-top: 14px; transition: background 0.6s var(--ease), border-color 0.6s var(--ease); }
.checkin.answered {
  background: linear-gradient(140deg, color-mix(in srgb, var(--mc) 14%, var(--surface)), var(--surface) 65%);
  border-color: color-mix(in srgb, var(--mc) 30%, transparent);
}
.ci-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.ci-head h3 { margin: 0; font-size: 15px; }
.ci-xp { font-size: 12px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.checkin.answered .ci-xp { color: var(--muted); }
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 0 8px; border-radius: 16px; border: 1.5px solid transparent;
  transition: transform 0.3s var(--spring), background 0.3s, border-color 0.3s, opacity 0.3s, filter 0.3s;
}
.mood:hover { background: var(--surface-2); }
.mood:active { transform: scale(0.9); }
.mood-e { font-size: 30px; line-height: 1; transition: transform 0.4s var(--spring); }
.mood:hover .mood-e { transform: scale(1.12) rotate(-6deg); }
.mood-l { font-size: 11px; font-weight: 700; color: var(--muted); }
.checkin.answered .mood:not(.sel) { opacity: 0.45; filter: grayscale(0.6); }
.checkin.answered .mood:not(.sel):hover { opacity: 0.85; filter: none; }
.mood.sel { background: color-mix(in srgb, var(--mc) 16%, transparent); border-color: color-mix(in srgb, var(--mc) 55%, transparent); }
.mood.sel .mood-l { color: var(--mc); }
.mood.sel .mood-e { transform: scale(1.15); }
.mood.bounce .mood-e { animation: moodBounce 0.7s var(--spring); }
@keyframes moodBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.45) rotate(-10deg); }
  60% { transform: scale(1.05) rotate(6deg); }
  100% { transform: scale(1.15); }
}
.quote-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.55s var(--ease); }
.quote-wrap.show { grid-template-rows: 1fr; }
.quote-inner { overflow: hidden; }
.quote {
  margin-top: 14px; padding: 14px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--mc) 9%, var(--surface-2));
  border-left: 3px solid var(--mc);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.5s var(--ease) 0.15s, transform 0.5s var(--ease) 0.15s;
}
.quote-wrap.show .quote { opacity: 1; transform: none; }
.quote.swap { animation: quoteSwap 0.5s var(--ease); }
@keyframes quoteSwap { 35% { opacity: 0; transform: translateY(6px); } }
.quote blockquote { font-size: 15px; font-weight: 600; line-height: 1.5; }
.quote cite { display: block; margin-top: 6px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); }

.mood-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.mw-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mw-face {
  width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--mc, var(--accent)) 16%, var(--surface-2));
  animation: heatIn 0.5s var(--spring) both; animation-delay: calc(var(--i) * 60ms + 200ms);
}
.mw-face.blank { background: var(--surface-2); color: var(--faint); font-size: 18px; }
.mw-col.today .mw-face { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.mw-col.today .bar-label { color: var(--text); }

/* ---------- journal ---------- */
.compose { position: relative; overflow: hidden; }
.textarea {
  height: auto; min-height: 130px; padding: 14px 16px; resize: none; display: block;
  font-size: 15px; font-weight: 500; line-height: 1.55;
}
.compose-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
#charCount { color: var(--faint); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.seal-fx {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  background: var(--surface); opacity: 0; transition: opacity 0.3s var(--ease);
}
.seal-fx > span { grid-area: 1 / 1; }
.seal-env { font-size: 64px; }
.seal-wax { font-size: 26px; transform: translate(0, 14px) scale(0); }
.compose.sealing .seal-fx { opacity: 1; }
.compose.sealing .seal-env { animation: envIn 1.3s var(--spring) both; }
.compose.sealing .seal-wax { animation: waxIn 1.3s var(--spring) both; }
.compose.sealing textarea { filter: blur(6px); transform: scale(0.9); transition: filter 0.3s, transform 0.3s var(--ease); }
@keyframes envIn {
  0% { transform: scale(0.3) rotate(-15deg); opacity: 0; }
  30% { transform: scale(1.1) rotate(4deg); opacity: 1; }
  70% { transform: scale(1); }
  100% { transform: translateY(80px) scale(0.6); opacity: 0; }
}
@keyframes waxIn {
  0%, 30% { transform: translate(0, 14px) scale(0); }
  45% { transform: translate(0, 14px) scale(1.4); }
  70% { transform: translate(0, 14px) scale(1); opacity: 1; }
  100% { transform: translate(0, 94px) scale(0.5); opacity: 0; }
}

.letter-list { display: flex; flex-direction: column; gap: 10px; }
.letter {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.letter:hover { border-color: var(--border-strong); }
.letter:active { transform: scale(0.98); }
.l-icon {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 22px;
  background: var(--surface-2);
}
.l-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.l-title { font-weight: 700; font-size: 15px; }
.l-sub { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-bar { display: block; height: 5px; border-radius: 99px; background: var(--surface-3); margin-top: 9px; overflow: hidden; }
.l-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 1s var(--ease); }
.letter.ready {
  background: linear-gradient(120deg, color-mix(in srgb, #ec4899 18%, var(--surface)), var(--surface) 70%);
  border-color: color-mix(in srgb, #ec4899 35%, transparent);
}
.letter.ready .l-icon { background: color-mix(in srgb, #ec4899 20%, var(--surface-2)); animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: none; } 78% { transform: rotate(-10deg) scale(1.06); } 86% { transform: rotate(8deg) scale(1.06); } 94% { transform: rotate(-4deg); } }
.letter.sealed .l-icon { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.letter.fresh { animation: freshIn 0.8s var(--spring) both !important; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
@keyframes freshIn { from { opacity: 0; transform: translateY(-20px) scale(0.9); } }

.sealed-sheet, .letter-sheet { text-align: center; }
.big-lock { font-size: 56px; margin: 6px 0 10px; animation: bump 0.6s var(--spring); }
.letter-sheet .env { font-size: 60px; margin: 4px 0 14px; }
.letter-sheet.unsealing .env { animation: envOpen 0.9s var(--spring) both; }
@keyframes envOpen {
  0% { transform: scale(0.4) rotate(-20deg); opacity: 0; }
  50% { transform: scale(1.25) rotate(8deg); opacity: 1; }
  100% { transform: none; }
}
.paper {
  text-align: left; padding: 20px; border-radius: 18px; margin-bottom: 18px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.letter-sheet.unsealing .paper { animation: paperIn 0.8s var(--ease) 0.45s both; }
@keyframes paperIn { from { opacity: 0; transform: translateY(24px); clip-path: inset(0 0 100% 0 round 18px); } to { clip-path: inset(0 0 0 0 round 18px); } }
.paper-meta { color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 12px; }
.paper-text { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.65; }

/* ---------- goals manager ---------- */
.goal-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px; border-radius: 18px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.goal-row:hover { border-color: var(--border-strong); }
.goal-row:active { transform: scale(0.98); }
.goal-row .gr-body { flex: 1; min-width: 0; }
.goal-row .gr-name { font-weight: 700; font-size: 15px; }
.goal-row .gr-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.goal-row .chev { width: 18px; height: 18px; stroke: var(--faint); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.data-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.data-actions .btn-danger { grid-column: 1 / -1; }
.muted-note { color: var(--muted); font-size: 12px; margin-bottom: 14px; line-height: 1.5; }
.install-card {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 18%, var(--surface)), var(--surface) 75%);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.install-card img { width: 48px; height: 48px; border-radius: 14px; flex: none; }
.install-card .ic-body { flex: 1; min-width: 0; }
.install-card strong { display: block; font-size: 15px; }
.install-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.install-card .btn { height: 40px; padding: 0 16px; flex: none; }

/* ---------- nav ---------- */
.nav {
  position: fixed; z-index: 30; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--badge-h, 0px));
  transform: translateX(-50%);
  width: min(448px, calc(100% - 32px));
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px; border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
}
.nav-indicator {
  position: absolute; top: 6px; bottom: 6px; left: 6px;
  width: calc((100% - 12px) / 5); border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  transition: transform 0.45s var(--spring);
}
.nav-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; border-radius: 18px; color: var(--muted);
  font-size: 11px; font-weight: 700; transition: color 0.25s;
}
.nav-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s var(--spring); }
.nav-btn[aria-current="page"] { color: var(--text); }
.nav-btn[aria-current="page"] svg { transform: translateY(-1px) scale(1.08); stroke: var(--accent); }
.nav-btn:active svg { transform: scale(0.85); }

/* ---------- sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(5, 7, 12, 0.55);
  backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.35s var(--ease);
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0;
  width: min(480px, 100%); max-height: 92vh; overflow-y: auto;
  padding: 10px 20px calc(max(24px, env(safe-area-inset-bottom)) + var(--badge-h, 0px));
  border-radius: 28px 28px 0 0;
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom: 0;
  transform: translate(-50%, 105%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 9px; background: var(--surface-3); margin: 0 auto 16px; }
.sheet h2 { font-size: 22px; font-weight: 800; margin-bottom: 18px; }
.sheet p.lead { color: var(--muted); margin: -8px 0 20px; line-height: 1.5; }

.field { margin-bottom: 18px; }
.field > label, .field-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.input {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 15px;
  background: var(--surface-2); border: 1.5px solid transparent; outline: none;
  font-size: 16px; font-weight: 600; transition: border-color 0.2s, background 0.2s;
}
.input:focus { border-color: var(--accent); background: var(--surface); }
.input.invalid { border-color: var(--danger); animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--faint); font-size: 12px; margin-top: 6px; }

.presets { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -20px 20px; padding: 0 20px 4px; scrollbar-width: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; transition: transform 0.2s var(--spring), background 0.2s;
}
.chip:hover { background: var(--surface-3); }
.chip:active { transform: scale(0.93); }

.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.icon-opt {
  aspect-ratio: 1; border-radius: 12px; font-size: 20px; display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid transparent;
  transition: transform 0.25s var(--spring), border-color 0.2s, background 0.2s;
}
.icon-opt:hover { transform: scale(1.08); }
.icon-opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); transform: scale(1.06); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt {
  width: 32px; height: 32px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 3px var(--surface); border: 2px solid transparent;
  transition: transform 0.25s var(--spring), border-color 0.2s;
}
.color-opt:hover { transform: scale(1.1); }
.color-opt.sel { border-color: var(--c); transform: scale(1.12); }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.sheet-actions.inline { flex-direction: row; }
.sheet-actions.inline .btn { flex: 1; }

/* ---------- level up ---------- */
.levelup {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px;
  background: rgba(5, 7, 12, 0.7); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity 0.4s var(--ease);
}
.levelup.show { opacity: 1; pointer-events: auto; }
.levelup-card {
  position: relative; overflow: hidden; text-align: center;
  width: min(340px, 100%); padding: 36px 24px 24px; border-radius: 28px;
  background: var(--surface); border: 1px solid var(--border-strong);
  transform: scale(0.7) translateY(30px); opacity: 0;
  transition: transform 0.6s var(--spring), opacity 0.4s var(--ease);
}
.levelup.show .levelup-card { transform: none; opacity: 1; }
.levelup-rays {
  position: absolute; left: 50%; top: 110px; width: 520px; height: 520px; margin: -260px;
  background: repeating-conic-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 0 10deg, transparent 10deg 20deg);
  mask: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 65%);
  animation: spin 18s linear infinite; pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.levelup-card > *:not(.levelup-rays) { position: relative; }
.levelup-kicker { font-size: 13px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-2); }
.levelup-num {
  font-size: 96px; font-weight: 800; line-height: 1.1; margin: 6px 0 2px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.levelup.show .levelup-num { animation: numIn 0.9s var(--spring) 0.15s both; }
@keyframes numIn { from { transform: scale(0.3) rotate(-12deg); opacity: 0; } }
.levelup-title { font-size: 20px; font-weight: 800; }
.levelup-sub { color: var(--muted); font-size: 14px; margin: 8px 0 22px; }
.levelup .btn { width: 100%; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 80; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(420px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.55);
  animation: toastIn 0.5s var(--spring) both;
}
.toast.out { animation: toastOut 0.35s var(--ease) forwards; }
.toast-body { flex: 1; min-width: 0; }
.toast.link { pointer-events: auto; cursor: pointer; transition: transform 0.2s var(--spring), border-color 0.2s; }
.toast.link:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.toast.link:active { transform: scale(0.97); }
.toast .chev { width: 18px; height: 18px; flex: none; stroke: var(--muted); stroke-width: 2.4; fill: none; stroke-linecap: round; }

/* highlight for whatever a tapped toast jumps to */
.goal-card, .badge, .letter, .goal-stat, .heat { outline: 2px solid transparent; outline-offset: 4px; }
.goal-stat, .heat { border-radius: 14px; }
.flash { outline-color: var(--accent) !important; animation: flashPulse 0.6s var(--spring) 0.25s 2 !important; }
@keyframes flashPulse { 50% { transform: scale(1.025); } }
.toast-icon { font-size: 24px; }
.toast strong { display: block; font-size: 14px; }
.toast small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-24px) scale(0.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px) scale(0.95); } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 75; }

/* ---------- segmented control (schedule, badges/rewards, theme) ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button {
  height: 38px; padding: 0 8px; border-radius: 11px; font-size: 13px; font-weight: 700; color: var(--muted);
  transition: background 0.25s var(--ease), color 0.2s, transform 0.2s var(--spring);
}
.seg button:active { transform: scale(0.95); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.35); }
.seg-wide { margin-bottom: 16px; }
.seg-sm button { height: 32px; font-size: 12px; padding: 0 10px; }

/* ---------- today: day switch, rest days, weekly goals ---------- */
.day-toggle { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.day-toggle button { height: 32px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--muted); transition: background 0.25s var(--ease), color 0.2s; }
.day-toggle button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.35); }
.section-head:has(.day-toggle) { align-items: center; }
.yday-note { margin: -2px 2px 12px; font-size: 12px; font-weight: 600; color: var(--gold); line-height: 1.45; }
.goal-card.rest { opacity: 0.6; }
.goal-card.rest:hover, .goal-card.rest.has-count { opacity: 1; }
.week-pill {
  flex: none; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  color: var(--muted); background: var(--surface-2);
}
.week-pill.met { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.freeze-count:empty { display: none; }
.freeze-count { margin-left: 4px; padding-left: 8px; border-left: 1px solid var(--border-strong); font-size: 13px; }
.coin-line {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 9px;
  font-size: 12px; font-weight: 600; color: var(--muted); transition: color 0.2s;
}
.coin-line b { color: var(--gold); font-variant-numeric: tabular-nums; }
.coin-line:hover { color: var(--text); }

.backup-banner { display: flex; gap: 12px; margin-top: 14px; border-color: color-mix(in srgb, var(--gold) 30%, transparent); transition: opacity 0.3s, transform 0.3s var(--ease); }
.backup-banner.leaving { opacity: 0; transform: translateY(-8px) scale(0.98); }
.bb-icon { font-size: 26px; line-height: 1; }
.bb-body strong { display: block; font-size: 15px; }
.bb-body small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 3px; }
.bb-actions { display: flex; gap: 8px; margin-top: 12px; }
.bb-actions .btn { height: 38px; padding: 0 14px; font-size: 13px; }

/* ---------- weekly challenges ---------- */
.challenges { margin-top: 16px; }
.ch-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.ch-row + .ch-row { border-top: 1px solid var(--border); }
.ch-icon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); }
.ch-body { flex: 1; min-width: 0; }
.ch-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; }
.ch-xp { flex: none; color: var(--gold); font-size: 12px; }
.ch-bar { height: 6px; border-radius: 99px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.ch-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width 0.7s var(--ease); }
.ch-count { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.ch-row.done .ch-icon { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.ch-row.done .ch-count { color: var(--accent); }
.ch-row.done .ch-top span:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); }

/* ---------- insights ---------- */
.insight { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.insight + .insight { border-top: 1px solid var(--border); }
.in-icon { width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center; font-size: 17px; background: var(--surface-2); }
.insight p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.insight b { color: var(--text); }

/* ---------- goal form: schedule ---------- */
.sched-days, .sched-weekly { display: none; margin-top: 10px; }
.sched-days.show { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.sched-days.invalid { animation: shake 0.4s; }
.day-chip {
  aspect-ratio: 1; max-height: 42px; border-radius: 12px; font-weight: 800; font-size: 13px;
  background: var(--surface-2); border: 2px solid transparent; color: var(--muted);
  transition: transform 0.2s var(--spring), background 0.2s, border-color 0.2s, color 0.2s;
}
.day-chip:active { transform: scale(0.9); }
.day-chip.sel { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.sched-weekly.show { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px; border-radius: 14px; background: var(--surface-2); }
.sched-weekly span { font-size: 14px; font-weight: 600; color: var(--muted); }
.sched-weekly b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.sched-weekly .icon-btn { background: var(--surface); }
.sig-opt:disabled { opacity: 0.35; pointer-events: none; }

/* ---------- rewards ---------- */
.coin-card { display: flex; align-items: center; gap: 14px; background: linear-gradient(120deg, color-mix(in srgb, var(--gold) 18%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.cc-icon { font-size: 34px; }
.cc-val { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cc-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.reward-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.reward {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 18px 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.reward.can { border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.rw-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: var(--surface-2); }
.reward.can .rw-icon { background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--gold) 35%, var(--surface-2)), var(--surface-2)); }
.rw-name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.rw-buy { height: 36px; padding: 0 14px; font-size: 13px; margin-top: 2px; }
.rw-need { font-size: 11px; font-weight: 600; color: var(--muted); }
.reward-edit { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--faint); }
.reward-edit:hover { background: var(--surface-2); color: var(--text); }
.reward-edit .pencil { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.reward-new { border: 1.5px dashed var(--border-strong); background: transparent; box-shadow: none; justify-content: center; color: var(--muted); }
.reward-new:hover { color: var(--text); border-color: var(--accent); }
.reward-new .rw-icon svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; }
.purchase { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; text-align: left; }
.purchase + .purchase { border-top: 1px solid var(--border); }
.pu-icon { font-size: 20px; }
.pu-body { flex: 1; min-width: 0; }
.pu-body b { display: block; font-size: 14px; }
.pu-body small { color: var(--muted); font-size: 12px; }
.pu-cost { font-size: 13px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

.coin {
  display: inline-block; width: 1em; height: 1em; border-radius: 50%; vertical-align: -0.15em; flex: none;
  background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 60%, #b45309);
  box-shadow: inset 0 0 0 0.09em rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
}
.coin-lg { width: 34px; height: 34px; vertical-align: middle; }

/* ---------- sync, buddies, reminders ---------- */
.card h3 small.err, #syncStatus.err { color: var(--danger); }
.code-box { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.code-box code, .code-box .code-input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 13px; display: flex; align-items: center;
  background: var(--surface-2); font: 700 15px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.06em;
  overflow: hidden; white-space: nowrap;
}
.code-box .code-input { text-transform: uppercase; }
.code-box code.masked { color: transparent; text-shadow: 0 0 9px var(--muted); user-select: none; }
.code-box .btn { height: 46px; padding: 0 14px; flex: none; }
.code-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.btn-inline { font-size: 12px; font-weight: 700; color: var(--accent); padding: 2px 4px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12px; }
.buddies-card { margin-top: 16px; }
.buddy { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.buddy + .buddy { border-top: 1px solid var(--border); }
.bd-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; color: var(--on-accent); background: var(--grad);
}
.bd-body { flex: 1; min-width: 0; }
.bd-body b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-body small { color: var(--muted); font-size: 12px; }
.bd-today { flex: none; font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; max-width: 45%; }
.bd-today.done { color: var(--accent); }
.setting-note { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; max-width: 220px; }
.reminder-time { display: none; }
.reminder-time.show { display: flex; }
.rt-controls { display: flex; align-items: center; gap: 8px; }
.time-input { width: 120px; height: 38px; padding: 0 10px; font-size: 14px; }

/* ---------- settings ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; font-weight: 600; }
.setting + .setting { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background 0.25s var(--ease); }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--spring); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
.btn-link { display: block; width: 100%; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.btn-link:hover { color: var(--text); }

@media (max-width: 380px) {
  .icon-grid { grid-template-columns: repeat(6, 1fr); }
  .mood-e { font-size: 26px; }
}

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