:root {
  --bg: #080b10;
  --bg-2: #0d1117;
  --panel: rgba(18, 24, 32, 0.86);
  --panel-strong: rgba(24, 32, 42, 0.94);
  --panel-soft: rgba(22, 30, 39, 0.74);
  --card: rgba(248, 250, 252, 0.98);
  --card-soft: rgba(255, 255, 255, 0.95);
  --ink: #17202a;
  --ink-soft: #5b6875;
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(45, 212, 191, 0.34);
  --accent: #ff6a00;
  --accent-2: #ff3f13;
  --accent-3: #2dd4bf;
  --accent-soft: rgba(255, 106, 0, 0.16);
  --danger: #d96b5f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --radius-xl: 12px;
  --radius-lg: 10px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 106, 0, 0.16), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(45, 212, 191, 0.11), transparent 30%),
    linear-gradient(315deg, rgba(248, 195, 91, 0.07), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.028) 0 1px, transparent 1px 84px),
    var(--bg);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 12%),
    repeating-linear-gradient(180deg, transparent 0 6px, rgba(255,255,255,0.018) 6px 7px);
  mix-blend-mode: screen;
  opacity: 0.48;
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3 {
  font-family: "Georgia", "Times New Roman", "Songti SC", serif;
  letter-spacing: 0.01em;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
  overflow: hidden;
  align-items: start;
}

