:root {
  --deep: #0e3a39;
  --deep-2: #18514d;
  --gold: #c9a96b;
  --gold-soft: #eadfc8;
  --cream: #fbf8f0;
  --paper: rgba(255, 253, 247, .94);
  --ink: #183532;
  --muted: #627571;
  --line: #dce5df;
  --danger: #8f352f;
  --danger-bg: #fff1ef;
  --shadow: 0 22px 70px rgba(14, 58, 57, .15);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(201, 169, 107, .18), transparent 24rem),
    linear-gradient(145deg, #f5f0e4 0%, #f9f8f2 48%, #e8f0eb 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  z-index: 0;
  border: 1px solid rgba(201, 169, 107, .25);
  border-radius: 50%;
  pointer-events: none;
}

.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(14, 58, 57, .11);
  border-radius: inherit;
}

.ambient::after { inset: 25%; }
.ambient-a { width: 36rem; height: 36rem; left: -20rem; top: -12rem; }
.ambient-b { width: 28rem; height: 28rem; right: -16rem; bottom: -10rem; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  padding: 4px 0;
  border: 0;
  color: var(--deep);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-logo {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
  box-shadow: 0 5px 18px rgba(14, 58, 57, .08);
}

.quiet-link {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  color: var(--deep);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.app-card {
  min-height: calc(100vh - 112px);
  padding: clamp(26px, 6vw, 54px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 32px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 8px;
  color: #876c38;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; color: var(--deep); font-size: clamp(2rem, 7vw, 3.25rem); line-height: 1.2; letter-spacing: .02em; }
h2 { margin-bottom: 14px; color: var(--deep); font-size: clamp(1.55rem, 5vw, 2.15rem); line-height: 1.3; }
h3 { margin-bottom: 8px; color: var(--deep); font-size: 1.04rem; }

.lead { max-width: 34rem; color: var(--muted); font-size: 1.08rem; }
.positioning { margin: 28px 0 32px; color: var(--deep); font-size: 1.22rem; font-weight: 700; }
.helper { color: var(--muted); }
.tiny { color: var(--muted); font-size: .82rem; }

.home-art {
  display: grid;
  place-items: center;
  width: min(64vw, 260px);
  aspect-ratio: 1;
  margin: 22px auto 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,169,107,.55) 0 3%, transparent 4% 11%, rgba(201,169,107,.25) 12% 13%, transparent 14% 26%, rgba(14,58,57,.12) 27% 28%, transparent 29% 42%, rgba(14,58,57,.07) 43% 44%, transparent 45%);
}

.home-art::after {
  content: "靜";
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(201, 169, 107, .75);
  border-radius: 50%;
  color: var(--deep);
  background: rgba(255,255,255,.55);
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 2rem;
}

.progress-wrap { margin-bottom: 30px; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: .82rem; }
.progress { height: 5px; overflow: hidden; border-radius: 999px; background: #e5ebe7; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--deep-2)); transition: width .35s ease; }

.stack { display: grid; gap: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 22px 0; }
.choice-grid.moods { grid-template-columns: repeat(5, 1fr); }

.choice {
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255,255,255,.68);
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.choice:hover { transform: translateY(-1px); border-color: var(--gold); }
.choice.selected { border-color: var(--deep); background: #edf4f0; box-shadow: inset 0 0 0 1px var(--deep); }
.choice strong, .choice span { display: block; }
.choice strong { color: var(--deep); font-size: 1.05rem; }
.choice span { margin-top: 4px; color: var(--muted); font-size: .88rem; }

.mood {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 88px;
  padding: 10px 5px;
}
.mood .mood-dot { width: 15px; height: 15px; border: 2px solid var(--gold); border-radius: 50%; }
.mood span { font-size: .78rem; line-height: 1.25; }

label.field { display: block; margin: 20px 0; font-weight: 750; color: var(--deep); }
label.field small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
textarea, input[type="text"], input[type="number"] {
  width: 100%;
  margin-top: 8px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 102px; resize: vertical; }
textarea:focus, input:focus { border-color: var(--deep); box-shadow: 0 0 0 3px rgba(14,58,57,.1); }

.range-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
input[type="range"] { width: 100%; accent-color: var(--deep); }
.range-value { min-width: 54px; color: var(--deep); font-weight: 800; text-align: right; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn {
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary { flex: 1; color: #fff; background: var(--deep); box-shadow: 0 10px 24px rgba(14,58,57,.18); }
.btn-secondary { color: var(--deep); border-color: var(--line); background: #fff; }
.btn-ghost { color: var(--muted); background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.practice-stage { text-align: center; }
.listening-needs {
  margin: 26px 0 20px;
  padding: 20px;
  border: 1px solid var(--gold-soft);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(234,223,200,.22));
  text-align: left;
}
.listening-needs h3 { text-align: center; }
.need-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.need-choice { min-height: 132px; text-align: left; }
.need-choice small { display: inline-block; margin-top: 10px; color: #876c38; font-weight: 800; }
.session-outline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--deep);
  background: rgba(255,255,255,.72);
}
.session-outline span { color: var(--muted); font-size: .86rem; text-align: right; }
.countdown-toggle { min-height: 44px; margin-top: -18px; }
.audio-error-card {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #dfb7a4;
  border-radius: 18px;
  color: #694034;
  background: #fff7f2;
  text-align: left;
}
.audio-error-card p { margin: 5px 0 12px; }
.breath-orb {
  display: grid;
  place-items: center;
  width: min(62vw, 250px);
  aspect-ratio: 1;
  margin: 24px auto;
  border: 1px solid rgba(201,169,107,.7);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,169,107,.24), rgba(14,58,57,.08) 58%, transparent 59%);
}
.breath-orb.playing { animation: breathe 8s ease-in-out infinite; }
.breath-orb b { color: var(--deep); font-size: 2.4rem; font-variant-numeric: tabular-nums; }
.breath-orb small { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; }

.recorder-card {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  text-align: left;
}
.recorder-card h3, .recorder-card p { margin-bottom: 8px; }
.recorder-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.recording { border-color: #b85c52; color: #7d302a; }
.recording-state { color: #7d302a; font-weight: 800; }
.recording-state::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: #b85c52; }
.recording-error { color: var(--danger); }
.recording-preview { width: 100%; margin-top: 8px; }

.note {
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
  color: var(--muted);
  background: rgba(234,223,200,.28);
}

.response-card {
  margin: 22px 0;
  padding: 24px;
  border: 1px solid var(--gold-soft);
  border-radius: 22px;
  background: linear-gradient(145deg, #fffdf8, #f5f0e4);
}
.response-card p { margin-bottom: 10px; font-size: 1.08rem; }

.heart-reveal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: start center;
  overflow-y: auto;
  padding: max(26px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  background: rgba(7, 29, 27, .82);
  backdrop-filter: blur(7px);
}

.heart-light {
  position: fixed;
  z-index: 0;
  top: 42%;
  left: 50%;
  width: min(104vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 225, 166, .7) 0%, rgba(201, 169, 107, .25) 27%, transparent 68%);
  filter: blur(14px);
  transform: translate(-50%, -50%);
  animation: heartGlow 1s ease-out both;
  pointer-events: none;
}

.heart-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  padding: 12px 0 8px;
  text-align: center;
  animation: heartRise 1s cubic-bezier(.2, .72, .25, 1) both;
}

.heart-eyebrow {
  margin: 0 0 3px;
  color: #eadfc8;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .14em;
}

.heart-dialog h2 { margin-bottom: 15px; color: #fffaf0; font-size: 1.45rem; }
.heart-card-frame { margin: 0; }
.heart-card-image {
  display: block;
  width: 100%;
  max-height: calc(100svh - 245px);
  object-fit: contain;
  border: 1px solid rgba(234, 223, 200, .72);
  border-radius: 22px;
  background: #f5f0e4;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .34), 0 0 42px rgba(234, 223, 200, .22);
}

.heart-note {
  max-width: 420px;
  margin: 15px auto 0;
  color: rgba(255, 250, 240, .82);
  font-size: .84rem;
  line-height: 1.65;
}

.heart-actions { display: grid; gap: 4px; margin-top: 15px; }
.heart-actions .btn { width: 100%; }
.heart-actions .btn-primary { color: var(--deep); background: #f2e7ca; }
.heart-home { color: rgba(255, 250, 240, .84); }

@keyframes heartRise {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heartGlow {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.72); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.crisis {
  padding: 22px;
  border: 1px solid #e4a7a1;
  border-radius: 20px;
  color: #5b2824;
  background: var(--danger-bg);
}
.crisis h2 { color: var(--danger); }
.crisis .btn-primary { background: var(--danger); }

.summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.summary div { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.7); }
.summary small { display: block; color: var(--muted); }
.summary b { color: var(--deep); }

.growth-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 10px;
}
.growth-overview div {
  padding: 14px 8px;
  border: 1px solid var(--gold-soft);
  border-radius: 16px;
  text-align: center;
  background: rgba(255,255,255,.68);
}
.growth-overview b { display: block; color: var(--deep); font-size: 1.45rem; }
.growth-overview small { color: var(--muted); }

.record {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.record:last-child { border-bottom: 0; }
.record-head { display: flex; justify-content: space-between; gap: 14px; }
.record p { margin: 8px 0 0; color: var(--muted); }
.record-change { color: var(--deep) !important; font-weight: 750; }
.record-details { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.record-details span, .bowl-details span {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--deep);
  background: var(--gold-soft);
  font-size: .83rem;
}
.bowl-details { margin-top: 12px; padding: 12px; border-radius: 14px; background: rgba(234,223,200,.25); }
.bowl-details small { display: block; margin-bottom: 8px; color: var(--muted); }
.bowl-details span { display: inline-block; margin: 0 5px 5px 0; }
.empty { padding: 34px 18px; border: 1px dashed var(--line); border-radius: 18px; text-align: center; color: var(--muted); }

.privacy-card {
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid var(--gold-soft);
  border-radius: 20px;
  background: rgba(255,255,255,.58);
}
.privacy-card ul { margin: 0; padding-left: 1.25rem; }
.privacy-card li { margin: 0 0 12px; color: var(--muted); line-height: 1.65; }
.privacy-card li:last-child { margin-bottom: 0; }
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 18px 0;
  padding: 15px;
  border-radius: 16px;
  color: var(--deep);
  background: var(--gold-soft);
  line-height: 1.55;
}
.consent-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--deep); flex: 0 0 auto; }
.optional-consent small { display: block; margin-top: 5px; color: var(--muted); font-weight: 450; line-height: 1.55; }

.practice-library {
  margin: 20px 0;
  padding: 18px;
  border: 1px solid var(--gold-soft);
  border-radius: 20px;
  background: rgba(255,255,255,.58);
}
.practice-library h3, .timer-heading { margin: 0 0 12px; color: var(--deep); }

.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 36px);
  padding: 12px 18px;
  border-radius: 999px;
  color: #fff;
  background: var(--deep);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.connection-status {
  margin: 0 auto 10px;
  padding: 9px 14px;
  max-width: 720px;
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  color: var(--deep);
  background: rgba(251,248,240,.94);
  text-align: center;
  font-size: .88rem;
}

@keyframes breathe {
  0%, 100% { transform: scale(.92); box-shadow: 0 0 0 0 rgba(201,169,107,.1); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 22px rgba(201,169,107,0); }
}

@media (max-width: 620px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .app-card { min-height: calc(100vh - 96px); padding: 26px 20px; border-radius: 26px; }
  .brand-bar { padding: 0 8px; }
  .brand-logo { width: 64px; height: 64px; }
  .choice-grid.moods { grid-template-columns: repeat(3, 1fr); }
  .choice-grid.moods .choice:last-child { grid-column: 2; }
  .choice-grid.paths { grid-template-columns: 1fr; }
  .need-grid { grid-template-columns: 1fr; }
  .need-choice { min-height: 96px; }
  .session-outline { align-items: flex-start; flex-direction: column; }
  .session-outline span { text-align: left; }
  .actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
