:root {
  --bg-0: #f6f1e8;
  --bg-1: #efe3cf;
  --paper: rgba(255, 249, 240, 0.74);
  --ink-strong: #182127;
  --ink-soft: #43515b;
  --line: rgba(24, 33, 39, 0.12);
  --brand: #c65b32;
  --brand-deep: #8e3f22;
  --accent: #1f6c68;
  --accent-soft: rgba(31, 108, 104, 0.11);
  --shadow: 0 24px 70px rgba(72, 50, 27, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --transition: 220ms ease;
  --headline-font: "Rockwell", "Book Antiqua", "Georgia", serif;
  --body-font: "Bahnschrift", "Aptos", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at top left, rgba(198, 91, 50, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(31, 108, 104, 0.18), transparent 28%),
    linear-gradient(140deg, var(--bg-0), var(--bg-1));
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-strong);
  font-family: var(--body-font);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 32%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.08) 0,
      rgba(255, 255, 255, 0.08) 10px,
      rgba(0, 0, 0, 0.02) 10px,
      rgba(0, 0, 0, 0.02) 20px
    );
}

.background-orbit {
  position: fixed;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(36px);
  pointer-events: none;
  opacity: 0.6;
  z-index: 0;
}

.orbit-a {
  top: -8rem;
  right: -10rem;
  background: rgba(198, 91, 50, 0.18);
}

.orbit-b {
  bottom: -12rem;
  left: -8rem;
  background: rgba(31, 108, 104, 0.16);
}

.hero-shell,
.layout-grid {
  position: relative;
  z-index: 1;
}

