/* ThoughtPark styles: night and morning themes, one calm centered column. */

:root {
  --radius: 18px;
  --gap: 16px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --release-ms: 1500ms;
  --morning-release-ms: 1300ms;
  --park-ms: 450ms;
  --enter-ms: 320ms;
  font-size: 18px;
}

body[data-theme="night"] {
  --bg: #0e1424;
  --surface: #18203a;
  --surface-2: #212a48;
  --text: #e7e4da;
  --muted: #9aa0b4;
  --accent: #f2cf7a;
  --accent-ink: #1b1a14;
  --line: rgba(231, 228, 218, .12);
  --glow: rgba(242, 207, 122, .18);
}

body[data-theme="morning"] {
  --bg: #f7efe4;
  --surface: #fffaf3;
  --surface-2: #efe3d2;
  --text: #2b2a33;
  --muted: #6f6a73;
  --accent: #d9a441;
  --accent-ink: #231c0c;
  --line: rgba(43, 42, 51, .1);
  --glow: rgba(217, 164, 65, .25);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 600ms var(--ease), color 600ms var(--ease);
}

button, textarea { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Night sky ---------------------------------------------------------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.sky-decor, .sky-stars { position: absolute; inset: 0; transition: opacity 1600ms var(--ease); }

.sky-dot {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #cfd6ee;
  animation: twinkle 6s ease-in-out infinite;
}
@keyframes twinkle { 50% { opacity: .08; } }

.sky-star {
  --d: calc(var(--size, 4px) * 1.6);
  position: absolute;
  width: var(--d);
  height: var(--d);
  margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  border-radius: 50%;
  background: #fff6d8;
  box-shadow: 0 0 8px 3px rgba(242, 207, 122, .6), 0 0 28px 8px rgba(242, 207, 122, .22);
  animation: glow 5s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: 0 0 10px 4px rgba(242, 207, 122, .75), 0 0 36px 12px rgba(242, 207, 122, .3); } }
.sky-star { pointer-events: auto; cursor: pointer; }
/* A bigger invisible target so small stars are easy to hover or tap. */
.sky-star::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; }
.sky-star:hover, .sky-star.is-active { transform: scale(1.6); transition: transform 250ms var(--ease); }
body[data-theme="morning"] .sky-star { pointer-events: none; }

.sky-star.is-new { animation: star-in 1200ms var(--ease) both, glow 5s ease-in-out 1200ms infinite; }
@keyframes star-in {
  0%   { opacity: 0; transform: scale(.2); }
  60%  { opacity: 1; transform: scale(1.8); }
  100% { opacity: 1; transform: scale(1); }
}

.sky-shooting {
  position: absolute;
  width: 140px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 246, 216, 0), #fff6d8);
  transform: rotate(-25deg);
  transform-origin: right center;
  animation: shoot 1300ms var(--ease) forwards;
}
@keyframes shoot {
  0%   { opacity: 0; translate: 0 0; }
  15%  { opacity: 1; }
  100% { opacity: 0; translate: -320px 150px; }
}

/* Sunrise: the glow rises and the stars fade when morning arrives. */
.sky-sun {
  position: absolute;
  left: 50%;
  bottom: -60vh;
  width: 140vmax;
  height: 90vh;
  translate: -50% 40vh;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 120, .55), rgba(255, 170, 110, .18) 55%, transparent);
  opacity: 0;
  transition: translate 2200ms var(--ease), opacity 2200ms var(--ease);
}
body[data-theme="morning"] .sky-sun { translate: -50% 0; opacity: .7; }

/* Moon (night) and sun (morning) share a spot in the upper right. At sunrise
   the moon sets and the sun rises. */
.sky-moon, .sky-sun-disc {
  position: absolute;
  top: 78px;
  right: max(8vw, 28px);
  transition: translate 2400ms var(--ease), opacity 2000ms var(--ease), scale 800ms var(--ease);
}
.sky-moon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  /* The crescent is the shadow of a transparent circle. */
  box-shadow: 13px 7px 0 0 #f4dfa6;
  filter: drop-shadow(0 0 14px rgba(242, 207, 122, .55)) drop-shadow(0 0 40px rgba(242, 207, 122, .25));
  translate: -13px -7px;
}
body[data-theme="morning"] .sky-moon { translate: -13px 40vh; opacity: 0; }

