/* =========================================================================
   MyPain Malaysia — design system
   Apple-inspired: system type, generous whitespace, translucent chrome,
   pill buttons, soft cards. Brand accent: MyPain teal.
   ========================================================================= */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f5f5f7;               /* canvasLight */
  --bg-alt: #f5f6f3;           /* warmWhite */
  --surface: #ffffff;
  --surface-2: #f5f6f3;        /* warmWhite inner panels */
  --fill: rgba(16, 60, 67, 0.06);
  --fill-strong: rgba(16, 60, 67, 0.11);
  --text: #1e293b;             /* slate-800 */
  --text-2: #475569;           /* slate-600 */
  --text-3: #64748b;           /* slate-500 */
  --heading: #103c43;          /* deepTeal */
  --hairline: rgba(226, 232, 240, 0.9);   /* slate-200 */
  --hairline-strong: #cbd5e1;

  --accent: #148580;           /* primaryTeal */
  --accent-hover: #11726e;
  --accent-soft: rgba(20, 133, 128, 0.1);
  --accent-ink: #ffffff;
  --brand-deep: #103c43;       /* deepTeal */
  --sage: #8fd6c6;             /* softSage */
  --stone: #7b8a8e;            /* mutedStone */

  --amber: #92400e;
  --amber-soft: #fffbeb;
  --amber-line: #fde68a;
  --red: #9f1239;
  --red-soft: #fff1f2;
  --red-line: #fecdd3;

  --nav-bg: rgba(255, 255, 255, 0.85);
  --shadow-1: 0 2px 12px rgba(16, 60, 67, 0.05);
  --shadow-2: 0 4px 20px rgba(16, 60, 67, 0.08);
  --shadow-3: 0 12px 32px rgba(16, 60, 67, 0.16);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --pill: 980px;

  --maxw: 1080px;
  --maxw-wide: 1240px;
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  color-scheme: light;
}

