:root {
  color-scheme: light;
  font-family: "DM Sans", "Noto Sans SC", system-ui, sans-serif;
  color: #20201d;
  background: #eef0e9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #20201d;
  --muted: #6f716a;
  --paper: #fffef9;
  --line: rgba(32, 32, 29, 0.13);
  --sage: #6d8065;
  --sage-dark: #43543f;
  --sage-soft: #dce6d7;
  --lime: #d8e86c;
  --coral: #c76e5a;
  --shadow: 0 28px 80px rgba(43, 49, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, rgba(216, 232, 108, 0.24), transparent 26rem),
    radial-gradient(circle at 100% 16%, rgba(109, 128, 101, 0.14), transparent 30rem),
    #eef0e9;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app-header,
main,
footer {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--sage-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.brand strong,
.brand small {
  display: block;
}

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

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(67, 84, 63, 0.18);
  border-radius: 999px;
  color: var(--sage-dark);
  background: rgba(220, 230, 215, 0.64);
  font-size: 11px;
  font-weight: 600;
}

.privacy-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  align-items: end;
  gap: 60px;
  padding: 52px 0 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--sage);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 72px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.hero-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.hero-note strong {
  color: var(--ink);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 20px;
  align-items: start;
}

.self-check-card,
.insight-card,
.boundary-card {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.self-check-card {
  min-height: 680px;
  padding: 28px;
  border-radius: 28px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 28px;
}

.step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a1a39c;
  font-size: 11px;
  font-weight: 600;
}

.step:not(:last-child)::after {
  position: absolute;
  top: 13px;
  right: 12px;
  left: 42px;
  height: 1px;
  background: var(--line);
  content: "";
}

.step span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
}

.step.is-active {
  color: var(--ink);
}

.step.is-active span,
.step.is-complete span {
  border-color: var(--sage-dark);
  color: #fff;
  background: var(--sage-dark);
}

.step.is-complete::after {
  background: var(--sage);
}

.capture-stage {
  display: grid;
  justify-items: center;
  padding: 18px 20px 10px;
  text-align: center;
}

.camera-orbit {
  position: relative;
  display: grid;
  width: min(340px, 78vw);
  aspect-ratio: 1;
  margin: 4px auto 26px;
  place-items: center;
  border: 1px solid rgba(67, 84, 63, 0.13);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(216, 232, 108, 0.45), transparent 57%),
    repeating-radial-gradient(circle, transparent 0 34px, rgba(67, 84, 63, 0.055) 35px 36px);
}

.camera-orbit::before,
.camera-orbit::after {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 6px rgba(109, 128, 101, 0.09);
  content: "";
}

.camera-orbit::before {
  top: 14%;
  right: 15%;
}

.camera-orbit::after {
  bottom: 18%;
  left: 10%;
}

.face-guide {
  position: relative;
  width: 45%;
  height: 62%;
  border: 2px solid var(--sage-dark);
  border-radius: 46% 46% 50% 50%;
}

.guide-eye {
  position: absolute;
  top: 40%;
  width: 16%;
  height: 2px;
  background: var(--sage-dark);
}

.guide-eye.left {
  left: 22%;
}

.guide-eye.right {
  right: 22%;
}

.guide-line {
  position: absolute;
  right: 30%;
  bottom: 22%;
  left: 30%;
  height: 2px;
  background: var(--sage-dark);
}

.capture-stage h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.capture-stage > p {
  max-width: 560px;
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

#photoInput {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.primary-button,
.secondary-button {
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--sage-dark);
  color: #fff;
  background: var(--sage-dark);
}

.primary-button:disabled {
  border-color: var(--line);
  color: #9d9e99;
  background: #e9eae5;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

.capture-tips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
}

.capture-tips span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.preview-shell {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 22px;
  background: #d8dbd3;
}

#previewCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
}

.preview-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  background: rgba(32, 32, 29, 0.58);
  font-size: 9px;
  backdrop-filter: blur(8px);
}

