:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #17171b;
  background: #f4f1ec;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 5%, rgba(255, 92, 120, 0.13), transparent 28rem),
    radial-gradient(circle at 88% 22%, rgba(41, 112, 255, 0.1), transparent 26rem),
    #f4f1ec;
}

button,
textarea {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible + span {
  outline: 3px solid rgba(255, 49, 88, 0.28);
  outline-offset: 3px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.8fr);
  gap: 64px;
  min-height: 680px;
  padding: 42px 0 72px;
  align-items: center;
}

.brand {
  position: absolute;
  top: 30px;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: #fff;
  background: #ff3158;
  box-shadow: 0 12px 25px rgba(255, 49, 88, 0.25);
}

.eyebrow,
.section-label {
  display: block;
  margin-bottom: 18px;
  color: #ff3158;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(48px, 6.2vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.068em;
}

.hero-copy h1 em {
  color: #ff3158;
  font-style: normal;
}

.hero-copy p {
  max-width: 600px;
  margin: 28px 0 0;
  color: #69676c;
  font-size: 18px;
  line-height: 1.8;
}

.parse-card {
  position: relative;
  padding: 30px;
  border: 1px solid rgba(23, 23, 27, 0.08);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.83);
  box-shadow: 0 35px 90px rgba(43, 35, 31, 0.12);
  backdrop-filter: blur(24px);
}

.parse-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.25));
}

.parse-card label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 160px;
  padding: 18px 19px;
  border: 1px solid #ddd8d1;
  border-radius: 18px;
  color: #202024;
  background: #fbfaf8;
  line-height: 1.65;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus {
  border-color: #ff3158;
  box-shadow: 0 0 0 4px rgba(255, 49, 88, 0.08);
  outline: none;
}

.engine-picker {
  min-width: 0;
  margin: 17px 0 0;
  padding: 0;
  border: 0;
}

.engine-picker legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 13px;
  font-weight: 800;
}

.engine-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.parse-card .engine-option {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

.engine-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.engine-option span {
  display: flex;
  min-height: 70px;
  flex-direction: column;
  justify-content: center;
  padding: 12px 14px;
  border: 1px solid #ddd8d1;
  border-radius: 15px;
  background: #fbfaf8;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.engine-option strong {
  font-size: 14px;
}

.engine-option small {
  margin-top: 4px;
  color: #858188;
  font-size: 11px;
  font-weight: 500;
}

.engine-option input:checked + span {
  border-color: #ff3158;
  background: rgba(255, 49, 88, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 49, 88, 0.08);
}

.engine-option input:disabled + span {
  cursor: not-allowed;
  opacity: 0.55;
}

.engine-hint {
  margin: 9px 2px 0;
  color: #77747a;
  font-size: 11px;
  line-height: 1.55;
}

.form-actions,
.result-actions,
.image-card-actions {
  display: flex;
  gap: 12px;
}

.form-actions {
  margin-top: 15px;
}

.button,
.card-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.button:hover,
.card-button:hover {
  transform: translateY(-2px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.button-primary {
  flex: 1;
  color: #fff;
  background: #ff3158;
  box-shadow: 0 14px 30px rgba(255, 49, 88, 0.26);
}

.button-secondary {
  padding: 0 20px;
  color: #27262a;
  background: #ebe7e1;
}

.button-dark {
  padding: 0 22px;
  color: #fff;
  background: #19191d;
}

.button-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.is-loading .button-text {
  display: none;
}

.is-loading .button-loader {
  display: block;
}

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

.form-hint {
  margin: 14px 3px 0;
  color: #8a878c;
  font-size: 12px;
  line-height: 1.6;
}

.empty-state {
  margin-bottom: 100px;
  padding: 80px 30px;
  border: 1px dashed #cbc5bc;
  border-radius: 28px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 19px;
  color: #fff;
  background: #19191d;
  font-size: 28px;
}

.empty-state h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.empty-state p {
  margin: 12px 0 0;
  color: #77747a;
}

.result-section {
  scroll-margin-top: 24px;
  padding: 56px 0 80px;
  border-top: 1px solid rgba(23, 23, 27, 0.12);
}

.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.result-heading h2 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.result-heading p {
  margin: 12px 0 0;
  color: #77747a;
}

.progress-panel {
  margin-bottom: 24px;
  padding: 18px 20px;
  border-radius: 18px;
  color: #fff;
  background: #19191d;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  font-size: 13px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #ff3158;
  transition: width 180ms ease;
}

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

.image-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 23, 27, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 50px rgba(43, 35, 31, 0.08);
}

.image-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #e8e3dc;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

.image-card:hover .image-frame img {
  transform: scale(1.025);
}

.image-number {
  position: absolute;
  right: 13px;
  bottom: 13px;
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: 12px;
  color: #fff;
  background: rgba(20, 20, 23, 0.78);
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.select-control {
  position: absolute;
  z-index: 2;
  top: 13px;
  left: 13px;
  cursor: pointer;
}

.select-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.select-control span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  background: rgba(20, 20, 23, 0.5);
  backdrop-filter: blur(12px);
}

.select-control input:checked + span {
  border-color: #ff3158;
  background: #ff3158;
}

.select-control input:checked + span::after {
  content: "✓";
  color: #fff;
  font-weight: 900;
}

.image-card-actions {
  padding: 13px;
}

.card-button {
  flex: 1;
  min-height: 43px;
  color: #fff;
  background: #ff3158;
  font-size: 13px;
}

.card-button-muted {
  color: #2c2b2f;
  background: #ebe7e1;
}

footer {
  padding: 32px 0 50px;
  border-top: 1px solid rgba(23, 23, 27, 0.1);
  color: #88858a;
  font-size: 13px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 99;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 15px 18px;
  border-radius: 15px;
  color: #fff;
  background: #1b1b1f;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-type="success"] {
  background: #147d55;
}

.toast[data-type="error"] {
  background: #b92e46;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 42px;
    min-height: auto;
    padding-top: 130px;
  }

  .hero-copy h1 {
    max-width: 760px;
  }

  .result-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
  }

  .hero {
    padding-top: 112px;
    padding-bottom: 48px;
  }

  .brand {
    left: 4px;
  }

  .hero-copy h1 {
    font-size: 47px;
  }

  .hero-copy p {
    font-size: 15px;
  }

  .parse-card {
    padding: 20px;
    border-radius: 24px;
  }

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

  .form-actions .button-primary,
  .result-actions .button-dark {
    flex-basis: 100%;
  }

  .result-actions {
    width: 100%;
  }

  .result-actions .button {
    flex: 1;
    padding: 0 12px;
  }

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

  .toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }
}

@media (max-width: 520px) {
  .engine-options {
    grid-template-columns: 1fr;
  }
}
