/* Stress detail sheet (stress-ui.js) and the shared day chart (shared/day-chart.js). */

/* ---------- day chart ---------- */
.dc { position: relative; margin: 6px 0 4px; padding-right: 34px; user-select: none; -webkit-user-select: none; }
.dc-moons { position: relative; height: 26px; }
.dc-moon { position: absolute; bottom: 2px; transform: translateX(-50%); width: 20px; height: 20px; color: #7c8cf0; }
.dc-moon svg { width: 100%; height: 100%; fill: currentColor; }
.dc-plots { position: relative; }
.dc-panel { position: relative; touch-action: none; overscroll-behavior: contain; }
.dc-panel + .dc-panel { margin-top: 10px; }
.dc-panel svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.dc-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; }
.dc-sleep { fill: rgba(124, 140, 240, 0.13); }
.dc-sleep-top { fill: #7c8cf0; }
.dc-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.dc-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--panel); border: 3px solid var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); }
.dc-y { position: absolute; top: 0; bottom: 0; right: -34px; width: 30px; pointer-events: none; }
.dc-y span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dc-now { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--muted); opacity: 0.45; pointer-events: none; }
.dc-x { position: relative; height: 22px; margin-top: 4px; border-top: 1px solid var(--border); }
.dc-x span { position: absolute; top: 4px; padding-left: 5px; font-size: 11px; color: var(--muted); border-left: 1px solid var(--border); line-height: 16px; font-variant-numeric: tabular-nums; }
.dc-fill { stroke: none; }
.dc-pt { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--c); pointer-events: none; }
.dc-strip { position: relative; height: 12px; margin: 8px 0 2px; border-radius: 6px; background: var(--panel-2); }
.dc-seg { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; border-radius: 6px; }
.dc-seg.charge { background: #5cc95c; }
.dc-seg.drain { top: 4px; bottom: 4px; background: color-mix(in srgb, #f59e0b 45%, transparent); }
.dc-seg.steady { top: 4px; bottom: 4px; background: var(--border); }
.dc-seg svg { width: 10px; height: 10px; fill: #fff; }
.dc-cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px solid var(--text); pointer-events: none; }
.dc-cursor b { position: absolute; top: -4px; left: 6px; white-space: nowrap; font-size: 12px; font-weight: 700; background: var(--text); color: var(--panel); padding: 3px 8px; border-radius: 8px; }
.dc-cursor.flip b { left: auto; right: 6px; }

/* ---------- sheet ---------- */
.st-head { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; text-align: center; margin: 0 0 4px; }
.st-head .vs-title { grid-column: 1 / -1; margin: 0; }
.st-datenav { grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--muted); }
.st-nav, .st-info-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: var(--shadow); display: inline-grid; place-items: center; cursor: pointer; color: var(--text); }
.st-nav:disabled { opacity: 0.35; cursor: default; }
.st-nav svg, .st-info-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.st-info-btn { position: absolute; top: 0; right: 0; }
.st-info-btn.on { background: var(--text); color: var(--panel); }
.st-info { background: var(--panel); border-radius: 18px; padding: 12px 14px; font-size: 14px; line-height: 1.5; margin: 8px 0; box-shadow: var(--shadow); }
.st-loading { padding: 40px 0; text-align: center; }

.st-gauge { position: relative; width: 210px; height: 210px; margin: 10px auto 0; }
.st-gauge svg { width: 100%; height: 100%; display: block; overflow: visible; }
.st-gauge-halo { fill: none; stroke: #e1e4e8; stroke-width: 6; stroke-linecap: round; }
:root[data-theme="dark"] .st-gauge-halo { stroke: var(--d-hair); }
.st-gauge svg line { stroke-width: 3.2; stroke-linecap: round; }
.st-gauge-face { fill: var(--panel); filter: drop-shadow(0 6px 16px rgba(var(--n-ink-rgb), 0.08)); }
.st-gauge-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.st-gauge-mid b { font-size: 52px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.st-gauge-mid span { font-size: 17px; font-weight: 700; margin-top: 4px; }
.st-gauge-lo, .st-gauge-hi { position: absolute; bottom: 22px; font-size: 12px; color: var(--muted); }
.st-gauge-lo { left: 50px; }
.st-gauge-hi { right: 42px; }
.st-gauge-sub { text-align: center; margin: -6px 0 14px; }

.st-minis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-mini { background: var(--panel); border-radius: 20px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.st-mini-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); font-size: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.st-mini-title svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-mini-val { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.st-mini-val small { font-size: 16px; font-weight: 600; color: var(--muted); }
.st-hr-vs { white-space: nowrap; }

.st-coach { background: var(--panel); border-radius: 20px; padding: 14px 16px; margin: 10px 0 4px; box-shadow: var(--shadow); }
.st-coach-title { font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.st-coach p { margin: 4px 0 0; line-height: 1.5; }

.st-day-head { margin: 22px 2px 4px; }
.st-day-head b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.st-day-head span { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.st-nochart-note { margin: 2px 2px 8px; }
.st-nochart { background: var(--panel-2); border-radius: 16px; padding: 14px; margin: 8px 0; line-height: 1.5; }

.st-dur { text-align: right; margin: 12px 2px 8px; }
.st-dur b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.st-split { display: grid; gap: 8px; }
.st-split-row { display: grid; grid-template-columns: 64px 1fr 42px 46px; align-items: center; gap: 10px; background: var(--panel); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.st-split-l { font-weight: 700; }
.st-split-bar { height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--c) 16%, transparent); overflow: hidden; }
.st-split-bar i { display: block; height: 100%; border-radius: 6px; background: var(--c); }
.st-split-pct { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.st-split-t { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.st-note { margin: 6px 2px 0; }

.st-trends-head { font-size: 20px; font-weight: 700; margin: 24px 2px 10px; }
.st-trends { display: grid; gap: 10px; }
.st-trend { position: relative; display: grid; grid-template-columns: 1fr 46%; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; background: var(--panel); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; }
.st-trend-title { font-weight: 700; color: var(--muted); }
.st-trend-val { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0; }
.st-tag { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 14px; }
.st-tag svg { width: 16px; height: 16px; border-radius: 50%; background: currentColor; padding: 3px; fill: none; stroke: var(--panel); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.st-tag.good { color: #22a35a; }
.st-tag.warn { color: #d97706; }
.st-tag.muted { color: var(--muted); }
.st-spark { width: 100%; height: 64px; overflow: visible; }
.st-spark path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.st-spark-wrap { position: relative; display: block; width: 100%; height: 64px; }
.st-spark-wrap .st-spark { display: block; }
.st-spark-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--panel); border: 3px solid; box-sizing: border-box; box-shadow: 0 1px 4px rgba(var(--n-ink-rgb), 0.18); }
.st-spark-band { fill: rgba(79, 179, 161, 0.14); }
.st-trend-arrow { position: absolute; top: 12px; right: 14px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.st-trend.is-open .st-trend-arrow { transform: rotate(90deg); }
.st-trend-more { background: var(--panel-2); border-radius: 16px; padding: 10px 14px 12px; margin-top: -4px; }
.st-trend-more p { margin: 0 0 8px; line-height: 1.45; }
.st-trend-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.st-trend-stats b { display: block; font-size: 18px; font-weight: 700; }
.st-trend-stats span { font-size: 12px; color: var(--muted); }

.st-foot { display: flex; justify-content: space-between; margin: 20px 2px 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.hl-card-more { margin-top: 10px; width: 100%; justify-content: center; }

@media (max-width: 380px) {
  .st-split-row { grid-template-columns: 56px 1fr 38px 42px; gap: 8px; padding: 10px 12px; }
  .st-trend { grid-template-columns: 1fr 42%; }
}
