:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f3f7fb;
  --ink: #101828;
  --muted: #64748b;
  --line: #d9e2ec;
  --blue: #2b6cb0;
  --blue-strong: #1e5a9a;
  --blue-soft: #eaf4ff;
  --orange: #b7791f;
  --orange-soft: #fff7ed;
  --green: #2f855a;
  --green-soft: #edf8f2;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.gtech-app {
  min-height: 100vh;
  padding: 32px;
}

.intake-view {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px 0 80px;
}

.hero-copy {
  margin: 0 auto 28px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.hero-copy h1,
.preview-topbar h2,
.factory-card h2,
.output-modal h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.22;
}

.hero-subtitle {
  max-width: 680px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.question-flow {
  display: grid;
  gap: 18px;
}

.question-group {
  padding: 22px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.045);
  animation: slideIn 320ms ease both;
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.question-group.is-current {
  border-color: #c8dbef;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-group.is-complete {
  opacity: 0.72;
}

.question-group.is-entry {
  padding: 28px;
}

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

.group-header h2,
.sweep-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.group-header p,
.group-description,
.console-head p,
.preview-topbar p,
.ai-correction-panel p,
.modal-helper,
.factory-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.035);
}

.question-title-row,
.sweep-head,
.preview-topbar,
.preview-action-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.question-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

.explain-under-options {
  margin-top: 14px;
}

.explain-toggle,
.text-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.explain-toggle span {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid #b7d3ec;
  border-radius: 999px;
  color: var(--blue);
  font-size: 11px;
  line-height: 1;
}

.explain-toggle.inline {
  margin-top: 5px;
}

.segmented-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.segmented-options.option-count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-options.option-count-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment-option {
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.segment-option:hover {
  border-color: #98b9d9;
  background: var(--blue-soft);
}

.segment-option.is-selected {
  border-color: #7ab0df;
  background: #f2f8ff;
  color: var(--blue-strong);
  box-shadow: inset 0 0 0 1px rgba(43, 108, 176, 0.16), 0 8px 18px rgba(43, 108, 176, 0.08);
}

.segment-option.is-unknown {
  border-color: #e2b26a;
  background: var(--orange-soft);
  color: #744210;
  box-shadow: none;
}

.segment-option.is-small {
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.segment-option.is-small.is-selected {
  background: #ffffff;
  color: var(--blue-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.segment-option.is-small.is-unknown {
  background: #fff7ed;
  color: #8a5a14;
}

.unknown-fallback-option {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 18px;
  border: 1px dashed #cbd5e1;
  background: #fbfdff;
  color: #526273;
  font-weight: 800;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.unknown-fallback-option:hover,
.unknown-fallback-option.is-selected {
  border-color: #e2b26a;
  background: var(--orange-soft);
  color: #744210;
}

.question-explanation {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid #9ec5ec;
  background: #f4f9ff;
}

.question-explanation strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.question-explanation p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}

.question-explanation summary {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.inline-ai {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #f0d19a;
  background: #fffaf2;
}

.inline-ai.is-compact {
  grid-column: 1 / -1;
}

.inline-ai label,
.output-fields label {
  display: grid;
  gap: 8px;
}

.inline-ai span,
.output-fields span {
  font-size: 13px;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 82px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.65;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.12);
}

.primary-cta,
.secondary-cta,
.ghost-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
}

.primary-cta {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(43, 108, 176, 0.2);
}

.primary-cta:hover {
  background: var(--blue-strong);
}

.secondary-cta,
.ghost-cta {
  border-color: var(--line);
  background: #ffffff;
  color: var(--blue);
}

.secondary-cta:hover,
.ghost-cta:hover {
  border-color: #a8c7e6;
  background: var(--blue-soft);
}

.secondary-cta {
  margin-top: 10px;
}

.primary-cta.compact {
  min-height: 36px;
  padding: 0 12px;
  box-shadow: none;
}

.full-width {
  width: 100%;
}

.inline-ai-result,
.condition-correction-result {
  margin-top: 12px;
}

.ai-suggestion,
.proposal-card,
.path-notice {
  padding: 12px;
  border: 1px solid #e8c98c;
  background: #fffaf0;
  color: #5f4218;
  font-size: 13px;
  line-height: 1.7;
}

.ai-suggestion p,
.proposal-card p,
.path-notice p,
.proposal-card ul {
  margin: 4px 0 0;
}

.path-notice {
  margin-top: 16px;
}

.path-notice.is-ready {
  border-color: #b8dbc5;
  background: var(--green-soft);
  color: #22543d;
}

.path-notice.is-blocked {
  border-color: #efbd8a;
  background: #fff7ed;
  color: #7b341e;
}

.sweep-head {
  align-items: center;
}

.mark-all-no {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--blue);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.sweep-list {
  display: grid;
  border-top: 1px solid var(--line);
  margin-top: 14px;
}

.sweep-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 360px;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}

.sweep-row > div:first-child strong {
  font-size: 15px;
}

.sweep-question-label {
  display: grid;
  gap: 2px;
  align-content: center;
}

.small-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #f1f5f9;
}

.intake-action-bar {
  position: sticky;
  bottom: 18px;
  z-index: 5;
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.intake-action-bar .primary-cta {
  min-width: 260px;
}

.preview-view {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 64px);
}

.condition-console,
.preview-main,
.factory-card,
.output-modal {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.condition-console {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
}

.console-head h2,
.ai-correction-panel h3 {
  margin: 0;
  font-size: 20px;
}

.condition-summary {
  display: grid;
  gap: 10px;
  max-height: 48vh;
  margin-top: 16px;
  overflow: auto;
  padding-right: 2px;
}

.condition-edit-row {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid #e4ebf3;
  background: #fbfdff;
}

.condition-edit-title {
  color: #475569;
  font-size: 12px;
  line-height: 1.5;
}

.console-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.console-option-chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d6e1ec;
  border-radius: 999px;
  background: #ffffff;
  color: #506274;
  font-size: 12px;
  font-weight: 800;
}

.console-option-chip.is-selected {
  border-color: #8ab8df;
  background: #edf6ff;
  color: var(--blue-strong);
}

.console-option-chip.is-selected::before {
  content: "✓";
  margin-right: 4px;
  font-size: 11px;
}

.console-option-chip.is-unknown {
  border-color: #e6c079;
  background: #fff7ed;
  color: #805a16;
}

.ai-correction-panel {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #ffffff 18%);
}

.condition-correction-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid #dbe7f3;
  border-radius: 18px;
  background: #f8fbff;
}

