@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url("/fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("/fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 200 1000; font-display: swap; src: url("/fonts/nunito-latin-wght-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #fbf6ea;
  --surface: #ffffff;
  --surface-2: #f4eedf;
  --ink: #2e3a31;
  --muted: #6f7a70;
  --line: #e9e1cf;
  --track: #ece4d3;
  --accent: #4fae63;
  --accent-strong: #3b9450;
  --accent-soft: #e2f3df;
  --accent-ink: #ffffff;
  --sun: #ffd23f;
  --pink: #ff8fab;
  --sky: #6bc1f5;
  --warn: #ee9a45;
  --danger: #d9534f;
  --work: #5b8def;
  --work-soft: #e4ecfd;
  --life: #4fae63;
  --life-soft: #e2f3df;
  --dino-ink: #33413a;
  --shadow: 0 1px 0 rgba(46, 58, 49, 0.06), 0 6px 20px rgba(46, 58, 49, 0.07);
  --shadow-soft: rgba(46, 58, 49, 0.1);
  --radius: 20px;
  --radius-sm: 14px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar-h: 66px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161d18;
    --surface: #1f2921;
    --surface-2: #273229;
    --ink: #edf3ea;
    --muted: #a0aea2;
    --line: #314034;
    --track: #324036;
    --accent: #66c977;
    --accent-strong: #7ad78a;
    --accent-soft: #263d2b;
    --accent-ink: #10200f;
    --work: #7ea6f5;
    --work-soft: #233149;
    --life: #66c977;
    --life-soft: #263d2b;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-soft: rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161d18; --surface: #1f2921; --surface-2: #273229; --ink: #edf3ea; --muted: #a0aea2;
  --line: #314034; --track: #324036; --accent: #66c977; --accent-strong: #7ad78a; --accent-soft: #263d2b;
  --accent-ink: #10200f; --work: #7ea6f5; --work-soft: #233149; --life: #66c977; --life-soft: #263d2b;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --shadow-soft: rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 8px; }

#app { min-height: 100dvh; }
.main {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom));
}
.view { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.big { font-size: 1.6rem; text-align: center; }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 800; }
.error { color: var(--danger); font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

/* ---------- top bar & tabs ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  max-width: 560px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.topbar-dino { display: flex; align-items: center; gap: 8px; }
.lvl { display: flex; flex-direction: column; gap: 3px; font-family: var(--font-display); font-size: 0.9rem; }
.lvl .xp-bar { width: 74px; }
.topbar-title { font-size: 1.25rem; flex: 1; }
.topbar-stats { margin-left: auto; display: flex; gap: 6px; }
.pill-stat {
  font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
  background: var(--surface); border: 2px solid var(--line); border-radius: 999px;
  padding: 4px 11px; white-space: nowrap;
}
.pill-stat.off { border-color: var(--warn); }
.back { font-size: 1.8rem; line-height: 1; }

.xp-bar { display: block; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.xp-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--sun)); border-radius: inherit; transition: width 0.5s ease; }
.xp-bar.big { height: 14px; width: 100%; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 2px solid var(--line);
}
.tab {
  flex: 1; max-width: 112px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 14px; color: var(--muted);
  font-size: 0.75rem; font-weight: 800;
}
.tab-icon { font-size: 1.35rem; line-height: 1; filter: grayscale(0.6); opacity: 0.8; transition: transform 0.2s; }
.tab.on { color: var(--ink); background: var(--accent-soft); }
.tab.on .tab-icon { filter: none; opacity: 1; transform: translateY(-2px) scale(1.08); }

.fab {
  position: fixed; z-index: 25;
  right: max(16px, calc(50vw - 264px));
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 50%;
  border: 3px solid var(--dino-ink); background: var(--sun); color: var(--dino-ink);
  font-size: 2rem; font-weight: 700; line-height: 1;
  box-shadow: 0 4px 0 var(--dino-ink);
  transition: transform 0.1s;
}
.fab:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--dino-ink); }

/* ---------- buttons & inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px;
  border-radius: 14px; border: 2px solid transparent;
  font-weight: 800; font-size: 0.98rem;
  transition: transform 0.08s, background 0.2s, box-shadow 0.1s;
}
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-strong); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--accent-strong); }
.btn-soft { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost.danger, .danger { color: var(--danger); }
.btn-big { min-height: 54px; font-size: 1.08rem; border-radius: 18px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: 0.88rem; }
.link { background: none; border: 0; padding: 4px 0; color: var(--accent-strong); font-weight: 800; font-size: 0.92rem; }
.icon-btn {
  background: none; border: 0; min-width: 36px; height: 36px; border-radius: 10px;
  display: inline-grid; place-items: center; color: var(--muted); font-size: 1rem;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.3; }
.pill {
  border: 2px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 14px; font-weight: 800; min-height: 38px;
}
.pill:active { background: var(--accent-soft); }
.pill:disabled { opacity: 0.4; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions.center { justify-content: center; }

input:not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%; min-height: 46px;
  padding: 10px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface);
  outline: none; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 0; }
.title-input { font-size: 1.15rem; font-weight: 700; }
.search { margin-bottom: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.field-label { font-weight: 800; font-size: 0.9rem; }
.field-hint { font-size: 0.82rem; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date-row { display: flex; gap: 4px; align-items: center; }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 2px solid var(--line); border-radius: 16px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 12px;
  padding: 9px 6px; font-weight: 800; font-size: 0.92rem; color: var(--muted); white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-sm button { font-size: 0.82rem; padding: 7px 4px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex-shrink: 0; border: 2px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 0.88rem; white-space: nowrap;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); }
.chip-ghost { border-style: dashed; }

.toggle { border: 2px solid var(--line); background: var(--surface); border-radius: 14px; min-height: 46px; padding: 8px 14px; font-weight: 800; text-align: left; }
.toggle.on { background: var(--accent-soft); border-color: var(--accent); }

.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 1.3rem; font-weight: 800; }
.stepper input { width: 84px !important; text-align: center; font-weight: 800; }
.stepper-suffix { color: var(--muted); font-weight: 700; }

.emoji-input { display: flex; flex-direction: column; gap: 8px; }
.emoji-current { width: 64px !important; font-size: 1.6rem; text-align: center; padding: 4px !important; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji-row button { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; background: var(--surface-2); font-size: 1.2rem; }
.emoji-row button.on { border-color: var(--accent); }
.emoji-mini { width: 56px !important; text-align: center; font-size: 1.2rem; }

/* ---------- cards & lists ---------- */

.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2 { font-size: 1.12rem; }
.badge { font-family: var(--font-display); font-weight: 600; background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.section-title h2 { font-size: 1.15rem; }

.list { display: flex; flex-direction: column; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 0; border-bottom: 1.5px solid var(--line); background: transparent; text-align: left; width: 100%;
}
.list-row:last-child { border-bottom: 0; }
.list-row small { display: block; }
.link-row { flex: 1; background: none; border: 0; text-align: left; padding: 0; display: flex; flex-direction: column; }
.habit-row.off { opacity: 0.55; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 12px; }
.empty h3 { font-size: 1.1rem; }
.empty p { color: var(--muted); max-width: 32ch; }

/* ---------- home ---------- */

.hero { display: flex; align-items: flex-end; gap: 4px; padding-top: 4px; }
.hero-dino { flex-shrink: 0; cursor: pointer; }
.bubble {
  position: relative; flex: 1; margin-bottom: 40px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 20px 20px 20px 6px;
  padding: 12px 14px; box-shadow: var(--shadow); font-weight: 700;
}
.bubble::before {
  content: ""; position: absolute; left: -10px; bottom: 10px; width: 16px; height: 16px;
  background: var(--surface); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line);
  transform: rotate(45deg); border-radius: 0 0 0 4px;
}
.bubble-name { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--muted); font-weight: 800; }

