:root {
  --page: #0c0c17;
  --phone: #ffffff;
  --ink: #11111c;
  --muted: #44435a;
  --soft: #f4efeb;
  --soft-strong: #eee8e2;
  --line: #e2dfdc;
  --dark-panel: #151520;
  --orange: #f45a1a;
  --orange-strong: #db4910;
  --orange-soft: #fff0e9;
  --green: #2fa866;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.18);
  --radius: 8px;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 90, 26, 0.08), transparent 28rem),
    var(--page);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.42;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 20;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 12px;
}

.phone-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 12px;
}

.device-frame {
  position: relative;
  width: min(100%, 390px);
  min-height: min(844px, calc(100vh - 40px));
  max-height: 900px;
  overflow: hidden auto;
  border: 10px solid #29242a;
  border-radius: 56px;
  background: var(--phone);
  box-shadow: var(--shadow);
  scrollbar-width: none;
}

.device-frame::-webkit-scrollbar {
  display: none;
}

.device-notch {
  position: sticky;
  top: 0;
  z-index: 8;
  width: 122px;
  height: 42px;
  margin: 0 auto -42px;
  border-radius: 0 0 24px 24px;
  background: #29242a;
}

.device-frame::before {
  content: attr(data-flow-label);
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.58);
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
}

.api-banner {
  position: sticky;
  top: 0;
  z-index: 7;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  color: transparent;
  background: transparent;
}

.app-screen {
  min-height: calc(min(844px, 100vh - 28px) - 20px);
  padding: 76px 26px 34px;
  background: var(--phone);
}

.home-screen {
  display: grid;
  align-content: center;
  gap: 78px;
}

.home-center {
  text-align: center;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 0 auto 26px;
  border-radius: 26px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 3rem;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2,
.object-name,
.step-instruction,
.history-title {
  letter-spacing: 0;
}

.home-center h1 {
  margin: 0 0 12px;
  font-size: 3rem;
  line-height: 0.98;
  font-weight: 1000;
}

.screen-copy {
  color: var(--muted);
  font-size: 1.23rem;
  font-weight: 750;
  line-height: 1.55;
}

.home-actions,
.confirm-actions,
.camera-actions,
.save-row,
.step-actions,
.completion-panel,
.custom-question,
.additional-context,
.correction-box,
.follow-up-box {
  display: grid;
  gap: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--phone);
  font-weight: 950;
  text-align: center;
  text-decoration: none;
}

.button-primary {
  background: var(--orange);
  color: #fff;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--orange-strong);
}

.button-secondary {
  border-color: #ddd9d5;
  background: var(--soft);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04) inset;
}

.button-outline {
  border-color: var(--orange);
  background: #fff;
  color: var(--orange);
}

.compact {
  min-height: 50px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 0.92rem;
}

.screen-nav {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.screen-nav h1 {
  margin: 0;
  text-align: center;
  font-size: 1.28rem;
  line-height: 1.15;
  font-weight: 950;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid #ebe7e3;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 850;
  box-shadow: 0 6px 16px rgba(20, 20, 30, 0.08);
}

.home-button {
  justify-self: end;
  color: var(--orange);
  border-color: #ffd4c2;
  background: var(--orange-soft);
}

.onboarding-screen {
  padding-top: 66px;
}

.skip-onboarding {
  display: block;
  margin-left: auto;
  margin-bottom: 18px;
}

.text-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 950;
  text-decoration: underline;
}

.demo-card,
.camera-surface,
.photo-frame {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: var(--dark-panel);
}

.demo-card {
  min-height: 250px;
  padding: 22px;
  color: #fff;
}

.play-button,
.demo-count {
  position: absolute;
  top: 20px;
}

.play-button {
  left: 20px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #3a3a49;
  color: #fff;
}

.demo-count {
  right: 20px;
  border-radius: 8px;
  background: #0f0f19;
  padding: 8px 12px;
  font-weight: 900;
}

.demo-visual {
  height: 178px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.demo-camera,
.demo-cube {
  font-size: 4rem;
}

.demo-scan span {
  display: block;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.demo-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 38%;
  height: 4px;
  background: var(--orange);
}

.voice-status {
  margin: 14px 0 22px;
  text-align: center;
  color: var(--muted);
  font-weight: 850;
}

.voice-status span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
}

.onboarding-screen h1 {
  font-size: 2rem;
  line-height: 1.16;
  font-weight: 1000;
  margin-bottom: 16px;
}

.onboarding-screen > .button-primary {
  width: 100%;
}

.pager-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 26px 0 22px;
}

.pager-dots span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #e6e0dc;
}

.pager-dots .is-active {
  width: 28px;
  background: var(--orange);
}

.camera-surface {
  display: grid;
  place-items: center;
  height: 430px;
  margin-bottom: 28px;
}

.camera-surface video,
.camera-surface img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--dark-panel);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.54);
  font-weight: 750;
}

