:root {
  color-scheme: light;
  --bg: #eef4f2;
  --bg-2: #f8fbfa;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --text: #12201d;
  --muted: #687873;
  --line: #dbe6e2;
  --primary: #0f766e;
  --primary-2: #0b5f59;
  --primary-soft: #dff5f1;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --neutral-soft: #eef2f1;
  --shadow: 0 22px 60px rgba(29, 62, 54, .11);
  --shadow-sm: 0 10px 30px rgba(29, 62, 54, .08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --content: min(1200px, calc(100% - 40px));
}

html.dark {
  color-scheme: dark;
  --bg: #0d1514;
  --bg-2: #111d1b;
  --surface: #172320;
  --surface-2: #1d2b27;
  --text: #e8f1ee;
  --muted: #9bb0aa;
  --line: #2d403b;
  --primary: #2dd4bf;
  --primary-2: #14b8a6;
  --primary-soft: #173d38;
  --success: #4ade80;
  --success-soft: #173a25;
  --warning: #fbbf24;
  --warning-soft: #443517;
  --danger: #f87171;
  --danger-soft: #462222;
  --neutral-soft: #22302d;
  --shadow: 0 22px 60px rgba(0, 0, 0, .30);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(20,184,166,.12), transparent 28rem),
    radial-gradient(circle at 95% 100%, rgba(59,130,246,.08), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color .25s ease, color .25s ease;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.public-header {
  width: var(--content);
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand span:last-child { display: grid; }
.brand strong { font-size: 15px; line-height: 1.2; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.brand-symbol { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--primary), var(--primary-2)); border-radius: 14px; box-shadow: 0 12px 25px rgba(15,118,110,.25); }
.public-nav { display: flex; align-items: center; gap: 6px; }
.public-nav a { padding: 10px 13px; border-radius: 11px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700; }
.public-nav a:hover, .public-nav a.active { color: var(--primary); background: var(--primary-soft); }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface); cursor: pointer; font-size: 19px; box-shadow: var(--shadow-sm); }

.landing-shell { width: var(--content); margin: 0 auto 60px; }
.landing-hero { min-height: 630px; display: grid; grid-template-columns: 1.15fr .75fr; gap: 24px; align-items: stretch; padding: 24px; border: 1px solid var(--line); border-radius: 34px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow); }
.hero-copy { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; min-height: 580px; padding: clamp(36px, 6vw, 74px); border-radius: 27px; color: #fff; background: linear-gradient(135deg, #0f766e, #0b514d); }
.hero-copy::after { content: ""; position: absolute; width: 340px; height: 340px; right: -140px; bottom: -150px; border: 55px solid rgba(255,255,255,.10); border-radius: 50%; }
.eyebrow { display: inline-block; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.hero-copy .eyebrow { color: rgba(255,255,255,.72); }
.hero-copy h1 { max-width: 760px; margin: 16px 0 22px; font-size: clamp(39px, 5.8vw, 70px); line-height: .98; letter-spacing: -.055em; }
.hero-copy > p { max-width: 690px; margin: 0; color: rgba(255,255,255,.78); font-size: 17px; line-height: 1.75; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.hero-badges span { padding: 9px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.09); font-size: 12px; font-weight: 750; }
.research-note { display: grid; gap: 4px; max-width: 520px; margin-top: 30px; padding: 16px 18px; border: 1px solid rgba(255,255,255,.18); border-radius: 17px; background: rgba(255,255,255,.08); }
.research-note span { color: rgba(255,255,255,.72); font-size: 13px; }

.start-panel { align-self: center; display: grid; gap: 16px; padding: clamp(24px, 4vw, 38px); border-radius: 27px; background: var(--surface); }
.section-heading { margin-bottom: 22px; }
.section-heading.compact { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 6px; }
.section-heading h2, .panel-header h2, .report-panel h2 { margin: 5px 0 0; font-size: 27px; letter-spacing: -.035em; }
.section-heading p, .panel-header p, .report-panel p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.step-number { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--primary); background: var(--primary-soft); font-weight: 900; }
.field { display: grid; gap: 7px; }
.field span { font-size: 12px; font-weight: 800; }
.field input { width: 100%; min-height: 49px; padding: 0 14px; color: var(--text); border: 1px solid var(--line); border-radius: 13px; outline: none; background: var(--surface-2); }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent); }
.consent { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--primary); }
.form-message, .inline-message { min-height: 20px; margin: 0; color: var(--muted); font-size: 13px; }
.form-message.error, .inline-message.error { color: var(--danger); }
.form-message.success, .inline-message.success { color: var(--success); }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 0; border-radius: 13px; text-decoration: none; cursor: pointer; font-size: 13px; font-weight: 850; transition: transform .15s ease, opacity .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button.primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 12px 25px rgba(15,118,110,.20); }
.button.secondary { color: var(--primary); background: var(--primary-soft); }
.button.danger { color: var(--danger); background: var(--danger-soft); }
.button.full { width: 100%; }

