
:root {
  --bg: #0b1020;
  --surface: #131b2e;
  --surface2: #19233a;
  --line: rgba(190, 202, 255, 0.11);
  --text: #f2f4ff;
  --muted: #a0abc5;
  --purple: #a99aff;
  --blue: #82c9ff;
  --green: #8ce3c1;
  --orange: #ffc18c;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #070b15;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #070b15;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 0%, rgba(97, 100, 189, 0.16), transparent 35%),
    var(--bg);
  border-inline: 1px solid rgba(255, 255, 255, 0.035);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  padding: 12px 20px;
  background: rgba(11, 16, 32, 0.9);
  border-bottom: 1px solid rgba(190, 202, 255, 0.06);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.moon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(174, 160, 255, 0.28);
  border-radius: 15px;
  color: #d5cbff;
  background: linear-gradient(145deg, #262848, #141b30);
  font-size: 25px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 18px;
}

.page {
  display: none;
  padding: 22px 19px 112px;
  animation: enter 0.25s ease both;
}

.page.active {
  display: block;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome {
  padding: 19px 1px 22px;
}

.eyebrow {
  display: inline-block;
  color: #aaa8e4;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.6;
}

h1 {
  margin: 17px 0 14px;
  font-size: clamp(34px, 9vw, 43px);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

h1 span {
  color: #b3a7ff;
}

h2 {
  margin: 8px 0 10px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

h3 {
  margin: 10px 0;
  font-size: 17px;
}

p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.welcome > p,
.page-heading > p {
  max-width: 340px;
}

.night-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(175, 166, 255, 0.2);
  border-radius: 25px;
  background:
    radial-gradient(circle at 85% 10%, rgba(133, 124, 255, 0.22), transparent 35%),
    linear-gradient(145deg, #242746, #141a30 65%, #101a2c);
}

.night-card::after {
  position: absolute;
  top: -30px;
  right: -25px;
  width: 135px;
  height: 135px;
  border: 1px solid rgba(191, 183, 255, 0.16);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 17px rgba(179, 164, 255, 0.025), 0 0 0 36px rgba(179, 164, 255, 0.02);
  pointer-events: none;
}

.stars {
  position: absolute;
  top: 20px;
  right: 22px;
  color: #c6c0ff;
  font-size: 18px;
  opacity: 0.75;
}

.night-card h2 {
  margin: 15px 0 10px;
  font-size: 26px;
  line-height: 1.2;
}

.night-card p {
  max-width: 240px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
  transition: transform 0.15s, background 0.15s;
}

.primary-btn {
  border: 1px solid rgba(213, 207, 255, 0.25);
  background: linear-gradient(110deg, #8b80db, #656fb9);
  color: white;
  box-shadow: 0 7px 24px rgba(97, 103, 190, 0.18);
}

.primary-btn span {
  font-size: 17px;
}

.primary-btn:active,
.secondary-btn:active,
.danger-btn:active {
  transform: scale(0.98);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
}

.danger-btn {
  border: 1px solid rgba(255, 132, 153, 0.2);
  background: rgba(100, 36, 56, 0.22);
  color: #ffb4c1;
}

.full-btn {
  width: 100%;
  margin-top: 12px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 28px 0 15px;
}

.section-title h2 {
  margin-bottom: 0;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 11px;
  font-weight: 700;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 163px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(150deg, rgba(26, 35, 57, 0.98), rgba(17, 25, 43, 0.98));
  text-align: left;
  transition: border-color 0.2s, transform 0.2s;
}

.quick-card:hover {
  border-color: rgba(169, 154, 255, 0.4);
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 13px;
  font-size: 21px;
}

.purple {
  color: #c5b5ff;
  background: rgba(139, 117, 233, 0.16);
}

.blue {
  color: #92d9ff;
  background: rgba(90, 177, 240, 0.14);
}

.green {
  color: #8de4c3;
  background: rgba(76, 185, 144, 0.14);
}

.orange {
  color: #ffc59a;
  background: rgba(231, 153, 94, 0.14);
}

.quick-card strong {
  padding-right: 3px;
  font-size: 12px;
  line-height: 1.5;
}

.quick-card small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.card-arrow {
  position: absolute;
  top: 17px;
  right: 14px;
  color: #9da4c6;
  font-size: 15px;
}

.tip-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(144, 164, 225, 0.14);
  border-radius: 19px;
  background: rgba(20, 28, 47, 0.82);
}

.tip-label {
  color: #a7b9ff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.tip-card p {
  margin: 10px 0 0;
  color: #c1c8dd;
  font-size: 12px;
}

.progress-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.progress-line {
  height: 6px;
  overflow: hidden;
  border-radius: 10px;
  background: #283149;
}

.progress-line span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8c82df, #8be0cb);
  transition: width 0.25s;
}

.progress-card p {
  margin: 11px 0;
  font-size: 11px;
}

.progress-card strong {
  color: white;
}

.disclaimer {
  margin: 25px 0 0;
  color: #808ca8;
  font-size: 10px;
}

.page-heading {
  padding: 12px 0 18px;
}

.page-heading h1 {
  margin-top: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.search > span {
  color: var(--purple);
  font-size: 24px;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 12px;
}

.doc-list {
  display: grid;
  gap: 10px;
  margin-top: 17px;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  text-align: left;
}

.doc-card .quick-icon {
  flex: 0 0 auto;
  margin: 0;
}

.doc-card-copy {
  flex: 1;
  min-width: 0;
}

.doc-card-copy strong,
.doc-card-copy small {
  display: block;
}

.doc-card-copy strong {
  font-size: 12px;
}

.doc-card-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.doc-arrow {
  color: #b9b0ed;
  font-size: 18px;
}

.back-link {
  margin: 0 0 18px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 12px;
}

.article-content h1 {
  font-size: 32px;
}

.article-content h2 {
  margin-top: 27px;
  font-size: 17px;
}

.article-content h3 {
  margin-top: 20px;
  font-size: 13px;
}

.article-content p,
.article-content li {
  color: #bdc6dc;
  font-size: 12px;
  line-height: 1.85;
}

.article-content ul,
.article-content ol {
  padding-left: 20px;
}

.article-content li {
  padding-left: 3px;
  margin: 7px 0;
}

.article-content .article-lead {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: #e3e7f8;
}

.article-content .callout {
  margin: 18px 0;
  padding: 14px;
  border-left: 3px solid #9e91ef;
  border-radius: 0 12px 12px 0;
  background: rgba(105, 98, 171, 0.1);
}

.article-content .callout p {
  margin: 0;
}

.article-content a {
  color: #a9d7ff;
  overflow-wrap: anywhere;
}

.routine-date {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 11px;
}

.routine-list {
  display: grid;
  gap: 10px;
}

.routine-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
}

.routine-item input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #9b91e7;
}

.routine-item strong {
  display: block;
  font-size: 12px;
}

.routine-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.routine-item.done {
  border-color: rgba(125, 210, 185, 0.22);
  background: rgba(43, 93, 81, 0.15);
}

.breathing-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 36%, rgba(119, 125, 224, 0.16), transparent 45%),
    var(--surface);
  text-align: center;
}

