:root {
  color-scheme: dark;

  --bg: #070b12;
  --shell: #090f18;
  --panel: #0c141f;
  --card: #0d1723;
  --border: #1d2b3d;

  --text: #f4f8ff;
  --muted: #8c9cb1;
  --soft: #b8c6d7;

  --teal: #63d6c6;
  --blue: #6aa8ff;
  --green: #64d69f;
  --amber: #f2c777;
  --red: #ff7b83;
}

/* =========================================================
   RESET / PAGE
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, #14243a 0, transparent 35%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   APP SHELL / HEADER
   ========================================================= */

.vs-app {
  width: min(100%, 1460px);
  margin: 0 auto;
  padding: 18px 24px 38px;
}

.vs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 18px;
}

.vs-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.vs-brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, #18aaa9, #4d8fff);
  box-shadow: 0 10px 34px rgba(70, 143, 255, 0.2);
}

.vs-brand-mark::before,
.vs-brand-mark::after,
.vs-brand-mark span {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 99px;
}

.vs-brand-mark::before {
  left: 9px;
  top: 16px;
  width: 18px;
  height: 4px;
}

.vs-brand-mark::after {
  left: 16px;
  top: 9px;
  width: 4px;
  height: 18px;
}

.vs-brand-mark span {
  right: 5px;
  bottom: 5px;
  width: 6px;
  height: 6px;
  opacity: 0.85;
}

.vs-brand-copy {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.vs-brand-copy strong {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.vs-brand-copy small {
  color: #718197;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.vs-live-only {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #263548;
  border-radius: 999px;
  background: #0c141f;
  color: #aab9ca;
  font-size: 12px;
}

.vs-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #41d493;
  box-shadow: 0 0 0 4px rgba(65, 212, 147, 0.11);
}

/* =========================================================
   SCAN SHELL / TOP BAR
   ========================================================= */

.scan-shell {
  overflow: hidden;
  border: 1px solid #192536;
  border-radius: 30px;
  background: #050911;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.scan-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 26px 28px 22px;
  border-bottom: 1px solid #152130;
  background: linear-gradient(180deg, #0b121d, #080e17);
}

.eyebrow {
  margin: 0 0 8px;
  color: #72cfc7;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.scan-topbar h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.scan-intro {
  margin: 9px 0 0;
  color: #8798ac;
  font-size: 13px;
}

.privacy-chip {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid #1e3a39;
  border-radius: 999px;
  background: #0b1b1b;
  color: #a6dfd5;
  font-size: 11px;
}

.privacy-chip span {
  color: #56d1b9;
}

/* =========================================================
   MAIN SCAN GRID
   ========================================================= */

.scan-grid {
  display: grid;
  grid-template-columns:
    minmax(220px, 0.72fr)
    minmax(420px, 1.65fr)
    minmax(220px, 0.72fr);
  gap: 14px;
  padding: 14px;
  background:
    radial-gradient(
      circle at 50% 35%,
      rgba(33, 65, 102, 0.24),
      transparent 35%
    );
}

.metrics-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

/* =========================================================
   METRIC CARDS
   ========================================================= */

.metric-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background:
    linear-gradient(
      180deg,
      rgba(15, 25, 38, 0.98),
      rgba(8, 15, 24, 0.98)
    );
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.015);
}

.metric-emphasis {
  background:
    linear-gradient(
      180deg,
      rgba(17, 31, 44, 0.99),
      rgba(8, 17, 25, 0.99)
    );
}

.metric-label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #a8b7c8;
  font-size: 12px;
  font-weight: 650;
}

.metric-label-row small {
  color: #65768b;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.metric-reading {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 38px;
  margin-top: 11px;
}

.metric-reading > span {
  color: #fbfdff;
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 780;
  line-height: 1;
  letter-spacing: -0.055em;
}

.metric-reading small {
  color: #738398;
  font-size: 11px;
  font-weight: 700;
}

.metric-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  margin-top: 10px;
}

.metric-footer-stack {
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
}

.metric-status {
  color: #9ce3c9;
  font-size: 11px;
}

.metric-status.warning {
  color: var(--amber);
}

