:root {
  color-scheme: light;
  --teal-950: #052f2e;
  --teal-900: #074744;
  --teal-800: #09605a;
  --teal-700: #08796f;
  --teal-600: #069385;
  --mint-500: #3dd9be;
  --mint-200: #bcefe5;
  --mint-100: #e3f8f3;
  --paper: #f7faf9;
  --white: #ffffff;
  --ink: #102927;
  --muted: #637876;
  --line: #dbe7e4;
  --warning-bg: #fff8e7;
  --warning-line: #f1d48c;
  --warning-ink: #694d0a;
  --danger: #b33b49;
  --success: #08796f;
  --shadow: 0 18px 50px rgba(14, 55, 51, .09);
  --radius-lg: 24px;
  --radius-md: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 85% 5%, rgba(61, 217, 190, .09), transparent 25rem),
    var(--paper);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(6, 147, 133, .35);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: 244px minmax(0, 1fr);
  grid-template-rows: 80px minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "menu content";
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: max(14px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 14px max(28px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: var(--teal-950);
  color: var(--white);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--mint-500);
  color: var(--teal-950);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -.07em;
}

.brand > span:last-child {
  display: grid;
}

.brand strong {
  font-size: 18px;
  letter-spacing: -.02em;
}

.brand small {
  margin-top: 1px;
  color: #b8d0cc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.delivery-status,
.capture-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #d8e8e5;
  font-size: 12px;
}

.delivery-status span,
.capture-state span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f2c35b;
  box-shadow: 0 0 0 4px rgba(242, 195, 91, .12);
}

.delivery-status[data-state="sent"] span,
.capture-state[data-state="sent"] span {
  background: #60dfbf;
  box-shadow: 0 0 0 4px rgba(96, 223, 191, .13);
}

.delivery-status[data-state="error"] span,
.capture-state[data-state="error"] span {
  background: #ff8995;
  box-shadow: 0 0 0 4px rgba(255, 137, 149, .13);
}

.capture-state[data-state="recording"] span {
  background: #ff6e7e;
  box-shadow: 0 0 0 4px rgba(255, 110, 126, .13);
  animation: pulse 1.25s ease infinite;
}

.menu {
  position: sticky;
  top: 80px;
  grid-area: menu;
  display: flex;
  height: calc(100vh - 80px);
  height: calc(100dvh - 80px);
  min-height: 0;
  flex-direction: column;
  padding: 30px 18px max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
}

.menu__label {
  margin: 0 14px 12px;
  color: #91a29f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.menu nav {
  display: grid;
  gap: 6px;
}

.menu__item {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 720;
  text-align: left;
}

.menu__item:hover {
  background: var(--mint-100);
  color: var(--teal-800);
}

.menu__item.is-active {
  background: var(--teal-900);
  box-shadow: 0 9px 24px rgba(7, 71, 68, .14);
  color: var(--white);
}

.menu__item svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.menu__item:first-child svg {
  fill: currentColor;
  stroke: none;
}

.menu__tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  color: var(--muted);
}

.menu__tip > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--mint-100);
  color: var(--teal-700);
  font-size: 12px;
  font-weight: 900;
}

.menu__tip p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.content {
  grid-area: content;
  min-width: 0;
  padding: clamp(26px, 4vw, 58px) max(clamp(20px, 4vw, 64px), env(safe-area-inset-right)) max(44px, env(safe-area-inset-bottom)) max(clamp(20px, 4vw, 64px), env(safe-area-inset-left));
}

.view {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.view-heading,
.section-heading,
.test-controls,
.usb-row,
.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.view-heading {
  align-items: flex-end;
  margin-bottom: 28px;
}

.view-heading h1,
.section-heading h2,
.test-controls h2,
.result-panel h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -.035em;
}

.view-heading h1 {
  font-size: clamp(29px, 3vw, 46px);
  line-height: 1.05;
}

.view-heading p:not(.eyebrow) {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 1.3vw, 17px);
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal-700);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 780;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid var(--teal-800);
  background: var(--teal-800);
  box-shadow: 0 9px 22px rgba(9, 96, 90, .16);
  color: var(--white);
}

.primary-button:hover {
  background: var(--teal-700);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--teal-800);
}

.secondary-button:hover {
  border-color: #afceca;
  background: var(--mint-100);
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, .72fr);
  gap: 20px;
}