html.dark {
  --bg: #0c1618;               /* darkCanvas */
  --bg-alt: #0f1c1f;
  --surface: #132226;          /* darkCard */
  --surface-2: #1a2d32;        /* darkElevated */
  --fill: rgba(143, 214, 198, 0.08);
  --fill-strong: rgba(143, 214, 198, 0.14);
  --text: #f1f5f9;             /* slate-100 */
  --text-2: #94a3b8;           /* slate-400 */
  --text-3: #7b8a8e;           /* mutedStone */
  --heading: #ffffff;
  --hairline: #1e293b;         /* slate-800 */
  --hairline-strong: #334155;
  --accent: #8fd6c6;           /* softSage */
  --accent-hover: #a8e2d5;
  --accent-soft: rgba(20, 133, 128, 0.2);
  --accent-ink: #103c43;
  --amber: #fcd34d;
  --amber-soft: rgba(69, 26, 3, 0.4);
  --amber-line: rgba(146, 64, 14, 0.6);
  --red: #fda4af;
  --red-soft: rgba(76, 5, 25, 0.3);
  --red-line: rgba(136, 19, 55, 0.6);
  --nav-bg: rgba(19, 34, 38, 0.85);
  --shadow-1: none;
  --shadow-2: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.text-large { font-size: 20px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--heading); font-family: var(--font-display); font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: rgba(143, 214, 198, 0.4); color: #103c43; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--pill);
}
.skip-link:focus { top: 12px; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.container-wide { width: 100%; max-width: var(--maxw-wide); margin: 0 auto; padding: 0 22px; }
.section { padding: 88px 0; }
.section-tight { padding: 56px 0; }
.section-alt { background: var(--bg-alt); }
.stack > * + * { margin-top: var(--gap, 16px); }
.grid { display: grid; gap: var(--gap, 20px); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
@media (max-width: 980px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-7, .span-5 { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .section { padding: 64px 0; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .g-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-4:not(.keep-2) { grid-template-columns: 1fr; }
}

/* ---------- Type scale ---------- */
.eyebrow { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; color: var(--accent); }
.eyebrow.muted { color: var(--text-2); }
.display { font-size: clamp(2.5rem, 6.4vw, 4.8rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.04; }
.headline { font-size: clamp(2rem, 4.4vw, 3.3rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.07; }
.title-1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; letter-spacing: -0.02em; }
.title-2 { font-size: 1.35rem; font-weight: 600; }
.title-3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.lede { font-size: clamp(1.1rem, 1.8vw, 1.4rem); line-height: 1.4; color: var(--text-2); letter-spacing: -0.015em; }
.body-2 { font-size: 0.9rem; color: var(--text-2); }
.caption { font-size: 0.76rem; color: var(--text-3); letter-spacing: -0.005em; }
.gradient-text {
  background: linear-gradient(90deg, #0b7a75 0%, #2bb3a3 45%, #6c8cff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html.dark .gradient-text { background: linear-gradient(90deg, #5fd0c0 0%, #8fd6c6 45%, #a5b8ff 100%); -webkit-background-clip: text; background-clip: text; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Global nav ---------- */
.gnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.gnav-inner { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--heading); font-weight: 600; font-size: 0.95rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand-deep); display: grid; place-items: center; }
.brand-mark svg { width: 15px; height: 15px; color: var(--sage); }
.brand small { color: var(--accent); font-weight: 500; }
.gnav-links { display: flex; align-items: center; gap: 4px; }
.gnav-links a {
  color: var(--text); opacity: 0.8; font-size: 0.78rem; padding: 6px 11px; border-radius: var(--pill);
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}
.gnav-links a:hover { opacity: 1; text-decoration: none; }
.gnav-links a[aria-current="page"] { opacity: 1; font-weight: 600; background: var(--surface); color: var(--heading); box-shadow: var(--shadow-1); }
.gnav-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  min-width: 34px; height: 34px; padding: 0 9px; border-radius: var(--pill);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text); font-size: 0.74rem; font-weight: 600;
  transition: background 0.2s var(--ease);
}
.icon-btn:hover { background: var(--fill); }
.icon-btn svg { width: 17px; height: 17px; }
.flare-btn { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); }
.flare-btn:hover { background: var(--amber-soft); filter: brightness(0.97); }
@media (max-width: 900px) { .gnav-links { display: none; } .flare-btn .label { display: none; } }

/* ---------- Mobile tab bar ---------- */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hairline);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
  color: var(--text-3); font-size: 0.62rem; font-weight: 500; letter-spacing: 0;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
@media (max-width: 900px) { .tabbar { display: grid; } body { padding-bottom: 72px; } }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: var(--pill);
  font-size: 0.94rem; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.2s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: var(--accent); color: var(--accent-ink); }