.metric-status.danger {
  color: var(--red);
}

.metric-status.estimated {
  color: #edca89;
}

.metric-note {
  display: block;
  color: #7f90a5;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.35;
}

.pulse-line {
  width: 50px;
  height: 18px;
  background:
    linear-gradient(
      90deg,
      transparent 0 8%,
      var(--teal) 8% 12%,
      transparent 12% 22%,
      var(--teal) 22% 26%,
      transparent 26% 39%,
      var(--teal) 39% 44%,
      transparent 44% 100%
    );
  opacity: 0.45;
  clip-path:
    polygon(
      0 55%,
      20% 55%,
      28% 10%,
      37% 90%,
      45% 55%,
      100% 55%,
      100% 65%,
      47% 65%,
      37% 100%,
      27% 35%,
      22% 65%,
      0 65%
    );
}

/* =========================================================
   CAMERA
   ========================================================= */

.camera-card {
  position: relative;
  isolation: isolate;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid #1c2939;
  border-radius: 23px;
  background:
    radial-gradient(
      circle at 50% 38%,
      #20354d,
      #0d1723 44%,
      #060a10 75%
    );
}

.camera-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  background: #0a111a;
}

.processing-canvas {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.camera-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(2, 6, 10, 0.32),
      transparent 25%,
      transparent 58%,
      rgba(2, 6, 10, 0.58)
    );
  pointer-events: none;
}

/* =========================================================
   FACE GUIDE
   ========================================================= */

.face-guide {
  position: absolute;
  left: 50%;
  top: 43%;
  width: min(42%, 250px);
  aspect-ratio: 0.82;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(102, 218, 204, 0.6);
  border-radius: 46% 46% 40% 40%;
  box-shadow:
    0 0 0 999px rgba(1, 5, 10, 0.12),
    0 0 36px rgba(99, 214, 198, 0.06);
  transition:
    border-color 0.2s,
    opacity 0.2s;
}

.face-guide.searching {
  border-color: rgba(242, 199, 119, 0.8);
}

.face-guide.error {
  border-color: rgba(255, 123, 131, 0.9);
}

.face-guide .c {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--teal);
}

.face-guide.searching .c {
  border-color: var(--amber);
}

.face-guide.error .c {
  border-color: var(--red);
}

.c.tl {
  left: -3px;
  top: -3px;
  border-top: 3px solid;
  border-left: 3px solid;
  border-radius: 15px 0 0;
}

.c.tr {
  right: -3px;
  top: -3px;
  border-top: 3px solid;
  border-right: 3px solid;
  border-radius: 0 15px 0 0;
}

.c.bl {
  left: -3px;
  bottom: -3px;
  border-bottom: 3px solid;
  border-left: 3px solid;
  border-radius: 0 0 0 15px;
}

.c.br {
  right: -3px;
  bottom: -3px;
  border-right: 3px solid;
  border-bottom: 3px solid;
  border-radius: 0 0 15px;
}

/* =========================================================
   CAMERA TOOLBAR
   ========================================================= */

.camera-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scan-state,
.live-badge {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(4, 9, 16, 0.72);
  color: #d9e6f2;
  font-size: 11px;
  backdrop-filter: blur(14px);
}

.scan-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #77889d;
}

.scan-state.good .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(100, 214, 159, 0.1);
}

.scan-state.warn .status-dot {
  background: var(--amber);
}

.scan-state.bad .status-dot {
  background: var(--red);
}