.screen-visual-card,
.recommendation-card,
.test-workspace,
.event-section,
.result-panel,
.raw-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow);
}

.screen-visual-card {
  min-width: 0;
  padding: clamp(20px, 3.5vw, 36px);
}

.screen-visual-card__header,
.screen-visual-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.screen-visual-card__header span:first-child {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.screen-visual-card__header strong {
  font-size: clamp(24px, 3.5vw, 42px);
  letter-spacing: -.045em;
}

.badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--mint-100);
  color: var(--teal-800);
  font-size: 11px;
  font-weight: 800;
}

.screen-ruler {
  position: relative;
  display: grid;
  min-height: 195px;
  place-items: center;
  margin: 26px 28px 22px 0;
  padding: 13px 25px 24px 0;
}

.screen-preview {
  display: grid;
  width: min(100%, 430px);
  aspect-ratio: var(--detected-aspect, 16 / 9);
  max-height: 240px;
  place-items: center;
  overflow: hidden;
  border: 7px solid var(--teal-900);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 28px 28px,
    radial-gradient(circle at 50% 45%, #13877d, var(--teal-950));
  box-shadow: 0 13px 30px rgba(5, 47, 46, .18);
  color: #c9efe8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.screen-ruler__width,
.screen-ruler__height {
  position: absolute;
  color: var(--teal-700);
  font-size: 10px;
  font-weight: 800;
}

.screen-ruler__width {
  right: 25px;
  bottom: 2px;
  left: 0;
  border-top: 1px solid #9ac9c2;
  padding-top: 5px;
  text-align: center;
}

.screen-ruler__height {
  top: 13px;
  right: 0;
  bottom: 24px;
  display: grid;
  width: 19px;
  place-items: center;
  border-left: 1px solid #9ac9c2;
  writing-mode: vertical-rl;
}

.screen-visual-card__footer {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.screen-visual-card__footer strong {
  margin-left: 4px;
  color: var(--ink);
}

.recommendation-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3vw, 34px);
  background:
    radial-gradient(circle at 100% 0, rgba(61, 217, 190, .16), transparent 13rem),
    var(--teal-950);
  color: var(--white);
}

.recommendation-card__icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 38px;
  border-radius: 15px;
  background: rgba(61, 217, 190, .14);
  color: var(--mint-500);
}

.recommendation-card__icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.recommendation-card .eyebrow {
  color: #82d8ca;
}

.recommendation-card h2 {
  margin: 0;
  color: var(--white);
  font-size: clamp(24px, 2.5vw, 34px);
  letter-spacing: -.04em;
  line-height: 1.1;
}

.recommendation-card > p:not(.eyebrow) {
  margin: 13px 0 26px;
  color: #b8d0cc;
  font-size: 13px;
  line-height: 1.55;
}

.compact-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.compact-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: 11px;
}

.compact-list dt {
  color: #8fb2ad;
}

.compact-list dd {
  margin: 0;
  color: var(--white);
  font-weight: 800;
  text-align: right;
}

.details-section,
.event-section {
  margin-top: 34px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2,
.test-controls h2,
.result-panel h2 {
  font-size: clamp(21px, 2vw, 28px);
}

.muted-label,
.event-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.device-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.device-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .82);
}

.device-card__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 17px;
  color: var(--teal-800);
  font-size: 12px;
  font-weight: 850;
}

.device-card__title span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint-100);
  font-size: 12px;
}

.device-card dl {
  display: grid;
  gap: 11px;
  margin: 0;
}

.device-card dl > div {
  min-width: 0;
}

.device-card dt {
  margin-bottom: 2px;
  color: #8a9b98;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.device-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.4;
}

.raw-details {
  margin-top: 18px;
  overflow: hidden;
  box-shadow: none;
}

