:root {
  --bg: #f4f9fe;
  --panel: rgba(255, 255, 255, 0.9);
  --line: #b6dcff;
  --line-strong: #3aa4ea;
  --text: #10324f;
  --muted: #5f7e99;
  --accent: #0a9de3;
  --shadow: 0 20px 60px rgba(21, 79, 129, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 214, 255, 0.25), transparent 30%),
    linear-gradient(180deg, #f7fcff 0%, #edf6fb 100%);
}

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

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

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

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
}

.lede {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(182, 220, 255, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
  justify-content: flex-end;
}

.hero-pill,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.hero-pill.active,
.chip.active {
  border-color: var(--line-strong);
  color: white;
  background: linear-gradient(135deg, #31b4f3, #008fdd);
  box-shadow: 0 10px 25px rgba(10, 157, 227, 0.28);
}

.system-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
  padding: 18px 22px;
}

.system-item {
  display: grid;
  gap: 4px;
}

.system-label {
  color: var(--muted);
  font-size: 13px;
}

.system-actions {
  align-content: start;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 24px;
}

.history-shell {
  margin-top: 24px;
}

.panel {
  padding: 24px;
}

.panel-header h2 {
  margin: 0;
  font-size: 24px;
}

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

.field-stack,
.two-col,
.analysis-stack {
  display: grid;
  gap: 16px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span,
.panel-subtitle {
  font-weight: 700;
  color: #4e7696;
}

.field input,
.field select,
.field textarea,
.prompt-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.prompt-editor:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(58, 164, 234, 0.12);
  transform: translateY(-1px);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.case-type-list {
  display: grid;
  gap: 12px;
}

.prompt-editor {
  resize: vertical;
  min-height: 200px;
}

.prompt-editor:disabled {
  background: rgba(240, 247, 251, 0.92);
  color: #7f98ac;
  cursor: not-allowed;
}

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

.note-box {
  margin: 6px 0 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(182, 220, 255, 0.9);
  background: rgba(235, 248, 255, 0.92);
}

.note-box strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}

.note-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 18px;
}

.chip {
  cursor: pointer;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.primary-button {
  min-height: 52px;
  border: none;
  border-radius: 18px;
  padding: 0 24px;
  font: inherit;
  font-weight: 700;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #20b4f6 0%, #008fd7 100%);
  box-shadow: 0 18px 36px rgba(8, 139, 208, 0.25);
}

.primary-button.small {
  min-height: 44px;
  padding: 0 18px;
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost-button {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: white;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button.large {
  min-height: 44px;
  padding: 0 18px;
}

.status-text {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed var(--line);
  border-radius: 24px;
  color: var(--muted);
  background: rgba(245, 252, 255, 0.8);
}

.results {
  display: grid;
  gap: 16px;
}

.result-card {
  border: 1px solid rgba(182, 220, 255, 0.86);
  border-radius: 22px;
  padding: 18px;
  background: rgba(248, 253, 255, 0.92);
}

.stage-card {
  position: relative;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #24b6f5, #0d8fdd);
  color: white;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.stage-badge.secondary {
  background: linear-gradient(135deg, #4dbfd0, #239aa7);
}

.stage-badge.tertiary {
  background: linear-gradient(135deg, #3abf93, #15906c);
}

.result-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.result-list,
.analysis-stack {
  display: grid;
  gap: 12px;
}

.clip-chip,
.analysis-item {
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
  background: white;
}

.analysis-item h4 {
  margin: 0 0 6px;
}

.code-block {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
}

.code-block.emphasis {
  font-size: 15px;
}

.clean-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.75;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.inline-actions.compact {
  margin-bottom: 0;
}

.top-gap {
  margin-top: 14px;
  margin-bottom: 0;
}

.split-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sub-guide {
  margin: 10px 0 0;
  color: var(--muted);
}

.warnings-card {
  border-color: #ffd088;
  background: #fff9ed;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item,
.history-empty {
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
}

.history-item {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.history-item:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 12px 24px rgba(58, 164, 234, 0.14);
}

.history-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1080px) {
  .hero,
  .system-strip,
  .workspace-grid,
  .split-card,
  .two-col {
    grid-template-columns: 1fr;
  }
}