.btn-tinted { background: var(--accent-soft); color: var(--accent); }
.btn-tinted:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.btn-gray { background: var(--fill); color: var(--text); }
.btn-gray:hover { background: var(--fill-strong); }
.btn-dark { background: var(--brand-deep); color: #fff; }
.btn-dark:hover { background: var(--accent); }
html.dark .btn-dark { background: #148580; }
.btn-sm { min-height: 34px; padding: 0 15px; font-size: 0.8rem; }
.btn-xs { min-height: 28px; padding: 0 12px; font-size: 0.74rem; }
.btn-block { width: 100%; }
.link-more { color: var(--accent); font-size: 1rem; font-weight: 400; display: inline-flex; align-items: center; gap: 2px; }
.link-more::after { content: "›"; font-size: 1.15em; line-height: 1; transform: translateY(-1px); margin-left: 3px; }
.link-more.sm { font-size: 0.86rem; }
button.link-more { padding: 0; }
button.link-more:hover { text-decoration: underline; }

/* ---------- Cards / tiles ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 28px;
  box-shadow: var(--shadow-1); border: 1px solid var(--hairline);
}
.section-alt .card { border-color: transparent; }
html.dark .card { border-color: var(--hairline); }
.card-flat { background: var(--surface-2); border-radius: var(--r-md); padding: 18px; }
.card-tight { padding: 20px; }
.tile {
  position: relative; display: flex; flex-direction: column; text-align: left; width: 100%;
  background: var(--surface); border-radius: var(--r-xl); padding: 30px; overflow: hidden;
  color: var(--text); border: 1px solid var(--hairline); box-shadow: var(--shadow-1);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.section-alt .tile { border-color: transparent; }
html.dark .tile { border-color: var(--hairline); }
.tile:hover { transform: translateY(-3px) scale(1.005); box-shadow: var(--shadow-2); text-decoration: none; }
.tile .tile-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 18px;
}
.tile .tile-icon svg { width: 22px; height: 22px; }
.tile h3 { font-size: 1.2rem; font-weight: 600; }
.tile p { color: var(--text-2); font-size: 0.92rem; margin-top: 6px; }
.tile .link-more { margin-top: auto; padding-top: 18px; font-size: 0.9rem; }
.tile.warn .tile-icon { background: var(--amber-soft); color: var(--amber); }
.tile.dark { background: var(--brand-deep); color: #fff; border-color: transparent; }
.tile.dark h3 { color: #fff; }
.tile.dark p { color: rgba(255, 255, 255, 0.78); }
.tile.dark .link-more { color: var(--sage); }
.tile.dark .tile-icon { background: rgba(143, 214, 198, 0.16); color: var(--sage); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--pill);
  background: var(--fill); color: var(--text-2); font-size: 0.72rem; font-weight: 600; letter-spacing: 0;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }

.notice { border-radius: var(--r-md); padding: 14px 16px; font-size: 0.86rem; line-height: 1.45; background: var(--surface-2); color: var(--text-2); }
.notice strong { color: var(--text); }
.notice.accent { background: var(--accent-soft); color: var(--text); }
.notice.amber { background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--text); }
.notice.red { background: var(--red-soft); border: 1px solid var(--red-line); color: var(--text); }
.notice.red strong { color: var(--red); }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; text-align: center; position: relative; overflow: hidden; isolation: isolate; background: var(--brand-deep); color: #fff; }
.hero h1 { color: #fff; }
.hero .eyebrow { color: var(--sage); }
.hero .lede { color: rgba(226, 232, 240, 0.95); }
.hero .reassure { color: rgba(143, 214, 198, 0.9) !important; }
.hero .btn-primary { background: #148580; color: #fff; }
.hero .btn-primary:hover { background: #11726e; }
.hero .btn-secondary { color: #fff; border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.1); }
.hero .btn-secondary:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
html.dark .hero { background: #103c43; }
.hero .eyebrow { font-size: 1rem; margin-bottom: 14px; }
.hero .display { max-width: 15ch; margin: 0 auto; }
.hero .lede { max-width: 40ch; margin: 22px auto 0; }
.hero .row { justify-content: center; margin-top: 32px; }
.hero .reassure { margin-top: 22px; color: var(--text-3); font-size: 0.86rem; }
.hero-art { margin: 56px auto 0; max-width: 880px; }
.hero::before {
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 380px; height: 380px; z-index: -1; pointer-events: none;
  border-radius: 50%; background: rgba(20, 133, 128, 0.35); filter: blur(48px);
}
.hero::after {
  content: ""; position: absolute; right: 12%; top: 40px; width: 150px; height: 150px; z-index: -1; pointer-events: none;
  border-radius: 50%; border: 1px solid rgba(143, 214, 198, 0.2);
}
@media (max-width: 640px) { .hero { padding: 64px 0 48px; } }

/* ---------- Page header (inner views) ---------- */
.page-head { padding-top: 64px; padding-bottom: 28px; }
.page-head .headline { margin-top: 6px; }
.page-head .lede { margin-top: 12px; max-width: 46ch; }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex; padding: 3px; border-radius: 11px; background: var(--fill); gap: 2px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  padding: 7px 16px; border-radius: 9px; font-size: 0.82rem; font-weight: 500; color: var(--text);
  white-space: nowrap; transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.segmented button[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); font-weight: 600; }
html.dark .segmented button[aria-selected="true"] { background: var(--surface-2); color: var(--accent); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-row button {
  padding: 7px 15px; border-radius: var(--pill); font-size: 0.8rem; font-weight: 500;
  background: var(--fill); color: var(--text); transition: background 0.2s var(--ease);
}
.filter-row button:hover { background: var(--fill-strong); }
.filter-row button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.subnav { position: sticky; top: 52px; z-index: 40; background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hairline); }
.subnav-inner { display: flex; align-items: center; gap: 4px; height: 50px; overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav-inner button { padding: 6px 13px; border-radius: var(--pill); font-size: 0.8rem; color: var(--text-2); white-space: nowrap; }
.subnav-inner button:hover { color: var(--text); }
.subnav-inner button[aria-selected="true"] { color: #fff; font-weight: 600; background: var(--accent); }
html.dark .subnav-inner button[aria-selected="true"] { color: var(--accent-ink); }

/* ---------- Pillars bento ---------- */
.pillar { border-radius: var(--r-xl); padding: 32px; min-height: 260px; display: flex; flex-direction: column; text-align: left; color: var(--text); transition: transform 0.35s var(--ease); width: 100%; }
.pillar:hover { transform: translateY(-3px); }
.pillar .eyebrow { color: inherit; opacity: 0.7; }
.pillar h3 { font-size: 1.6rem; font-weight: 700; margin-top: 6px; }
.pillar p { margin-top: 10px; font-size: 0.92rem; opacity: 0.85; }
.pillar .link-more { margin-top: auto; padding-top: 20px; color: inherit; font-weight: 500; }
.p-body, .p-mind, .p-conn, .p-mean { background: var(--surface-2); color: var(--heading); border: 1px solid var(--hairline); }
.pillar:hover { border-color: var(--accent); }
.pillar .eyebrow { color: var(--accent); opacity: 1; }
.pillar p { color: var(--text-2); opacity: 1; }
.pillar .link-more { color: var(--accent); }
.pillar.p-body, .pillar.p-mind, .pillar.p-conn, .pillar.p-mean { transition: transform 0.35s var(--ease), border-color 0.2s; }
.pathway { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 28px; }
.pathway span { padding: 8px 16px; border-radius: var(--pill); background: var(--surface); font-size: 0.84rem; font-weight: 500; border: 1px solid var(--hairline); }
.pathway i { color: var(--text-3); font-style: normal; }

/* ---------- Horizontal scroller (myths) ---------- */
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 340px); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 22px 24px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }
.scroller-wrap { max-width: var(--maxw-wide); margin: 0 auto; }
.scroller-controls { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--text); }
.round-btn:hover { background: var(--fill-strong); }
.round-btn svg { width: 16px; height: 16px; }
.myth { background: var(--surface); border-radius: var(--r-xl); padding: 28px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--hairline); min-height: 270px; }
.myth .label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.myth .m { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(196, 30, 58, 0.5); font-size: 1.02rem; line-height: 1.35; }
.myth .f { font-size: 1.12rem; font-weight: 600; line-height: 1.32; letter-spacing: -0.015em; }