.side-panel,
.main-panel {
  min-width: 0;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.side-panel::-webkit-scrollbar,
.main-panel::-webkit-scrollbar {
  width: 10px;
}

.side-panel::-webkit-scrollbar-thumb,
.main-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.side-panel {
  position: sticky;
  top: 22px;
  height: calc(100dvh - 44px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.input-card {
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 106, 0, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(45, 212, 191, 0.06), transparent 26%),
    var(--panel-strong);
  color: #eef5f7;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  height: 100%;
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.form-intro {
  position: relative;
  padding: 2px 0 10px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: #93a4ad;
}

.form-intro h1 {
  margin: 0 0 4px;
  font-size: 31px;
  line-height: 1.02;
  color: #eef5f7;
}

.lede {
  margin: 0;
  color: rgba(247, 239, 228, 0.78);
  font-size: 16px;
  line-height: 1.55;
}

.intro-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.intro-tags span {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(247, 239, 228, 0.88);
  font-size: 13px;
}

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

.field span {
  font-size: 13px;
  font-weight: 700;
  color: #eef5f7;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: #eef5f7;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field textarea {
  resize: none;
}

#referenceUrls {
  min-height: 88px;
}

#notes {
  min-height: 96px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #7f919c;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.8) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.8) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field select option,
.field select optgroup {
  color: #17202a;
  background: #f8fafc;
}

.primary-button,
.ghost-button {
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

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

.primary-button {
  margin-top: 4px;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fffaf2;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 16px 34px rgba(255, 106, 0, 0.24);
}

.form-status {
  min-height: 22px;
  margin: 0;
  font-size: 13px;
  color: rgba(247, 239, 228, 0.72);
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: calc(100dvh - 44px);
  overflow: hidden;
  align-self: stretch;
}

.main-panel > * {
  min-height: 0;
}

.state-card,
.list-card,
.summary-card,
.unit-card {
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.state-card {
  padding: 34px 36px;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 106, 0, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 24%),
    var(--panel-strong);
  color: #eef5f7;
}

.empty-state,
.loading-state {
  min-height: 0;
  flex: 1;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 24px;
  text-align: center;
}

.empty-visual {
  position: relative;
  width: min(420px, 66%);
  min-height: 260px;
  display: grid;
  place-items: center;
  perspective: 1200px;
}

.empty-logo-shell {
  position: relative;
  width: min(360px, 100%);
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 10px 24px 36px;
  transform-style: preserve-3d;
}

.empty-logo-shell::before {
  content: "";
  position: absolute;
  inset: 12% 16%;
  background: radial-gradient(circle, rgba(255, 150, 31, 0.22), transparent 72%);
  filter: blur(34px);
  animation: logoGlowPulse 4.2s ease-in-out infinite;
}

.empty-logo-shell::after {
  content: "";
  position: absolute;
  inset: 26px 54px 48px;
  border: 1px solid rgba(255, 106, 0, 0.22);
  border-radius: 50%;
  transform: rotateX(68deg) rotateZ(-8deg);
  opacity: 0.72;
}

.logo-orbit {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.orbit-one {
  inset: 18px 46px 34px;
  border: 1px solid rgba(255, 106, 0, 0.36);
  transform: rotateX(72deg) rotateZ(0deg);
  animation: orbitSpin 12s linear infinite;
}

.orbit-two {
  inset: 36px 74px 52px;
  border: 1px solid rgba(45, 212, 191, 0.24);
  transform: rotateX(72deg) rotateZ(0deg);
  animation: orbitSpinReverse 16s linear infinite;
}

.logo-floor {
  position: absolute;
  left: 42px;
  right: 42px;
  bottom: 4px;
  height: 52px;
  border: 1px solid rgba(255, 106, 0, 0.22);
  background:
    linear-gradient(rgba(255, 106, 0, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.16) 1px, transparent 1px);
  background-size: 14px 14px;
  transform: rotateX(72deg);
  box-shadow: 0 0 28px rgba(255, 106, 0, 0.12);
  opacity: 0.82;
}

.empty-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  height: auto;
  object-fit: contain;
  transform: translateZ(48px) rotateX(12deg);
  transform-origin: center;
  filter: drop-shadow(0 22px 44px rgba(255, 133, 23, 0.18));
  animation: logoFloat3d 5.4s ease-in-out infinite;
}

.empty-copy {
  max-width: 560px;
}

.empty-copy .eyebrow {
  color: var(--accent);
}

.empty-copy h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.02;
  color: #fff7ef;
}

@keyframes logoFloat3d {
  0%,
  100% {
    transform: translate3d(0, 0, 48px) rotateX(12deg) rotateZ(-1deg);
  }
  50% {
    transform: translate3d(0, -12px, 72px) rotateX(6deg) rotateZ(1deg);
  }
}

@keyframes logoGlowPulse {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes orbitSpin {
  from {
    transform: rotateX(72deg) rotateZ(0deg);
  }
  to {
    transform: rotateX(72deg) rotateZ(360deg);
  }
}

@keyframes orbitSpinReverse {
  from {
    transform: rotateX(72deg) rotateZ(360deg);
  }
  to {
    transform: rotateX(72deg) rotateZ(0deg);
  }
}

.loading-state {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-content: stretch;
  overflow: hidden;
}

.loading-head,
.progress-block {
  grid-column: 1 / -1;
}

.loading-head {
  max-width: 920px;
}

.progress-block,
.loading-steps,
.runtime-card {
  padding: 18px;
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}

.loading-head .eyebrow {
  color: rgba(247, 239, 228, 0.56);
}

.loading-head h2 {
  margin: 0 0 10px;
  font-size: 35px;
  line-height: 1.04;
  color: #fff7ef;
}

.loading-head p {
  margin: 0;
  color: rgba(247, 239, 228, 0.68);
  font-size: 16px;
}

.progress-block {
  display: grid;
  gap: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: rgba(247, 239, 228, 0.66);
  font-size: 14px;
}

.progress-meta strong {
  color: #fff7ef;
  font-size: 18px;
}

.progress-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #f8c35b, var(--accent-3));
  box-shadow: 0 0 22px rgba(255, 106, 0, 0.28);
  transition: width 0.28s ease;
}

.loading-steps {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  align-content: start;
}

.loading-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.loading-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(247, 239, 228, 0.72);
  font-weight: 800;
}

.loading-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 17px;
  color: #fff7ef;
}

.loading-step p {
  margin: 0;
  color: rgba(247, 239, 228, 0.64);
  line-height: 1.55;
}

.loading-step.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 106, 0, 0.34);
  transform: translateX(4px);
}

.loading-step.is-active span {
  background: rgba(255, 106, 0, 0.18);
  color: #ffb28b;
}

.loading-step.is-done span {
  background: rgba(45, 212, 191, 0.16);
  color: #9ae4d8;
}

.runtime-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.runtime-head .eyebrow {
  margin-bottom: 6px;
  color: rgba(247, 239, 228, 0.52);
}

.runtime-head strong {
  color: #fff7ef;
  font-size: 18px;
}

.runtime-log {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.runtime-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.runtime-time {
  color: rgba(247, 239, 228, 0.42);
  font-size: 12px;
}

.runtime-message {
  color: rgba(247, 239, 228, 0.82);
  line-height: 1.5;
  word-break: break-word;
}

.runtime-row.tone-success {
  border-color: rgba(79, 182, 164, 0.18);
}

.runtime-row.tone-success .runtime-message {
  color: #b7f2e9;
}

.runtime-row.tone-warning {
  border-color: rgba(240, 177, 74, 0.18);
}

.runtime-row.tone-warning .runtime-message {
  color: #ffd997;
}

.runtime-row.tone-error {
  border-color: rgba(217, 107, 95, 0.2);
}

.runtime-row.tone-error .runtime-message {
  color: #ffb4a8;
}

.result-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 106, 0, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 24%),
    rgba(18, 24, 32, 0.88);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.result-header h2 {
  margin: 0 0 8px;
  font-size: 33px;
  line-height: 1;
  color: #eef5f7;
}