.sky-sun-disc {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, #fff3c4, #ffd36b 45%, #f6a93b 100%);
  box-shadow: 0 0 30px 10px rgba(255, 196, 90, .55), 0 0 90px 30px rgba(255, 180, 80, .3);
  translate: 0 45vh;
  opacity: 0;
}
.sky-sun-disc::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 200, 90, .55) 0 6deg, transparent 6deg 24deg);
  -webkit-mask: radial-gradient(closest-side, transparent 58%, #000 62%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 58%, #000 62%, transparent 100%);
  animation: sun-rays 40s linear infinite;
}
@keyframes sun-rays { to { rotate: 360deg; } }
body[data-theme="morning"] .sky-sun-disc { translate: 0 0; opacity: 1; }
body.is-all-clear .sky-sun-disc { scale: 1.25; }
body[data-theme="morning"] .sky-decor,
body[data-theme="morning"] .sky-stars { opacity: 0; }

/* Content sits above the sky. Empty areas of the content let the pointer
   through, so stars behind them can still be hovered. */
.topbar, .notice { position: relative; z-index: 4; }
/* No z-index on .screen, so its buttons can rise above the sky on Goodnight. */
.screen { position: relative; }
/* On Goodnight and Breathing the sky is the focus: stars sit above the text so
   every star can be hovered, and only the buttons stay above the stars. */
body.is-goodnight .sky { z-index: 3; }
.goodnight button, .breathing button, .sleep-tool button { position: relative; z-index: 4; }
.topbar, .screen, .goodnight, .breathing { pointer-events: none; }
.topbar > *, .screen > *:not(.goodnight):not(.breathing), .goodnight > *, .breathing > * { pointer-events: auto; }

.star-tip {
  position: fixed;
  z-index: 5;
  max-width: min(280px, calc(100vw - 24px));
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 24px var(--glow);
  pointer-events: none;
  animation: card-enter 200ms var(--ease) both;
}
.star-tip { z-index: 6; }
.star-tip-text { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.star-tip-meta { margin: 4px 0 0; font-size: .8rem; color: var(--muted); }
.parked-count, .toast-area { z-index: 5; }

/* Top bar */
.topbar {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; }
.brand-icon { width: 24px; height: 24px; fill: var(--accent); filter: drop-shadow(0 0 8px var(--glow)); }

/* Night / Morning toggle */
.mode-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.mode-toggle button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 34px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 200ms var(--ease), color 200ms var(--ease);
}
.mode-toggle button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.mode-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Screen column. The extra top space is a strip of sky for the moon and sun. */
.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 88px 24px 120px;
}

.screen-title { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 20px; font-weight: 700; }

/* Compose box */
.compose {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 10px 10px 16px;
}
.compose:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.compose textarea {
  flex: 1;
  min-height: 48px;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  padding: 10px 0;
  line-height: 1.4;
}
.compose textarea::placeholder { color: var(--muted); }

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms var(--ease), background-color 200ms var(--ease), opacity 200ms;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-quiet { background: var(--surface-2); color: var(--text); }
.btn[disabled] { opacity: .45; cursor: default; }

/* Thought cards */
.cards { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  animation: card-enter var(--enter-ms) var(--ease) both;
}
.card-text { margin: 0 0 14px; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 10px; }
.card-actions .btn { flex: 1; }

