:root {
  color-scheme: light;
  --bg: #f3eff8;
  --surface: #fffdfa;
  --surface-soft: #fbf7f1;
  --ink: #151936;
  --muted: #72748a;
  --line: rgba(40, 32, 60, 0.12);
  --purple: #7651da;
  --purple-dark: #20135b;
  --lavender: #ece2ff;
  --pink: #ffe6e8;
  --mint: #dcf5e8;
  --peach: #fff0cc;
  --blue: #e0efff;
  --shadow: 0 26px 70px rgba(45, 33, 84, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 8%, rgba(126, 90, 215, 0.16), transparent 32%),
    radial-gradient(circle at 84% 20%, rgba(255, 166, 187, 0.18), transparent 30%),
    linear-gradient(120deg, #f8f1fb, #fffaf1 45%, #f4effd);
  color: var(--ink);
  font-family: "Nunito Sans", Arial, "Helvetica Neue", Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-stage {
  display: grid;
  min-height: 100svh;
  place-items: center;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 24px 16px;
}

.phone {
  display: none;
  position: relative;
  overflow: hidden;
  width: min(100%, 390px);
  min-height: 620px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
}

.app-phone {
  flex-direction: column;
  padding: 22px 18px 76px;
}

.phone.active {
  display: flex;
}

.phone:not(.active) {
  display: none;
}

.dark-phone {
  color: #fff;
  background:
    radial-gradient(circle at 80% 20%, rgba(130, 104, 227, 0.52), transparent 28%),
    linear-gradient(160deg, #17114b, #2e1778 58%, #15134c);
}

.phone h1,
.phone h2,
.phone h3,
.phone p {
  margin-top: 0;
}

.phone h1 {
  max-width: 220px;
  margin-inline: auto;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.42;
  text-align: center;
}

.phone h2 {
  margin-bottom: 4px;
  font-size: 1.35rem;
  line-height: 1.16;
}

.phone h3 {
  margin-bottom: 0;
  font-size: 0.98rem;
}

.subcopy {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.subcopy.light {
  color: rgba(255, 255, 255, 0.78);
}

.phone-header,
.section-title,
.routine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.phone-header {
  min-height: 38px;
  margin-bottom: 12px;
}

.phone-header > div {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f5f0eb;
  color: var(--ink);
  font-weight: 850;
}

.icon-button.dark {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.primary-button,
.glass-button,
.ghost-button,
.lavender-button,
.filter,
.tabs button,
.link-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(180deg, #9069f0, #6844d4);
  color: #fff;
  box-shadow: 0 12px 26px rgba(91, 61, 188, 0.24);
}

.glass-button {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ghost-button,
.filter,
.tabs button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.lavender-button,
.filter.active,
.tabs button.active {
  background: var(--lavender);
  color: #5533bd;
}

.wide {
  width: 100%;
}

.link-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--purple);
}

.welcome-phone {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 28px 22px;
}

.welcome-copy {
  position: relative;
  z-index: 2;
  margin-bottom: auto;
  padding-top: 110px;
  text-align: center;
}

.spark {
  color: #fff;
  margin-bottom: 16px;
  font-size: 2rem;
  font-weight: 900;
}

.night-sky {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 11%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 42% 6%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 76% 14%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 62% 35%, #ffd78c 0 1px, transparent 2px),
    radial-gradient(circle at 20% 31%, rgba(255,255,255,0.7) 0 1px, transparent 2px);
  opacity: 0.9;
}

.landscape,
.reward-landscape {
  position: absolute;
  inset: auto 0 110px;
  height: 210px;
  background:
    radial-gradient(circle at 22% 62%, rgba(134, 82, 213, 0.7), transparent 22%),
    radial-gradient(circle at 82% 48%, rgba(255, 175, 151, 0.7), transparent 20%),
    linear-gradient(170deg, transparent 38%, rgba(106, 72, 185, 0.62) 39% 57%, transparent 58%),
    linear-gradient(150deg, transparent 48%, rgba(31, 38, 103, 0.86) 49% 66%, transparent 67%),
    linear-gradient(180deg, transparent, rgba(8, 11, 47, 0.72));
}

.moon {
  position: absolute;
  right: 34px;
  top: 4px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #ffe0a5;
  box-shadow: 0 0 40px rgba(255, 223, 161, 0.48);
}

.streak-card {
  display: grid;
  grid-template-columns: 1fr 86px;
  align-items: center;
  min-height: 106px;
  margin: 16px 0;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(120deg, #fff2e2, #f0d8ff);
}

.streak-card span,
.streak-card small,
.task-item small,
.suggestion-card small,
.routine-head span,
.brain-result small {
  color: var(--muted);
  font-size: 0.74rem;
}

.streak-card strong {
  display: inline-block;
  margin-top: 12px;
  font-size: 2rem;
}

.flame {
  width: 82px;
  height: 82px;
  border-radius: 52% 52% 54% 54%;
  background:
    radial-gradient(circle at 52% 58%, #ffd86e 0 18%, transparent 20%),
    radial-gradient(circle at 50% 64%, #ff9e56 0 34%, transparent 36%),
    linear-gradient(135deg, #ff6b62, #ffbd64);
  clip-path: polygon(50% 0, 72% 28%, 88% 58%, 70% 100%, 30% 100%, 12% 58%, 34% 30%);
}

.soft-card,
.action-row,
.suggestion-card,
.task-item,
.routine-item,
.reward-hero,
.stats-grid article,
.brain-result {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.soft-card {
  padding: 14px;
}

.mini-title,
.tiny-task {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mini-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.tiny-task {
  min-height: 22px;
  font-size: 0.84rem;
}

.mini-check,
.task-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1.5px solid #c4c1cf;
  border-radius: 999px;
  background: transparent;
}

.mini-check.checked,
.task-item.completed .task-check {
  background: var(--purple);
  border-color: var(--purple);
}

.stacked-actions,
.suggestion-list,
.task-list,
.routine-list,
.brain-results {
  display: grid;
  gap: 10px;
}

.stacked-actions {
  margin-top: 12px;
}

.action-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
}

.action-row small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.quick {
  margin-top: 12px;
}

.badge,
.task-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 900;
}

.badge.warm,
.flag-orange {
  background: #fff0d9;
  color: #e57232;
}

.badge.cool,
.flag-blue {
  background: #e6edff;
  color: #3a67d7;
}

.flag-red {
  background: #ffe5e6;
  color: #db4e58;
}

.tabs,
.filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 16px 0;
  padding: 4px;
  border-radius: 16px;
  background: #f2eee9;
}

.tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tabs button,
.filter {
  min-height: 34px;
  border-radius: 12px;
  padding: 0 8px;
  font-size: 0.76rem;
}

.mascot.cloud {
  align-self: flex-end;
  width: 104px;
  height: 76px;
  margin: -10px 42px 0 0;
  border-radius: 48px;
  background:
    radial-gradient(circle at 72% 34%, #b58cff 0 28%, transparent 30%),
    radial-gradient(circle at 42% 26%, #caadff 0 33%, transparent 34%),
    radial-gradient(circle at 46% 62%, #9472e8 0 47%, transparent 49%);
  box-shadow: 0 18px 32px rgba(119, 83, 217, 0.16);
}

.suggestion-card {
  display: grid;
  grid-template-columns: 54px 1fr 34px;
  gap: 10px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
}

.suggestion-card .xp {
  grid-column: 2 / 4;
  justify-self: end;
  color: #138077;
  font-size: 0.72rem;
  font-weight: 800;
}

.time-pill,
.count-pill {
  display: inline-grid;
  min-width: 42px;
  min-height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #dbf4e6;
  color: #177552;
  font-size: 0.72rem;
  font-weight: 850;
}

.focus-phone {
  min-height: 620px;
  padding: 22px 18px;
  text-align: center;
}

.focus-phone select {
  position: relative;
  z-index: 2;
  width: 120px;
  min-height: 36px;
  margin: 6px auto 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
}

.timer-ring {
  position: relative;
  display: grid;
  width: 210px;
  height: 210px;
  place-items: center;
  margin: 20px auto;
  border-radius: 999px;
  background:
    conic-gradient(from -18deg, #ffbe7d 0 27%, rgba(255,255,255,0.12) 27% 100%),
    radial-gradient(circle, rgba(60, 39, 142, 0.92) 0 62%, transparent 63%);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.04), 0 20px 44px rgba(0, 0, 0, 0.22);
}

.timer-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: linear-gradient(160deg, #412189, #2d1c73);
}

.timer-ring span {
  position: relative;
  z-index: 1;
  font-size: 3.25rem;
  font-weight: 900;
}

.focus-phone h3,
.focus-controls,
.focus-tools,
.focus-phone .phone-header {
  position: relative;
  z-index: 2;
}

.focus-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.focus-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: auto;
}

.focus-tools button {
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.72rem;
}

.section-title {
  margin: 12px 0 10px;
}

.task-list {
  overflow: auto;
  padding-right: 2px;
}

.task-item {
  display: grid;
  grid-template-columns: 24px 34px 1fr 34px;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 10px 4px 10px 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
}

.task-item.completed {
  opacity: 0.5;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.week-strip span {
  display: grid;
  min-height: 54px;
  place-items: center;
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.week-strip span.active {
  background: var(--lavender);
  color: #5533bd;
}

.timeline {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px 10px;
  align-items: start;
}

.timeline > span {
  color: var(--muted);
  font-size: 0.76rem;
}

.event {
  min-height: 58px;
  padding: 12px;
  border-left: 4px solid #9f86f4;
  border-radius: 10px;
  font-weight: 800;
}

.event small {
  color: #494265;
  font-weight: 650;
}

.event.purple { background: #eadfff; }
.event.mint { background: var(--mint); border-left-color: #71c7a0; }
.event.peach { background: var(--peach); border-left-color: #f2bd62; }

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

textarea {
  min-height: 210px;
  padding: 16px;
  resize: vertical;
  line-height: 1.45;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

.brain-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.brain-result {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px;
}

.routine-item {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.habit-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.habit-dots span {
  height: 22px;
  border-radius: 8px;
  background: #f0ece6;
}

.habit-dots span.filled {
  background: #bde9d4;
}

.reward-hero {
  min-height: 150px;
  margin: 12px 0 18px;
  padding: 16px;
  color: #fff;
  background:
    linear-gradient(rgba(96, 68, 202, 0.42), rgba(54, 31, 141, 0.48)),
    linear-gradient(140deg, #8d6aec, #f0a06e);
}

.reward-hero strong,
.reward-hero span {
  position: relative;
  z-index: 2;
  display: block;
}

.reward-landscape {
  position: relative;
  inset: auto;
  height: 78px;
  margin: 8px -16px 4px;
  opacity: 0.9;
}

progress {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.38);
}

progress::-webkit-progress-value {
  background: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.stats-grid article,
.profile-stats article {
  padding: 14px;
}

.stats-grid strong,
.profile-stats strong {
  display: block;
  font-size: 1.1rem;
}

.stats-grid span,
.profile-stats span {
  color: var(--muted);
  font-size: 0.72rem;
}

.badge-row {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.badge-row span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(160deg, #b891ff, #6bc5e8);
  color: #fff;
  font-weight: 900;
}

.profile-phone {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 18px 76px;
  text-align: center;
}

.avatar {
  position: relative;
  z-index: 2;
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  margin-top: 22px;
  border: 4px solid rgba(255,255,255,0.72);
  border-radius: 999px;
  background: linear-gradient(160deg, #ffcfab, #9b6bf0);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
}

.profile-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 28px;
}

.profile-reward-link {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 850;
}

.profile-stats article,
.mood-chart {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.profile-stats span {
  color: rgba(255, 255, 255, 0.78);
}

.mood-chart {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 150px;
  margin-top: 22px;
  padding: 16px;
  text-align: left;
}

.chart-line {
  height: 76px;
  margin-top: 18px;
  background:
    radial-gradient(circle at 10% 52%, #ffbd7f 0 4px, transparent 5px),
    radial-gradient(circle at 26% 38%, #ffa0d0 0 4px, transparent 5px),
    radial-gradient(circle at 42% 62%, #a98bff 0 4px, transparent 5px),
    radial-gradient(circle at 58% 48%, #9fd8cc 0 4px, transparent 5px),
    radial-gradient(circle at 72% 70%, #69d8d5 0 4px, transparent 5px),
    radial-gradient(circle at 86% 42%, #ffbd7f 0 4px, transparent 5px),
    linear-gradient(165deg, transparent 47%, #ffbd7f 48% 50%, transparent 51%),
    linear-gradient(18deg, transparent 48%, #a98bff 49% 51%, transparent 52%);
  border-radius: 12px;
}

.bottom-nav {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  min-height: 62px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.86);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.bottom-nav button.active {
  color: var(--purple);
}

.bottom-nav .fab {
  align-self: center;
  justify-self: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: linear-gradient(180deg, #9069f0, #6844d4);
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 10px 22px rgba(72, 46, 165, 0.28);
}

.dark-nav {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(20, 14, 68, 0.78);
}

.dark-nav button {
  color: #fff;
}

dialog {
  width: min(560px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(20, 14, 68, 0.28);
}

dialog::backdrop {
  background: rgba(22, 18, 48, 0.42);
}

.capture-form {
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.eyebrow,
label span {
  display: block;
  margin-bottom: 6px;
  color: var(--purple);
  font-size: 0.78rem;
  font-weight: 850;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.empty-state.small {
  padding: 8px;
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }

  .app-stage {
    width: 100%;
    padding: 0;
  }

  .phone {
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .form-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  menu,
  .brain-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
