:root {
  --ink: #0B2E44;
  --muted: #5E7A8C;
  --tq-top: #3EE9D8;
  --tq-bottom: #17B3C9;
  --tq-deep: #0E7F94;
  --line: #D6E9EC;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #FFFFFF 0%, #F2FBFB 55%, #E3F6F5 100%) fixed;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
h1, h2, h3, .t { font-family: "Bricolage Grotesque", system-ui, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
.view { max-width: 480px; margin: 0 auto; }
[hidden] { display: none !important; }

/* Library */
.lib-head { padding: 20px 4px 8px; }
.lib-head h1 { margin: 0; font-size: 30px; }
.lib-head p { margin: 2px 0 0; color: var(--muted); }
.list { list-style: none; margin: 8px 0 32px; padding: 0; display: grid; gap: 10px; }
.list button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 14px; text-align: left;
  border-radius: 18px; background: #fff; box-shadow: 0 3px 0 #D3E7EA, 0 6px 14px rgba(14,127,148,.08); }
.list button:active { transform: translateY(2px); box-shadow: 0 1px 0 #D3E7EA; }
.list img { width: 54px; height: 57px; flex: none; }
.list b { display: block; font-size: 18px; }
.list span { color: var(--muted); font-size: 14px; }
.status { color: var(--muted); text-align: center; }

/* Player */
.top { display: flex; justify-content: space-between; padding-top: 16px; }
.round { width: 44px; height: 44px; border-radius: 22px; background: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 0 #CFE3E6, 0 3px 8px rgba(14,127,148,.12); }
.title { text-align: center; margin-top: 4px; }
.title h2 { margin: 0; font-size: 30px; }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.dial { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 18px auto 0; }
.dial .face { width: 100%; height: 100%; display: block; }
.dial-icon { position: absolute; top: 11%; left: 50%; width: 22%; transform: translateX(-50%); }
.dial-time { position: absolute; top: 40%; left: 0; right: 0; text-align: center; }
.dial-time .t { font-weight: 600; font-size: clamp(44px, 15vw, 58px); font-variant-numeric: tabular-nums; line-height: 1; }
.dial-time .l { color: var(--muted); font-size: 15px; margin-top: 4px; }
.paused .dial-time { opacity: .5; }
.live { position: absolute; left: 25%; width: 50%; height: auto; aspect-ratio: 300 / 40; top: 72%; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .4s; }
.playing .live { opacity: 1; }
.drift { animation: drift 2.4s linear infinite; animation-play-state: paused; }
.playing .drift { animation-play-state: running; }
@keyframes drift { to { transform: translateX(-100px); } }
.banner { margin: 14px 0 0; text-align: center; border-radius: 14px; padding: 12px; background: #FFF4D1; color: #7A5300;
  font-weight: 700; box-shadow: 0 3px 0 #F1DE9C; width: 100%; }
.done { text-align: center; margin-top: 14px; }
.done h3 { margin: 0; font-size: 30px; }
.done p { margin: 4px 0 0; color: var(--muted); }
.bar { margin: 22px 20px 0; }
.track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--tq-top), var(--tq-bottom)); }
.labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.controls { display: flex; justify-content: center; align-items: flex-start; gap: 44px; margin-top: 26px; }
.ctl { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.ctl.spacer { width: 58px; }
.key { display: flex; align-items: center; justify-content: center; }
.key.big { width: 88px; height: 84px; border-radius: 26px; color: #fff; background: linear-gradient(180deg, var(--tq-top), var(--tq-bottom));
  box-shadow: 0 6px 0 var(--tq-deep), 0 12px 22px rgba(14,127,148,.3); }
.key.small { width: 58px; height: 56px; border-radius: 18px; margin-top: 14px; background: #fff; color: var(--ink);
  box-shadow: 0 5px 0 #C9DFE3, 0 10px 16px rgba(14,127,148,.14); }
.key:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--tq-deep); }
.key.small:active { box-shadow: 0 1px 0 #C9DFE3; }
.end-buttons { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 24px; }
.wide, .ghost { width: min(300px, 100%); border-radius: 20px; font-weight: 700; }
.wide { height: 56px; color: #fff; font-size: 18px; background: linear-gradient(180deg, var(--tq-top), var(--tq-bottom)); box-shadow: 0 5px 0 var(--tq-deep); }
.ghost { height: 52px; background: #fff; box-shadow: 0 4px 0 #C9DFE3; }
.note { margin: 28px 8px 24px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 #D3E7EA; padding: 12px 14px; font-size: 14px; color: #2B4A5C; }

/* ---- Step 4: app shell ---- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wide[disabled] { opacity: .55; }
.ghost { background: transparent; box-shadow: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; min-height: 44px; }
.link-btn { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 12px; }
.text-link { color: #0A6E80; font-weight: 700; }
.note-small { font-size: 14px; color: #4F6A7A; text-align: center; margin: 8px 0; }
.lock-note { font-size: 13px; line-height: 1.4; max-width: 320px; margin: 6px auto 0; }

/* first launch */
.onboard section { min-height: 92vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 24px 8px; }
.onboard h1 { font-size: 30px; line-height: 1.15; margin: 0; }
.ob-logo { width: min(280px, 70vw); }
.ob-photo { width: min(300px, 76vw); border-radius: 26px; box-shadow: 0 18px 40px -20px rgba(11,46,68,.45); }
.card-text { background: #fff; border-radius: 18px; padding: 16px 18px; box-shadow: 0 3px 0 #D3E7EA; text-align: left; font-size: 17px; line-height: 1.5; color: #2B4A5C; max-width: 420px; }
.card-text ol { margin: 0; padding-left: 22px; } .card-text li { margin: 6px 0; }

/* library */
.lib-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 6px; }
.lib-logo { width: 150px; }
.banner-card { background: #0E7F94; color: #fff; border-radius: 16px; padding: 14px 16px; font-weight: 700; margin: 6px 0 10px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 0 14px; box-shadow: 0 2px 0 #D3E7EA; color: #4F6A7A; margin: 8px 0 4px; }
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--ink); padding: 13px 0; width: 100%; }
.search:focus-within { outline: 3px solid #17B3C9; }
.row-sec h2, #freeSec h2, #lockedSec h2 { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 20px; margin: 18px 4px 8px; }
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.chips button { flex: none; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; }
.chips img { width: 64px; height: 68px; }
.list li.locked button { opacity: .4; }
.list li.locked button:focus-visible { opacity: 1; }
.list .meta { display: flex; align-items: center; gap: 6px; }
.list .lock { width: 14px; height: 14px; flex: none; }
.list .tag { font-size: 12px; font-weight: 700; color: #0A6E80; }
.list .go { margin-left: auto; width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(180deg, var(--tq-top), var(--tq-bottom)); box-shadow: 0 3px 0 var(--tq-deep); display: flex; align-items: center; justify-content: center; color: #0B2E44; flex: none; }
.list li.locked .go { background: #E2F0F2; box-shadow: none; }
.unlock-banner { width: 100%; text-align: left; background: #0E7F94; color: #fff; border-radius: 16px; padding: 14px 16px; font-weight: 700; margin-bottom: 10px; box-shadow: 0 4px 0 #0A6577; }
.none { text-align: center; color: #4F6A7A; }

/* player star */
#fav[aria-pressed="true"] #favStar { fill: #F5B70A; stroke: #C98F00; }

/* plans */
.plans-icon { width: 76px; display: block; margin: 6px auto 4px; }
.plans-title { font-size: 25px; text-align: center; line-height: 1.2; margin: 6px 6px 16px; }
.plan-cards { display: grid; gap: 12px; margin-bottom: 10px; }
.plan { width: 100%; text-align: left; background: #fff; border-radius: 18px; padding: 16px 18px; box-shadow: 0 3px 0 #D3E7EA; border: 2px solid transparent; position: relative; }
.plan[aria-checked="true"] { border-color: #0E7F94; box-shadow: 0 4px 0 #0A6577; }
.plan.pick { background: #F0FCFB; }
.plan .p-name { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 20px; font-weight: 700; }
.plan .p-price { font-size: 17px; font-weight: 700; color: #0A6E80; margin-top: 2px; }
.plan .p-sub { font-size: 15px; color: #2B4A5C; margin-top: 4px; }
.plan .badge { position: absolute; top: -10px; right: 14px; background: #0E7F94; color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.plans-links { display: flex; flex-direction: column; align-items: center; }
#plans .wide { margin: 8px auto 0; display: flex; }

/* help */
.prose h1 { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 30px; margin: 8px 4px 4px; }
.prose h2 { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 19px; margin: 22px 4px 6px; }
.prose p { margin: 0 4px; line-height: 1.55; color: #2B4A5C; }

/* menu and sheets */
.sheet { position: fixed; inset: 0; background: rgba(11,46,68,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 20; padding: 12px; }
.sheet-card { background: #fff; border-radius: 22px; padding: 10px; width: min(480px, 100%); display: flex; flex-direction: column; gap: 4px; margin-bottom: env(safe-area-inset-bottom); }
.sheet-card h2 { font-family: "Bricolage Grotesque", system-ui, sans-serif; margin: 10px 10px 4px; }
.sheet-item { display: block; text-align: left; padding: 14px 16px; border-radius: 14px; font-weight: 700; color: var(--ink); text-decoration: none; min-height: 48px; }
.sheet-item:hover, .sheet-item:focus-visible { background: #F0FCFB; }
.sheet-item.muted { font-weight: 400; color: #4F6A7A; font-size: 14px; }
.sheet-item.close { text-align: center; color: #0A6E80; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; background: #0B2E44; color: #fff; font-weight: 700; border-radius: 16px; padding: 14px 16px; z-index: 30; }
button:focus-visible, a:focus-visible { outline: 3px solid #17B3C9; outline-offset: 2px; }

/* accessibility (WCAG 2.1 AA), as on teslatoner.com: dark text and icons on the bright turquoise */
.wide, .key.big, .big { color: #0B2E44; }
.list li.locked button { opacity: 1; }
.list li.locked img, .list li.locked .go { opacity: .4; }
.list li.locked .meta { color: #4F6A7A; }

/* Install steps: which phone? (iPhone deep teal, Android navy; white text passes AA on both) */
.phone-q { text-align: center; font-weight: 700; font-size: 19px; margin: 4px 0 12px; }
.phone-pick { display: flex; gap: 12px; justify-content: center; }
.phone-btn { flex: 1; max-width: 150px; height: 64px; border-radius: 18px; color: #fff; font-size: 20px; font-weight: 700; }
.phone-btn.iphone { background: #0E7F94; box-shadow: 0 5px 0 #0A5F6F; }
.phone-btn.android { background: #0B2E44; box-shadow: 0 5px 0 #061B29; }
.switch-phone { display: block; margin: 6px auto 0; font-size: 15px; width: auto; height: auto; }

/* Sign in and Account forms */
.form { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 4px; }
.form p { align-self: stretch; }
.form label { align-self: stretch; font-weight: 700; margin-top: 4px; }
.form input { align-self: stretch; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 14px; border: 2px solid #9DBFC6;
  background: #fff; color: var(--ink); min-height: 52px; box-sizing: border-box; }
.form input:focus { outline: 3px solid #0E7F94; outline-offset: 1px; }
.form input.code { font-size: 28px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.form-msg { min-height: 1.4em; font-weight: 700; color: #8A1C1C; text-align: center; }
.form-msg.ok { color: #0B5E3B; }
#account .ghost, #account .wide { display: block; margin: 10px auto; }

/* Long button labels wrap inside the button instead of running past its edges */
.wide { height: auto; min-height: 56px; padding: 10px 20px; line-height: 1.25; box-sizing: border-box; }

/* Paying for a plan (7.5) and Account billing (7.6) */
.pay-panel { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 12px; }
.pay-card { align-self: stretch; background: #fff; border-radius: 14px; padding: 14px; border: 2px solid #9DBFC6; min-height: 52px; }
#plans .form-msg { margin-top: 10px; }
#acPlanBtns .wide, #acPlanBtns .ghost { display: block; margin: 10px auto; }
.orders { list-style: none; padding: 0; margin: 0; }
.orders li { background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 10px; }
.orders li span { color: #3E5A6A; font-size: 15px; }

/* Lily (spec 22) */
.lily-btn { display: flex; align-items: center; gap: 10px; margin: 12px auto; padding: 8px 16px 8px 8px; border-radius: 30px; background: #fff;
  box-shadow: 0 3px 0 #D3E7EA, 0 6px 14px rgba(14,127,148,.08); color: var(--ink); font-size: 16px; min-height: 48px; }
.lily-btn img { width: 36px; height: 36px; border-radius: 50%; }
.lily-card { height: min(78vh, 640px); padding: 12px; gap: 8px; }
.lily-head { display: flex; align-items: center; gap: 10px; }
.lily-head div { flex: 1; display: flex; flex-direction: column; }
.lily-head span { color: #4F6A7A; font-size: 14px; }
.lily-face { width: 44px; height: 44px; border-radius: 50%; }
.lily-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: #0E7F94; color: #fff; border-bottom-right-radius: 6px; }
.bubble.lily { align-self: flex-start; background: #F0FCFB; color: var(--ink); border-bottom-left-radius: 6px; }
.bubble.wait { color: #4F6A7A; font-style: italic; }
.lily-plays { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.lily-plays button { display: flex; align-items: center; gap: 8px; text-align: left; background: #fff; border-radius: 14px; padding: 8px 12px; min-height: 44px;
  font-weight: 700; color: var(--ink); box-shadow: 0 2px 0 #CDE6EA; }
.lily-plays button span { font-weight: 400; color: #4F6A7A; font-size: 14px; }
.lily-form { display: flex; gap: 8px; }
.lily-form input { flex: 1; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 14px; border: 2px solid #9DBFC6; min-height: 48px; }
.lily-form input:focus { outline: 3px solid #0E7F94; outline-offset: 1px; }
.lily-send { width: 48px; height: 48px; border-radius: 14px; background: #0E7F94; color: #fff; display: flex; align-items: center; justify-content: center; }

/* Staging-only test unlock */
.test-box { margin: 18px 0; padding: 14px 16px; border: 2px dashed #E0A800; border-radius: 16px; background: #FFF9E6; text-align: center; }
.test-box p { margin: 0 0 10px; text-align: left; font-size: 15px; }
.test-box .wide, .test-box .ghost { display: block; margin: 8px auto; }

/* Custom frequency (spec 6.6) */
#customSec .list { margin-top: 0; }
.steps { align-self: stretch; display: grid; gap: 12px; }
.step { background: #fff; border-radius: 18px; box-shadow: 0 3px 0 #D3E7EA; padding: 12px 14px 14px; }
.step-head { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.step-head b { font-size: 16px; }
.step-remove { min-width: 44px; min-height: 44px; margin: -6px -8px -6px 0; color: #8A1C1C; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.step-fields { display: flex; gap: 8px; align-items: flex-end; }
.step-fields label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; margin: 0; min-width: 0; }
.step-fields label.min { flex: 0 0 76px; }
.step-fields .plus { align-self: center; padding-top: 22px; font-weight: 700; color: #4F6A7A; }
.form .step-fields input { width: 100%; min-width: 0; padding: 12px 10px; font-size: 18px; box-sizing: border-box; }
.add-step { align-self: stretch; min-height: 52px; border-radius: 16px; border: 2px dashed #17B3C9; background: #F2FCFD; color: #0A6E80; font-weight: 700; font-size: 17px; }
.add-step span { font-size: 22px; margin-right: 4px; }
.add-step[hidden] { display: none; }
.step-total { align-self: stretch; text-align: center; color: #4F6A7A; margin: 0; }
.paste-btn { align-self: center; }
.paste-box { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 10px; background: #fff; border-radius: 18px; box-shadow: 0 3px 0 #D3E7EA; padding: 14px; }
.paste-box[hidden] { display: none; }
.paste-box label { align-self: stretch; font-weight: 400; font-size: 15px; line-height: 1.45; margin: 0; }
.paste-box textarea { align-self: stretch; box-sizing: border-box; font: inherit; font-size: 16px; padding: 12px; border-radius: 14px; border: 2px solid #9DBFC6; min-height: 150px; resize: vertical; }
.paste-box textarea:focus { outline: 3px solid #0E7F94; outline-offset: 1px; }
.sub-h { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 20px; margin: 22px 4px 8px; }
.custom-recent { display: grid; gap: 10px; }
.custom-recent button { min-height: 52px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 #D3E7EA; font-weight: 700; font-size: 17px; padding: 10px 14px; text-align: left; }

/* CAFL Frequencies (spec 24) */
.cafl-note { margin: 6px 2px 10px; }
.cafl-results .via { display: block; font-size: 13px; color: #6B8594; font-weight: 500; }
.caution, .title p.caution { color: #9A4A00; background: #FFF4E5; border-radius: 10px; padding: 6px 10px; font-size: 14px; font-weight: 700; margin: 6px auto 0; display: inline-block; }
.cafl-results .caution { display: block; margin: 4px 0 0; padding: 3px 8px; font-size: 13px; }

/* Cancer study (spec 25) */
.study-card { margin: 12px auto; }
.study-card p { margin: 0 0 10px; }
.study-field { display: block; margin: 12px auto; max-width: 420px; text-align: left; font-weight: 700; font-size: 15px; }
.study-field input, .study-field select, .study-row input, .study-row select { display: block; width: 100%; box-sizing: border-box; margin-top: 6px; font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 12px; border: 1px solid #C9DFE3; background: #fff; }
.study-check { display: flex; gap: 10px; align-items: flex-start; max-width: 420px; margin: 14px auto; text-align: left; font-size: 15px; }
.study-check input { margin-top: 4px; width: 20px; height: 20px; flex: none; }
.study-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: 6px; align-items: end; margin: 8px 0; }
.study-row input, .study-row select { margin-top: 0; padding: 8px; font-size: 15px; }
.study-row button { font-size: 20px; padding: 0 6px; color: #9A3B3B; }
.study-reports { list-style: none; padding: 0; margin: 8px auto 24px; max-width: 420px; display: grid; gap: 8px; text-align: left; }
.study-reports li { background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 2px 0 #D3E7EA; font-size: 15px; }
.study-reports .acts { display: flex; gap: 14px; margin-top: 4px; }
.study-reports .acts a, .study-reports .acts button { color: #0A6E80; font-weight: 700; font-size: 14px; text-decoration: underline; }
.study-q { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; }
.study-q select { font: inherit; padding: 6px 8px; border-radius: 10px; border: 1px solid #C9DFE3; }