.quality-section {
  margin-top: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.quality-summary {
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--sage-dark);
  background: var(--sage-soft);
  font-size: 10px;
  font-weight: 600;
}

.quality-summary.has-warning {
  color: #934738;
  background: rgba(199, 110, 90, 0.14);
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.quality-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #fafbf7;
}

.quality-item strong,
.quality-item span {
  display: block;
}

.quality-item strong {
  color: var(--ink);
  font-size: 11px;
}

.quality-item span {
  margin-top: 4px;
  font-size: 10px;
}

.quality-item.is-pass {
  border-color: rgba(109, 128, 101, 0.3);
  background: rgba(220, 230, 215, 0.36);
}

.quality-item.is-warning {
  border-color: rgba(199, 110, 90, 0.26);
  background: rgba(199, 110, 90, 0.07);
}

.quality-advice {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.stage-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.result-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: center;
  padding: 10px 0 22px;
}

.score-ring {
  display: grid;
  width: 170px;
  height: 170px;
  place-content: center;
  border-radius: 50%;
  text-align: center;
  background:
    radial-gradient(circle, var(--paper) 59%, transparent 60%),
    conic-gradient(var(--sage-dark) var(--score-angle, 0deg), var(--sage-soft) 0);
}

.score-ring span,
.score-ring small {
  color: var(--muted);
  font-size: 9px;
}

