:root {
  color-scheme: dark;
  --bg: #090b15;
  --surface: rgba(24, 27, 46, 0.82);
  --surface-solid: #171a2b;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f6f2eb;
  --muted: #9899aa;
  --dream: #a5a3ff;
  --dream-soft: rgba(127, 122, 255, 0.15);
  --regret: #e1a7bd;
  --regret-soft: rgba(207, 119, 152, 0.14);
  --future: #93d5bf;
  --future-soft: rgba(97, 191, 158, 0.14);
  --danger: #f19a9a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 80% -10%, rgba(100, 88, 180, 0.22), transparent 35%),
    radial-gradient(circle at -10% 35%, rgba(48, 99, 110, 0.13), transparent 32%),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(75px);
  pointer-events: none;
  opacity: .25;
}

.ambient-one { width: 220px; height: 220px; top: 120px; right: -130px; background: #766edc; }
.ambient-two { width: 180px; height: 180px; bottom: 100px; left: -120px; background: #5ba88c; }

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 18px) 18px calc(104px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  margin-bottom: 20px;
}

.topbar h1, .section-heading h2, .sheet-header h2 {
  margin: 3px 0 0;
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: -.04em;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  width: 43px;
  height: 43px;
  padding: 10px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  -webkit-tap-highlight-color: transparent;
}

.icon-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }

.view { display: none; animation: appear .28s ease both; }
.view.active { display: block; }

@keyframes appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.hero-card {
  position: relative;
  min-height: 280px;
  padding: 30px 25px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(58, 56, 99, .75), rgba(24, 28, 50, .92)),
    var(--surface-solid);
  box-shadow: 0 24px 60px rgba(0,0,0,.27);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  top: -95px;
  right: -65px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}