.focus-line {
  position: absolute;
  width: 76%;
  height: 1px;
  background: rgba(244, 90, 26, 0.65);
}

.focus-ring {
  width: 64px;
  height: 64px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}

.camera-placeholder p {
  position: absolute;
  bottom: 20px;
  margin: 0;
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: rgba(255, 255, 255, 0.74);
}

.tl {
  left: 22px;
  top: 22px;
  border-left: 3px solid;
  border-top: 3px solid;
}

.tr {
  right: 22px;
  top: 22px;
  border-right: 3px solid;
  border-top: 3px solid;
}

.bl {
  left: 22px;
  bottom: 22px;
  border-left: 3px solid;
  border-bottom: 3px solid;
}

.br {
  right: 22px;
  bottom: 22px;
  border-right: 3px solid;
  border-bottom: 3px solid;
}

.camera-actions {
  grid-template-columns: 92px 1fr 1fr;
  align-items: center;
}

.shutter-button {
  grid-row: span 2;
  justify-self: center;
  width: 76px;
  height: 76px;
  border: 4px solid #e5e3e1;
  border-radius: 50%;
  background: #fbfaf8;
  box-shadow: 0 0 0 6px #f3f2f1 inset, 0 10px 20px rgba(0, 0, 0, 0.08);
}

.file-button input {
  display: none;
}

.camera-caption {
  margin: 28px 4px 0;
  color: var(--muted);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 850;
}

.notice,
.safety-warning,
.follow-up-answer,
.check-panel,
.completion-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--orange-soft);
  color: var(--muted);
  font-weight: 800;
}

.review-notice {
  margin-bottom: 14px;
}

.analysisSection h2,
.app-screen > h2 {
  margin-bottom: 10px;
  font-size: 2.05rem;
  line-height: 1.12;
  font-weight: 1000;
}

.device-card,
.compact-device-card {
  border: 2px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 34px rgba(20, 20, 30, 0.06);
}

.device-card {
  margin: 28px 0 26px;
}

.device-photo {
  position: relative;
  display: grid;
  place-items: center;
  height: 158px;
  background: var(--soft);
  border-bottom: 2px solid #ffd1bd;
}

.device-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.device-photo span {
  position: absolute;
  top: 16px;
  right: 14px;
  border-radius: 9px;
  background: var(--orange);
  color: #fff;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 950;
}

.device-card-body {
  padding: 26px 22px;
}

.object-name {
  margin-bottom: 14px;
  font-size: 2rem;
  line-height: 1.18;
  font-weight: 1000;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 9px;
  background: var(--orange-soft);
  color: var(--orange);
  font-weight: 950;
  padding: 0 12px;
  margin-bottom: 14px;
}

.description,
.component-list {
  color: var(--muted);
  font-weight: 700;
}

.component-list {
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
}

.component-item {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.component-name {
  color: var(--ink);
  font-weight: 900;
}

.text-input {
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.context-input {
  min-height: 82px;
  padding-top: 12px;
  padding-bottom: 12px;
  resize: vertical;
}

.text-input:focus {
  outline: 3px solid rgba(244, 90, 26, 0.18);
  border-color: var(--orange);
}

.compact-device-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
  padding: 14px 18px;
}

.mini-thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--soft);
}

.compact-device-card strong {
  display: block;
  font-size: 1.14rem;
  line-height: 1.15;
  font-weight: 1000;
}

.compact-device-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.voice-orb {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  width: 188px;
  height: 188px;
  margin: 46px auto 30px;
  border: 0;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  box-shadow: 0 24px 70px rgba(244, 90, 26, 0.2);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -moz-user-select: none;
  touch-action: manipulation;
  user-select: none;
  --voice-level: 0;
}

.voice-orb * {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.voice-orb .voice-icon {
  font-size: 3rem;
  line-height: 1;
  pointer-events: none;
}

.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 22px;
  opacity: 0.7;
  pointer-events: none;
}

.voice-wave i {
  display: block;
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.72;
  transform: scaleY(calc(0.2 + var(--voice-level) * 1.2));
  transform-origin: center;
  transition: transform 80ms linear, opacity 140ms ease;
}

.voice-wave i:nth-child(2),
.voice-wave i:nth-child(3) {
  height: 24px;
  transform: scaleY(calc(0.25 + var(--voice-level) * 1.45));
}

.voice-wave i:nth-child(4) {
  transform: scaleY(calc(0.18 + var(--voice-level) * 0.95));
}

.voice-orb strong {
  font-size: 1rem;
  font-weight: 950;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.voice-orb.is-recording,
.button.is-recording {
  background: var(--ink);
  color: #fff;
}

.voice-orb.is-recording {
  transform: scale(0.985);
}

.voice-orb.is-pulsing .voice-wave i {
  animation: voice-pulse 520ms ease;
}

@keyframes voice-pulse {
  0%,
  100% {
    transform: scaleY(0.25);
  }

  40% {
    transform: scaleY(1.25);
  }
}

.help-copy {
  color: var(--muted);
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.6;
  font-weight: 850;
}

.intent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 26px 0;
}