.score-ring strong {
  margin: 3px 0 -2px;
  font-size: 46px;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.result-copy h2 {
  margin: 0 0 8px;
  font-size: 29px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.result-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.roi-result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.roi-result {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafbf7;
}

.roi-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.roi-result-head strong {
  font-size: 12px;
}

.roi-result-head b {
  font-size: 18px;
  font-weight: 500;
}

.score-bar {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sage-soft);
}

.score-bar i {
  display: block;
  width: var(--score-width);
  height: 100%;
  border-radius: inherit;
  background: var(--sage-dark);
}

.roi-result small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.method-note {
  margin-top: 14px;
  padding: 15px;
  border-left: 3px solid var(--lime);
  border-radius: 0 12px 12px 0;
  background: rgba(216, 232, 108, 0.14);
}

.method-note strong {
  font-size: 11px;
}

.method-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.result-actions {
  flex-wrap: wrap;
}

.insight-column {
  display: grid;
  gap: 16px;
}

.insight-card,
.boundary-card {
  border-radius: 22px;
}

.insight-card {
  padding: 22px;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.history-empty {
  display: grid;
  min-height: 270px;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.history-empty > span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: var(--sage-dark);
  background: var(--sage-soft);
  font-size: 22px;
}

.history-empty p {
  max-width: 250px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

#historyChart {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.history-axis {
  stroke: var(--line);
  stroke-width: 1;
}

.history-line {
  fill: none;
  stroke: var(--sage-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.history-area {
  fill: url("#historyGradient");
}

.history-dot {
  fill: var(--paper);
  stroke: var(--sage-dark);
  stroke-width: 2;
}

.history-list {
  display: grid;
  gap: 7px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

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

.boundary-card {
  display: flex;
  gap: 14px;
  padding: 18px;
  box-shadow: none;
}

.boundary-icon {
  flex: 0 0 auto;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--coral);
  font-weight: 600;
}

.boundary-card strong {
  font-size: 11px;
}

.boundary-card p {
  margin: 5px 0 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.boundary-card a {
  color: var(--sage-dark);
  font-size: 10px;
  font-weight: 600;
  text-underline-offset: 3px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

footer strong {
  color: var(--ink);
}

@media (max-width: 960px) {
  .hero,
  .app-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: 22px;
  }

  .insight-column {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .app-header,
  main,
  footer {
    width: min(100% - 24px, 1360px);
  }

  .brand small {
    display: none;
  }

  .hero {
    padding-top: 36px;
  }

  .hero h1 {
    font-size: 41px;
  }

  .self-check-card {
    min-height: 0;
    padding: 18px;
    border-radius: 22px;
  }

  .step {
    gap: 5px;
    font-size: 10px;
  }

  .capture-stage {
    padding-inline: 0;
  }

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

  .result-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .roi-result-grid {
    grid-template-columns: 1fr;
  }

  .stage-actions {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .stage-actions button {
    width: 100%;
  }

  .insight-column {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Pastel Soft design system */
:root {
  --ink: #594b69;
  --muted: #82758f;
  --paper: #ffffff;
  --line: rgba(155, 122, 204, 0.15);
  --sage: #7daa91;
  --sage-dark: #795ca0;
  --sage-soft: #e5f3e9;
  --lime: #d9efdf;
  --coral: #ff9eb0;
  --lavender: #9b7acc;
  --pink-soft: #fde2e4;
  --blue-soft: #e2ecf6;
  --mint-soft: #e5f3e9;
  --shadow: 0 14px 44px rgba(155, 122, 204, 0.14);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 2%, rgba(253, 226, 228, 0.96), transparent 29rem),
    radial-gradient(circle at 96% 10%, rgba(226, 236, 246, 0.98), transparent 34rem),
    radial-gradient(circle at 83% 76%, rgba(229, 243, 233, 0.84), transparent 34rem),
    linear-gradient(145deg, #fff9fb 0%, #f8f7ff 48%, #f4fbf8 100%);
}

.app-header {
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(155, 122, 204, 0.13);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 30px rgba(155, 122, 204, 0.1);
  backdrop-filter: blur(18px);
}

.brand-mark {
  border-radius: 15px;
  color: #655178;
  background: linear-gradient(135deg, #ffcad4, #d8d4f4 55%, #ccebdd);
  box-shadow: 0 8px 20px rgba(155, 122, 204, 0.16);
}

.privacy-pill {
  border: 0;
  color: #54735f;
  background: rgba(229, 243, 233, 0.86);
  box-shadow: 0 5px 18px rgba(125, 170, 145, 0.1);
}

.privacy-pill i {
  background: #7daa91;
  box-shadow: 0 0 0 5px rgba(125, 170, 145, 0.14);
}

.hero {
  padding-top: 48px;
}

.eyebrow {
  color: #9270bd;
}

.hero h1 {
  color: #5c4c6d;
  text-shadow: 0 8px 28px rgba(155, 122, 204, 0.1);
}

.self-check-card,
.insight-card,
.boundary-card {
  border-color: rgba(155, 122, 204, 0.12);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.self-check-card {
  border-radius: 32px;
}

.insight-card,
.boundary-card {
  border-radius: 24px;
}

.step:not(:last-child)::after {
  height: 3px;
  border-radius: 999px;
  background: rgba(155, 122, 204, 0.12);
}

.step span {
  border-color: rgba(155, 122, 204, 0.15);
  color: #8e7a9e;
  background: #fff;
  box-shadow: 0 4px 12px rgba(155, 122, 204, 0.08);
}

.step.is-active span,
.step.is-complete span {
  border-color: transparent;
  color: #644f7c;
  background: linear-gradient(135deg, #ffb5c2, #d8d4f4 58%, #cdeade);
  box-shadow: 0 7px 18px rgba(155, 122, 204, 0.18);
}

.step.is-complete::after {
  background: linear-gradient(90deg, #d8d4f4, #cdeade);
}

.camera-orbit {
  border: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.96) 0 29%, transparent 30%),
    radial-gradient(circle at 28% 25%, rgba(255, 181, 194, 0.62), transparent 38%),
    radial-gradient(circle at 75% 35%, rgba(226, 236, 246, 0.92), transparent 42%),
    radial-gradient(circle at 58% 78%, rgba(229, 243, 233, 0.96), transparent 38%),
    #faf7ff;
  box-shadow:
    0 18px 44px rgba(155, 122, 204, 0.13),
    inset 0 0 0 12px rgba(255, 255, 255, 0.34);
}

.camera-orbit::before,
.camera-orbit::after {
  background: #ffb5c2;
  box-shadow: 0 0 0 7px rgba(255, 181, 194, 0.18);
}

.camera-orbit::after {
  background: #9b7acc;
  box-shadow: 0 0 0 7px rgba(155, 122, 204, 0.14);
}

.face-guide {
  border-color: #9270bd;
}

.guide-eye,
.guide-line {
  background: #9270bd;
}

.primary-button {
  border: 0;
  color: #5e4779;
  background: linear-gradient(135deg, #ffb5c2, #d7d7f5 58%, #cdeade);
  box-shadow: 0 8px 22px rgba(155, 122, 204, 0.2);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  box-shadow: 0 11px 28px rgba(155, 122, 204, 0.24);
  transform: translateY(-1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible {
  outline: 3px solid rgba(155, 122, 204, 0.22);
  outline-offset: 3px;
}

.primary-button:disabled {
  border: 0;
  color: #aaa0b1;
  background: #eeeaf3;
  box-shadow: none;
}

.secondary-button {
  border-color: rgba(155, 122, 204, 0.15);
  color: #665475;
  background: #fff;
  box-shadow: 0 5px 16px rgba(155, 122, 204, 0.08);
}

.capture-tips span {
  border: 0;
  color: #745d87;
  background: rgba(226, 236, 246, 0.72);
}

.capture-tips span:nth-child(2) {
  background: rgba(229, 243, 233, 0.82);
}

.capture-tips span:nth-child(3) {
  background: rgba(253, 226, 228, 0.78);
}

.preview-shell {
  border-radius: 28px;
  background: linear-gradient(135deg, #fde2e4, #e2ecf6);
  box-shadow: 0 14px 34px rgba(155, 122, 204, 0.15);
}

.preview-badge {
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: #fff;
  background: rgba(139, 103, 185, 0.72);
}

.quality-summary {
  color: #5b7261;
  background: #e5f3e9;
}

.quality-summary.has-warning {
  color: #9a5765;
  background: #fde2e4;
}

.quality-item,
.roi-result {
  border-color: rgba(155, 122, 204, 0.12);
  border-radius: 20px;
  background: #fbfaff;
  box-shadow: 0 5px 18px rgba(155, 122, 204, 0.06);
}

.quality-item.is-pass {
  border-color: transparent;
  background: rgba(229, 243, 233, 0.72);
}

.quality-item.is-warning {
  border-color: transparent;
  background: rgba(253, 226, 228, 0.72);
}

.score-ring {
  box-shadow: 0 14px 32px rgba(155, 122, 204, 0.16);
  background:
    radial-gradient(circle, #fff 58%, transparent 59%),
    conic-gradient(#9b7acc var(--score-angle, 0deg), #fde2e4 0);
}

.score-bar {
  background: #ebe5f3;
}

.score-bar i {
  background: linear-gradient(90deg, #ffb5c2, #9b7acc);
}

.method-note {
  border: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(253, 226, 228, 0.58), rgba(226, 236, 246, 0.58));
}

.history-empty > span {
  color: #72588d;
  background: linear-gradient(135deg, #fde2e4, #e2ecf6);
  box-shadow: 0 8px 20px rgba(155, 122, 204, 0.13);
}

.history-line {
  stroke: #9b7acc;
}

.history-dot {
  fill: #fff;
  stroke: #ff9eb0;
}

.boundary-card {
  border: 0;
  background: linear-gradient(135deg, rgba(253, 226, 228, 0.82), rgba(226, 236, 246, 0.82));
  box-shadow: 0 12px 34px rgba(155, 122, 204, 0.12);
}

.boundary-icon {
  color: #684e7f;
  background: #ffb5c2;
}

.boundary-card a,
.text-button {
  color: #8463aa;
}

@media (max-width: 680px) {
  .app-header {
    margin-top: 10px;
    border-radius: 20px;
  }

  .hero h1 {
    font-size: 39px;
  }

  .self-check-card {
    border-radius: 24px;
  }

  .camera-orbit {
    width: min(300px, 76vw);
  }
}