.card.is-releasing {
  pointer-events: none;
  animation: card-release var(--release-ms) var(--ease) forwards;
}
.card.is-parking {
  pointer-events: none;
  animation: card-park var(--park-ms) var(--ease) forwards;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes card-release {
  0%   { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(-70px) scale(.96); filter: blur(6px); }
}
@keyframes card-park {
  0%   { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(40px) scale(.9); }
}

/* Parked counter pinned at the bottom */
.parked-count {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: .9rem;
  color: var(--muted);
  white-space: nowrap;
  transition: transform 200ms var(--ease);
}
.parked-count strong { color: var(--accent); font-weight: 700; }
.parked-count.bump { animation: bump 400ms var(--ease); }
@keyframes bump {
  50% { transform: translateX(-50%) scale(1.08); }
}

/* Morning checklist */
.screen-sub { margin: -10px 0 20px; color: var(--muted); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist.is-entering li { animation: card-enter var(--enter-ms) var(--ease) both; }

.check-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: opacity 300ms var(--ease), background-color 300ms var(--ease);
}
.check-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-box {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: grid;
  place-items: center;
  transition: background-color 200ms var(--ease);
}
.check-text { overflow-wrap: anywhere; }

.is-done .check-item { opacity: .5; background: transparent; }
.is-done .check-box { background: var(--accent); }
.is-done .check-box::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.is-done .check-text { text-decoration: line-through; text-decoration-color: var(--muted); }

.link-button {
  margin-top: 24px;
  border: 0;
  background: none;
  padding: 8px 0;
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  cursor: pointer;
}
.link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Gentle prompt */
.prompt { margin: 12px 4px 0; color: var(--accent); font-size: .95rem; font-style: italic; opacity: .85; }
.prompt.is-fresh { animation: prompt-in 900ms var(--ease) both; }
@keyframes prompt-in { from { opacity: 0; } to { opacity: .85; } }

/* ---- Morning moments ------------------------------------------------------ */
.morning-summary { margin: 0 0 14px; color: var(--accent); font-weight: 700; }
body[data-theme="morning"] .morning-summary { color: #a8761c; }

.morning-item { display: flex; gap: 8px; align-items: stretch; }
.morning-item .check-item { flex: 1; min-width: 0; }
.morning-letgo {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0 14px;
  min-height: 44px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 200ms var(--ease), background-color 200ms var(--ease);
}
.morning-letgo:hover { color: var(--text); background: var(--surface); }
.morning-letgo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Higher specificity than .is-arriving / .is-entering so Let go always animates. */
.checklist li.morning-item.is-releasing { pointer-events: none; animation: morning-release var(--morning-release-ms) var(--ease) forwards; }
/* In the morning, a thought you let go lights up with a rainbow shimmer and fades into light. */
@keyframes morning-release {
  0%   { opacity: 1; transform: none; filter: brightness(1); }
  35%  { opacity: 1; transform: scale(1.03); filter: brightness(1.12) saturate(1.3); }
  100% { opacity: 0; transform: scale(.94) translateY(-12px); filter: brightness(1.5) blur(3px); }
}
.check-item { position: relative; overflow: hidden; }
.morning-item.is-releasing .check-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg,
    transparent 15%,
    rgba(255, 90, 90, .45), rgba(255, 170, 60, .5), rgba(255, 230, 80, .5),
    rgba(90, 210, 120, .45), rgba(80, 160, 255, .45), rgba(170, 110, 255, .45),
    transparent 85%);
  background-size: 250% 100%;
  animation: rainbow-sweep 900ms var(--ease) forwards;
  pointer-events: none;
}
@keyframes rainbow-sweep {
  from { background-position: 120% 0; opacity: 0; }
  30%  { opacity: 1; }
  to   { background-position: -30% 0; opacity: .9; }
}
.sparkle {
  position: fixed;
  z-index: 6;
  pointer-events: none;
  background: hsl(var(--hue) 95% 62%);
  /* A four-pointed sparkle. */
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 4px hsl(var(--hue) 100% 70%));
}

.check-box { position: relative; }
.sunburst {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--accent) 0 10deg, transparent 10deg 36deg);
  -webkit-mask: radial-gradient(closest-side, transparent 45%, #000 50%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 45%, #000 50%, transparent 100%);
  pointer-events: none;
  animation: sunburst 750ms var(--ease) forwards;
}
@keyframes sunburst {
  from { opacity: 1; transform: scale(.4) rotate(0deg); }
  to   { opacity: 0; transform: scale(1.5) rotate(40deg); }
}

.all-clear {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  font-weight: 700;
}
.all-clear[hidden] { display: none; }
.all-clear.is-fresh { animation: card-enter 600ms var(--ease) both; }
.all-clear-sun {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 18px var(--accent);
}
body.is-all-clear .sky-sun { opacity: 1; translate: -50% -12vh; }