/* ---------- Lists ---------- */
.list-inset { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--hairline); }
.section-alt .list-inset { border-color: transparent; }
.list-inset > * { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--hairline); width: 100%; text-align: left; }
.list-inset > *:last-child { border-bottom: 0; }
.list-inset > table { display: table; padding: 0; border-bottom: 0; }
.list-inset .grow { flex: 1; min-width: 0; }
.steps { counter-reset: s; display: grid; gap: 16px; }
.steps li { list-style: none; display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; }
.steps li::before {
  counter-increment: s; content: counter(s);
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}
.check-list li { list-style: none; position: relative; padding-left: 26px; margin-top: 10px; font-size: 0.94rem; color: var(--text-2); }
.check-list li::before { content: ""; position: absolute; left: 2px; top: 0.45em; width: 12px; height: 7px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

/* ---------- FAQ (details) ---------- */
.faq details { border-bottom: 1px solid var(--hairline); }
.faq summary {
  list-style: none; cursor: pointer; padding: 22px 36px 22px 0; position: relative;
  font-size: 1.08rem; font-weight: 600; letter-spacing: -0.015em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg); transition: transform 0.3s var(--ease);
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq .answer { padding: 0 0 22px; color: var(--text-2); max-width: 70ch; }
.faq .answer p + p { margin-top: 10px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); letter-spacing: -0.005em; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid transparent; font-size: 0.94rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.sm, .select.sm { min-height: 36px; padding: 6px 10px; font-size: 0.84rem; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.checkbox { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.88rem; color: var(--text-2); }
.checkbox input, .toggle input { accent-color: var(--accent); width: 20px; height: 20px; flex-shrink: 0; margin: 1px 0 0; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* iOS switch */
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 31px; background: var(--fill-strong); transition: background 0.25s var(--ease); }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.1); transition: transform 0.25s var(--ease); }
.switch input:checked + span { background: #148580; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* ---------- Metrics ---------- */
.metric { background: var(--surface); border-radius: var(--r-lg); padding: 22px; border: 1px solid var(--hairline); }
.section-alt .metric { border-color: transparent; }
.metric .k { font-size: 0.78rem; color: var(--text-2); font-weight: 500; }
.metric .v { color: var(--heading); font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; line-height: 1; }
.metric .v small { font-size: 0.9rem; font-weight: 500; color: var(--text-2); letter-spacing: 0; margin-left: 3px; }
.metric .d { font-size: 0.76rem; color: var(--accent); margin-top: 10px; font-weight: 500; }
.bar { height: 6px; border-radius: 6px; background: var(--fill); overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width 0.6s var(--ease); }

.banner {
  border-radius: var(--r-xl); padding: 34px; color: #fff; position: relative; overflow: hidden;
  background: #103c43;
}
.banner h1, .banner h2, .banner h3 { color: #fff; }
.banner .eyebrow { color: var(--sage); }
.banner p { color: rgba(226, 232, 240, 0.9); }
.banner .btn-glass { background: rgba(255, 255, 255, 0.14); color: #fff; border: 1px solid rgba(255, 255, 255, 0.22); }
.banner .btn-glass:hover { background: rgba(255, 255, 255, 0.24); }

/* checklist rows */
.check-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: background 0.2s; }
.check-row + .check-row { margin-top: 8px; }
.check-row input { accent-color: var(--accent); width: 20px; height: 20px; flex-shrink: 0; }
.check-row.done span { color: var(--text-3); text-decoration: line-through; }

/* ---------- Lesson cards ---------- */
.lesson-card { cursor: pointer; }
.lesson-card .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lesson-card h3 { margin-top: 12px; }
.read-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.progress-ring { --p: 0; width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--fill) 0); display: grid; place-items: center; }
.progress-ring::after { content: attr(data-label); width: 42px; height: 42px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; }

