/* ============================================================
   Your Sleep, Read from Your Blood — monthly report
   Calm "night" theme. Mobile-first, data-driven (assets/report.js).
   ============================================================ */

:root {
  --bg: #070b18;
  --bg-2: #0a1024;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #eaf0ff;
  --text-soft: #c4cdec;
  --muted: #93a0c4;
  --faint: #6a779b;

  --violet: #8b7bff;
  --teal: #34d8c8;
  --blue: #5aa6ff;

  --good: #46e0b8;
  --warm: #ffc07a;
  --rose: #ff8aa0;
  --cool: #74b6ff;

  --grad-aurora: linear-gradient(135deg, #8b7bff 0%, #34d8c8 100%);
  --grad-good: linear-gradient(135deg, #34d8c8 0%, #46e0b8 100%);
  --grad-watch: linear-gradient(135deg, #ffc07a 0%, #ff9e7a 100%);
  --grad-care: linear-gradient(135deg, #ff9e7a 0%, #ff8aa0 100%);

  --radius: 22px;
  --radius-sm: 14px;
  --app-w: 560px;
  --shadow: 0 22px 50px -28px rgba(0, 0, 0, 0.9);
  --font-d: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-b: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-b);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* ambient night backdrop */
.aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 45% at 18% 8%, rgba(139, 123, 255, 0.22), transparent 60%),
    radial-gradient(55% 40% at 88% 14%, rgba(52, 216, 200, 0.16), transparent 60%),
    radial-gradient(70% 50% at 50% 100%, rgba(90, 166, 255, 0.12), transparent 65%),
    linear-gradient(180deg, #070b18 0%, #080d1e 55%, #060a16 100%);
}
.stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 33% 12%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 68% 28%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.4px 1.4px at 82% 9%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 50% 40%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 92% 46%, rgba(255,255,255,0.4), transparent);
}

.app {
  position: relative; z-index: 1;
  max-width: var(--app-w);
  margin: 0 auto;
  padding: 26px 18px 64px;
  display: flex; flex-direction: column; gap: 18px;
}

/* ---------------------------------------------------------------- header */
.r-header { display: flex; align-items: center; gap: 13px; padding: 4px 2px 2px; }
.moon {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  background: var(--grad-aurora);
  display: grid; place-items: center;
  box-shadow: 0 0 26px -6px rgba(139, 123, 255, 0.7);
}
.moon svg { width: 22px; height: 22px; }
.r-header h1 { font-family: var(--font-d); font-size: 19px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.15; }
.r-header .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* badge */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 13px; border-radius: 999px; align-self: flex-start;
}
.badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.eyebrow {
  font-family: var(--font-d); font-size: 11px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted);
  display: block; margin-bottom: 12px;
}