.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-nav .icon-btn { font-size: 1.6rem; width: 44px; height: 44px; }
.day-nav-label { text-align: center; display: flex; flex-direction: column; }
.day-nav-label strong { font-family: var(--font-display); font-size: 1.2rem; }
.day-nav-label span { color: var(--muted); font-size: 0.85rem; }

.day-meter { display: flex; align-items: center; gap: 10px; }
.day-meter-bar { flex: 1; height: 12px; background: var(--track); border-radius: 99px; overflow: hidden; }
.day-meter-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--sun)); border-radius: inherit; transition: width 0.5s ease; }
.day-meter.good .day-meter-bar span { background: linear-gradient(90deg, var(--accent), var(--sun)); }
.day-meter-text { font-weight: 800; font-size: 0.88rem; white-space: nowrap; }

.top3-card { border-color: color-mix(in srgb, var(--sun) 60%, var(--line)); }
.empty-pick { border: 2px dashed var(--line); background: var(--surface-2); border-radius: 16px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.empty-pick span { color: var(--muted); font-size: 0.9rem; }
.win { font-weight: 800; color: var(--accent-strong); text-align: center; }

.habit-list { display: flex; flex-direction: column; gap: 10px; }
.habit {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: border-color 0.2s, background 0.2s;
}
.habit.done { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.habit-head, .habit-check {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; background: none; border: 0; text-align: left;
}
.habit-check { border: 2px solid var(--line); }
.habit-check.done { border-color: var(--accent); }
.habit-emoji { font-size: 1.7rem; width: 40px; text-align: center; flex-shrink: 0; }
.habit-name { flex: 1; font-weight: 800; display: flex; flex-direction: column; }
.habit-name small { font-weight: 700; color: var(--muted); font-size: 0.82rem; }
.habit-progress { width: 56px; height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; flex-shrink: 0; }
.habit-progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.3s; }
.habit-items { display: flex; flex-direction: column; padding: 0 10px 10px; gap: 4px; }
.habit-item {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 8px;
  border: 0; background: transparent; border-radius: 12px; font-weight: 700;
}
.habit-item.on { background: var(--accent-soft); }
.habit-count { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 14px 12px; }
.chev { color: var(--muted); font-size: 1.1rem; }

.week-dots { display: flex; gap: 6px; padding: 0 14px 10px; }
.card .week-dots { padding: 0; }
.dot {
  flex: 1; aspect-ratio: 1; max-width: 42px; display: grid; place-items: center;
  border-radius: 50%; background: var(--track); font-weight: 800; font-size: 0.8rem; color: var(--muted);
}
.dot.on { background: var(--accent); color: var(--accent-ink); }
.dot.sel { outline: 3px solid var(--sun); outline-offset: 1px; }
.dot.future { opacity: 0.45; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
}
.quick strong { display: block; font-size: 0.95rem; line-height: 1.2; }
.quick small { color: var(--muted); font-weight: 700; }
.quick-emoji { font-size: 1.8rem; }
.quick-sos { background: color-mix(in srgb, var(--pink) 18%, var(--surface)); border-color: color-mix(in srgb, var(--pink) 45%, var(--line)); }
.quick-focus { background: color-mix(in srgb, var(--sun) 22%, var(--surface)); border-color: color-mix(in srgb, var(--sun) 55%, var(--line)); }
.pending-card { flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
.pending-card > div { display: flex; flex-direction: column; }
.tip { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 700; color: var(--muted); }

/* ---------- tasks ---------- */

.area-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.area-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface);
  font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; color: var(--muted);
}
.area-emoji { font-size: 1.4rem; }
.area-btn-trabajo.on { background: var(--work-soft); border-color: var(--work); color: var(--ink); }
.area-btn-vida.on { background: var(--life-soft); border-color: var(--life); color: var(--ink); }
.area-trabajo .btn-primary { background: var(--work); box-shadow: 0 3px 0 color-mix(in srgb, var(--work) 70%, #000); }

.quick-add { display: flex; gap: 8px; }
.quick-add input { flex: 1; }
.quick-add .btn { min-width: 52px; font-size: 1.4rem; padding: 0 12px; }
.quick-add-sm .btn { min-width: 44px; font-size: 1.1rem; }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); cursor: pointer;
  transition: opacity 0.3s, transform 0.2s;
}
.card .task { background: var(--surface-2); }
.task.important { border-left: 6px solid var(--sun); }
.task.done { opacity: 0.6; }
.task.done .task-title { text-decoration: line-through; text-decoration-thickness: 2px; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 800; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.8rem; color: var(--muted); font-weight: 700; margin-top: 2px; }
.task-meta .late { color: var(--warn); }