.intent-button {
  min-height: 62px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  font-weight: 950;
}

.photo-workspace {
  margin-bottom: 26px;
}

.photo-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: auto;
  padding: 0;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  opacity: 0.82;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.photo-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.step-progress {
  position: absolute;
  left: 12px;
  top: 12px;
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
  padding: 9px 14px;
  font-weight: 950;
  z-index: 2;
}

.guide-screen .badge {
  margin-bottom: 12px;
}

.step-card {
  margin-bottom: 24px;
}

.step-number {
  display: none;
}

.step-instruction {
  margin-bottom: 14px;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 1000;
}

.step-fallback {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.5;
  font-weight: 750;
}

.follow-up-box {
  border: 2px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 18px;
}

.follow-up-box > label {
  padding: 18px 18px 0;
  color: #8b8991;
  font-size: 1.1rem;
  font-weight: 750;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px;
}

.quick-reply {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.inline-hint {
  margin: 8px 0 0;
  border-radius: 12px;
  background: var(--orange-soft);
  color: var(--orange);
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.3;
  font-weight: 850;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.input-row.stacked {
  display: grid;
}

.input-row .text-input {
  flex: 1 1 0;
}

.custom-question .input-row {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.custom-question .input-row {
  display: grid;
}

.custom-question #dictateCustomBtn {
  display: none;
}

.follow-up-answer {
  margin: 0 12px 12px;
}

.save-row {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.save-row .button {
  min-height: 44px;
  font-size: 0.76rem;
}

.history-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.history-item {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.history-item::before {
  content: "";
  display: block;
  height: 134px;
  background: var(--soft);
}

.history-title {
  padding: 14px 14px 2px;
  font-size: 1.08rem;
  line-height: 1.15;
  font-weight: 1000;
}

.history-meta {
  padding: 0 14px 14px;
  color: var(--muted);
  font-weight: 750;
}

.archive-photo-block {
  position: absolute;
  inset: 0 0 auto;
  height: 134px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.archive-photo {
  max-width: 82%;
  max-height: 108px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.archive-emoji {
  font-size: 4.1rem;
  line-height: 1;
}

.archive-section-label,
.archive-field,
.history-steps,
.archive-events {
  display: none;
}

.history-item.is-complete::after,
.history-item.is-progress::after {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-weight: 950;
}

.history-item.is-complete::after {
  content: "✓";
  background: var(--green);
}

.history-item.is-progress::after {
  content: attr(data-progress);
  border-radius: 9px;
  background: var(--ink);
  padding: 0 8px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 12, 23, 0.55);
  z-index: 30;
}

.busy-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 250px;
  border-radius: 20px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
  font-weight: 950;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 5px solid var(--line);
  border-top-color: var(--orange);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(360px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
  box-shadow: var(--shadow);
}

.history-dialog {
  width: min(390px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 18px;
  border: 0;
  border-radius: 24px;
}

.history-dialog::backdrop {
  background: rgba(12, 12, 23, 0.55);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

body.high-contrast {
  --phone: #fff;
  --ink: #000;
  --muted: #222;
  --line: #000;
  --orange: #c63b00;
}

@media (max-width: 520px) {
  .phone-stage {
    padding: 0;
    place-items: stretch;
  }

  .device-frame {
    width: 100%;
    min-height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .device-frame::before {
    display: none;
  }

  .device-notch {
    display: none;
  }

  .app-screen {
    min-height: 100vh;
    padding: calc(72px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
  }

  .onboarding-screen {
    padding-top: calc(30px + env(safe-area-inset-top));
  }

  .guide-screen {
    padding-top: calc(86px + env(safe-area-inset-top));
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
  }

  .skip-onboarding {
    margin-bottom: 18px;
  }

  .demo-card {
    min-height: 250px;
  }

  .demo-visual {
    height: 178px;
  }

  .onboarding-screen h1 {
    font-size: 2rem;
    margin-bottom: 16px;
  }

  .onboarding-screen .screen-copy {
    font-size: 1.08rem;
  }

  .voice-status {
    margin: 14px 0 22px;
    font-size: 0.95rem;
  }

  .pager-dots {
    margin: 26px 0 22px;
  }

  .home-center h1 {
    font-size: 2.75rem;
  }

  .camera-surface {
    height: min(56vh, 430px);
  }
}

@media (max-width: 360px) {
  body {
    font-size: 16px;
  }

  .app-screen {
    padding-left: 18px;
    padding-right: 18px;
  }

  .two-col,
  .intent-grid,
  .history-list {
    grid-template-columns: 1fr;
  }

  .camera-actions,
  .save-row {
    grid-template-columns: 1fr;
  }

  .shutter-button {
    grid-row: auto;
  }
}
