:root {
  --paper: #f6f8fa;
  --ink: #17344a;
  --muted: #476074;
  --line: #dce5eb;
  --display: 'Fraunces', Georgia, serif;
  --serif: var(--display);
  --sans: 'DM Sans', sans-serif;
  --app-gutter: clamp(18px, 4vw, 48px);
}

body { background: var(--paper); color: var(--ink); display: block; }
button { color: inherit; font: inherit; }
button:focus-visible, summary:focus-visible { outline: 2px solid #326798; outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-icon { width: 20px; height: 20px; display: inline-block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.phone { width: 100%; max-width: 1280px; height: 100vh; height: 100dvh; margin: 0 auto; border-radius: 0; box-shadow: none; background: transparent; }
.app-header { padding: 14px var(--app-gutter); display: flex; align-items: center; min-height: 65px; }
.brand { display: inline-flex; gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; cursor: pointer; font: 500 27px/.95 var(--display); letter-spacing: -.06em; }
.brand > span > span { color: #45749a; }
.brand small { display: block; margin-top: 6px; color: var(--muted); font: 700 8px/1 var(--sans); letter-spacing: .12em; }
.brand-orb, .welcome-orb { border-radius: 50%; background: radial-gradient(ellipse at 33% 24%, #f1f9fd 0%, #b5d3e5 24%, #79a9cb 48%, #3b739e 73%, #204f72 100%); }
.brand-orb { width: 35px; aspect-ratio: 1; }
.content { min-height: 0; outline: none; scrollbar-width: thin; }
.content:not([data-screen="home"]) { width: min(100%, 780px); margin: 0 auto; padding: 8px var(--app-gutter) 28px; }
.content canvas { max-width: 100%; }
.ecg-monitor { max-width: 100%; }
.nav { padding: 5px 10px max(5px, env(safe-area-inset-bottom)); background: #fff; gap: 4px; border-color: var(--line); }
.nav-btn { align-self: center; min-height: 48px; place-content: center; padding: 6px; gap: 4px; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 700; }
.nav-btn[aria-current="page"] { background: #e5eef6; color: #194b74; }
.nav-btn:hover { color: var(--ink); background: #eef3f7; }

.welcome { position: relative; isolation: isolate; overflow: hidden; margin: 6px var(--app-gutter) 0; border-radius: 26px; background: linear-gradient(115deg, #152f46 7%, #1c4562 61%, #3e7595 100%); color: #f8fbff; }
.welcome-copy { position: relative; z-index: 1; padding: clamp(28px, 5vw, 70px); }
.kicker { display: flex; align-items: center; gap: 8px; color: #356488; font: 700 10px/1.4 var(--sans); letter-spacing: .19em; }
.welcome .kicker { color: #c1dcee; }
.kicker span { width: 7px; height: 7px; border-radius: 50%; background: #a8cfeb; }
.welcome h1 { margin: 16px 0 20px; font: 400 clamp(39px, 7vw, 86px)/.99 var(--display); letter-spacing: -.055em; }
.welcome h1 em { color: #c4e0f1; font-style: normal; }
.welcome-description { max-width: 325px; color: #e1edf5; font-size: clamp(14px, 1.55vw, 17px); line-height: 1.6; }
.primary-action, .text-action { display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer; font-weight: 700; }
.primary-action { min-height: 48px; margin-top: 24px; padding: 9px 19px 9px 14px; border: 0; border-radius: 32px; color: #173b56; background: #f1f8ff; font-size: 14px; }
.primary-action .app-icon { width: 22px; height: 22px; }
.primary-action:hover { background: #d8edf9; }
.primary-action:focus-visible { outline-color: #fff; }
.welcome-art { position: absolute; pointer-events: none; top: 50%; right: clamp(-160px, -12vw, -85px); width: min(69vw, 390px); aspect-ratio: 1; transform: translateY(-50%); opacity: .55; }
.ripple { position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 18px, #c7e3fb35 19px 20px, transparent 21px 33px); mask-image: radial-gradient(circle, #000 30%, transparent 71%); }
.welcome-orb { position: absolute; inset: 26%; box-shadow: 0 0 55px #b3def850, 12px 18px 52px #0d2d49a8, inset 0 0 1px 1px #b0d2e67a; }
.welcome-orb::after { content: ''; position: absolute; top: 18%; left: 21%; width: 27%; height: 14%; transform: rotate(-31deg); border-radius: 50%; background: #eef8ffbd; filter: blur(3px); }

.home-section { margin: clamp(26px, 4vw, 45px) var(--app-gutter) 0; }
.home-section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px 18px; margin-bottom: 16px; }
.home-section h2 { margin-top: 5px; font: 400 clamp(25px, 3.4vw, 41px)/1.12 var(--display); letter-spacing: -.045em; }
.text-action { min-height: 37px; border: 0; background: transparent; color: #2e5d80; font-size: 13px; }
.text-action:hover { text-decoration: underline; }
.practice-grid { display: grid; gap: 12px; }
.home-tile { width: 100%; min-height: 94px; display: grid; grid-template-columns: auto 1fr auto; gap: clamp(10px, 2vw, 17px); align-items: center; padding: 15px clamp(12px, 2vw, 24px); border: 1px solid var(--line); border-radius: 16px; background: #fff; text-align: left; cursor: pointer; transition: background-color .18s, border-color .18s; }
.home-tile:hover { background: #edf5fa; border-color: #b7cddd; }
.tile-icon { display: grid; place-items: center; width: clamp(36px, 5vw, 50px); aspect-ratio: 1; border-radius: 13px; background: #e6f0f5; color: #245c7e; }
.program-tile .tile-icon { background: #f2ede4; color: #745a35; }
.home-tile strong { display: block; font: 500 clamp(16px, 2vw, 22px)/1.18 var(--display); letter-spacing: -.025em; }
.home-tile small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.home-tile > .app-icon { color: #396785; width: 17px; }
.tile-progress { display: block; background: #e0eaf0; height: 3px; max-width: 155px; overflow: hidden; border-radius: 3px; margin-top: 8px; }
.tile-progress span { display: block; height: 100%; border-radius: inherit; background: #3c749b; }
.wellbeing { padding-bottom: 30px; }
.questionnaires { margin-top: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; }
.questionnaires summary { cursor: pointer; font-size: 13px; font-weight: 700; padding-block: 5px; }
.questionnaire-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.questionnaire-options .q-btn { cursor: pointer; }
.questionnaire-options .q-btn:hover { border-color: #a5bdcf; }
.questionnaire-options .stat-lab { display: block; margin-top: 3px; }

#q-modal { justify-content: center; padding-inline: var(--app-gutter); }
#q-modal [role="dialog"] { max-width: 560px; }
.audio-error { color: #814030; text-align: center; font-size: 13px; }
.audio-error:empty { display: none; }
.audio-seek { width: 100%; accent-color: #2f6da8; }
.player-time { font-size: clamp(23px, 7vw, 50px); letter-spacing: .02em; }
.player-wrap { max-width: 500px; margin: 0 auto; }
.player-ecg canvas { margin-inline: auto; }
.library-entry, .week-header, .day-row { width: 100%; text-align: left; }
.week-header, .day-row { border: 0; background: transparent; }
.day-row:not(:last-child) { border-bottom: 1px solid var(--beige-d); }
.week-header:focus-visible, .day-row:focus-visible { outline-offset: -3px; }
.library-entry:hover, .week-header:hover, .day-row:hover { background: #edf5fa; }
.library-entry .med-sub, .week-title, .day-detail { display: block; }
.breathe-wrap .benefits-card { max-width: 400px; color: var(--muted); font-size: 13px; line-height: 1.55; }

@media (min-width: 680px) {
  .phone { display: grid; grid-template-columns: 1fr auto; grid-template-rows: 78px minmax(0, 1fr); }
  .app-header { grid-area: 1 / 1; }
  .nav { grid-area: 1 / 2; gap: 5px; padding: 12px var(--app-gutter) 12px 0; align-items: center; background: transparent; border: 0; }
  .nav-btn { flex: none; flex-direction: row; gap: 7px; padding: 8px 13px; font-size: 13px; }
  .nav-btn .app-icon { width: 17px; height: 17px; }
  .content { grid-area: 2 / 1 / 3 / 3; }
  .practice-grid { grid-template-columns: 1fr 1.2fr; }
  .welcome-art { right: -20px; width: min(50%, 510px); opacity: 1; }
  .questionnaire-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #q-modal { align-items: center !important; }
  #q-modal [role="dialog"] { border-radius: 22px !important; }
}