.check {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--muted); background: var(--surface); padding: 0;
  display: grid; place-items: center; transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.check svg { width: 18px; height: 18px; fill: none; stroke: var(--accent-ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.5); transition: 0.2s; }
.check.on, .task.done .check, .habit.done > .check, .habit-check.done .check { background: var(--accent); border-color: var(--accent); }
.check.on svg, .task.done .check svg, .habit-check.done .check svg { opacity: 1; transform: scale(1); }
.check:active { transform: scale(0.88); }
.check-sm { width: 24px; height: 24px; border-width: 2.5px; }
.check-sm svg { width: 14px; height: 14px; }
.struck { text-decoration: line-through; color: var(--muted); }

.steps { display: flex; flex-direction: column; gap: 6px; }
.step { display: flex; align-items: center; gap: 8px; }
.step > span { flex: 1; font-weight: 700; }
.step input { flex: 1; }

.cat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cat-row { display: flex; gap: 6px; align-items: center; }

.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
}
.pick.on { border-color: var(--sun); background: color-mix(in srgb, var(--sun) 16%, var(--surface)); }
.pick-mark {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600;
}
.pick.on .pick-mark { background: var(--sun); border-color: var(--dino-ink); color: var(--dino-ink); }
.pick-title { flex: 1; font-weight: 700; }
.pick-when { font-size: 0.78rem; color: var(--muted); font-weight: 800; }

