
:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #2a3550;
  background: #eef4fd;
  --primary: #2f58b7;
  --primary-strong: #274ca4;
  --primary-soft: rgba(47, 88, 183, 0.18);
  --line: #d8e2f3;
  --muted: #6b7690;
  --ink: #25324a;
  --card: rgba(255,255,255,.94);
  --card-soft: rgba(248, 251, 255, .96);
  --shadow: rgba(24, 45, 87, .12);
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 9%, rgba(88, 126, 220, .34), transparent 0 210px),
    linear-gradient(180deg, #274ca4 0 210px, #eef4fd 210px 100%);
}
.app-shell { max-width: 1280px; margin: 0 auto; padding: 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.eyebrow { color: rgba(255,255,255,.78); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 4px 0 0; font-size: clamp(30px, 4vw, 46px); color: #fff; letter-spacing: .02em; }
h2 { text-align: center; margin: 32px 0 20px; font-size: clamp(28px, 4vw, 42px); color: #ffffff; letter-spacing: .02em; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
button {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #3a69d4, var(--primary));
  color: #fff;
  padding: 14px 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(38, 80, 174, .28);
}
button:hover { filter: brightness(1.03); }
button:active { transform: translateY(1px); }
.switch, .duration-select { color: rgba(255,255,255,.88); }
.switch { font-size: 14px; user-select: none; display: flex; align-items: center; gap: 8px; }
.duration-select { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.duration-select select {
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  color: #fff;
  padding: 10px 12px;
  font: inherit;
  font-weight: 800;
  outline: none;
}
.duration-select select option { color: #23314b; }
.duration-select select:focus { border-color: rgba(255,255,255,.45); box-shadow: 0 0 0 4px rgba(255,255,255,.14); }
.measure-layout { display: grid; grid-template-columns: minmax(360px, .8fr) minmax(560px, 1.2fr); gap: 20px; align-items: start; }
.camera-panel, .results-panel, .radar-card, .debug-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 18px 42px var(--shadow);
  backdrop-filter: blur(6px);
}
.camera-panel { padding: 18px; position: sticky; top: 18px; }
.camera-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 24px; background: #17202d; }
video, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
video.mirror, #overlay.mirror { transform: scaleX(-1); }
#overlay { pointer-events: none; background: transparent; }
.scan-ring { position: absolute; inset: 10%; border: 2px dashed rgba(255,255,255,.16); border-radius: 50%; pointer-events: none; }
.status-row { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 14px 4px 6px; min-height: 46px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #b9c2cc; display: inline-block; }
.dot.running { background: var(--primary); box-shadow: 0 0 0 6px var(--primary-soft); }
.dot.warn { background: #e9ad34; box-shadow: 0 0 0 6px rgba(233,173,52,.15); }
.quality-row { display: grid; grid-template-columns: 112px 1fr 74px; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.measurement-row { margin-top: 8px; }
.measurement-row b { white-space: nowrap; }
.measurement-row small { color: var(--muted); font-weight: 800; margin-left: 3px; }
progress { width: 100%; height: 12px; accent-color: var(--primary); }
.results-panel { padding: 24px; }
.section-title { font-size: clamp(28px, 3.2vw, 42px); padding-bottom: 14px; border-bottom: 2px solid #31435f; color: #42506a; letter-spacing: .08em; margin-bottom: 24px; }
.vital-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.vital-card { min-height: 126px; border: 1px solid var(--line); border-radius: 22px; background: var(--card-soft); padding: 18px 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.82); }
.vital-card span { display: block; color: #5c6678; font-size: 18px; line-height: 1.12; font-weight: 800; }
.vital-card strong { display: inline-block; color: #36425a; margin-top: 10px; font-size: clamp(30px, 4vw, 42px); line-height: .95; letter-spacing: .01em; }
.vital-card small { margin-left: 6px; color: #7d8490; font-size: 13px; font-weight: 700; }
.vital-card .vital-subline { display: block; margin: 8px 0 0; color: #8b939d; font-size: 12px; font-weight: 800; letter-spacing: .01em; }
.vital-subline.low { color: #d58d26; }
.vital-subline.medium { color: #2f7ce0; }
.vital-subline.high { color: var(--primary); }
.vital-card i { font-style: normal; color: var(--primary); opacity: .42; font-size: 32px; }
.vital-card.compact { min-height: 100px; }
.vital-card.compact strong { font-size: clamp(26px, 3vw, 34px); }
.wellness-card { grid-column: span 1; }
.health-section { margin-top: 10px; }
.health-layout { display: grid; grid-template-columns: minmax(520px, 1.1fr) minmax(360px, .9fr); gap: 20px; align-items: stretch; }
.radar-card { padding: 16px; display: flex; align-items: center; justify-content: center; min-height: 520px; }
#radar { width: 100%; max-width: 620px; height: auto; }
.indicator-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.indicator-card { background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 20px; min-height: 132px; padding: 14px; text-align: center; box-shadow: 0 12px 28px rgba(23, 42, 56, .05); }
.indicator-card h3 { margin: 0 0 4px; color: #616c80; font-size: 18px; }
.gauge { position: relative; height: 70px; margin: 4px 0; }
.gauge canvas { width: 128px; height: 70px; }
.gauge strong { position: absolute; inset: 30px 0 auto; display: block; font-size: 34px; color: var(--primary); }
.badge { display: inline-block; min-width: 72px; padding: 4px 10px; border-radius: 99px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; }
.badge.good { background: #5f8fe0; }
.badge.poor { background: #f0ba3d; }
.badge.excellent { background: var(--primary); }
.debug-box { margin-top: 20px; padding: 12px 16px; }
.debug-box summary { cursor: pointer; font-weight: 800; color: var(--muted); }
pre { background: #0f1722; color: #d7e9ff; padding: 14px; border-radius: 16px; max-height: 360px; overflow: auto; white-space: pre-wrap; }
.note { margin: 18px 4px 0; color: var(--muted); line-height: 1.55; }
@media (max-width: 1040px) {
  .measure-layout, .health-layout { grid-template-columns: 1fr; }
  .camera-panel { position: static; }
}
@media (max-width: 680px) {
  .app-shell { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .vital-grid, .indicator-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 28px; letter-spacing: .04em; }
  .health-layout { display: block; }
  .radar-card { min-height: auto; margin-bottom: 14px; }
}
.profile-card { margin-top: 14px; border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; background: rgba(246, 249, 255, .92); }
.profile-card summary { cursor: pointer; color: var(--ink); font-weight: 900; }
.profile-card summary small { color: var(--muted); font-weight: 700; margin-left: 6px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.profile-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.profile-grid input, .profile-grid select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; background: #fff; color: var(--ink); font: inherit; outline: none; }
.profile-grid input:focus, .profile-grid select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.profile-note { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 10px 0 0; }
@media (max-width: 680px) { .profile-grid { grid-template-columns: 1fr; } }