.result-header .eyebrow,
.result-header .muted {
  color: #93a4ad;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-body {
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
  display: grid;
  gap: 16px;
}

.ghost-button {
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  background: rgba(255, 106, 0, 0.08);
  color: #eef5f7;
  border: 1px solid rgba(255, 106, 0, 0.3);
  font-size: 13px;
}

.ghost-button:hover {
  background: rgba(255, 106, 0, 0.14);
}

.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.66;
  cursor: wait;
  transform: none;
}

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

.summary-card {
  border-radius: var(--radius-xl);
  padding: 18px 18px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 252, 0.96));
}

.summary-card:nth-child(1) {
  box-shadow:
    inset 0 4px 0 rgba(255, 122, 26, 0.72),
    var(--shadow);
}

.summary-card:nth-child(2) {
  box-shadow:
    inset 0 4px 0 rgba(255, 179, 0, 0.76),
    var(--shadow);
}

.summary-card:nth-child(3) {
  box-shadow:
    inset 0 4px 0 rgba(255, 151, 38, 0.82),
    var(--shadow);
}

.summary-card .eyebrow {
  color: rgba(15, 23, 34, 0.46);
}

.summary-card .muted {
  color: var(--ink-soft);
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  color: var(--ink);
}

.list-card {
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  background: linear-gradient(180deg, rgba(252, 254, 255, 0.98), rgba(241, 246, 250, 0.96));
}

.list-card h3 {
  margin: 0 0 10px;
  font-size: 25px;
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.source-item {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(215, 225, 234, 0.84);
}

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

.source-head strong {
  color: #132033;
}

.source-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.source-status.success {
  background: rgba(255, 179, 0, 0.14);
  color: #b06d00;
}

.source-status.error {
  background: rgba(217, 107, 95, 0.14);
  color: #b24c41;
}

.source-status.neutral {
  background: rgba(95, 102, 116, 0.12);
  color: #5f6674;
}

.source-url,
.source-note {
  margin: 0;
  line-height: 1.6;
  word-break: break-word;
}

.source-url {
  color: #304055;
  font-size: 13px;
}

.source-note {
  color: #69778a;
  font-size: 13px;
}

.unit-list {
  display: grid;
  gap: 16px;
}

.unit-card {
  border-radius: var(--radius-xl);
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(241, 246, 251, 0.97));
  border: 1px solid rgba(214, 224, 238, 0.82);
}

.unit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.unit-card-header .eyebrow {
  color: rgba(15, 23, 34, 0.48);
}

.unit-title {
  margin: 0;
  font-size: 27px;
}

.fields {
  display: grid;
  gap: 12px;
}

.field-row {
  background: rgba(246, 250, 254, 0.96);
  border: 1px solid rgba(212, 222, 236, 0.88);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  gap: 12px;
}

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

.field-label {
  color: #122033;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.field-value {
  min-height: 108px;
  border: 1px solid rgba(205, 216, 230, 0.92);
  background: rgba(255, 255, 255, 0.98);
  color: #162030;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.field-title-line,
.field-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.field-subline {
  font-size: 13px;
  color: #5f6b7c;
  line-height: 1.5;
}

.field-type,
.field-source {
  color: #5f6b7c;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.required-pill[data-required="true"] {
  background: rgba(255, 106, 0, 0.12);
  color: #a55000;
}

.required-pill[data-required="false"] {
  background: rgba(148, 163, 184, 0.16);
  color: #5b6875;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .page-shell {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  .empty-copy h2,
  .loading-head h2 {
    font-size: 34px;
  }

  .loading-state {
    grid-template-columns: 1fr;
    overflow: auto;
  }
}

@media (max-width: 960px) {
  html,
  body {
    overflow: auto;
  }

  .page-shell {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .side-panel,
  .main-panel {
    position: static;
    height: auto;
    overflow: visible;
  }

  .input-card {
    height: auto;
    overflow: visible;
  }

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

  .result-header {
    flex-direction: column;
  }

  .loading-state {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .empty-copy h2,
  .loading-head h2 {
    font-size: 34px;
  }

  .form-intro h1 {
    font-size: 36px;
  }
}