/* ---------- sheet ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 22, 0.45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh;
  background: var(--bg); border-radius: 26px 26px 0 0;
  display: flex; flex-direction: column; animation: up 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.sheet-tall { height: 88dvh; }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 4px; }
.sheet-head h2 { font-size: 1.25rem; }
.sheet-body > * { flex-shrink: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.sheet-foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); background: var(--surface); }
.sheet-foot .btn-primary { margin-left: auto; min-width: 120px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40%); opacity: 0.4; } }

/* ---------- toasts, confetti, celebrations ---------- */

.toasts { position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--bg); font-weight: 800; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); animation: toast-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); max-width: calc(100vw - 32px);
}
.toast-reward { background: var(--sun); color: var(--dino-ink); font-family: var(--font-display); font-size: 1.1rem; border: 2px solid var(--dino-ink); }
.toast-error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(-16px) scale(0.8); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 90; pointer-events: none; }

.celebrate { position: fixed; inset: 0; z-index: 80; background: rgba(20, 28, 22, 0.55); display: grid; place-items: center; padding: 16px; animation: fade 0.2s; }
.celebrate-card {
  background: var(--surface); border: 3px solid var(--dino-ink); border-radius: 28px; padding: 24px 20px;
  width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  box-shadow: 0 8px 0 var(--dino-ink); animation: pop-in 0.4s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.celebrate-card h2 { font-size: 1.6rem; }
.celebrate-card p { color: var(--muted); font-weight: 700; }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } }

/* ---------- dino animations ---------- */

