:root {
  color-scheme: light;
  --ink: #18171f;
  --muted: #6f6b7b;
  --line: #ded9ec;
  --paper: rgba(255, 255, 255, 0.88);
  --surface: #f5f3ff;
  --purple: #7257d9;
  --purple-dark: #5137b2;
  --purple-soft: #eee9ff;
  --green: #16745a;
  --green-soft: #e6f7f1;
  --red: #b43c55;
  --red-soft: #fff0f3;
  --shadow: 0 24px 70px rgba(50, 37, 99, 0.12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7f5fc;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(114, 87, 217, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(114, 87, 217, 0.035) 1px, transparent 1px),
    #f7f5fc;
  background-size: 36px 36px;
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.44;
  pointer-events: none;
}

.ambient-one {
  top: -230px;
  right: -140px;
  background: #dcd2ff;
}

.ambient-two {
  bottom: -270px;
  left: -190px;
  background: #d8f2eb;
}

.shell {
  width: min(100% - 32px, 840px);
  margin: 0 auto;
  padding: 40px 0 48px;
}

.hero {
  padding: 0 4px 34px;
}

.eyebrow,
.step-label {
  margin: 0;
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  margin-top: 28px;
}

h1 {
  max-width: 660px;
  margin: 14px 0 18px;
  font-size: clamp(44px, 8vw, 74px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

h1 span {
  color: var(--purple);
}

.hero-copy {
  max-width: 610px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.extractor-card,
.results {
  border: 1px solid rgba(222, 217, 236, 0.9);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.extractor-card {
  padding: 30px;
}

.card-heading,
.results-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

h2,
h3 {
  margin: 7px 0 0;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 21px;
}

.environment-badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

form {
  margin-top: 22px;
}

.url-field {
  position: relative;
  display: block;
}

textarea {
  display: block;
  width: 100%;
  min-height: 128px;
  resize: vertical;
  padding: 18px 84px 72px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  color: var(--ink);
  background: #fbfaff;
  font-size: 15px;
  line-height: 1.6;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea::placeholder {
  color: #a49eaf;
}

textarea:focus {
  border-color: var(--purple);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(114, 87, 217, 0.11);
}

.paste-button {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.method-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: #9992a5;
  font-size: 12px;
}

.method-divider::before,
.method-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.qr-upload {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px dashed #bdb4d8;
  border-radius: 17px;
  outline: none;
  background: #faf9fd;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.qr-upload:hover,
.qr-upload:focus-visible,
.qr-upload.dragging {
  border-color: var(--purple);
  background: var(--purple-soft);
  box-shadow: 0 0 0 4px rgba(114, 87, 217, 0.09);
}

.qr-upload.scanning {
  cursor: wait;
  border-style: solid;
}

.qr-upload.success {
  border-color: #80c8b4;
  border-style: solid;
  background: var(--green-soft);
}

.qr-upload.error {
  border-color: #e6a7b5;
  border-style: solid;
  background: var(--red-soft);
}

.qr-icon {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  place-content: center;
  gap: 4px;
  border-radius: 14px;
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.qr-icon span {
  border: 3px solid currentColor;
  border-radius: 2px;
}

.qr-icon span:last-child {
  border-width: 0 3px 3px 0;
  border-radius: 0;
}

.scanning .qr-icon {
  animation: breathe 900ms ease-in-out infinite alternate;
}

.success .qr-icon {
  color: var(--green);
  background: #fff;
}

.error .qr-icon {
  color: var(--red);
  background: #fff;
}

.qr-upload-copy {
  min-width: 0;
}

.qr-upload-copy strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-upload-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.upload-action {
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--purple-dark);
  background: #fff;
  font-size: 12px;
  font-weight: 780;
  box-shadow: 0 2px 9px rgba(50, 37, 99, 0.08);
}

.primary-button,
.secondary-button,
.copy-button {
  border: 0;
  border-radius: 14px;
  font-weight: 780;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, opacity 150ms ease;
}

.primary-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  min-width: 126px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px 9px 14px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
}

.primary-button:hover,
.secondary-button:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.copy-button:disabled {
  cursor: wait;
  opacity: 0.56;
  transform: none;
}

.button-arrow {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
}

.notice,
.status-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.notice p,
.status-panel p,
.authorization-copy p,
#quizMeta,
footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.notice {
  font-size: 13px;
}

.notice-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-soft);
}

.status-panel {
  align-items: flex-start;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  background: var(--purple-soft);
}

.status-panel.error {
  background: var(--red-soft);
}

.status-panel.error strong {
  color: var(--red);
}

.status-spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 2px;
  border: 2px solid rgba(114, 87, 217, 0.22);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.status-panel.error .status-spinner {
  border: 0;
  animation: none;
}

.status-panel.error .status-spinner::before {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  content: "!";
  font-size: 12px;
  font-weight: 900;
}

.status-panel.success .status-spinner {
  border: 0;
  animation: none;
}

.status-panel.success .status-spinner::before {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  content: "✓";
  font-size: 12px;
  font-weight: 900;
}

.authorization-panel {
  margin-top: 20px;
  padding: 22px;
  border: 1px dashed #c8bdec;
  border-radius: 18px;
  background: #faf8ff;
}

.authorization-copy p:last-child {
  margin-top: 8px;
  font-size: 14px;
}

.secondary-button {
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  color: #fff;
  background: var(--purple);
}

.mini-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.mini-steps li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mini-steps span {
  display: grid;
  width: 24px;
  height: 24px;
  margin-bottom: 7px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--purple-dark);
  background: #fff;
  font-weight: 800;
}

.results {
  margin-top: 24px;
  padding: 30px;
}

#quizMeta {
  margin-top: 8px;
  font-size: 14px;
}

.copy-button {
  flex: 0 0 auto;
  padding: 11px 14px;
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.answer-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.answer-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.answer-index {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-size: 13px;
  font-weight: 850;
}

.question-title {
  margin: 1px 0 12px;
  font-size: 16px;
  font-weight: 760;
  line-height: 1.55;
}

.correct-answer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 14px;
  font-weight: 740;
  line-height: 1.45;
}

.answer-letter {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--green);
  font-size: 11px;
}

.option-summary {
  margin-top: 12px;
  color: #8b8597;
  font-size: 12px;
  line-height: 1.6;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 26px 5px 0;
  font-size: 11px;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 15px;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 14px 40px rgba(24, 23, 31, 0.24);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

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

@keyframes breathe {
  to { transform: scale(0.9); opacity: 0.7; }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 22px, 840px);
    padding-top: 22px;
  }

  .hero {
    padding-bottom: 24px;
  }

  .eyebrow { margin-top: 18px; }

  h1 {
    font-size: clamp(42px, 13vw, 58px);
  }

  .hero-copy {
    font-size: 14px;
  }

  .extractor-card,
  .results {
    padding: 20px;
    border-radius: 22px;
  }

  .environment-badge {
    padding: 7px 9px;
  }

  .qr-upload {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .qr-icon {
    width: 44px;
    height: 44px;
  }

  .upload-action {
    display: none;
  }

  .mini-steps {
    grid-template-columns: 1fr;
  }

  .mini-steps li {
    display: flex;
    align-items: center;
    gap: 9px;
  }

  .mini-steps span {
    margin: 0;
  }

  .results-heading {
    align-items: center;
  }

  .answer-card {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
  }

  .answer-index {
    width: 36px;
    height: 36px;
  }

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

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