/* exercises */
.ex-card { background: var(--surface); border-radius: var(--r-lg); padding: 14px; border: 1px solid var(--hairline); text-align: left; width: 100%; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); display: flex; flex-direction: column; }
.ex-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.ex-art { height: 112px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); margin-bottom: 12px; }
.ex-art svg { width: 84px; height: 84px; }
.ex-card .t { font-size: 0.86rem; font-weight: 600; line-height: 1.25; }
.ex-card .c { font-size: 0.74rem; color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Tools ---------- */
.timer { font-size: clamp(3.6rem, 9vw, 5rem); font-weight: 200; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.breath-stage { width: 220px; height: 220px; margin: 8px auto; position: relative; display: grid; place-items: center; }
.breath-stage::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent); }
.breath-circle {
  width: 136px; height: 136px; border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 35% 30%, #c4ece3, #8fd6c6 55%, #148580);
  color: #103c43; transform: scale(0.85); transition: transform 4s ease-in-out;
  box-shadow: 0 18px 40px rgba(20, 133, 128, 0.3);
}
.breath-circle b { display: block; font-size: 1rem; }
.breath-circle small { font-size: 0.78rem; opacity: 0.9; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--hairline); }
td { padding: 13px 18px; border-bottom: 1px solid var(--hairline); }
tr:last-child td { border-bottom: 0; }
tr.you td { background: var(--accent-soft); }

