/* Habit Streak Mini App — Wallet style with a theme system (CSS variables). */

@font-face {
  font-family: Onest;
  src: url("fonts/Onest.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Theme: wallet (default) ---------- */
:root,
:root[data-theme="wallet"] {
  --bg: #EFEFF4;
  --card: #FFFFFF;
  --text: #111111;
  --text-2: #3A3A3C;
  --muted: #8E8E93;
  --line: #F0F0F3;
  --green: #34C759;
  --green-soft: #E6F8EC;
  --blue: #3390EC;
  --today-ring: #34C759;
  --spark-glow: rgba(255, 122, 58, 0.28);
  --soft: #F2F2F7;
  --soft-2: #F7F7FA;
  --track: #EBEBF0;
  --flame: #E85D1C;
  --tab-active: #111111;
  --tab-idle: #8E8E93;
  --overlay: rgba(0, 0, 0, 0.36);
  --shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
  --tabbar-bg: rgba(239, 239, 244, 0.94);
  color-scheme: light;
}

/* ---------- Theme: neon (registered, hidden from the switcher) ---------- */
:root[data-theme="neon"] {
  --bg: #070414;
  --card: rgba(20, 10, 36, 0.86);
  --text: #FFF6FB;
  --text-2: #F2D6EA;
  --muted: #B79AB3;
  --line: rgba(255, 120, 200, 0.14);
  --green: #2EF0D0;
  --green-soft: rgba(46, 240, 208, 0.16);
  --blue: #FF6AD5;
  --today-ring: #FF3DAA;
  --spark-glow: rgba(255, 80, 160, 0.45);
  --soft: rgba(255, 255, 255, 0.08);
  --soft-2: rgba(255, 255, 255, 0.06);
  --track: rgba(255, 255, 255, 0.1);
  --flame: #FFB07A;
  --tab-active: #FF6AD5;
  --tab-idle: #8A7388;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 -8px 40px rgba(255, 61, 170, 0.18);
  --tabbar-bg: rgba(8, 4, 18, 0.92);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.hidden { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Onest, "Golos Text", "Noto Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overscroll-behavior-y: none;
}

.app {
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100vh);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.content {
  flex: 1;
  padding: calc(8px + var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px)) 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ----- Hero ----- */
.hero {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 100px;
  padding: 0 2px 0 4px;
}
.hero-text { flex: 1; min-width: 0; padding-top: 4px; }
.kicker { font-size: 13px; font-weight: 550; color: var(--muted); letter-spacing: 0.01em; line-height: 1.2; }
.hello { margin-top: 1px; font-size: 21px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.15; }
.quote { margin-top: 6px; font-size: 13px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; color: var(--text-2); max-width: 230px; }
.sparky-wrap { position: relative; width: 112px; height: 112px; flex: none; display: grid; place-items: center; }
.sparky-wrap::before {
  content: ""; position: absolute; width: 88px; height: 88px; border-radius: 50%;
  background: radial-gradient(circle, var(--spark-glow) 0%, transparent 70%); top: 6px;
}
.sparky { position: relative; width: 112px; height: 112px; object-fit: contain; display: block; }
.gear {
  position: absolute; top: calc(6px + var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px)); right: 12px;
  width: 34px; height: 34px; border-radius: 50%; background: var(--card);
  display: grid; place-items: center; color: var(--muted); z-index: 3;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* ----- Cards ----- */
.card { background: var(--card); border-radius: 20px; overflow: hidden; }
.streak { padding: 12px 16px 10px; }
.streak-top { display: flex; justify-content: space-between; align-items: flex-start; }
.streak-kicker { font-size: 13px; font-weight: 550; color: var(--muted); }
.streak-num { font-size: 46px; font-weight: 700; letter-spacing: -0.06em; line-height: 0.92; margin-top: 1px; }
.streak-unit { font-size: 15px; font-weight: 600; letter-spacing: -0.03em; margin-top: 1px; }
.streak-right { text-align: right; padding-top: 2px; }
.rec { font-size: 12px; font-weight: 550; color: var(--muted); }
.today-progress { margin-top: 6px; font-size: 13px; font-weight: 550; color: var(--muted); }
.today-progress .up { color: var(--green); font-weight: 650; }
.bar { margin-top: 6px; height: 4px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--green); transition: width .25s ease; }

.week { display: flex; justify-content: space-between; padding: 8px 2px 2px; border-top: 1px solid var(--line); margin-top: 10px; }
.day { width: 40px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.day .wd { font-size: 11px; font-weight: 550; color: var(--muted); letter-spacing: 0.01em; }
.day .dn { font-size: 13px; font-weight: 650; letter-spacing: -0.02em; line-height: 1; }
.dot { width: 20px; height: 20px; border-radius: 50%; background: var(--track); display: grid; place-items: center; margin-top: 1px; }
.dot.done { background: var(--green); }
.dot.today { background: var(--card); box-shadow: inset 0 0 0 2.2px var(--today-ring); }
.day.is-today .wd, .day.is-today .dn { color: var(--text); font-weight: 700; }
.day.is-today .dn { color: var(--today-ring); }

.card-h { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px 4px; }
.card-h .h { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.card-h .more { font-size: 13px; font-weight: 550; color: var(--blue); }

/* Habit rows */
.row { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 12px; min-height: 56px; }
.row + .row { border-top: 1px solid var(--line); }
.row .mid { flex: 1; min-width: 0; text-align: left; padding: 2px 0; }
.check {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 1.6px solid #D1D1D6; display: grid; place-items: center; background: transparent;
}
:root[data-theme="neon"] .check { border-color: rgba(255,255,255,0.25); }
.row.done .check { background: var(--green); border-color: var(--green); }
.check.busy { opacity: .5; }
.ico {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: var(--ibg, var(--soft)); display: grid; place-items: center;
  font-size: 19px; line-height: 1; color: var(--ifg, var(--text));
}
.ico svg { display: block; }
.nm { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm { margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm .ok { color: var(--green); font-weight: 600; }
.sm .part { color: var(--text-2); font-weight: 600; }
.streak-pill { flex: none; display: flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 30px; justify-content: flex-end; }
.streak-pill .n { font-variant-numeric: tabular-nums; }
.row.done .streak-pill .n { color: var(--flame); }
.empty { padding: 18px 16px; color: var(--muted); font-size: 14px; line-height: 1.4; text-align: center; }

/* ----- Plan ----- */
.cat-hint { display: flex; align-items: center; gap: 8px; padding: 2px 44px 2px 4px; }
.cat-hint .sparky-sm { position: relative; width: 64px; height: 64px; flex: none; }
.cat-hint .sparky-sm img { width: 64px; height: 64px; object-fit: contain; display: block; }
.cat-hint .htxt { flex: 1; font-size: 14px; font-weight: 550; letter-spacing: -0.02em; line-height: 1.35; color: var(--text); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 16px; background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 550; letter-spacing: -0.01em; display: grid; place-items: center; white-space: nowrap;
}
.chip.on { background: var(--text); color: var(--bg); font-weight: 600; }
.span-dates { margin-top: 6px; padding: 0 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: -0.01em; }
.draft-pill { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 600; }

.grid-card { padding-bottom: 4px; }
.grid-head, .grid-row {
  display: grid;
  grid-template-columns: 22px 32px minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.9fr);
  column-gap: 8px;
  align-items: center;
  padding: 9px 14px 8px;
}
.grid-head { padding: 8px 14px 2px; align-items: end; }
.grid-head span { font-size: 11px; font-weight: 550; color: var(--muted); text-align: right; }
.grid-head .h-day { color: #1C8A5A; font-weight: 650; }
:root[data-theme="neon"] .grid-head .h-day { color: var(--green); }
.grid-row + .grid-row { border-top: 1px solid var(--line); }
.grid-row .mid { grid-column: 3 / 6; min-width: 0; padding-bottom: 3px; }
.grid-row .menu-check, .grid-row .ico { grid-row: 1 / 3; }
.menu-check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--green); justify-self: center; }
.grid-row .ico { width: 32px; height: 32px; font-size: 17px; }
.grid-row .nm { font-size: 15.5px; font-weight: 650; white-space: normal; overflow: visible; }
.numcol { text-align: right; font-variant-numeric: tabular-nums; min-width: 0; }
.numcol .v { font-size: 14px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.numcol .u { margin-top: 1px; font-size: 10px; font-weight: 500; color: var(--muted); }
.numcol.day .v { font-size: 16px; font-weight: 700; }

/* ----- Tab bar ----- */
.tabbar {
  position: sticky; bottom: 0;
  flex: none;
  background: var(--tabbar-bg);
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  display: flex;
  padding: 4px 8px calc(14px + var(--tg-safe-area-inset-bottom, 0px));
  backdrop-filter: blur(12px);
  z-index: 5;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 4px; color: var(--tab-idle); }
.tab.active { color: var(--tab-active); }
.tab .label { font-size: 10px; font-weight: 550; letter-spacing: -0.01em; }
.tab.soon-tab { opacity: .55; }

/* ----- Sheets ----- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 0 16px calc(20px + var(--tg-safe-area-inset-bottom, 0px));
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: #D1D1D6; margin: 8px auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 0 0 12px; }
.sheet-head .titles { flex: 1; min-width: 0; }
.sheet-head .nm { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.sheet-head .sm { font-size: 13px; color: var(--muted); }
.sheet-close { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; flex: none; }
.sheet-block { padding: 12px 0; border-top: 1px solid var(--line); }
.slabel { font-size: 13px; font-weight: 550; color: var(--muted); margin-bottom: 8px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  min-width: 64px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--soft);
  font-size: 15px; font-weight: 650; letter-spacing: -0.02em; display: grid; place-items: center;
}
.preset.accent { background: var(--green-soft); color: #1C8A5A; }
:root[data-theme="neon"] .preset.accent { color: var(--green); }
.custom-row { display: flex; gap: 8px; margin-top: 8px; }
.custom-row input {
  flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--soft-2); color: var(--text); padding: 0 12px; font: inherit; font-size: 16px;
}
.btn-primary {
  height: 48px; border-radius: 14px; background: var(--green); color: #fff;
  font-size: 16px; font-weight: 650; letter-spacing: -0.02em; display: grid; place-items: center; padding: 0 18px;
}
.btn-secondary {
  height: 44px; border-radius: 12px; background: var(--soft); color: var(--text);
  font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px;
}
.entry { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 15px; }
.entry + .entry { border-top: 1px solid var(--line); }
.entry .undo-one { color: var(--blue); font-size: 14px; font-weight: 600; padding: 4px 0 4px 12px; }

.derived { display: flex; gap: 8px; margin-top: 4px; }
.derived .box { flex: 1; background: var(--soft-2); border-radius: 12px; padding: 10px 12px; }
.derived .box .k { font-size: 11.5px; font-weight: 550; color: var(--muted); }
.derived .box .v { margin-top: 2px; font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.derived .box .u { font-size: 13px; font-weight: 550; color: var(--muted); }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; text-align: left; width: 100%; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .t { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; }
.set-row .s { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 14px; }

/* home-screen prompt card */
.hs-card { background: var(--card); border-radius: 20px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.hs-card .txt { grid-column: 1 / 4; }
.hs-card .txt { flex: 1; min-width: 0; }
.hs-card .t { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; }
.hs-card .s { font-size: 12.5px; color: var(--muted); margin-top: 1px; line-height: 1.3; }
.hs-card .go { height: 34px; padding: 0 12px; border-radius: 10px; background: var(--green); color: #fff; font-size: 13px; font-weight: 650; }
.hs-card .later { color: var(--muted); font-size: 13px; font-weight: 550; padding: 6px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(90px + var(--tg-safe-area-inset-bottom, 0px));
  background: rgba(17, 17, 17, 0.9); color: #fff; padding: 10px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 550; z-index: 40; max-width: 90vw; text-align: center;
}
.state { padding: 60px 24px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.45; }
.state img { width: 120px; height: 120px; object-fit: contain; }
.state .btn-secondary { margin: 16px auto 0; display: inline-flex; }

/* small additions for the real app */
.sm .plan-note { color: var(--muted); font-weight: 500; margin-left: 4px; }
.soon-badge { display: inline-block; margin-left: 4px; font-size: 8px; font-weight: 600; color: var(--muted); vertical-align: top; }
.tabbar { position: sticky; }
.plan-title { font-size: 21px; font-weight: 700; letter-spacing: -0.04em; padding: 6px 4px 0; }

/* ----- Catalog (v2) ----- */
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; margin-top: 10px;
  border-radius: 12px; background: var(--card); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--text); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.chips-scroll { overflow-x: auto; margin: 10px -16px 0; padding: 0 16px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips.nowrap { flex-wrap: nowrap; width: max-content; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 6px 6px; }
.sec-h .sname { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sec-h .scount { font-size: 12px; font-weight: 600; color: var(--muted); }
.cgrid-head, .crow {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 0.9fr) minmax(0, 0.72fr) minmax(0, 0.58fr) 30px;
  column-gap: 6px; align-items: center; padding: 8px 12px 8px 12px;
}
.cgrid-head { padding-top: 10px; padding-bottom: 2px; }
.cgrid-head span { font-size: 11px; font-weight: 550; color: var(--muted); text-align: right; }
.cgrid-head .h-day { color: #1C8A5A; font-weight: 650; }
:root[data-theme="neon"] .cgrid-head .h-day { color: var(--green); }
.crow + .crow { border-top: 1px solid var(--line); }
.crow.extra-row { padding-top: 0; border-top: 0; margin-top: -4px; }
.cmid { display: flex; align-items: center; gap: 9px; min-width: 0; text-align: left; padding: 2px 0; }
.cmid .ico { width: 34px; height: 34px; border-radius: 10px; }
.cmid .ico svg { width: 21px; height: 21px; }
@media (max-width: 400px) {
  .cgrid-head, .crow { grid-template-columns: minmax(0, 2.1fr) minmax(0, 0.88fr) minmax(0, 0.7fr) minmax(0, 0.56fr) 30px; padding-left: 10px; padding-right: 10px; }
  .cmid { gap: 7px; }
  .cmid .ico { width: 30px; height: 30px; }
  .cmid .ico svg { width: 19px; height: 19px; }
  .extra-mid { padding-left: 37px; }
}
.ctxt { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.ctxt .nm { white-space: normal; overflow: visible; font-size: 14.5px; hyphens: manual; overflow-wrap: normal; word-break: normal; }
.cbadges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 7px; font-size: 10px; font-weight: 600; background: var(--soft); color: var(--muted); }
.badge.free { background: var(--green-soft); color: #1C8A5A; }
.badge.setup { background: #FFF3D6; color: #9A6B00; }
.extra-mid { padding-left: 43px; }
.extra-label { font-size: 12px; font-weight: 550; color: var(--muted); }
.ccol { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; min-width: 0; padding: 4px 2px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.ccol .v { font-size: 13.5px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; text-align: right; }
.ccol .u { font-size: 10px; font-weight: 500; color: var(--muted); }
.ccol.day .v { font-size: 15px; font-weight: 700; }
.ccol.extra .v { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ccol:not([disabled]):active, .numcol.edit:active { background: var(--soft); }
.add-btn { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--text); justify-self: end; }
.add-btn.added { background: var(--green); color: #fff; }
.cat-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 14px 0 4px; }

/* ----- Plan editable cells ----- */
.numcol.edit { padding: 3px 2px; border-radius: 8px; }
.ico-btn { display: grid; place-items: center; padding: 0; }
.grid-row.extra-row { padding-top: 0; border-top: 0 !important; margin-top: -6px; }
.grid-row.extra-row .numcol .v { font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ----- Shared target editor ----- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toggle-row .t { font-size: 15.5px; font-weight: 600; }
.toggle-row .s { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--track); position: relative; flex: none; transition: background .18s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: left .18s; }
.switch.on { background: var(--green); }
.switch.on i { left: 22px; }
.egrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ebox { display: block; background: var(--soft-2); border-radius: 12px; padding: 8px 10px; border: 1.5px solid transparent; }
.ebox.focus { border-color: var(--green); }
.ebox .k { display: block; font-size: 11.5px; font-weight: 550; color: var(--muted); }
.ein { display: flex; align-items: baseline; gap: 4px; margin-top: 2px; }
.einput { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 18px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); padding: 2px 0; }
.einput:disabled { color: var(--muted); }
.ein .u { font-size: 12px; font-weight: 550; color: var(--muted); flex: none; }
.edit-hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }

.pgrid .numcol { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.pgrid .numcol .v { font-size: 13.5px; }
.pgrid .numcol.day .v { font-size: 15px; }

.toast { display: flex; align-items: center; gap: 8px; }
.toast .toast-sep { opacity: .6; }
.toast .toast-action { color: #7CE39A; font: inherit; font-weight: 700; padding: 2px 2px; background: none; }
:root[data-theme="neon"] .toast .toast-action { color: var(--green); }

/* ----- Statistics ----- */
.stats-streak { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-top: 4px; }
.stats-streak .streak-sparky { width: 76px; height: 76px; object-fit: contain; flex: none; }
.ss-num { font-size: 40px; font-weight: 700; letter-spacing: -0.06em; line-height: 0.95; }
.ss-unit { font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
.stats-streak .rec { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stats-periods { margin-top: 12px; }
.stats-range { margin-top: 8px; padding: 0 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.heat-card, .pvf-card { margin-top: 12px; padding: 12px 14px 12px; }
.heat-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.heat-head .h { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.heat-n { font-size: 12.5px; font-weight: 600; color: var(--green); }
.heat-cal-wd, .heat-cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat-cal-wd span { text-align: center; font-size: 11px; color: var(--muted); font-weight: 550; padding-bottom: 4px; }
.heat-cal-days .hd { aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; }
.l0 { background: #E9E9EF; }
:root[data-theme="neon"] .l0 { background: rgba(255,255,255,0.08); }
.l1 { background: #D9F2DF; color: #1C6B36; }
.l2 { background: #A9E3B8; color: #145A2B; }
.l3 { background: #62CE7E; color: #fff; }
.l4 { background: #2FAF55; color: #fff; }
.heat-cal-days .hd.future, .hc.future { opacity: .45; }
.heat-cal-days .hd.outside, .hc.outside { visibility: hidden; }
.heat-cal-days .hd.today, .hc.today { box-shadow: inset 0 0 0 2px var(--today-ring); }
:root[data-theme="neon"] .l1 { background: rgba(46,240,208,.22); color: var(--text); }
:root[data-theme="neon"] .l2 { background: rgba(46,240,208,.42); color: var(--text); }
:root[data-theme="neon"] .l3 { background: rgba(46,240,208,.68); color: #04120F; }
:root[data-theme="neon"] .l4 { background: #2EF0D0; color: #04120F; }
.heat-scroll { overflow-x: auto; scrollbar-width: none; }
.heat-scroll::-webkit-scrollbar { display: none; }
.heat-grid-wrap { width: max-content; }
.heat-months { display: flex; padding-left: 22px; height: 16px; }
.heat-ml { width: 13px; flex: none; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: visible; }
.heat-months { display: flex; }
.heat-body { display: flex; }
.heat-wds { width: 22px; display: grid; grid-template-rows: repeat(7, 11px); gap: 2px; font-size: 9.5px; color: var(--muted); }
.heat-cols { display: flex; gap: 2px; }
.heat-col { display: grid; grid-template-rows: repeat(7, 11px); gap: 2px; }
.hc { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.heat-legend span { margin: 0 3px; }
.srow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; }
.srow + .srow { border-top: 1px solid var(--line); }
.srow.extra-row { padding-top: 4px; border-top: 0; margin-top: -6px; }
.srow .ico { width: 34px; height: 34px; }
.srow .ico svg { width: 21px; height: 21px; }
.ico-spacer { width: 34px; flex: none; }
.smid { flex: 1; min-width: 0; }
.stop { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.stop .nm { font-size: 15px; }
.sval { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sval .sof { color: var(--muted); font-weight: 500; }
.sval.sub { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.sbar { height: 6px; border-radius: 4px; background: var(--track); margin-top: 7px; overflow: hidden; }
.sbar > i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.sbar > i.behind { background: #F5A623; }
.sbar > i.ahead { background: var(--green); }
.sbot { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; font-weight: 600; }
.pace.ahead, .pace.on_track { color: #1C8A5A; }
.pace.behind { color: #D98A0B; }
.sbot .pct { color: var(--muted); margin-left: auto; }
.comm-card { padding: 12px 14px; }
.comm-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.comm-chips { margin-bottom: 6px; }
.crow-c { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.crow-c + .crow-c { border-top: 1px solid var(--line); }
.crow-c .ico { width: 32px; height: 32px; }
.crow-c .ico svg { width: 20px; height: 20px; }
.crow-c .nm { flex: 1; }
.cval { font-size: 14px; font-weight: 700; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.cextra { font-size: 11.5px; font-weight: 550; color: var(--muted); }

/* ---------- Awards (93 badges) ---------- */
.aw-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 10px; }
.aw-back { width: 36px; height: 36px; border-radius: 50%; background: var(--card); color: var(--text); display: grid; place-items: center; }
.aw-back-sp { width: 36px; }
.aw-top-title { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }

.aw-hero { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 20px; padding: 8px 14px 10px 6px; }
.aw-hero .sparky-sm { width: 80px; height: 80px; position: relative; flex: none; display: grid; place-items: center; }
.aw-hero .sparky-sm::before { content: ""; position: absolute; width: 62px; height: 62px; border-radius: 50%; background: radial-gradient(circle, var(--spark-glow) 0%, transparent 70%); top: 6px; }
.aw-hero .sparky-sm img { position: relative; width: 80px; height: 80px; object-fit: contain; display: block; }
.aw-hero .h-kicker { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.aw-hero .h-num { font-size: 32px; font-weight: 700; letter-spacing: -0.05em; line-height: 0.95; margin-top: 1px; color: var(--text); }
.aw-hero .h-num span { font-size: 16px; font-weight: 550; color: var(--muted); letter-spacing: -0.02em; }
.aw-hero .h-sub { margin-top: 4px; font-size: 12.5px; font-weight: 500; color: var(--text); opacity: 0.8; line-height: 1.35; }

.aw-sec { padding: 14px 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.aw-sec .sname { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.aw-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 0; background: var(--card); border-radius: 20px; padding: 14px 4px 12px; }
.aw-grid.show { grid-template-columns: repeat(4, 1fr); }
.aw-item { text-align: center; padding: 0 2px; background: none; color: var(--text); display: flex; flex-direction: column; align-items: center; }
.aw-name { margin-top: 6px; font-size: 11px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.aw-item.lock .aw-name { color: var(--muted); font-weight: 550; }
.aw-prog { margin-top: 1px; font-size: 10px; font-weight: 550; color: var(--muted); line-height: 1.2; }
.aw-item.next .aw-prog { color: var(--aw-next); font-weight: 650; }
.aw-all-btn { width: 100%; margin-top: 16px; }

/* Medal: metal ring by tier, tinted disc, line icon. Same silhouette on every tier of a ladder. */
:root { --aw-next: #C48A12; }
.medal {
  --ms: 64px; --ring-a: #E2A874; --ring-b: #A9642F; --disc: #FBEBDD; --ink: #8A4E22;
  width: var(--ms); height: var(--ms); border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(from 210deg, var(--ring-a), var(--ring-b), var(--ring-a), var(--ring-b), var(--ring-a));
  padding: calc(var(--ms) * 0.07); box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.medal.tier-silver { --ring-a: #E4E7EC; --ring-b: #9AA3AF; --disc: #F3F4F7; --ink: #56606B; }
.medal.tier-gold { --ring-a: #FFE08A; --ring-b: #D69A12; --disc: #FFF5D6; --ink: #9A7210; }
.medal.tier-legend { --ring-a: #C9B6FF; --ring-b: #6E4BE0; --disc: #F0EBFF; --ink: #5B3FD1; }
.medal-disc { width: 100%; height: 100%; border-radius: 50%; background: var(--disc); display: grid; place-items: center; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.medal-disc svg { width: 56%; height: 56%; display: block; }
.medal.locked { filter: grayscale(1); opacity: 0.45; }
.aw-item.next .medal { filter: none; opacity: 1; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px #E8A317; }

/* Catalog: collapsible discipline rows */
.chips-wrap { margin: 12px 0 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips-wrap::-webkit-scrollbar { display: none; }
.chips-wrap .chips { flex-wrap: nowrap; width: max-content; padding-right: 16px; }
.chips-wrap { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.aw-ladder { margin-top: 8px; }
.aw-lrow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 10px; background: none; color: var(--text); text-align: left; }
.aw-sec-ico { background: var(--soft); color: var(--text); }
.aw-lmid { flex: 1; min-width: 0; }
.aw-lname { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.aw-lsub { margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.25; }
.aw-lcount { font-size: 13px; font-weight: 550; color: var(--muted); flex: none; }
.aw-chev { color: var(--muted); flex: none; transition: transform 0.15s; }
.aw-ladder.open .aw-chev { transform: rotate(180deg); }
.aw-grid.ladder { background: none; border-top: 1px solid var(--line); border-radius: 0; padding: 12px 4px 12px; }

/* Badge card (sheet) */
.aw-close { position: absolute; top: 14px; right: 14px; }
.aw-big { display: flex; justify-content: center; margin: 14px 0 10px; }
.aw-sheet-title { text-align: center; font-size: 24px; font-weight: 750; letter-spacing: -0.03em; }
.aw-sheet-rare { text-align: center; font-size: 13px; font-weight: 650; margin-top: 4px; color: var(--aw-next); }
.aw-sheet-rare.r-common { color: #A9642F; }
.aw-sheet-rare.r-rare { color: #6B7682; }
.aw-sheet-rare.r-epic { color: #C48A12; }
.aw-sheet-rare.r-legend { color: #6E4BE0; }
.aw-sheet-desc { text-align: center; font-size: 14px; line-height: 1.4; margin: 10px 8px 0; color: var(--text); }
.aw-earned-on { text-align: center; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--green); }
.aw-progress-block { margin-top: 14px; background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.aw-progress-block .row { display: flex; justify-content: space-between; font-size: 13px; }
.aw-progress-block .lab { color: var(--muted); }
.aw-progress-block .val { font-weight: 650; }
.aw-progress-block .bar { height: 6px; margin-top: 8px; }
.aw-progress-block .bar i { background: var(--green); }
.aw-left-val { color: var(--aw-next) !important; }

/* Entry points */
.aw-home-medal { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 8px; margin-left: auto; background: none; color: var(--muted); }
.aw-home-n { font-size: 10px; font-weight: 600; }
.aw-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 10px; color: var(--text); text-align: left; }
.aw-row-meds { display: flex; flex: none; }
.aw-row-meds .medal + .medal { margin-left: -12px; }
.aw-row-mid { flex: 1; min-width: 0; }
.aw-row-t { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.aw-row-s { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.aw-row > svg { color: var(--muted); flex: none; }

/* Celebration */
.celebrate { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: grid; place-items: center; padding: 24px; }
.celebrate.hidden { display: none; }
.cel-card { position: relative; width: 100%; max-width: 340px; background: var(--card); color: var(--text); border-radius: 26px; padding: 18px 18px 18px; text-align: center; overflow: hidden; animation: cel-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes cel-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cel-sparky { width: 96px; height: 96px; object-fit: contain; }
.cel-kicker { font-size: 13px; font-weight: 650; color: var(--flame); margin-top: 2px; }
.cel-medal { display: flex; justify-content: center; margin: 10px 0 8px; }
.cel-medal .medal { animation: cel-medal 0.6s ease-out; }
@keyframes cel-medal { 0% { transform: rotate(-12deg) scale(0.6); } 60% { transform: rotate(6deg) scale(1.08); } 100% { transform: rotate(0) scale(1); } }
.cel-name { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.cel-actions { display: flex; gap: 8px; margin-top: 16px; }
.cel-actions .btn-secondary, .cel-actions .btn-primary { flex: 1; height: 46px; }
.cel-sparks { position: absolute; left: 50%; top: 150px; width: 0; height: 0; }
.cel-sparks i { position: absolute; width: 7px; height: 7px; border-radius: 2px; background: var(--flame); opacity: 0; animation: cel-spark 1.4s ease-out forwards; animation-delay: calc(var(--i) * 0.04s); transform: rotate(calc(var(--i) * 25.7deg)) translateY(-40px); }
.cel-sparks i:nth-child(3n) { background: var(--green); }
.cel-sparks i:nth-child(3n+1) { background: #E8A317; }
@keyframes cel-spark { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; transform: rotate(calc(var(--i) * 25.7deg)) translateY(-150px); } }
@media (prefers-reduced-motion: reduce) { .cel-card, .cel-medal .medal, .cel-sparks i { animation: none; } }

/* Home rows: no one-tap check circle; the whole row opens the log sheet. Completion is passive (green text). */
.row[data-open] { cursor: pointer; }
.preset.sel { background: var(--green); color: #fff; box-shadow: inset 0 0 0 2px var(--green); }
.btn-primary:disabled { opacity: 0.45; }
.extra-submit { width: 100%; margin-top: 10px; }
/* iOS Safari/WebKit only synthesises a click for taps on non-interactive elements if they have
   cursor: pointer — needed so a tap anywhere on a Home row opens the log sheet. */
.row[data-open], .row[data-open] * { cursor: pointer; }