.hero-shell {
  width: min(1380px, calc(100vw - 48px));
  margin: 24px auto 18px;
  padding: 32px;
  display: grid;
  grid-template-columns: 1.5fr minmax(280px, 360px);
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 36px;
  background: linear-gradient(145deg, rgba(255, 250, 245, 0.88), rgba(255, 242, 224, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero-copy h1,
.panel-heading h2,
.rail-header h2,
.data-card-header h3 {
  margin: 0;
  font-family: var(--headline-font);
  letter-spacing: 0.01em;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 0.95;
  max-width: 10ch;
}

.hero-text {
  margin: 18px 0 0;
  max-width: 58ch;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--brand-deep);
}

.hero-status-card,
.panel,
.stage-rail {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: var(--paper);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-status-card {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.status-pill,
.panel-chip,
.soft-chip,
.stage-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
}

.status-pill {
  padding: 8px 14px;
  background: rgba(198, 91, 50, 0.12);
  color: var(--brand-deep);
  font-weight: 700;
}

.hero-status-card dl {
  margin: 18px 0 0;
  display: grid;
  gap: 14px;
}

.hero-status-card dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.hero-status-card dd {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.layout-grid {
  width: min(1380px, calc(100vw - 48px));
  margin: 0 auto 30px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
}

.stage-rail {
  align-self: start;
  padding: 24px;
  border-radius: var(--radius-xl);
  position: sticky;
  top: 18px;
}

.stage-list {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.stage-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.stage-item.active {
  transform: translateX(4px);
  border-color: rgba(198, 91, 50, 0.28);
  background: linear-gradient(135deg, rgba(198, 91, 50, 0.14), rgba(255, 255, 255, 0.48));
}

.stage-index {
  width: 52px;
  height: 52px;
  background: rgba(24, 33, 39, 0.08);
  color: var(--ink-strong);
  font-weight: 800;
}

.stage-item.active .stage-index {
  background: var(--brand);
  color: #fff8f3;
}

.stage-item strong {
  display: block;
  margin-bottom: 6px;
}

.stage-item p,
.context-panel p,
.data-card-header span {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.context-panel {
  padding: 16px;
  border-radius: 18px;
  background: rgba(31, 108, 104, 0.08);
  border: 1px solid rgba(31, 108, 104, 0.12);
}

.context-label {
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.workspace-column {
  display: grid;
  gap: 24px;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.panel-heading,
.data-card-header,
.plan-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-chip,
.soft-chip {
  padding: 8px 14px;
  background: rgba(31, 108, 104, 0.08);
  border: 1px solid rgba(31, 108, 104, 0.16);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.form-grid,
.split-grid,
.session-shell,
.comparison-shell {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}

.field-span-2 {
  grid-column: span 2;
}

.field-span-3 {
  grid-column: 1 / -1;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-block span,
.advanced-tuning summary {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(24, 33, 39, 0.12);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink-strong);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(198, 91, 50, 0.4);
  box-shadow: 0 0 0 4px rgba(198, 91, 50, 0.1);
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action,
.preview-toggle,
.density-action,
.artifact-link {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
}

.primary-action {
  background: linear-gradient(135deg, var(--brand), #e08d54);
  color: #fff7f1;
  font-weight: 700;
  box-shadow: 0 18px 35px rgba(198, 91, 50, 0.28);
}

.primary-action:hover,
.preview-toggle:hover,
.secondary-action:hover,
.density-action:hover,
.artifact-link:hover {
  transform: translateY(-1px);
}

.secondary-action,
.preview-toggle,
.density-action,
.artifact-link {
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink-strong);
  border: 1px solid rgba(24, 33, 39, 0.1);
}

.cancel-action {
  background: rgba(122, 32, 32, 0.08);
  color: #7a2020;
  border-color: rgba(122, 32, 32, 0.14);
}

.preview-toggle.active {
  background: var(--accent);
  color: #f4fffd;
  border-color: transparent;
  box-shadow: 0 16px 30px rgba(31, 108, 104, 0.24);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.feedback-banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(198, 91, 50, 0.14);
  background: rgba(198, 91, 50, 0.08);
  color: var(--brand-deep);
  font-weight: 700;
}

.inline-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(31, 108, 104, 0.16);
  background: rgba(31, 108, 104, 0.08);
  color: var(--accent);
  font-weight: 700;
}

.inline-status::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.inline-status.is-error {
  border-color: rgba(122, 32, 32, 0.14);
  background: rgba(122, 32, 32, 0.08);
  color: #7a2020;
}

.inline-status.is-error::before {
  animation: none;
}

.progress-shell {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(24, 33, 39, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

.progress-shell.is-error {
  border-color: rgba(122, 32, 32, 0.14);
  background: rgba(122, 32, 32, 0.06);
}

.progress-track {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 33, 39, 0.1);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), #3db0aa);
  transition: width 260ms ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--ink-soft);
}

.progress-meta strong {
  color: var(--ink-strong);
  font-family: var(--headline-font);
  font-size: 1.1rem;
}

.feedback-banner.is-error {
  border-color: rgba(122, 32, 32, 0.14);
  background: rgba(122, 32, 32, 0.08);
  color: #7a2020;
}

.hidden {
  display: none !important;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.stat-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(248, 239, 226, 0.76));
  border: 1px solid rgba(24, 33, 39, 0.08);
}

.stat-card span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.6rem;
  font-family: var(--headline-font);
}

.split-grid {
  grid-template-columns: 1.1fr 1fr;
  margin-top: 20px;
}

.data-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.compact-card {
  height: 100%;
}

.table-shell {
  margin-top: 16px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(24, 33, 39, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

.table-shell table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.table-shell th,
.table-shell td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(24, 33, 39, 0.08);
  vertical-align: top;
}

.table-shell th {
  position: sticky;
  top: 0;
  background: rgba(246, 241, 232, 0.98);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.density-row.is-selected td {
  background: rgba(31, 108, 104, 0.08);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  text-align: center;
  color: var(--ink-soft);
  padding: 18px;
}

.compact-empty {
  min-height: 140px;
}

.session-shell {
  grid-template-columns: 1.4fr 360px;
  margin-top: 20px;
}

.comparison-shell {
  grid-template-columns: 1.35fr minmax(320px, 0.9fr);
  margin-top: 20px;
}

.session-sidebar {
  display: grid;
}

.advanced-tuning {
  border: 1px solid rgba(24, 33, 39, 0.08);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
}

.advanced-tuning summary {
  cursor: pointer;
}

.tuning-grid {
  margin-top: 12px;
}

.summary-list {
  display: grid;
  gap: 12px;
}

.inline-hint {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(31, 108, 104, 0.16);
  background: rgba(31, 108, 104, 0.08);
  color: var(--accent);
}

.inline-hint strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-strong);
}

.comparison-actions {
  margin-top: 16px;
}

.solution-row.is-selected td {
  background: rgba(198, 91, 50, 0.1);
}

.win-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.win-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 108, 104, 0.1);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.selection-summary {
  display: grid;
  gap: 16px;
}

.selection-summary .headline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.selection-summary h4 {
  margin: 0;
  font-family: var(--headline-font);
  font-size: 1.4rem;
}

.selection-summary p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.selection-metric {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(24, 33, 39, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.selection-metric span {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.selection-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
}

.selection-table {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(24, 33, 39, 0.08);
}

.selection-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  background: rgba(255, 255, 255, 0.76);
}

.selection-table th,
.selection-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(24, 33, 39, 0.08);
  text-align: left;
}

.selection-table th {
  background: rgba(246, 241, 232, 0.98);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.summary-list dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.summary-list dt {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.summary-list dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.plan-toolbar {
  margin-top: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.preview-action-group,
.preview-toggle-group,
.artifact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.preview-action-group {
  justify-content: flex-end;
}

.preview-shell {
  margin-top: 20px;
  min-height: 540px;
  border-radius: 24px;
  border: 1px solid rgba(24, 33, 39, 0.08);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.58);
}

.preview-shell iframe {
  width: 100%;
  min-height: 540px;
  border: 0;
  background: rgba(255, 255, 255, 0.72);
}

#previewPanel:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(246, 241, 232, 0.98);
  overflow: auto;
}

#previewPanel:fullscreen .preview-shell,
#previewPanel:fullscreen .preview-shell iframe {
  min-height: calc(100vh - 240px);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: rise-in 620ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.reveal-1 { animation-delay: 40ms; }
.reveal-2 { animation-delay: 140ms; }
.reveal-3 { animation-delay: 220ms; }
.reveal-4 { animation-delay: 320ms; }
.reveal-5 { animation-delay: 380ms; }

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1180px) {
  .hero-shell,
  .layout-grid,
  .session-shell,
  .split-grid,
  .comparison-shell,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stage-rail {
    position: static;
  }

  .field-span-2,
  .field-span-3 {
    grid-column: auto;
  }

  .hero-copy h1 {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .hero-shell,
  .layout-grid {
    width: min(100vw - 24px, 100%);
  }

  .hero-shell,
  .panel,
  .stage-rail {
    padding: 18px;
  }

  .table-shell table {
    min-width: 540px;
  }

  .selection-grid {
    grid-template-columns: 1fr;
  }

  .preview-shell,
  .preview-shell iframe {
    min-height: 420px;
  }
}