:root {
  color-scheme: light;
  --ink: #24201d;
  --muted: #756d66;
  --line: #ded4ca;
  --paper: #f4f1ec;
  --panel: #fffdfa;
  --green: #3e745f;
  --green-dark: #264b3d;
  --rose: #a65361;
  --blue: #416c8f;
  --gold: #b9823e;
  --shadow: 0 18px 44px rgba(50, 42, 35, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.help-button {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff8f5;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 20px 16px 96px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.65rem;
  line-height: 1.07;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff8f5;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
}

.share-pill {
  background: var(--ink);
  color: #fff;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hero-panel,
.panel,
.flow-panel,
.auth-panel,
.timeline-item,
.insight-card,
.journey-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero-panel {
  padding: 18px;
  background:
    linear-gradient(140deg, rgba(166, 83, 97, 0.12), rgba(62, 116, 95, 0.1)),
    var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel p {
  margin-bottom: 16px;
  font-size: 1.34rem;
  line-height: 1.2;
  font-weight: 850;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

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

.action-card {
  min-height: 128px;
  border: 0;
  border-radius: 8px;
  padding: 14px;
  background: var(--green-dark);
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow);
}

.action-card.rose {
  background: var(--rose);
}

.action-card.blue {
  background: var(--blue);
}

.action-card span {
  display: block;
  margin-bottom: 24px;
  opacity: 0.82;
  font-size: 0.82rem;
}

.action-card strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1.1;
}

.panel,
.flow-panel,
.auth-panel {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 850;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 0.86rem;
  font-weight: 850;
}

.help-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.help-label span {
  min-width: 0;
}

.field-label:first-child {
  margin-top: 0;
}

.choice-grid,
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-list {
  display: grid;
  gap: 8px;
}

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

.choice {
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span {
  min-height: 48px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fffaf5;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 780;
}

.choice input:checked + span {
  border-color: var(--green);
  background: #eaf4ee;
  color: var(--green-dark);
}

.range-row {
  display: grid;
  grid-template-columns: auto 1fr 2.2rem;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--rose);
}

textarea,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf5;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.other-input {
  margin-top: 8px;
}

.other-input[hidden] {
  display: none;
}

.chamber-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9f5f0;
}

.timer-label {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

#hold-timer {
  font-size: 1.35rem;
  line-height: 1;
}

.wave-card,
.breath-panel,
.script-panel {
  border-radius: 8px;
  padding: 14px;
  background: #fff6f2;
}

.wave-card span {
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wave-card p,
.breath-panel p,
.muted,
.empty-state,
.timeline-meta,
.auth-panel p,
.insight-card p,
.journey-card p {
  color: var(--muted);
}

.breath-panel {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  background: #edf5ef;
}

.breath-orb {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, #8eb8a5 19% 100%);
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.86);
  }
  50% {
    transform: scale(1);
  }
}

.script-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.script-panel:empty {
  display: none;
}

.script-block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.script-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.script-block span {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timeline-list,
.insight-grid,
.journey-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.insight-card,
.journey-card {
  padding: 14px;
}

.timeline-item.resolved {
  opacity: 0.72;
}

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

.timeline-item h2,
.insight-card h2,
.journey-card h2 {
  margin-bottom: 6px;
}

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

.badge {
  border-radius: 999px;
  padding: 5px 8px;
  background: #edf5ef;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 850;
}

.auth-panel {
  margin-bottom: 12px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-message {
  min-height: 20px;
  margin-bottom: 0;
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.help-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(36, 32, 29, 0.28);
}

.help-sheet {
  position: absolute;
  right: 12px;
  bottom: 96px;
  left: 12px;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.help-body {
  display: grid;
  gap: 12px;
}

.help-block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.help-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.help-block span {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.share-overlay[hidden] {
  display: none;
}

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(36, 32, 29, 0.28);
}

.share-sheet {
  position: absolute;
  right: 12px;
  bottom: 96px;
  left: 12px;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.share-qr {
  display: block;
  width: min(100%, 340px);
  aspect-ratio: 1;
  margin: 8px auto 14px;
  object-fit: contain;
}

.share-url {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.share-message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(255, 253, 250, 0.94);
  backdrop-filter: blur(14px);
}

.nav-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.nav-button.active {
  background: #edf5ef;
  color: var(--green-dark);
}

@media (max-width: 560px) {
  .action-grid {
    grid-template-columns: 1fr;
  }

  .choice-list.compact,
  .choice-grid,
  .chip-grid {
    grid-template-columns: 1fr;
  }
}