.falling-star {
  position: fixed;
  z-index: 4;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff3c4;
  box-shadow: 0 0 0 2px rgba(246, 169, 59, .6), 0 0 14px 6px rgba(246, 169, 59, .7), 0 0 36px 14px rgba(246, 169, 59, .35);
  pointer-events: none;
}
.checklist li.is-waiting { opacity: 0; animation: none; }
.checklist li.is-arriving { animation: arrive 600ms var(--ease) both; }
.checklist li.is-arriving .check-box { animation: box-glow 900ms var(--ease); }
@keyframes arrive {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes box-glow {
  0%   { box-shadow: 0 0 0 0 rgba(242, 207, 122, .8); }
  100% { box-shadow: 0 0 0 12px rgba(242, 207, 122, 0); }
}

/* ---- AI companion ---------------------------------------------------------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.icon-button svg { width: 20px; height: 20px; fill: currentColor; }
.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.talk-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.talk-button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.talk-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.talk-icon { font-size: .8rem; }

.card-note, .check-note {
  display: block;
  margin: -8px 0 12px;
  font-size: .85rem;
  color: var(--accent);
}
.card-note::before, .check-note::before { content: "✦ "; }
.check-body { display: flex; flex-direction: column; min-width: 0; }
.check-note { margin: 4px 0 0; }
body[data-theme="morning"] .check-note, body[data-theme="morning"] .card-note { color: #9a6a12; }

.morning-sides { display: flex; flex-direction: column; gap: 6px; flex: none; }
.morning-side {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 0 12px;
  min-height: 38px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
}
.morning-side:hover { color: var(--text); background: var(--surface); }
.morning-side:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.morning-talk { color: #9a6a12; }

.star-tip-note { margin: 4px 0 0; font-size: .85rem; color: var(--accent); }

@media (max-width: 420px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  .brand { font-size: .95rem; gap: 8px; }
  .topbar-actions { gap: 6px; }
  .mode-toggle button { padding: 6px 10px; }
  .icon-button { width: 36px; height: 36px; }
}

/* ---- Calendar ------------------------------------------------------------------ */
.cal-heading { display: flex; align-items: center; gap: 8px; }
.cal-heading .sheet-title { min-width: 150px; text-align: center; font-size: 1.1rem; }
.cal-nav { width: 34px; height: 34px; font-size: 1.3rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekday { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.cal-day:disabled { opacity: .35; cursor: default; }
.cal-day.is-today { border-color: var(--accent); }
.cal-day[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-num { font-size: .9rem; font-weight: 600; line-height: 1; }
.cal-marks { display: flex; gap: 3px; align-items: center; height: 10px; }
.cal-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--glow); }
.cal-moon { font-size: .7rem; line-height: 1; color: #8a7fd6; }
.cal-z { font-size: .7rem; line-height: 1; font-weight: 800; font-style: italic; color: #4f9d8f; }
.cal-day[aria-pressed="true"] .cal-z { color: var(--accent-ink); }
.cal-aids { padding: 10px 12px; border-radius: 12px; background: rgba(79, 157, 143, .12); }
.cal-aids-label { margin: 0 0 6px; font-weight: 700; color: #3f8a7d; font-size: .9rem; }
.cal-aids ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cal-aids li { display: grid; gap: 1px; }
.cal-aid-name { font-size: .9rem; font-weight: 600; }
.cal-aid-meta { font-size: .8rem; color: var(--muted); }
.cal-day[aria-pressed="true"] .cal-dot { background: var(--accent-ink); }
.cal-day[aria-pressed="true"] .cal-moon { color: var(--accent-ink); }
.cal-legend { margin: 0; font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-detail { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.cal-detail-title { margin: 0; font-size: 1rem; }
.cal-empty, .cal-released, .cal-privacy { margin: 0; color: var(--muted); font-size: .9rem; }
.cal-privacy { font-size: .8rem; }
.cal-thoughts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cal-thoughts li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: start; }
.cal-thought { overflow-wrap: anywhere; }
.cal-note { grid-column: 1; font-size: .8rem; color: var(--accent); }
.cal-note::before { content: "✦ "; }
.cal-outcome { grid-column: 2; grid-row: 1; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.cal-outcome-done { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); }
.cal-outcome-done::before { content: "✓ "; }
.cal-dream { padding: 10px 12px; border-radius: 12px; background: rgba(138, 127, 214, .12); }
.cal-dream-label { margin: 0 0 4px; font-weight: 700; color: #8a7fd6; font-size: .9rem; }
.cal-dream-text { margin: 0; font-style: italic; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Dream journal ---------------------------------------------------------- */
.dream-card {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(120, 110, 200, .12), rgba(255, 190, 120, .1));
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dream-open {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 4px 0;
  color: #5b4fa3;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.dream-open:focus-visible, .dream-journal summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.dream-heading { margin: 0; font-size: 1rem; color: #5b4fa3; }
.dream-input {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}
.dream-input:focus-visible { outline: 2px solid #8a7fd6; outline-offset: 1px; }
.dream-actions { display: flex; gap: 8px; align-items: center; }
.dream-actions .btn { flex: 1; }
.dream-actions-saved { gap: 16px; flex-wrap: wrap; }
.dream-actions-saved .talk-button { margin: 0; }
.dream-mic { flex: none; }
.dream-text {
  margin: 0;
  padding: 10px 14px;
  border-left: 3px solid #8a7fd6;
  border-radius: 0 12px 12px 0;
  background: var(--surface);
  font-style: italic;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dream-status, .dream-privacy { margin: 0; font-size: .8rem; color: var(--muted); }
.dream-reflection {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid rgba(138, 127, 214, .35);
  animation: card-enter 500ms var(--ease) both;
}
.dream-title { margin: 0 0 8px; font-size: 1.05rem; }
.dream-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dream-chip { padding: 2px 10px; border-radius: 999px; background: rgba(138, 127, 214, .15); color: #4a3f8f; font-size: .8rem; font-weight: 600; }
.dream-body { margin: 0 0 8px; line-height: 1.55; }
.dream-connection { margin: 0 0 8px; color: #9a6a12; font-size: .9rem; }
.dream-connection::before { content: "✦ "; }
.dream-question { margin: 0; font-style: italic; color: var(--muted); }
.dream-journal summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--muted); }
.dream-journal ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.dream-journal li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface); font-size: .85rem; }
.dream-journal-date { color: var(--muted); font-size: .75rem; }
.dream-journal-title { font-weight: 700; }
.dream-journal-title:empty { display: none; }
.dream-journal-text { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---- Worry time ---------------------------------------------------------------- */
.morning-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.morning-tools .talk-button { margin: 0; }
.morning-tools .talk-button[hidden] { display: none; }
.worry-button.is-now { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.worry-time { display: flex; flex-direction: column; gap: 12px; }
.worry-title { margin-bottom: 0; }
.worry-intro { margin: 0; color: var(--muted); }
.worry-clock { margin: 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #9a6a12; }
.worry-item { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.worry-count { margin: 0; font-size: .8rem; color: var(--muted); }
.worry-text { margin: 0; font-size: 1.3rem; font-weight: 600; overflow-wrap: anywhere; }
.worry-note { margin: 0; color: #9a6a12; font-size: .9rem; }
.worry-note::before { content: "✦ "; }
.worry-talk { align-self: flex-start; margin: 0; }
.worry-actions { display: flex; gap: 10px; }
.worry-actions .btn { flex: 1; }
.worry-next { align-self: center; color: var(--muted); }
.worry-done { padding: 18px; border-radius: var(--radius); background: var(--surface); text-align: center; }
.worry-done-title { margin: 0 0 6px; font-weight: 700; font-size: 1.1rem; }
.worry-done-count { margin: 0; color: var(--muted); }
.worry-back { align-self: flex-start; }

/* ---- Worries that keep coming back ------------------------------------------------ */
.recurring-card {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, #e0875a 45%, transparent);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recurring-card[hidden] { display: none; }
.recurring-label { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #e0875a; }
.recurring-word { margin: 0; color: var(--muted); font-size: .9rem; }
.recurring-word strong { color: var(--text); font-size: 1.1rem; }
.recurring-examples { margin: 0; padding-left: 18px; font-size: .85rem; color: var(--muted); display: grid; gap: 2px; }
.recurring-plan-note { margin: 4px 0 0; font-size: .9rem; color: var(--accent); font-weight: 600; }
.recurring-plan-note::before { content: "✦ Plan: "; }
body[data-theme="morning"] .recurring-plan-note { color: #9a6a12; }
.recurring-hint { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.recurring-actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.recurring-actions .talk-button { margin: 0; }

/* ---- Sleep rating and insights --------------------------------------------------- */
.rating-card { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.rating-title { margin: 0 0 6px; font-size: 1rem; }
.rating-moons { display: flex; gap: 6px; }
.rating-moon {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  font-size: 1.3rem; color: var(--muted); cursor: pointer;
  transition: transform 150ms var(--ease), color 150ms var(--ease), background-color 150ms var(--ease);
}
.rating-moon:hover { transform: scale(1.08); }
.rating-moon.is-lit { color: #8a7fd6; background: rgba(138, 127, 214, .14); border-color: rgba(138, 127, 214, .4); }
.rating-moon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating-note { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.cal-rating { margin: 0; font-size: .9rem; color: #8a7fd6; letter-spacing: .05em; }
.cal-insights-section { display: flex; flex-direction: column; gap: 8px; }
.cal-insights-button { align-self: flex-start; margin: 0; }
.cal-stat { margin: 0; font-size: .85rem; color: var(--muted); }
.cal-insights { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.cal-insights[hidden] { display: none; }
.cal-insights-title { margin: 0 0 8px; font-size: 1rem; }
.cal-insights-list { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }
.cal-suggestion { margin: 0; font-size: .9rem; color: var(--accent); font-weight: 600; }
.cal-suggestion::before { content: "Try: "; }
body[data-theme="morning"] .cal-suggestion { color: #9a6a12; }

/* ---- Three good things -------------------------------------------------------- */
.good-card {
  margin-top: 24px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--line);
  text-align: left;
}
.good-title { margin: 0 0 10px; font-size: 1rem; color: var(--accent); }
.good-list { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.good-list li::marker { content: "✦  "; color: var(--accent); }
.good-form { display: flex; gap: 8px; }
.good-form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.good-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.goodnight .good-card button { position: relative; z-index: 4; }
.goodnight .good-card input { position: relative; z-index: 4; }
.cal-good { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cal-good-label { margin: 0 0 6px; font-weight: 700; font-size: .9rem; color: #9a6a12; }
.cal-good ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }

/* ---- Help me fall asleep ----------------------------------------------------- */
.sleep-tools { margin-top: 28px; width: 100%; }
.sleep-tools-title { margin: 0 0 12px; font-size: 1rem; color: var(--muted); font-weight: 700; }
.sleep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sleep-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 200ms var(--ease), background-color 200ms var(--ease);
}
.sleep-option:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.sleep-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sleep-option-name { font-weight: 700; }
.sleep-option-detail { font-size: .8rem; color: var(--muted); }

.sleep-tool {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  pointer-events: none;
}
.sleep-tool > * { pointer-events: auto; }
.sleep-title { margin: 0; font-size: 1.3rem; }
.sleep-intro, .sleep-label { margin: 0; color: var(--muted); max-width: 340px; }
.sleep-label { font-size: .85rem; }
.sleep-stop { margin-top: 12px; }

/* Everything but the tool fades back while it runs. */
body.is-sleep-dim .topbar, body.is-sleep-dim .sky-stars, body.is-sleep-dim .sky-moon { opacity: .25; transition: opacity 3s var(--ease); }
body.is-sleep-dim .sleep-intro, body.is-sleep-dim .sleep-title { opacity: .7; }

.shuffle-word { margin: 8px 0 0; display: flex; gap: 6px; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.shuffle-word .is-current { color: var(--accent); }
.shuffle-letter { margin: 16px 0 0; font-size: 3.4rem; font-weight: 700; color: var(--accent); opacity: .8; line-height: 1; }
.shuffle-item { margin: 0; font-size: 1.6rem; min-height: 2.4em; }
.shuffle-item.is-fresh { animation: shuffle-in 2400ms var(--ease) both; }
@keyframes shuffle-in { from { opacity: 0; filter: blur(4px); } to { opacity: .9; filter: none; } }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips-column { flex-direction: column; align-items: stretch; width: min(320px, 100%); }
.chip {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip[hidden] { display: none; }
.sounds-status { margin: 4px 0 0; color: var(--muted); font-size: .9rem; min-height: 1.5em; }

.story-reading { justify-content: flex-start; padding-top: 12px; }
.story-text {
  margin: 0;
  max-width: 420px;
  text-align: left;
  font-size: 1.15rem;
  line-height: 1.9;
  color: var(--text);
  opacity: .78;
  white-space: pre-wrap;
}

/* ---- Welcome guide --------------------------------------------------------- */
.how-link {
  margin: -12px 0 18px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-underline-offset: 4px;
  cursor: pointer;
}
.how-link:hover { color: var(--text); }
.how-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.screen-links { display: flex; gap: 18px; margin: -12px 0 18px; }
.screen-links .how-link { margin: 0; }

.guide[open] { gap: 16px; text-align: center; }
.guide-welcome { font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.guide-panel { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 290px; }
.guide-panel.is-fresh { animation: card-enter 350ms var(--ease) both; }
.guide-count { font-size: .8rem; color: var(--muted); }
.guide-title { margin: 0; font-size: 1.5rem; }
.guide-body { max-width: 380px; color: var(--muted); line-height: 1.55; }
.guide-fine { font-size: .8rem; color: var(--muted); }
.guide-fine[hidden] { display: none; }

.guide-art {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1d2748, #0e1424 70%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.guide-art::before, .guide-art::after { content: ""; position: absolute; }
/* 1: a crescent moon */
.guide-art-moon::before {
  left: 36px; top: 30px; width: 46px; height: 46px; border-radius: 50%;
  box-shadow: 12px 6px 0 0 #f4dfa6; filter: drop-shadow(0 0 10px rgba(242, 207, 122, .5));
}
/* 2: parked stars and a shooting star */
.guide-art-stars::before {
  left: 30px; top: 40px; width: 8px; height: 8px; border-radius: 50%; background: #fff6d8;
  box-shadow: 0 0 8px 3px rgba(242, 207, 122, .6), 44px 22px 0 -1px #fff6d8, 44px 22px 8px 2px rgba(242, 207, 122, .5), 22px 48px 0 -2px #fff6d8;
}
.guide-art-stars::after {
  left: 52px; top: 22px; width: 60px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 246, 216, 0), #fff6d8); transform: rotate(-25deg);
}
/* 3: a companion spark */
.guide-art-spark::before {
  inset: 34px; background: #f2cf7a;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 10px rgba(242, 207, 122, .7));
}
/* 4: the morning sun */
.guide-art-sun { background: radial-gradient(circle at 50% 110%, #ffe2a8, #f7efe4 70%); }
.guide-art-sun::before {
  left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, #fff3c4, #ffd36b 45%, #f6a93b 100%);
  box-shadow: 0 0 24px 8px rgba(255, 196, 90, .55);
}

.guide-dots { display: flex; justify-content: center; gap: 8px; }
.guide-dot {
  width: 10px; height: 10px; padding: 0; border-radius: 50%;
  border: 0; background: var(--line); cursor: pointer;
}
.guide-dot[aria-current="step"] { background: var(--accent); width: 24px; border-radius: 999px; }
.guide-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-actions { display: flex; gap: 10px; }
.guide-actions .btn { flex: 1; }
.guide-actions .btn[hidden] { display: none; }

/* Morning plan */
.plan-button { margin: 0 0 16px; }
.plan-button[hidden] { display: none; }
body[data-theme="morning"] .talk-button { color: #8a5d0c; border-color: rgba(217, 164, 65, .5); }
.plan-card {
  margin: 0 0 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 6px 24px var(--glow);
  animation: card-enter 500ms var(--ease) both;
}
.plan-card[hidden] { display: none; }
.plan-title { margin: 0 0 6px; font-size: 1.1rem; }
.plan-opener { margin: 0 0 10px; color: var(--muted); }
.plan-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.plan-steps li::marker { color: var(--accent); font-weight: 700; }
.plan-action { display: block; font-weight: 600; }
.plan-thought { display: block; font-size: .8rem; color: var(--muted); }
.plan-demo, .plan-loading, .plan-error { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.plan-loading { margin: 0; animation: typing 1.2s ease-in-out infinite; }

/* Microphone */
.mic-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
}
.mic-button svg { width: 22px; height: 22px; fill: currentColor; }
.mic-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mic-button.is-listening {
  background: var(--accent);
  color: var(--accent-ink);
  animation: listening 1.4s ease-in-out infinite;
}
@keyframes listening {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 207, 122, .55); }
  50%      { box-shadow: 0 0 0 10px rgba(242, 207, 122, 0); }
}
.voice-status { margin: 12px 4px 0; color: var(--accent); font-size: .9rem; }

/* Bottom-sheet panels */
.sheet {
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  margin: auto auto 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .35);
  overflow: auto;
}
.sheet[open] { display: flex; flex-direction: column; gap: 14px; animation: sheet-up 350ms var(--ease) both; }
.sheet::backdrop { background: rgba(4, 6, 12, .6); backdrop-filter: blur(2px); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) {
  .sheet { margin: auto; border-radius: 24px; }
}
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-title { margin: 0; font-size: 1.25rem; }
.sheet p { margin: 0; }

.talk-thought {
  margin: 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--surface);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.demo-banner {
  padding: 10px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  font-size: .85rem;
}
.inline-link {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  cursor: pointer;
}

.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: card-enter var(--enter-ms) var(--ease) both;
}
.bubble-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble-user { align-self: flex-end; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-bottom-right-radius: 6px; }
.bubble-error { align-self: stretch; max-width: none; background: transparent; border: 1px dashed var(--line); color: var(--muted); font-size: .9rem; }
.bubble.is-typing:empty::after { content: "…"; letter-spacing: 2px; animation: typing 1.2s ease-in-out infinite; }
.bubble.is-typing:not(:empty) { color: var(--muted); }
@keyframes typing { 50% { opacity: .3; } }

.chat-compose { padding: 6px 6px 6px 14px; }
.chat-compose textarea { min-height: 40px; }
.talk-actions { display: flex; gap: 10px; }
.talk-actions .btn { flex: 1; }
.talk-save.is-ready { box-shadow: 0 0 0 0 var(--glow); animation: ready-pulse 1.8s ease-in-out infinite; }
@keyframes ready-pulse { 50% { box-shadow: 0 0 0 8px transparent, 0 0 18px var(--glow); } }
.btn:disabled, .sheet textarea:disabled { opacity: .55; cursor: default; }

/* Eyes-closed voice mode */
.voice-toggle { align-self: flex-start; min-height: 36px; font-size: .85rem; }
.voice-mode-status { margin: 0; color: var(--accent); font-size: .9rem; animation: typing 2s ease-in-out infinite; }
.sheet.is-voice { background: #03050a; border-color: #0b0f1c; }
.sheet.is-voice .bubble, .sheet.is-voice .talk-thought, .sheet.is-voice .compose { opacity: .28; animation: none; }
.sheet.is-voice .sheet-title, .sheet.is-voice .talk-actions { opacity: .45; }
.sheet.is-voice .voice-toggle { background: #0b0f1c; color: var(--accent); border-color: #1a2140; }

/* Crisis card */
.crisis { display: flex; flex-direction: column; gap: 12px; }
.crisis-title { margin: 0; font-size: 1.3rem; }
.crisis-actions { display: flex; gap: 10px; }
.crisis-actions .btn { flex: 1; display: grid; place-items: center; text-decoration: none; }
.crisis-small { font-size: .85rem; color: var(--muted); }
.crisis a:not(.btn) { color: inherit; }

/* Settings */
.settings-check { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.settings-check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Bedtime banner */
.bedtime-banner {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 7;
  width: min(432px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  animation: card-enter 400ms var(--ease) both;
}
.bedtime-banner span { flex: 1; }
.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-select, .settings-time {
  min-height: 44px; padding: 0 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
}
.settings-select:focus-visible, .settings-time:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings-form { display: flex; flex-direction: column; gap: 8px; }
.settings-label { font-weight: 700; }
.settings-row { display: flex; gap: 8px; }
.settings-row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.settings-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings-status { padding: 10px 14px; border-radius: 12px; background: var(--surface); font-size: .9rem; }
.settings-status.is-on { border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.settings-small { font-size: .85rem; color: var(--muted); }
.settings-small a { color: inherit; }
.settings-notes { margin: 0; padding-left: 18px; font-size: .85rem; color: var(--muted); display: grid; gap: 4px; }

/* First-use hint */
.hint { margin: 12px 4px 0; color: var(--muted); font-size: .9rem; }

/* Saving-off notice */
.notice {
  max-width: 432px;
  margin: 16px auto 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .85rem;
}

/* Goodnight */
.goodnight {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  animation: card-enter 800ms var(--ease) both;
}
.goodnight-title { font-size: 2rem; line-height: 1.2; margin: 0 0 12px; }
.goodnight-summary { margin: 0; color: var(--accent); font-weight: 600; }
.goodnight-note { margin: 8px 0 0; color: var(--muted); }
.goodnight .link-button { align-self: center; }
.goodnight-title, .goodnight-summary, .goodnight-note, .breath-label, .breath-remaining {
  text-shadow: 0 0 10px var(--bg), 0 0 18px var(--bg);
}

/* Breathing moment */
.breathing {
  min-height: 65vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.breath-stage { width: 240px; height: 240px; display: grid; place-items: center; }
.breath-circle {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(242, 207, 122, .35), rgba(242, 207, 122, .08) 70%);
  box-shadow: 0 0 60px rgba(242, 207, 122, .15);
  border: 1px solid rgba(242, 207, 122, .35);
  transform: scale(.55);
  will-change: transform;
}
.breath-label { font-size: 1.5rem; font-weight: 700; margin: 28px 0 4px; }
.breath-remaining { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.sleep-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  border: 0;
  background: #04060c;
  color: #3a4055;
  font-size: 1.1rem;
  cursor: pointer;
  animation: dim 2500ms var(--ease) both;
}
.sleep-overlay:focus-visible { outline: none; }
@keyframes dim { from { opacity: 0; } to { opacity: 1; } }

/* Undo toast */
.toast-area {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  width: min(432px, calc(100% - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
  font-size: .9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: card-enter var(--enter-ms) var(--ease) both;
}
.toast-undo {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.toast-undo:focus-visible { outline: 2px solid var(--accent); }

@media (prefers-reduced-motion: reduce) {
  :root { --release-ms: 250ms; --park-ms: 200ms; --enter-ms: 1ms; }
  .sky-dot, .sky-star, .sky-star.is-new, .prompt.is-fresh { animation: none; }
  .sky-shooting { animation: shoot-fade 600ms linear forwards; transform: rotate(-25deg); }
  @keyframes shoot-fade { from { opacity: .8; } to { opacity: 0; } }
  .sky-sun, .sky-decor, .sky-stars, .sky-moon, .sky-sun-disc { transition-duration: 1ms; }
  .sky-sun-disc::before { animation: none; }
  .breath-circle { transform: scale(.8); }
  .checklist li.is-arriving, .checklist li.is-arriving .check-box, .all-clear.is-fresh { animation: none; }
  .sheet[open], .bubble, .talk-save.is-ready, .mic-button.is-listening, .plan-card, .plan-loading, .guide-panel.is-fresh, .shuffle-item.is-fresh, .voice-mode-status { animation: none; }
  :root { --morning-release-ms: 300ms; }
  @keyframes morning-release { to { opacity: 0; } }
  .morning-item.is-releasing .check-item::after { animation: none; opacity: 0; }
  .sleep-overlay { animation-duration: 400ms; }
  @keyframes card-release { to { opacity: 0; } }
  @keyframes card-park { to { opacity: 0; } }
  .parked-count.bump { animation: none; }
}