.live-badge {
  padding: 9px 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

/* =========================================================
   CAMERA MESSAGE
   ========================================================= */

.camera-message {
  position: absolute;
  left: 50%;
  bottom: 96px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: min(86%, 580px);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 2px 10px #000;
}

.camera-message strong {
  font-size: 16px;
}

.camera-message span {
  color: #a1b1c4;
  font-size: 11px;
  line-height: 1.45;
}

/* =========================================================
   START BUTTON
   ========================================================= */

.start-button {
  position: absolute;
  left: 50%;
  top: 54%;
  min-width: 220px;
  padding: 15px 20px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(9, 17, 27, 0.88);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition:
    transform 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.start-button:hover {
  transform: translate(-50%, -50%) translateY(-1px);
  border-color: rgba(99, 214, 198, 0.45);
  background: rgba(11, 25, 34, 0.94);
}

.start-button:focus-visible {
  outline: 3px solid rgba(106, 168, 255, 0.35);
  outline-offset: 3px;
}

.start-button span {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.start-button small {
  display: block;
  margin-top: 4px;
  color: #8fa0b5;
  font-size: 10px;
}

.start-button.hidden {
  display: none;
}

/* =========================================================
   PROGRESS
   ========================================================= */

.progress-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(3, 8, 15, 0.78);
  backdrop-filter: blur(14px);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: #8fa1b6;
  font-size: 10px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #172334;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #39bdb5, #6aa8ff);
  transition: width 0.35s ease;
}

/* =========================================================
   SUMMARY
   ========================================================= */

.scan-summary {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 12px;
  padding: 0 14px 14px;
}

.overall-card,
.privacy-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #09111b;
}

.overall-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.summary-label {
  display: block;
  color: #6f8298;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.overall-card h2 {
  margin: 7px 0 3px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.overall-card p,
.privacy-card p {
  margin: 0;
  color: #8ea0b4;
  font-size: 11px;
  line-height: 1.55;
}

.privacy-card strong {
  color: #cfe0ef;
}

.quality-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid #183733;
  border-radius: 13px;
  background: #0a1b1a;
  color: #9ddfd0;
  font-size: 9px;
}

.quality-pill strong {
  color: #c4eee4;
  font-size: 15px;
}

.disclaimer {
  margin: 0;
  padding: 0 24px 18px;
  color: #61748b;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

/* =========================================================
   TABLET / SMALL DESKTOP
   ========================================================= */

@media (max-width: 1050px) {
  .scan-grid {
    grid-template-columns:
      minmax(210px, 0.78fr)
      minmax(400px, 1.5fr);
  }

  .metrics-right {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .camera-card {
    min-height: 590px;
  }

  .scan-summary {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   MOBILE
   True mobile composition:
   - camera remains visually important
   - 2 metric columns x 3 rows
   - readable typography
   - compact summary
   ========================================================= */

@media (max-width: 720px) {
  .vs-app {
    padding: 8px 8px 18px;
  }

  .vs-header {
    min-height: 46px;
    padding: 2px 1px 9px;
  }

  .vs-brand {
    gap: 8px;
  }

  .vs-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .vs-brand-copy {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .vs-brand-copy strong {
    font-size: 16px;
  }

  .vs-brand-copy small {
    font-size: 8px;
  }

  .vs-live-only {
    padding: 6px 8px;
    font-size: 9px;
  }

  .scan-shell {
    border-radius: 18px;
  }

  /* Compact top section, but still readable */
  .scan-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 11px 12px 10px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 8px;
  }

  .scan-topbar h1 {
    font-size: 20px;
    line-height: 1.08;
  }

  .scan-intro {
    margin-top: 4px;
    font-size: 10px;
  }

  .privacy-chip {
    display: none;
  }

  /* Main mobile layout */
  .scan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  /*
   * Flatten desktop side columns so the six cards can
   * participate in one two-column mobile grid.
   */
  .metrics-left,
  .metrics-right {
    display: contents;
  }

  /* Camera */
  .camera-card {
    order: -1;
    grid-column: 1 / -1;
    min-height: 292px;
    height: 292px;
    max-height: 292px;
    border-radius: 16px;
  }

  .camera-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .scan-state,
  .live-badge {
    font-size: 9px;
  }

  .scan-state {
    max-width: 78%;
    gap: 7px;
    padding: 7px 9px;
    line-height: 1.2;
  }

  .status-dot {
    width: 7px;
    height: 7px;
  }

  .live-badge {
    padding: 7px 8px;
  }

  .face-guide {
    top: 42%;
    width: min(50%, 165px);
  }

  .face-guide .c {
    width: 20px;
    height: 20px;
  }

  /* Camera message */
  .camera-message {
    bottom: 72px;
    width: 90%;
    gap: 3px;
  }

  .camera-message strong {
    font-size: 12px;
  }

  .camera-message span {
    font-size: 9px;
    line-height: 1.3;
  }

  /* Start button */
  .start-button {
    min-width: 185px;
    padding: 11px 15px;
    border-radius: 14px;
  }

  .start-button span {
    font-size: 12px;
  }

  .start-button small {
    font-size: 8px;
  }

  /* Progress */
  .progress-panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .progress-copy {
    margin-bottom: 6px;
    font-size: 9px;
  }

  .progress-track {
    height: 6px;
  }

  /* Metric cards */
  .metric-card {
    grid-column: span 1;
    min-width: 0;
    min-height: 94px;
    padding: 11px 10px;
    border-radius: 14px;
  }

  .metric-label-row {
    gap: 6px;
    font-size: 10px;
  }

  .metric-label-row > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .metric-label-row small {
    display: none;
  }

  .metric-reading {
    min-height: 27px;
    margin-top: 7px;
    gap: 4px;
  }

  .metric-reading > span {
    font-size: 23px;
    line-height: 1;
    letter-spacing: -0.04em;
  }

  .metric-reading small {
    font-size: 9px;
  }

  .metric-footer {
    min-height: 18px;
    margin-top: 6px;
  }

  .metric-footer-stack {
    gap: 4px;
  }

  .metric-status {
    font-size: 9px;
    line-height: 1.25;
  }

  .metric-note {
    font-size: 8.5px;
    line-height: 1.3;
  }

  .pulse-line {
    display: none;
  }

  /* Summary */
  .scan-summary {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 8px 8px;
  }

  .overall-card {
    flex-direction: row;
    align-items: center;
    padding: 10px 11px;
    border-radius: 14px;
  }

  .summary-label {
    font-size: 8px;
  }

  .overall-card h2 {
    margin: 4px 0 0;
    font-size: 15px;
  }

  .overall-card p {
    display: none;
  }

  .quality-pill {
    align-self: auto;
    padding: 6px 8px;
    font-size: 9px;
  }

  .quality-pill strong {
    font-size: 12px;
  }

  .privacy-card {
    display: none;
  }

  .disclaimer {
    padding: 5px 12px 12px;
    font-size: 8px;
    line-height: 1.4;
  }
}

/* =========================================================
   EXTRA-SMALL MOBILE
   ========================================================= */

@media (max-width: 460px) {
  .vs-app {
    padding: 6px 6px 14px;
  }

  .vs-header {
    padding-bottom: 7px;
  }

  .vs-brand-mark {
    width: 28px;
    height: 28px;
  }

  .vs-brand-copy strong {
    font-size: 15px;
  }

  .vs-live-only {
    max-width: 145px;
    text-align: right;
    line-height: 1.1;
  }

  .scan-topbar {
    padding: 10px 10px 9px;
  }

  .scan-topbar h1 {
    font-size: 18px;
  }

  .scan-intro {
    font-size: 9px;
  }

  .camera-card {
    min-height: 280px;
    height: 280px;
    max-height: 280px;
  }

  .face-guide {
    width: min(48%, 150px);
  }

  .camera-message {
    bottom: 68px;
  }

  .camera-message strong {
    font-size: 11px;
  }

  .camera-message span {
    font-size: 8.5px;
  }

  .progress-copy {
    flex-wrap: nowrap;
    font-size: 8.5px;
  }

  .metric-card {
    min-height: 90px;
    padding: 10px 9px;
  }

  .metric-label-row {
    font-size: 9.5px;
  }

  .metric-reading {
    margin-top: 6px;
  }

  .metric-reading > span {
    font-size: 21px;
  }

  .metric-reading small {
    font-size: 8.5px;
  }

  .metric-footer {
    margin-top: 5px;
  }

  .metric-status {
    font-size: 8.5px;
  }

  .metric-note {
    font-size: 8px;
    line-height: 1.25;
  }

  .overall-card {
    padding: 9px 10px;
  }

  .overall-card h2 {
    font-size: 14px;
  }

  .quality-pill {
    font-size: 8.5px;
  }

  .quality-pill strong {
    font-size: 11px;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .progress-track span,
  .face-guide,
  .start-button {
    transition: none;
  }
}