/* ---------- Help ---------- */
.hotline { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--hairline); }
.hotline .num { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hotline.emergency { background: var(--red-soft); border-color: var(--red-line); }
.hotline.emergency .num { color: var(--red); }

/* ---------- Footer ---------- */
.footer { background: var(--bg-alt); color: var(--text-2); font-size: 0.76rem; padding: 40px 0 28px; border-top: 1px solid var(--hairline); }
.footer p { line-height: 1.55; }
.footer .cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 24px 0; padding: 24px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.footer h4 { font-size: 0.76rem; font-weight: 600; color: var(--text); margin-bottom: 10px; letter-spacing: -0.01em; }
.footer .cols a, .footer .cols button { display: block; color: var(--text-2); margin-top: 8px; font-size: 0.76rem; text-align: left; }
.footer .cols a:hover, .footer .cols button:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 760px) { .footer .cols { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Sheets (modals) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 620px; max-height: min(88vh, 900px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); padding: 30px;
  transform: translateY(24px) scale(0.98); transition: transform 0.35s var(--ease);
}
.sheet:focus { outline: none; }
.sheet.wide { max-width: 760px; }
.sheet.narrow { max-width: 460px; }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.close-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.close-btn:hover { background: var(--fill-strong); color: var(--text); }
.close-btn svg { width: 14px; height: 14px; }
.prose { color: var(--text); font-size: 1.02rem; line-height: 1.6; }
.prose p + p, .prose p + div, .prose div + p { margin-top: 14px; }
.prose strong { font-weight: 600; }
.prose .aside { margin-top: 18px; background: var(--surface-2); border-radius: var(--r-md); padding: 18px; font-size: 0.92rem; }
.prose .aside b { display: block; margin-bottom: 4px; }
pre.report { margin: 0; padding: 16px; background: var(--surface-2); border-radius: var(--r-md); font-family: var(--mono); font-size: 0.74rem; line-height: 1.55; white-space: pre-wrap; max-height: 320px; overflow-y: auto; letter-spacing: 0; }
@media (max-width: 640px) {
  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 22px 22px 0 0; max-height: 92vh; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateY(100%); }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  padding: 12px 20px; border-radius: var(--pill); font-size: 0.86rem; font-weight: 500;
  background: #103c43; color: #fff; box-shadow: var(--shadow-3);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  animation: toast-in 0.35s var(--ease); max-width: min(92vw, 460px); text-align: center;
}
html.dark .toast { background: #f1f5f9; color: #103c43; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 900px) { .toasts { bottom: 92px; } }

/* ---------- Motion ---------- */
.view { animation: view-in 0.45s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Utilities ---------- */
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-24 { margin-bottom: 24px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: 0.84rem; } .xsmall { font-size: 0.76rem; }
.bold { font-weight: 600; }
.accent-text { color: var(--accent); }
.amber-text { color: var(--amber); }
.mono { font-family: var(--mono); letter-spacing: 0; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--hairline); margin: 20px 0; border: 0; }
.scroll-y { max-height: 360px; overflow-y: auto; }
.nowrap { white-space: nowrap; }

/* ---------- Print ---------- */
@media print {
  .gnav, .tabbar, .footer, .no-print, .toasts { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .sheet-backdrop:not(.open) { display: none !important; }
  .sheet-backdrop.open { position: static; background: none; backdrop-filter: none; padding: 0; }
  .sheet { box-shadow: none; max-height: none; transform: none; }
  pre.report { max-height: none; background: none; }
  main { display: none; }
}

/* Scrollbar (original MyPain style) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(20, 133, 128, 0.25); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(20, 133, 128, 0.45); }