.dino { display: block; overflow: visible; }
.anim-bob .dino-body { animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.anim-jump .dino-body { animation: jump 1.4s cubic-bezier(0.3, 0, 0.3, 1) infinite; transform-origin: 50% 100%; }
.anim-wobble { animation: wobble 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.anim-bob .dino-arm, .anim-jump .dino-arm { animation: wave 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 30% 90%; }
.dino-zzz { font-family: var(--font-display); font-size: 26px; font-weight: 600; animation: zzz 2.5s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-3px) scaleY(1.02); } }
@keyframes jump { 0%, 60%, 100% { transform: translateY(0) scale(1, 1); } 10% { transform: translateY(0) scale(1.06, 0.94); } 30% { transform: translateY(-16px) scale(0.97, 1.04); } 50% { transform: translateY(0) scale(1.04, 0.96); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-6deg); } 30% { transform: rotate(5deg); } 45% { transform: rotate(-3deg); } 60% { transform: rotate(0); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
@keyframes zzz { 0%, 100% { opacity: 0.2; transform: translate(0, 0); } 50% { opacity: 1; transform: translate(4px, -6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- loading / auth / onboarding ---------- */

.loading { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; font-family: var(--font-display); font-size: 1.1rem; color: var(--muted); }
.auth, .onboarding { max-width: 440px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 16px 32px; display: flex; flex-direction: column; gap: 18px; min-height: 100dvh; justify-content: center; }
.auth-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.logo { font-size: 2.4rem; letter-spacing: -0.01em; }
.auth-card { gap: 14px; }
.onb-step { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.onb-step .field { width: 100%; }
.onb-list { width: 100%; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.color-pick { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.color-opt { width: 64px; height: 64px; border-radius: 18px; border: 3px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.color-opt.on { border-color: var(--dino-ink); background: var(--accent-soft); transform: scale(1.06); }
.profile-preview { display: flex; justify-content: center; }

/* ---------- focus ---------- */

.focus-view { align-items: center; text-align: center; padding-top: 8px; }
.focus-view .field { width: 100%; text-align: left; }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring > svg { position: absolute; inset: 0; }
.ring-arc { transition: stroke-dashoffset 0.6s ease; }
.ring-label { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ring-label strong { font-family: var(--font-display); font-size: 1.5rem; }
.ring-label small { color: var(--muted); font-weight: 700; font-size: 0.78rem; }
.timer { font-family: var(--font-display); font-size: 3.6rem; font-weight: 600; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.focus-task { font-weight: 800; font-size: 1.05rem; }
.duration-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dur {
  width: 62px; height: 66px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.dur strong { font-family: var(--font-display); font-size: 1.4rem; }
.dur small { color: var(--muted); font-weight: 800; font-size: 0.72rem; }
.dur.on { border-color: var(--dino-ink); background: var(--sun); color: var(--dino-ink); }
.dur.on small { color: var(--dino-ink); }

.breathe { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 8px; }
.breath-circle {
  width: 210px; height: 210px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, color-mix(in srgb, var(--sky) 45%, transparent) 0%, color-mix(in srgb, var(--sky) 15%, transparent) 70%);
  transition: transform var(--ms) ease-in-out; transform: scale(0.72);
}
.breath-circle.in, .breath-circle.hold { transform: scale(1); }
.breath-circle.out { transform: scale(0.72); }
.breath-label { font-family: var(--font-display); font-size: 1.8rem; }
.ideas { display: flex; flex-direction: column; gap: 8px; }
.idea { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px; font-weight: 700; }
.idea span { font-size: 1.4rem; }

/* ---------- rewards ---------- */

.wallet { display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--sun) 20%, var(--surface)); border: 2px solid color-mix(in srgb, var(--sun) 60%, var(--line)); border-radius: var(--radius); padding: 14px; }
.wallet-amount { font-family: var(--font-display); font-size: 2.2rem; font-weight: 600; line-height: 1.1; }
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.reward { position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; box-shadow: var(--shadow); }
.reward.can { border-color: var(--accent); }
.reward-edit { position: absolute; top: 4px; right: 4px; font-size: 0.85rem; }
.reward-emoji { font-size: 2.4rem; }
.reward-name { font-size: 0.95rem; line-height: 1.2; min-height: 2.4em; display: grid; place-items: center; }
.reward-cost { font-family: var(--font-display); font-weight: 600; }
.reward-bar { display: block; width: 100%; height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; }
.reward-bar > span { display: block; height: 100%; background: var(--sun); border-radius: inherit; }

/* ---------- more / settings ---------- */

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-tile { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.menu-tile strong { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.menu-tile small { color: var(--muted); font-weight: 700; }
.menu-emoji { font-size: 2rem; margin-bottom: 4px; }

/* ---------- progress ---------- */

.dino-card { align-items: center; text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat strong { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.stat span { font-size: 0.74rem; color: var(--muted); font-weight: 700; line-height: 1.2; }
.heatmap { display: flex; gap: 4px; justify-content: space-between; }
.heat-col { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.heat { display: block; aspect-ratio: 1; border-radius: 5px; background: var(--track); }
.heat.good { background: var(--accent); }
.heat.saved { background: var(--sun); }
.heat.some { background: color-mix(in srgb, var(--accent) 35%, var(--track)); }
.heat.future, .heat.before { background: transparent; border: 1.5px dashed var(--line); }
.heat-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.heat-legend .heat { width: 12px; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.ach { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; opacity: 0.55; }
.ach.got { opacity: 1; border-color: var(--sun); background: color-mix(in srgb, var(--sun) 12%, var(--surface)); }
.ach-emoji { font-size: 1.8rem; }
.ach strong { font-size: 0.82rem; line-height: 1.2; }
.ach small { font-size: 0.7rem; color: var(--muted); line-height: 1.2; }
.stage-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.stage { flex-shrink: 0; width: 96px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 8px 4px; }
.stage strong { font-size: 0.75rem; line-height: 1.2; }
.stage small { font-size: 0.7rem; color: var(--muted); }
.stage.locked .dino { filter: grayscale(1) brightness(0.9); opacity: 0.4; }

/* ---------- gym ---------- */

.routine-list { display: flex; flex-direction: column; gap: 8px; }
.routine { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 10px 10px 14px; }
.routine-main { flex: 1; text-align: left; background: none; border: 0; padding: 0; display: flex; flex-direction: column; }
.exercises { display: flex; flex-direction: column; gap: 10px; }
.exercise { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.exercise-head { display: flex; gap: 4px; align-items: center; }
.exercise-name { font-weight: 800; }
.sets { display: flex; flex-direction: column; gap: 6px; }
.set { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.set label { display: flex; align-items: center; gap: 4px; }
.set input { width: 68px !important; min-height: 40px !important; padding: 6px 8px !important; text-align: center; font-weight: 800; color: var(--ink); }
.set-n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 0.75rem; flex-shrink: 0; }
.paste { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.paste summary { font-weight: 800; cursor: pointer; }
.paste textarea { margin: 10px 0; }

/* ---------- food ---------- */

.kcal-card { flex-direction: row; align-items: center; gap: 16px; }
.kcal-info { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.meal { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.meal-head { display: flex; align-items: center; gap: 8px; }
.meal-head h3 { font-size: 1.02rem; flex: 1; }
.meal-row { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem; }
.meal-row > span:first-child { flex: 1; }
.ingredients { display: flex; flex-direction: column; gap: 6px; }
.ingredient { display: grid; grid-template-columns: 1fr 72px 72px auto; gap: 6px; align-items: center; }
.ingredient input { padding: 8px !important; }
.kcal-preview { text-align: center; background: var(--accent-soft); border-radius: 14px; padding: 10px; }
.quick-meal { border-top: 2px dashed var(--line); padding-top: 12px; }

/* ---------- reading & phone ---------- */

.reading-today { flex-direction: row; align-items: center; gap: 16px; }
.reading-today .habit-count { padding: 0; }
.bars { position: relative; display: flex; gap: 6px; align-items: flex-end; height: 120px; padding: 0 2px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-col small { font-size: 0.7rem; color: var(--muted); font-weight: 800; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.bar { display: block; width: 100%; background: color-mix(in srgb, var(--accent) 55%, var(--track)); border-radius: 8px 8px 0 0; min-height: 2px; transition: height 0.4s; }
.bar.ok { background: var(--accent); }
.bar.over { background: var(--warn); }
.bars-14 { gap: 3px; }
.bar-goal { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--danger); z-index: 1; pointer-events: none; }
.book { gap: 8px; }
.book-main { display: flex; gap: 12px; align-items: center; background: none; border: 0; padding: 0; text-align: left; }
.book-main span:last-child { display: flex; flex-direction: column; }
.book-cover { font-size: 2rem; }
.book-progress { display: flex; flex-direction: column; gap: 4px; }
.book-progress small { color: var(--muted); font-weight: 700; }
.tips { display: flex; flex-direction: column; gap: 8px; }
.tip-card { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.tip-card summary { font-weight: 800; cursor: pointer; }
.tip-card p { margin-top: 8px; color: var(--muted); font-weight: 600; }

@media (min-width: 600px) {
  .main { padding-top: 16px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- casa ---------- */

.casa-card { border-color: color-mix(in srgb, var(--sky) 55%, var(--line)); background: color-mix(in srgb, var(--sky) 10%, var(--surface)); }
.casa-card.done { flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.casa-done { font-weight: 800; }
.casa-tip { font-weight: 700; }
.casa-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  border: 2px dashed color-mix(in srgb, var(--sky) 60%, var(--line)); background: color-mix(in srgb, var(--sky) 10%, var(--surface));
  border-radius: 16px; padding: 10px 14px; font-weight: 800; text-align: left;
}
.house-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.house-level {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px;
  border: 2px solid var(--line); background: var(--surface); border-radius: 14px;
}
.house-level span { font-size: 1.5rem; line-height: 1.1; }
.house-level small { font-size: 0.68rem; font-weight: 800; color: var(--muted); }
.house-level.on { border-color: var(--sky); background: color-mix(in srgb, var(--sky) 18%, var(--surface)); }
.habit-progress.wide { width: 100%; height: 10px; }
.chore-list { display: flex; flex-direction: column; gap: 8px; }
.chore { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
.chore.done { opacity: 0.6; }
.chore.late { border-left: 6px solid var(--warn); }
.chore-main { flex: 1; display: flex; flex-direction: column; text-align: left; background: none; border: 0; padding: 0; }
.chore-name { font-weight: 800; }
.chore-meta { color: var(--muted); font-weight: 700; font-size: 0.8rem; }
.chore.late .chore-meta { color: var(--warn); }

/* ---------- dino picker ---------- */

.pick-btn { border-style: dashed; }
.pick-hero { display: flex; align-items: center; gap: 12px; }
.pick-hero h3 { font-size: 1.2rem; margin: 2px 0 4px; overflow-wrap: anywhere; }

/* ---------- pomodoro ---------- */

.pomo-rounds { display: flex; gap: 6px; justify-content: center; font-size: 1.5rem; }
.pomo-dot { opacity: 0.45; transition: transform 0.2s, opacity 0.2s; }
.pomo-dot.now { opacity: 1; transform: scale(1.2); }
.pomo-dot.done { opacity: 1; }
.pomo-plan { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.pomo-tune { width: 100%; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 4px 14px 12px; }

/* ---------- notifications ---------- */

.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.reminders { display: flex; flex-direction: column; gap: 8px; }
.reminder { display: flex; align-items: center; gap: 10px; }
.reminder.off .reminder-title { color: var(--muted); }
.reminder-title { flex: 1; font-weight: 700; font-size: 0.9rem; }
.reminder input[type="time"] { width: 112px !important; min-height: 40px; padding: 6px 8px; }
.switch { flex-shrink: 0; width: 46px; height: 28px; border-radius: 99px; border: 0; background: var(--track); position: relative; padding: 0; transition: background 0.2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(18px); }

/* ---------- exercise catalog ---------- */

.ex-group { gap: 4px; padding: 12px 14px; }
.ex-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border: 0; border-top: 1.5px solid var(--line); background: none; text-align: left; width: 100%; }
.ex-name { font-weight: 700; }
.ex-kg { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.pick:disabled { opacity: 0.5; }