.hero-kicker { margin: 0 0 17px; color: #bebbea; font-size: 12px; letter-spacing: .1em; }

.hero-card h2 {
  position: relative;
  z-index: 2;
  max-width: 310px;
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 500;
  line-height: 1.42;
  letter-spacing: .02em;
}

.hero-copy { position: absolute; z-index: 2; bottom: 24px; margin: 0; color: #aaa9bd; font-size: 13px; }
.hero-orbit { position: absolute; right: 24px; bottom: 24px; width: 96px; height: 96px; }

.hero-moon {
  position: absolute;
  width: 76px;
  height: 76px;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #d9d6f7, #908bd0);
  box-shadow: 0 0 35px rgba(181, 176, 246, .28);
}

.hero-moon::after {
  content: "";
  position: absolute;
  width: 67px;
  height: 67px;
  top: -9px;
  left: -9px;
  border-radius: 50%;
  background: #343455;
}

.hero-star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; box-shadow: 0 0 7px #fff; }
.star-one { top: 2px; left: 12px; }
.star-two { top: 27px; right: 1px; }
.star-three { bottom: 3px; left: 2px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 31px 2px 14px;
}

.section-heading h2 { font-size: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }

.stat-card {
  display: flex;
  min-width: 0;
  min-height: 126px;
  padding: 14px 12px;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 22px;
  text-align: left;
}

.dream-tint { background: linear-gradient(145deg, var(--dream-soft), rgba(255,255,255,.025)); }
.regret-tint { background: linear-gradient(145deg, var(--regret-soft), rgba(255,255,255,.025)); }
.future-tint { background: linear-gradient(145deg, var(--future-soft), rgba(255,255,255,.025)); }

.stat-symbol { margin-bottom: auto; font-size: 22px; }
.stat-card:nth-child(1) .stat-symbol { color: var(--dream); }
.stat-card:nth-child(2) .stat-symbol { color: var(--regret); }
.stat-card:nth-child(3) .stat-symbol { color: var(--future); }
.stat-card strong { font-size: 29px; line-height: 1; letter-spacing: -.05em; }
.stat-card span:last-child { margin-top: 5px; color: var(--muted); font-size: 11px; }

.quick-grid { display: grid; gap: 9px; }

.quick-card {
  display: grid;
  grid-template-columns: 45px 1fr 18px;
  gap: 13px;
  align-items: center;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  text-align: left;
  background: rgba(255,255,255,.035);
}

.quick-icon {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 14px;
  font-size: 20px;
}

.dream-icon { color: var(--dream); background: var(--dream-soft); }
.regret-icon { color: var(--regret); background: var(--regret-soft); }
.future-icon { color: var(--future); background: var(--future-soft); }
.quick-card strong, .quick-card small { display: block; }
.quick-card strong { font-size: 14px; }
.quick-card small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.chevron { color: #6d6e7d; font-size: 25px; font-weight: 200; }

.section-intro {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.intro-symbol { width: 34px; font-size: 29px; text-align: center; }
.section-intro strong, .section-intro small { display: block; }
.section-intro strong { font-size: 14px; }
.section-intro small { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.filter-row {
  display: flex;
  gap: 7px;
  margin: 19px -18px 16px;
  padding: 0 18px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  font-size: 11px;
}
.filter-chip.active { color: var(--text); border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.09); }

.progress-card {
  margin-top: 13px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
}
.progress-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.progress-top strong { color: var(--future); }
.progress-track { height: 4px; margin-top: 11px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.07); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--future); transition: width .35s ease; }

.entry-list { display: grid; gap: 10px; }

.entry-card {
  position: relative;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.032);
}
.entry-card[data-type="dream"] { border-left: 2px solid rgba(165,163,255,.65); }
.entry-card[data-type="regret"] { border-left: 2px solid rgba(225,167,189,.62); }
.entry-card[data-type="future"] { border-left: 2px solid rgba(147,213,191,.62); }
.entry-card.done { opacity: .58; }
.entry-card.done h3 { text-decoration: line-through; }

.entry-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.entry-card h3 { margin: 2px 0 0; font-size: 15px; line-height: 1.45; }
.entry-card p { display: -webkit-box; margin: 10px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.65; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.entry-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 13px; }
.meta-tag { padding: 5px 8px; border-radius: 999px; color: #b6b6c3; background: rgba(255,255,255,.055); font-size: 10px; }

.entry-menu {
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255,255,255,.05);
}

.future-check {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(147,213,191,.45);
  border-radius: 50%;
  color: transparent;
  background: transparent;
}
.future-check.checked { color: #0d221b; background: var(--future); }

.empty-state {
  padding: 55px 25px;
  border: 1px dashed rgba(255,255,255,.1);
  border-radius: 24px;
  color: var(--muted);
  text-align: center;
}
.empty-state span { display: block; margin-bottom: 13px; color: #77788a; font-family: serif; font-size: 38px; }
.empty-state strong { display: block; color: #bbb9c3; font-size: 14px; }
.empty-state small { display: block; margin-top: 7px; font-size: 11px; line-height: 1.6; }

.fab {
  position: fixed;
  z-index: 5;
  right: max(20px, calc((100vw - 520px) / 2));
  bottom: calc(88px + var(--safe-bottom));
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 12px 17px 12px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  font-size: 12px;
  font-weight: 700;
}
.fab span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: rgba(0,0,0,.13); font-size: 18px; line-height: 1; }
.dream-fab { background: #7773c8; }
.regret-fab { background: #b8758f; }
.future-fab { color: #10241d; background: #82c3aa; }

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 12px;
  bottom: calc(10px + var(--safe-bottom));
  left: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 536px;
  height: 70px;
  margin: 0 auto;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  background: rgba(21,23,39,.88);
  box-shadow: 0 18px 50px rgba(0,0,0,.42);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.nav-item {
  display: flex;
  gap: 4px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 17px;
  color: #777888;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.nav-item span { font-size: 18px; line-height: 1; }
.nav-item small { font-size: 9px; font-weight: 700; letter-spacing: .06em; }
.nav-item.active { color: #e7e3ef; background: rgba(255,255,255,.065); }

.sheet {
  width: min(100%, 560px);
  max-height: 92vh;
  margin: auto auto 0;
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 30px 30px 0 0;
  color: var(--text);
  background: #131624;
  box-shadow: 0 -20px 70px rgba(0,0,0,.55);
}
.sheet::backdrop { background: rgba(3,4,8,.7); backdrop-filter: blur(4px); }
.sheet[open] { animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(35px); } to { opacity: 1; transform: none; } }

.sheet form, .sheet-static { padding: 10px 18px calc(20px + var(--safe-bottom)); }
.sheet-handle { width: 35px; height: 4px; margin: 0 auto 21px; border-radius: 99px; background: rgba(255,255,255,.17); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.sheet-header .icon-button { border: 0; font-size: 25px; font-weight: 200; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; margin: 0 0 7px 3px; color: #b8b7c3; font-size: 11px; font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 13px 14px;
  outline: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--text);
  background: rgba(255,255,255,.045);
  font-size: 14px;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(165,163,255,.5); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 9px; margin-top: 24px; }
.primary-button, .danger-button {
  min-height: 49px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
}
.primary-button { flex: 1; color: #181825; background: #ddd9ec; }
.danger-button { color: var(--danger); background: rgba(241,154,154,.08); }
.hidden { display: none !important; }

.settings-card {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 15px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.03);
}
.settings-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 13px; color: var(--dream); background: var(--dream-soft); }
.settings-card strong, .settings-card small { display: block; }
.settings-card strong { font-size: 13px; }
.settings-card small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.settings-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: #d5d2dd;
  background: transparent;
  font-size: 13px;
}
.danger-text { color: var(--danger); }

.toast {
  position: fixed;
  z-index: 50;
  bottom: calc(100px + var(--safe-bottom));
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 15px;
  transform: translate(-50%, 15px);
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  color: #e6e3ec;
  background: #242738;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  font-size: 11px;
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 650px) {
  .app-shell { padding-top: 30px; }
  .bottom-nav { bottom: 18px; }
  .sheet { margin-bottom: 14px; border-radius: 30px; }
}