.method-section { padding: 84px 0 20px; }
.method-section > .section-heading { text-align: center; }
.method-section > .section-heading h2 { font-size: 37px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; }
.method-grid article { min-height: 210px; padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-sm); }
.method-grid article > span { color: var(--primary); font-weight: 900; }
.method-grid h3 { margin: 28px 0 8px; font-size: 20px; }
.method-grid p { margin: 0; color: var(--muted); line-height: 1.65; }

.app-body { display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.side-nav { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 238px; display: flex; flex-direction: column; overflow-y: auto; padding: 24px 17px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(15px); }
.side-brand { margin: 0 7px 34px; }
.side-nav nav { display: grid; gap: 5px; }
.side-nav nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 13px; color: var(--muted); border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 750; }
.side-nav nav a span { width: 22px; text-align: center; font-size: 17px; }
.side-nav nav a:hover, .side-nav nav a.active { color: var(--primary); background: var(--primary-soft); }
.side-footer { margin-top: auto; display: grid; gap: 4px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); }
.side-footer span { font-size: 12px; font-weight: 800; }
.side-footer small { color: var(--muted); line-height: 1.45; }
.app-content { grid-column: 2; min-width: 0; padding: 0 30px 60px; }
.app-content main, .app-header { max-width: 1380px; margin: 0 auto; }
.app-header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.app-header h1 { margin: 5px 0 0; font-size: 23px; letter-spacing: -.03em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.status-chip { display: inline-flex; align-items: center; min-height: 39px; padding: 0 13px; border-radius: 999px; font-size: 12px; font-weight: 850; }
.status-chip.neutral { color: var(--muted); background: var(--neutral-soft); }
.status-chip.success { color: var(--success); background: var(--success-soft); }
.status-chip.warning { color: var(--warning); background: var(--warning-soft); }
.status-chip.danger { color: var(--danger); background: var(--danger-soft); }
.session-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.session-strip div { min-width: 0; padding: 17px 20px; }
.session-strip div + div { border-left: 1px solid var(--line); }
.session-strip span, .metric-card span, .status-card > span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.session-strip strong { display: block; overflow: hidden; margin-top: 5px; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.alert-box, .finished-box { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 17px 19px; border-radius: 17px; }
.alert-box { color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line)); background: var(--danger-soft); }
.finished-box { color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line)); background: var(--primary-soft); }
.alert-box p, .finished-box p { margin: 4px 0 0; color: inherit; opacity: .8; font-size: 13px; }
.inline-message { margin: 0 0 14px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(370px, .75fr); gap: 18px; align-items: start; }
.panel, .status-card, .metric-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel { padding: 22px; border-radius: 22px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.panel-header h2 { font-size: 21px; }
.panel-header p { font-size: 13px; }
.video-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; background: #09100f; }
.video-frame video, .video-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-frame video { transform: scaleX(-1); }
.video-frame canvas { z-index: 2; transform: scaleX(-1); pointer-events: none; }
.camera-placeholder { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #cad8d4; background: radial-gradient(circle at center, #18302b, #09100f 70%); text-align: center; }
.camera-placeholder .camera-glyph { margin-bottom: 13px; font-size: 42px; }
.camera-placeholder small { margin-top: 6px; color: #80928d; }
.calibration-row { display: grid; gap: 8px; margin-top: 16px; }
.calibration-row > div:first-child { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 750; }
.progress-track { overflow: hidden; height: 8px; border-radius: 999px; background: var(--surface-2); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #2dd4bf); transition: width .25s ease; }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.metrics-column { display: grid; gap: 14px; }
.status-card { padding: 20px; border-radius: 19px; }
.status-card h2 { margin: 7px 0 6px; font-size: 27px; letter-spacing: -.04em; }
.status-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.status-card.normal { border-left: 5px solid var(--success); }
.status-card.warning { border-left: 5px solid var(--warning); }
.status-card.danger { border-left: 5px solid var(--danger); }
.status-card.neutral { border-left: 5px solid var(--muted); }
.audio-settings { display: grid; gap: 14px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow-sm); }
.audio-settings-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.audio-settings h3 { margin: 4px 0 0; font-size: 17px; }
.audio-settings > small { color: var(--muted); line-height: 1.45; }
.side-audio-settings { margin-top: 18px; padding: 15px; border-radius: 15px; background: var(--surface-2); box-shadow: none; }
.side-audio-settings .audio-settings-header { align-items: flex-start; flex-direction: column; gap: 12px; }
.side-audio-settings h3 { font-size: 15px; }
.side-audio-settings .volume-control { grid-template-columns: 1fr 48px; gap: 8px; }
.side-audio-settings .volume-control > span { grid-column: 1 / -1; }
.side-audio-settings .audio-test-button { width: 100%; }
.switch-control { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 800; }
.switch-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line); transition: background .2s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); transition: transform .2s ease; }
.switch-control input:checked + .switch-track { background: var(--primary); }
.switch-control input:checked + .switch-track::after { transform: translateX(18px); }
.switch-control input:focus-visible + .switch-track { outline: 3px solid color-mix(in srgb, var(--primary) 25%, transparent); outline-offset: 2px; }
.volume-control { display: grid; grid-template-columns: auto minmax(110px, 1fr) 45px; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
.volume-control input { width: 100%; accent-color: var(--primary); cursor: pointer; }
.volume-control input:disabled { cursor: not-allowed; opacity: .45; }
.volume-control output { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.audio-test-button { justify-self: start; min-height: 38px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric-card { min-height: 125px; padding: 16px; border-radius: 17px; }
.metric-card.featured { grid-column: 1 / -1; min-height: 112px; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.metric-card strong { display: block; margin-top: 14px; font-size: 24px; line-height: 1.1; letter-spacing: -.035em; }
.metric-card.featured strong { color: var(--primary); font-size: 29px; }
.metric-card small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.35; }
.data-panel, .report-panel { margin-top: 18px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
th { color: var(--muted); background: var(--surface-2); font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 38%, transparent); }
.empty-cell { padding: 30px; color: var(--muted); text-align: center; }
.table-actions { display: flex; gap: 8px; }
.table-actions a { color: var(--primary); font-weight: 800; text-decoration: none; }
.table-status { display: inline-flex; padding: 6px 9px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.report-panel { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.report-panel > div:first-child { max-width: 690px; }
.report-panel .action-row { flex: 0 0 auto; margin-top: 0; }
.mobile-nav { display: none; }

code { color: var(--primary); }

@media (max-width: 1100px) {
  .landing-hero { grid-template-columns: 1fr; }
  .hero-copy { min-height: 510px; }
  .start-panel { width: min(650px, 100%); justify-self: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics-column { grid-template-columns: .72fr 1.28fr; align-items: start; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-card.featured { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  :root { --content: min(100% - 24px, 1200px); }
  .public-header { min-height: 70px; }
  .public-nav a:not(.active) { display: none; }
  .landing-hero { padding: 10px; border-radius: 24px; }
  .hero-copy { min-height: 470px; padding: 32px 25px; border-radius: 19px; }
  .hero-copy h1 { font-size: 43px; }
  .method-grid { grid-template-columns: 1fr; }
  .app-body { display: block; }
  .side-nav { display: none; }
  .app-content { padding: 0 12px 82px; }
  .app-header { min-height: 76px; }
  .app-header h1 { font-size: 18px; }
  .status-chip { display: none; }
  .session-strip { grid-template-columns: 1fr; }
  .session-strip div + div { border-top: 1px solid var(--line); border-left: 0; }
  .metrics-column { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 15px; border-radius: 18px; }
  .report-panel { align-items: flex-start; flex-direction: column; }
  .mobile-nav { position: fixed; inset: auto 10px 10px; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px; border: 1px solid var(--line); border-radius: 17px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
  .mobile-nav a { padding: 9px 5px; color: var(--muted); border-radius: 10px; text-align: center; text-decoration: none; font-size: 11px; font-weight: 800; }
  .mobile-nav a:hover { color: var(--primary); background: var(--primary-soft); }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .hero-copy h1 { font-size: 37px; }
  .hero-copy > p { font-size: 15px; }
  .start-panel { padding: 22px 17px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 118px; padding: 14px; }
  .metric-card strong { font-size: 20px; }
  .metric-card.featured { grid-column: 1 / -1; }
  .action-row .button { flex: 1 1 42%; }
  .alert-box, .finished-box { align-items: stretch; flex-direction: column; }
}