.condition-correction-composer textarea {
  min-height: 52px;
  max-height: 116px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  resize: vertical;
}

.condition-correction-composer textarea:focus {
  box-shadow: none;
}

.composer-send {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(43, 108, 176, 0.18);
}

.composer-send:hover {
  background: var(--blue-strong);
}

.preview-main {
  min-width: 0;
  padding: 18px;
}

.preview-topbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.preview-topbar h2 {
  font-size: 24px;
}

.preview-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.preview-hints span {
  padding: 6px 10px;
  border: 1px solid #cfe0ef;
  background: #f4f9ff;
  color: #315f7d;
  font-size: 13px;
  font-weight: 700;
}

.one-figure-canvas {
  max-height: calc(100vh - 210px);
  overflow: auto;
  border: 1px solid #d5dde7;
  background: #eef2f7;
  padding: 18px;
}

.one-figure-canvas svg {
  display: block;
  width: min(100%, 794px);
  max-width: 794px;
  height: auto;
  margin: 0 auto;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.preview-action-bar {
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.loading-layer,
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(4px);
}

.loading-card,
.output-modal {
  width: min(520px, calc(100vw - 40px));
  padding: 26px;
  text-align: center;
}

.loading-card {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.loading-card strong {
  display: block;
  margin-top: 14px;
  font-size: 18px;
}

.loading-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.loader {
  display: inline-block;
  width: 34px;
  height: 34px;
  border: 4px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 880ms linear infinite;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
}

.output-modal {
  position: relative;
  text-align: left;
}

.output-modal h2 {
  font-size: 24px;
}

.output-fields {
  display: grid;
  gap: 14px;
  margin: 20px 0;
}

.factory-view {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
}

.factory-card {
  width: min(920px, 100%);
  padding: 28px;
  text-align: center;
}

.factory-card h2 {
  font-size: 30px;
}

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

.artifact-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f6f9fc);
}

.artifact-card span {
  color: var(--blue);
  font-weight: 900;
}

.artifact-card strong {
  font-size: 18px;
}

.artifact-card small {
  color: var(--muted);
}

.artifact-card.is-ready {
  border-color: #b7d8c2;
  background: var(--green-soft);
}

.artifact-card.is-ready span,
.artifact-card.is-ready small {
  color: var(--green);
}

.status-log {
  display: grid;
  gap: 8px;
  min-height: 170px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(135deg, #1e293b, rgba(15, 52, 83, 0.94));
  color: #dbeafe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 42px rgba(15, 23, 42, 0.16);
  text-align: left;
}

.status-log p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  animation: fadeIn 220ms ease both;
}

.status-log p::before {
  content: "◆";
  margin-right: 8px;
  color: #7dd3fc;
  font-size: 10px;
  text-shadow: 0 0 10px rgba(125, 211, 252, 0.55);
}

.status-log p:last-child::after {
  content: "|";
  display: inline-block;
  margin-left: 4px;
  color: #7dd3fc;
  animation: blinkCursor 800ms steps(2, start) infinite;
}

#download-package {
  margin-top: 20px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blinkCursor {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  body {
    min-width: 0;
  }

  .gtech-app {
    padding: 16px;
  }

  .segmented-options,
  .artifact-grid,
  .preview-view {
    grid-template-columns: 1fr;
  }

  .sweep-row {
    grid-template-columns: 1fr;
    padding: 12px 0;
  }

  .condition-console {
    position: static;
    max-height: none;
  }
}
