:root {
  color-scheme: light;
  --bg: #edf8ff;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --text: #0f172a;
  --muted: #6f8193;
  --line: #e7eef5;
  --primary: #2d7bd2;
  --primary-dark: #1f66b4;
  --cyan: #23c7c7;
  --danger: #dc2626;
  --shadow: 0 28px 80px rgba(42, 93, 132, 0.12);
  --radius: 30px;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.92), transparent 22rem),
    radial-gradient(circle at 82% 12%, rgba(45, 123, 210, 0.1), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 58%, #f8fcff 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 96px -7vw auto;
  height: 285px;
  pointer-events: none;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(45, 123, 210, 0.12), rgba(35, 199, 199, 0.16)) border-box;
  border: 1px solid transparent;
  border-radius: 0 0 42px 42px;
  box-shadow:
    0 32px 90px rgba(54, 102, 145, 0.09),
    inset 0 -1px 0 rgba(231, 238, 245, 0.9);
  opacity: 0.78;
  z-index: -2;
}

body::after {
  content: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1160px, calc(100% - 56px));
  margin: 0 auto;
  padding: 30px 0 54px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.08;
}

h1::before {
  content: "";
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 18px;
  background:
    radial-gradient(circle at 35px 28px, #2f80ed 0 3px, transparent 4px),
    linear-gradient(#2f80ed, #2f80ed) 34px 18px / 3px 12px no-repeat,
    linear-gradient(160deg, transparent 0 17px, #2f80ed 18px 31px, transparent 32px) 9px 6px / 30px 22px no-repeat,
    linear-gradient(200deg, transparent 0 17px, #1f66b4 18px 31px, transparent 32px) 7px 6px / 32px 22px no-repeat,
    linear-gradient(#2f80ed, #2f80ed) 13px 25px / 22px 8px no-repeat,
    linear-gradient(#1f66b4, #1f66b4) 16px 31px / 16px 5px no-repeat,
    #dceeff;
  box-shadow: 0 14px 30px rgba(47, 128, 237, 0.18);
}

h2 {
  font-size: 20px;
}

.hero-text {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(203, 225, 242, 0.95);
  border-radius: 36px;
  box-shadow: 0 28px 80px rgba(42, 93, 132, 0.13);
}

.card {
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  box-shadow: none;
  backdrop-filter: none;
}

.uploader-card {
  align-self: start;
  padding: 22px;
  overflow: hidden;
  background: rgba(248, 252, 255, 0.96);
  border: 1px solid rgba(218, 234, 247, 0.95);
  box-shadow: 0 14px 34px rgba(45, 90, 128, 0.06);
}

.result-card {
  display: flex;
  min-height: 680px;
  padding: 22px 0 22px;
  flex-direction: column;
}

.section-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.section-title > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(45, 123, 210, 0.22);
}

.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.drop-zone {
  display: grid;
  min-height: 182px;
  padding: 26px;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(35, 199, 199, 0.12), transparent 58%),
    var(--panel-soft);
  border: 1.5px dashed #b8d6ef;
  border-radius: 28px;
  transition: 0.2s ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--primary);
  background: #f0f8ff;
}

.drop-zone input {
  display: none;
}

.upload-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 16px;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(45, 123, 210, 0.24);
}

.drop-zone small,
.hint,
.notice {
  color: var(--muted);
  line-height: 1.6;
}

.or-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.field input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: 0.18s ease;
}

.field input {
  height: 48px;
  padding: 0 18px;
}

textarea {
  min-height: 86px;
  padding: 14px;
  resize: vertical;
}

.field input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(52, 87, 255, 0.12);
}

.advanced {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.advanced summary {
  color: #4f6b84;
  cursor: pointer;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.hint {
  margin: 12px 0 0;
  font-size: 13px;
}

code {
  padding: 2px 5px;
  background: #eef2ff;
  border-radius: 6px;
  color: #3730a3;
  font-size: 0.92em;
}

.generate-form {
  margin-top: 22px;
}

.generate-form button {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #2f85dc, #216fbe);
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(45, 123, 210, 0.28);
}

.generate-form button:hover {
  background: linear-gradient(180deg, #2579ce, #1b61a8);
}

.generate-form button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.result-output {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(249, 252, 255, 0.96), rgba(255, 255, 255, 0.98)),
    #fff;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 20px;
}

.empty-state p {
  margin: 0;
}

.result-output.is-loading::after {
  content: "▋";
  margin-left: 2px;
  animation: blink 0.9s steps(2, start) infinite;
}

.share-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #c8e3f6;
  border-radius: 24px;
  background: linear-gradient(135deg, #eff8ff, #f4fffd);
}

.share-panel[hidden] {
  display: none;
}

.share-panel h3 {
  margin: 0;
  font-size: 16px;
}

.share-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.share-row input {
  width: 100%;
  height: 44px;
  border: 1px solid #c8e3f6;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: #1f2937;
  outline: none;
}

.share-row button {
  height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.share-row button:hover {
  background: var(--primary-dark);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.primary-btn,
.ghost-btn {
  height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  font-weight: 800;
}

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

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(47, 91, 129, 0.08);
  white-space: nowrap;
}

.ghost-btn:hover {
  background: #fff;
}

.ghost-btn.danger {
  color: var(--danger);
}

.settings-dialog {
  width: min(540px, calc(100% - 32px));
  border: 0;
  border-radius: 28px;
  padding: 0;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.28);
}

.settings-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.settings-card {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 24px;
  line-height: 1;
}

.notice {
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  font-size: 13px;
}

.settings-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 820px) {
  .hero {
    display: grid;
  }

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

  .result-card {
    min-height: 620px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .card,
  .settings-dialog {
    border-radius: 20px;
  }

  .field-grid,
  .share-row,
  .settings-actions {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .share-row,
  .settings-actions {
    display: grid;
  }
}