.breathing-card h2 {
  margin-top: 23px;
}

.breathing-card > p {
  max-width: 265px;
  margin: 0 auto;
}

.breathing-orb {
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  margin: 22px auto;
  border: 1px solid rgba(181, 169, 255, 0.5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(134, 125, 220, 0.28), rgba(74, 100, 154, 0.12) 60%, transparent);
  box-shadow: 0 0 40px rgba(130, 121, 220, 0.1), inset 0 0 25px rgba(130, 121, 220, 0.1);
  transition: transform 4s ease-in-out, border-color 1s;
}

.breathing-orb span {
  font-size: 13px;
  font-weight: 700;
}

.breathing-orb.inhale {
  transform: scale(1.18);
  border-color: #a7b6ff;
}

.breathing-orb.exhale {
  transform: scale(0.9);
  border-color: #8ddfd0;
}

.timer {
  margin: 15px 0;
  color: #e1e1ff;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.button-row {
  display: flex;
  gap: 8px;
}

.button-row button {
  flex: 1;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
}

.tool-row .quick-icon {
  flex: 0 0 auto;
  margin: 0;
}

.tool-row > span:nth-child(2) {
  flex: 1;
}

.tool-row strong,
.tool-row small {
  display: block;
}

.tool-row strong {
  font-size: 11px;
}

.tool-row small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.form-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.form-card label {
  display: block;
  margin-bottom: 15px;
  color: #dfe5fa;
  font-size: 11px;
  font-weight: 650;
}

.form-card input,
.form-card select,
.form-card textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  padding: 10px;
  border: 1px solid rgba(186, 199, 241, 0.14);
  border-radius: 11px;
  color: var(--text);
  background: #10182b;
  font-size: 12px;
}

.form-card textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-message {
  min-height: 16px;
  font-size: 11px;
}

.history-list {
  display: grid;
  gap: 9px;
}

.history-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.history-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.history-item strong {
  font-size: 12px;
}

.history-item header span,
.history-item p {
  color: var(--muted);
  font-size: 10px;
}

.history-item p {
  margin: 5px 0 0;
}

.history-item button {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #ffb3c0;
  font-size: 10px;
}

.subheading {
  margin-top: 25px;
  font-size: 16px;
}

.source-link {
  display: block;
  margin-top: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: #b9d9ff;
  font-size: 11px;
  line-height: 1.5;
  text-decoration: none;
}

.body-copy {
  font-size: 12px;
  line-height: 1.8;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(398px, calc(100% - 24px));
  padding: 8px 6px;
  border: 1px solid rgba(191, 201, 255, 0.14);
  border-radius: 21px;
  background: rgba(19, 27, 46, 0.95);
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(22px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 49px;
  border: 0;
  border-radius: 14px;
  color: #8793af;
  background: transparent;
}

.nav-item > span {
  font-size: 21px;
  line-height: 1;
}

.nav-item small {
  font-size: 9px;
}

.nav-item.active {
  color: #e3ddff;
  background: rgba(147, 135, 221, 0.16);
}

.nav-item.active > span {
  color: #c5baff;
}

@media (min-width: 600px) {
  body {
    padding: 22px 0;
  }

  .app {
    height: min(900px, calc(100vh - 44px));
    min-height: 650px;
    border: 1px solid rgba(190, 202, 255, 0.12);
    border-radius: 30px;
  }

  .page {
    height: calc(100% - 74px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333c59 transparent;
  }

  .bottom-nav {
    position: absolute;
    bottom: 12px;
    width: calc(100% - 30px);
  }
}

@media (max-width: 350px) {
  .page {
    padding-inline: 14px;
  }

  .topbar {
    padding-inline: 14px;
  }

  .quick-card {
    padding: 11px;
  }

  .quick-card strong {
    font-size: 11px;
  }

  .breathing-orb {
    width: 130px;
    height: 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