/* ---------------------------------------------------------------- score hero */
.score-card { text-align: center; padding: 26px 20px 22px; }
.gauge { position: relative; width: 196px; height: 196px; margin: 4px auto 6px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 13; }
.gauge .fill { fill: none; stroke-width: 13; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.22,1,.36,1); }
.gauge.g-good .fill { stroke: url(#gGood); }
.gauge.g-watch .fill { stroke: url(#gWatch); }
.gauge.g-care .fill  { stroke: url(#gCare); }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-num { font-family: var(--font-d); font-size: 52px; font-weight: 700; line-height: 1; }
.gauge-num small { font-size: 18px; color: var(--muted); font-weight: 500; }
.gauge-label { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.score-name { font-family: var(--font-d); font-size: 14px; font-weight: 600; letter-spacing: 0.4px; margin-top: 2px; }
.score-name.t-good { color: var(--good); }
.score-name.t-watch { color: var(--warm); }
.score-name.t-care { color: var(--rose); }
.headline { font-family: var(--font-d); font-size: 20px; font-weight: 600; line-height: 1.3; margin: 16px auto 0; max-width: 30ch; }
.disclaimer { font-size: 12.5px; color: var(--faint); margin-top: 12px; line-height: 1.5; }
.trust { font-size: 13px; color: var(--text-soft); margin-top: 14px; display: inline-flex; gap: 7px; align-items: center; justify-content: center; }
.trust svg { width: 15px; height: 15px; color: var(--teal); flex: none; }

/* ---------------------------------------------------------------- short version */
.short p { font-size: 16.5px; color: var(--text-soft); line-height: 1.65; }
.short .lead-mark { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- insight cards */
.section-title { font-family: var(--font-d); font-size: 16px; font-weight: 600; letter-spacing: 0.3px; color: var(--text); margin: 8px 2px 2px; }
.insight { display: flex; flex-direction: column; gap: 13px; }
.insight-head { display: flex; align-items: flex-start; gap: 12px; }
.insight-rank {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font-d); font-weight: 700; font-size: 14px;
  display: grid; place-items: center; color: var(--violet);
}
.insight-title { font-family: var(--font-d); font-size: 17px; font-weight: 600; line-height: 1.3; flex: 1; }
.insight-noticed { font-size: 15px; color: var(--text-soft); line-height: 1.6; }

.blood-line { background: rgba(255,255,255,0.025); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px; }
.blood-line .bl-label { font-size: 11.5px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.mini-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft);
}
.chip .sym { font-size: 10px; line-height: 1; }
.chip.s-high { color: #ffd2a6; border-color: rgba(255, 192, 122, 0.32); background: rgba(255, 192, 122, 0.09); }
.chip.s-low  { color: #bcdcff; border-color: rgba(116, 182, 255, 0.32); background: rgba(116, 182, 255, 0.09); }
.chip.s-ok   { color: #b6f2df; border-color: rgba(70, 224, 184, 0.30); background: rgba(70, 224, 184, 0.08); }

.next-step, .doctor {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.55; border-radius: var(--radius-sm); padding: 12px 14px;
}
.next-step { background: rgba(52, 216, 200, 0.07); border: 1px solid rgba(52, 216, 200, 0.18); color: var(--text-soft); }
.doctor { background: rgba(255, 138, 160, 0.07); border: 1px solid rgba(255, 138, 160, 0.20); color: #ffd4dc; }
.next-step .ic, .doctor .ic { flex: none; width: 19px; height: 19px; margin-top: 1px; }
.next-step .ic { color: var(--teal); } .doctor .ic { color: var(--rose); }
.step-label { font-weight: 600; color: var(--text); }

.cite {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 12px; font-weight: 600; color: var(--violet);
  text-decoration: none; padding: 5px 10px; border-radius: 999px;
  border: 1px solid rgba(139, 123, 255, 0.32); background: rgba(139, 123, 255, 0.08);
  white-space: nowrap;
}
.cite:hover { background: rgba(139, 123, 255, 0.16); }

.more-btn {
  width: 100%; font-family: var(--font-d); font-weight: 600; font-size: 14px;
  color: var(--text-soft); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px; cursor: pointer;
}
.more-btn:hover { background: var(--surface-2); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- blood groups */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.s-high { background: var(--warm); } .dot.s-low { background: var(--cool); } .dot.s-ok { background: var(--good); }
.blood-group { margin-top: 14px; }
.blood-group:first-of-type { margin-top: 0; }
.bg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 10px; }

/* ---------------------------------------------------------------- trends / questions / refs */
.trend-illu { height: 60px; margin: 4px 0 14px; opacity: 0.7; }
.muted { color: var(--muted); font-size: 14.5px; line-height: 1.6; }

.q-list { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; list-style: none; }
.q-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--text-soft); }
.q-list .qmark { color: var(--violet); flex: none; font-weight: 700; }

.ref-list { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 14px; counter-reset: ref; }
.ref-item { display: flex; gap: 12px; scroll-margin-top: 20px; }
.ref-n {
  width: 25px; height: 25px; border-radius: 8px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font-d); font-weight: 700; font-size: 12.5px;
  display: grid; place-items: center; color: var(--violet);
}
.ref-item:target .ref-n { background: var(--grad-aurora); color: #08111e; border-color: transparent; }
.ref-body { font-size: 14px; color: var(--text-soft); line-height: 1.55; }
.ref-body .ref-type { font-weight: 600; color: var(--text); }
.ref-body a { color: var(--teal); text-decoration: none; font-weight: 500; white-space: nowrap; }
.ref-body a:hover { text-decoration: underline; }

.footer { font-size: 12.5px; color: var(--faint); line-height: 1.6; text-align: center; padding: 8px 6px 0; }

/* ---------------------------------------------------------------- hero banner */
.hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  height: clamp(190px, 46vw, 264px); box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,11,24,0) 30%, rgba(7,11,24,0.35) 62%, rgba(7,11,24,0.92) 100%);
}
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 20px 17px; }
.hero-eyebrow { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: #c9d3f5; opacity: 0.92; margin-bottom: 5px; }
.hero-text h1 { font-family: var(--font-d); font-size: 24px; font-weight: 700; line-height: 1.12; letter-spacing: 0.2px; text-shadow: 0 2px 18px rgba(0,0,0,0.5); }

/* potential pill + ghost gauge */
.gauge .ghost { fill: none; stroke: rgba(255,255,255,0.16); stroke-width: 13; stroke-linecap: round; stroke-dasharray: 2 8; }
.potential {
  display: inline-flex; align-items: center; gap: 7px; margin: 13px auto 0;
  font-size: 13.5px; color: var(--text-soft);
  background: rgba(52,216,200,0.08); border: 1px solid rgba(52,216,200,0.22);
  padding: 7px 14px; border-radius: 999px;
}
.potential b { color: var(--good); font-family: var(--font-d); }
.potential .ic { width: 15px; height: 15px; color: var(--teal); display: inline-flex; }
.potential .ic svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- score breakdown bar */
.intro { margin-bottom: 14px; }
.score-bar { display: flex; height: 18px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.bar-seg { height: 100%; }
.bar-seg.kept { background: var(--grad-good); }
.bar-seg + .bar-seg { box-shadow: inset 1px 0 0 rgba(7,11,24,0.5); }
.bd-rows { margin-top: 15px; display: flex; flex-direction: column; gap: 9px; }
.bd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-soft); }
.bd-key { display: inline-flex; align-items: center; gap: 9px; }
.sw { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.sw.kept { background: var(--grad-good); }
.bd-pts { font-family: var(--font-d); font-weight: 600; font-size: 13px; color: var(--muted); flex: none; }
.bd-pts.good { color: var(--good); }

/* ---------------------------------------------------------------- section intros */
.section-intro { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: -2px 2px 4px; }
.fineprint { font-size: 12px; color: var(--faint); text-align: center; margin: -4px 4px 0; }

/* shared marker / pattern icon badge */
.m-icon { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); }
.m-icon svg { width: 21px; height: 21px; }
.dotc { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

/* ---------------------------------------------------------------- marker impact cards */
.impact { display: flex; flex-direction: column; gap: 12px; }
.impact-head { display: flex; align-items: center; gap: 12px; }
.impact-title { flex: 1; font-family: var(--font-d); font-size: 15.5px; font-weight: 600; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip.inline { font-size: 11.5px; padding: 3px 9px; }
.pts-pill { flex: none; font-family: var(--font-d); font-weight: 700; font-size: 20px; color: var(--warm); line-height: 1; }
.pts-pill small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.impact-meter { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.impact-meter span { display: block; height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.22,1,.36,1); }
.impact-vals { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; color: var(--text-soft); }
.impact-vals b { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; margin-right: 5px; }
.impact-why { font-size: 14.5px; color: var(--text-soft); line-height: 1.6; }
.impact-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 3px; }
.links-to { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- top move cards */
.move { display: flex; flex-direction: column; gap: 13px; border-left: 3px solid var(--accent); }
.move-head { display: flex; align-items: center; gap: 11px; }
.move-rank { width: 26px; height: 26px; border-radius: 9px; flex: none; display: grid; place-items: center; font-family: var(--font-d); font-weight: 700; font-size: 14px; color: #08111e; background: var(--accent); }
.move-title { flex: 1; font-family: var(--font-d); font-size: 16.5px; font-weight: 600; line-height: 1.25; }
.gain-pill { flex: none; font-family: var(--font-d); font-weight: 700; font-size: 19px; color: var(--accent); line-height: 1; }
.gain-pill small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.ba { display: flex; flex-direction: column; gap: 8px; }
.ba-track { display: flex; height: 11px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.ba-now { height: 100%; background: rgba(255,255,255,0.20); }
.ba-gain { height: 100%; opacity: 0.85; }
.ba-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ba-label b { color: var(--text); font-family: var(--font-d); }
.ba-arrow { display: inline-flex; width: 15px; height: 15px; color: var(--faint); }
.ba-arrow svg { width: 15px; height: 15px; }
.move-why { font-size: 14.5px; color: var(--text-soft); line-height: 1.6; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.steps.tight { gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--text-soft); line-height: 1.5; }
.steps .ic { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--teal); }
.steps .ic svg { width: 18px; height: 18px; }
.targets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.t-label { font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.tchip { font-size: 12.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); }
.move-foot, .pattern-foot { padding-top: 2px; }

/* ---------------------------------------------------------------- pattern (what/why/how) cards */
.pattern { display: flex; flex-direction: column; gap: 14px; border-left: 3px solid var(--accent); }
.pattern-head { display: flex; align-items: center; gap: 11px; }
.pattern-title { flex: 1; font-family: var(--font-d); font-size: 16.5px; font-weight: 600; line-height: 1.25; }
.cost-pill { flex: none; font-size: 12px; font-weight: 600; color: var(--warm); border: 1px solid rgba(255,192,122,0.3); background: rgba(255,192,122,0.08); padding: 4px 10px; border-radius: 999px; }
.wwh { display: flex; flex-direction: column; gap: 14px; }
.wwh-row { display: flex; flex-direction: column; gap: 8px; }
.wwh-tag { align-self: flex-start; font-family: var(--font-d); font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.wwh-tag.what { color: var(--cool); background: rgba(116,182,255,0.1); border: 1px solid rgba(116,182,255,0.22); }
.wwh-tag.why  { color: var(--violet); background: rgba(139,123,255,0.1); border: 1px solid rgba(139,123,255,0.24); }
.wwh-tag.how  { color: var(--good); background: rgba(70,224,184,0.1); border: 1px solid rgba(70,224,184,0.22); }
.wwh-row p { font-size: 15px; color: var(--text-soft); line-height: 1.6; }

/* ---------------------------------------------------------------- connection map */
.connect-map { position: relative; display: flex; justify-content: space-between; gap: 14px; margin-top: 4px; }
.connect-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.cm-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; max-width: 46%; }
.cm-col.markers { align-items: flex-start; }
.cm-col.signals { align-items: flex-end; text-align: right; }
.cm-cap { font-size: 10.5px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.cm-node {
  font-size: 12.5px; line-height: 1.3; padding: 8px 11px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text-soft);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; cursor: default;
}
.cm-node.s-high { border-color: rgba(255,192,122,0.34); }
.cm-node.s-low  { border-color: rgba(116,182,255,0.34); }
.cm-node.sig { display: inline-flex; align-items: center; gap: 8px; border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.cm-node.hot { transform: scale(1.04); box-shadow: 0 0 0 1px var(--border-strong), 0 8px 22px -12px #000; border-color: var(--border-strong); }

/* ---------------------------------------------------------------- method explainer */
.method { padding: 0; overflow: hidden; }
.method-img { width: 100%; height: clamp(140px, 36vw, 200px); object-fit: cover; display: block; }
.method-body { padding: 18px 20px 20px; }
.method-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ms { display: flex; align-items: center; gap: 11px; font-size: 14px; color: var(--text-soft); }
.ms-n { width: 24px; height: 24px; border-radius: 8px; flex: none; display: grid; place-items: center; font-family: var(--font-d); font-weight: 700; font-size: 12.5px; color: var(--violet); background: var(--surface-2); border: 1px solid var(--border); }

/* cite link with superscript */
.cite sup { font-size: 9px; margin-right: 2px; }

/* reveal animation */
.reveal { opacity: 0; transform: translateY(14px); animation: rise 0.6s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .gauge .fill, .impact-meter span { transition: none; }
  html { scroll-behavior: auto; }
}

@media (max-width: 420px) {
  .app { padding: 20px 14px 56px; }
  .headline { font-size: 18px; }
  .hero-text h1 { font-size: 20px; }
  .gauge { width: 172px; height: 172px; }
  .gauge-num { font-size: 46px; }
  .cm-node { font-size: 11.5px; padding: 7px 9px; }
  .move-title, .pattern-title { font-size: 15.5px; }
}