.raw-details summary {
  padding: 17px 20px;
  color: var(--teal-800);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.raw-details pre {
  max-height: 440px;
  margin: 0;
  overflow: auto;
  padding: 20px;
  border-top: 1px solid var(--line);
  background: #062d2d;
  color: #d2e9e5;
  font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.privacy-notice {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--warning-line);
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.privacy-notice svg {
  width: 23px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.privacy-notice strong {
  font-size: 12px;
}

.privacy-notice p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.45;
}

.test-workspace {
  overflow: hidden;
}

.test-controls {
  padding: 23px 25px;
  border-bottom: 1px solid var(--line);
}

.test-controls__copy {
  display: flex;
  align-items: center;
  gap: 14px;
}

.test-controls h2 {
  font-size: 19px;
}

.test-controls p,
.usb-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.step-number {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--mint-100);
  color: var(--teal-800);
  font-size: 13px;
  font-weight: 900;
}

.test-field {
  display: grid;
  gap: 8px;
  padding: 24px 25px;
}

.test-field > span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.test-field textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  padding: 15px 17px;
  border: 1px solid #bdd2cf;
  border-radius: 13px;
  background: #fbfdfd;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.test-field textarea:not(:disabled) {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(6, 147, 133, .07);
}

.test-field small {
  color: var(--muted);
  font-size: 10px;
}

.usb-row {
  padding: 17px 25px;
  border-top: 1px solid var(--line);
  background: #f9fbfa;
}

.usb-row strong {
  font-size: 12px;
}

.event-section {
  min-height: 250px;
  padding: 24px 25px;
}

.empty-events {
  display: grid;
  min-height: 150px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-events > span {
  margin-bottom: 8px;
  color: #aac3bf;
  font-size: 32px;
}

.empty-events strong {
  color: var(--ink);
  font-size: 13px;
}

.empty-events p {
  margin: 5px 0 0;
  font-size: 11px;
}

.event-list {
  display: grid;
  max-height: 430px;
  gap: 7px;
  margin: 0;
  overflow: auto;
  padding: 0;
  list-style: none;
}

.event-item {
  display: grid;
  grid-template-columns: 76px minmax(100px, .65fr) minmax(0, 1.6fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
  font-size: 11px;
}

.event-item__time {
  color: #93a4a1;
  font-variant-numeric: tabular-nums;
}

.event-item__type {
  color: var(--teal-800);
  font-weight: 850;
}

.event-item__value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-panel {
  margin-top: 18px;
  padding: 22px 25px;
}

.result-panel h2 {
  font-size: 20px;
}

.result-panel > div > p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

noscript {
  position: fixed;
  z-index: 100;
  inset: 12px;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 16px;
  background: var(--teal-950);
  color: white;
  text-align: center;
}

@keyframes pulse {
  50% { opacity: .45; }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .recommendation-card__icon {
    margin-bottom: 24px;
  }

  .device-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    display: block;
  }

  .topbar {
    min-height: 68px;
    padding: max(11px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 11px max(14px, env(safe-area-inset-left));
  }

  .brand__mark {
    width: 37px;
    height: 37px;
    border-radius: 11px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand small {
    display: none;
  }

  .delivery-status {
    max-width: 48%;
    padding: 8px 10px;
  }

  .delivery-status strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu {
    position: sticky;
    z-index: 19;
    top: 68px;
    display: block;
    width: 100%;
    height: auto;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
  }

  .menu__label,
  .menu__tip {
    display: none;
  }

  .menu nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-width: 290px;
    gap: 7px;
  }

  .menu__item {
    min-height: 42px;
    justify-content: center;
    padding: 9px 12px;
    font-size: 12px;
  }

  .menu__item svg {
    width: 18px;
    height: 18px;
  }

  .content {
    padding-top: 26px;
  }

  .view-heading,
  .section-heading,
  .test-controls,
  .usb-row,
  .result-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .view-heading {
    margin-bottom: 20px;
  }

  .view-heading .secondary-button,
  .test-controls .primary-button,
  .usb-row .secondary-button,
  .result-panel .secondary-button {
    width: 100%;
  }

  .capture-state {
    align-self: flex-start;
  }

  .screen-ruler {
    min-height: 155px;
    margin-top: 18px;
  }

  .device-cards {
    grid-template-columns: 1fr;
  }

  .event-item {
    grid-template-columns: 64px minmax(90px, .7fr) minmax(0, 1fr);
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  .delivery-status {
    max-width: 43%;
  }

  .screen-visual-card__header,
  .screen-visual-card__footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-item {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .event-item__value {
    grid-column: 1 / -1;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .app-shell {
    grid-template-rows: 64px minmax(0, 1fr);
  }

  .topbar {
    min-height: 64px;
    padding-top: max(9px, env(safe-area-inset-top));
    padding-bottom: 9px;
  }

  .menu {
    top: 64px;
    height: calc(100dvh - 64px);
    padding-top: 15px;
  }

  .content {
    padding-top: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
