:root {
  --bg: #f4eee3;
  --bg-deep: #15231d;
  --panel: rgba(255, 252, 247, 0.7);
  --panel-strong: rgba(255, 248, 240, 0.92);
  --ink: #15231d;
  --muted: #5f675f;
  --line: rgba(21, 35, 29, 0.12);
  --line-strong: rgba(21, 35, 29, 0.22);
  --accent: #b86c40;
  --accent-soft: rgba(184, 108, 64, 0.14);
  --sand: #ddc7aa;
  --success: #2f6c55;
  --shadow: 0 28px 60px rgba(21, 35, 29, 0.12);
  --radius: 28px;
  --anchor-offset: 128px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--anchor-offset);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(184, 108, 64, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(47, 108, 85, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf7f1 0%, var(--bg) 48%, #efe7db 100%);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page-shell {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 64px;
}

main {
  display: grid;
  gap: 88px;
  padding-top: 52px;
}

.topbar {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(250, 245, 238, 0.72);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(21, 35, 29, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-deep);
  color: #f9f5ef;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 0.95rem;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.78rem;
}

.topnav {
  display: inline-flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

.topnav a:hover,
.text-link:hover {
  color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
  box-shadow: none;
}

.button:disabled:hover {
  transform: none;
}

.button.primary {
  background: var(--bg-deep);
  color: #fff9f2;
  box-shadow: 0 14px 30px rgba(21, 35, 29, 0.18);
}

.button.ghost {
  border-color: var(--line-strong);
  background: rgba(255, 252, 247, 0.44);
  color: var(--ink);
}

.button.compact {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9rem;
}

.hero,
.workflow,
.studio,
.blueprint {
  scroll-margin-top: var(--anchor-offset);
}

.hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 36px;
  align-items: stretch;
  min-height: clamp(620px, calc(100vh - 220px), 860px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1,
.section-heading h2,
.module-head h3,
.draft-head h3,
.blueprint-grid h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  line-height: 0.98;
}

.hero h1 {
  font-size: clamp(3.7rem, 6vw, 6.4rem);
  max-width: 10.5ch;
}

.hero-text {
  max-width: 52ch;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.hero-points {
  display: grid;
  gap: 14px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  max-width: 54ch;
}

.hero-points li {
  position: relative;
  padding-left: 20px;
  color: #334038;
  line-height: 1.55;
}

.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-scene {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 12px);
  background:
    linear-gradient(160deg, rgba(21, 35, 29, 0.94), rgba(21, 35, 29, 0.72)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  box-shadow: var(--shadow);
  min-height: 620px;
}

.scene-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 35%, black 40%, transparent 88%);
}

.scene-panel {
  position: absolute;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(250, 248, 244, 0.08);
  color: #f4eee6;
  backdrop-filter: blur(14px);
  animation: drift 8s ease-in-out infinite;
}

.scene-panel strong,
.scene-panel p {
  display: block;
}

.scene-label {
  display: inline-flex;
  margin-bottom: 14px;
  color: #dcb894;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scene-panel-primary {
  top: 10%;
  left: 9%;
  width: min(72%, 420px);
}

.scene-panel-primary strong {
  margin-top: 12px;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.scene-panel-secondary {
  right: 8%;
  bottom: 18%;
  width: 280px;
  animation-delay: -1.8s;
}

.scene-panel-secondary p,
.scene-panel-tertiary p {
  margin: 10px 0 0;
  color: rgba(255, 249, 242, 0.8);
}

.scene-panel-tertiary {
  left: 16%;
  bottom: 11%;
  width: 220px;
  animation-delay: -3.6s;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2 {
  font-size: clamp(2.2rem, 3.6vw, 4rem);
  max-width: 14ch;
}

.workflow-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-top: 34px;
}

.workflow-rail article {
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.workflow-rail span,
.blueprint-grid span {
  display: inline-flex;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.workflow-rail h3,
.draft-block h4 {
  margin: 16px 0 10px;
  font-size: 1.15rem;
}

.workflow-rail p,
.module-copy,
.draft-block p,
.blueprint-grid p,
.footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.78fr);
  gap: 28px;
  margin-top: 38px;
}

.intake-column,
.draft-panel {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(180deg, rgba(255, 251, 247, 0.92), rgba(255, 248, 242, 0.72));
  box-shadow: var(--shadow);
}

.intake-column {
  padding: 24px;
}

.module + .module {
  margin-top: 22px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.module-head h3,
.draft-head h3 {
  font-size: 1.75rem;
}

.module-copy {
  max-width: 36ch;
  font-size: 0.94rem;
}

.field-grid {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

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

label {
  display: grid;
  gap: 10px;
}

label span {
  font-size: 0.9rem;
  font-weight: 700;
}

input[type="text"],
select,
.module textarea,
.upload-field input[type="file"] {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

input[type="text"]:focus,
select:focus,
textarea:focus,
input[type="file"]:focus {
  outline: 2px solid rgba(184, 108, 64, 0.18);
  border-color: rgba(184, 108, 64, 0.4);
}

.module textarea {
  min-height: 132px;
  padding: 14px 16px;
  resize: vertical;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  width: fit-content;
  padding: 6px;
  border-radius: 18px;
  background: rgba(21, 35, 29, 0.04);
}

.segment {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.is-active {
  background: var(--bg-deep);
  color: #fff8f0;
}

.static-segmented .segment {
  cursor: default;
}

.static-segmented .segment:disabled {
  opacity: 1;
}

.upload-stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.upload-intro {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.upload-field {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
}

.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.upload-field small {
  color: var(--muted);
  line-height: 1.5;
}

.viewer-module {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(247, 241, 233, 0.72));
}

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

.viewer-head strong {
  display: block;
  font-size: 1rem;
}

.viewer-head span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-chip {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 700;
}

.viewer-chip.is-active {
  border-color: rgba(21, 35, 29, 0.22);
  background: var(--bg-deep);
  color: #fff9f2;
}

.viewer-stage {
  position: relative;
  width: 100%;
  min-height: 340px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(21, 35, 29, 0.1);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(184, 108, 64, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 238, 227, 0.92));
}

.viewer-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.upload-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.upload-badge[data-phase="idle"] {
  border-color: rgba(21, 35, 29, 0.14);
}

.upload-badge[data-phase="inspecting"],
.upload-badge[data-phase="queued"],
.upload-badge[data-phase="uploading"] {
  border-color: rgba(184, 108, 64, 0.28);
  background: rgba(184, 108, 64, 0.12);
  color: var(--accent);
}

.upload-badge[data-phase="uploaded"],
.upload-badge[data-phase="ready_local"] {
  border-color: rgba(47, 108, 85, 0.3);
  background: rgba(47, 108, 85, 0.1);
  color: var(--success);
}

.upload-badge[data-phase="error"] {
  border-color: rgba(184, 77, 64, 0.28);
  background: rgba(184, 77, 64, 0.1);
  color: #a54536;
}

.tooth-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.tooth-grid {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.tooth {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.tooth:hover {
  transform: translateY(-1px);
}

.tooth.is-selected {
  border-color: rgba(184, 108, 64, 0.6);
  background: rgba(184, 108, 64, 0.16);
  color: var(--ink);
}

.tooth.arch-break {
  margin-top: 10px;
}

.selection-note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.toggle-stack {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.compact-toggle-stack {
  margin-top: 18px;
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--bg-deep);
}

.draft-column {
  position: relative;
}

.draft-panel {
  position: sticky;
  top: 112px;
  padding: 24px;
}

.draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-track {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.run-status {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.run-status strong {
  font-size: 0.96rem;
}

.run-status span {
  color: var(--muted);
  line-height: 1.55;
}

.run-status[data-tone="working"] {
  border-color: rgba(184, 108, 64, 0.28);
  background: rgba(184, 108, 64, 0.08);
}

.run-status[data-tone="success"] {
  border-color: rgba(47, 108, 85, 0.3);
  background: rgba(47, 108, 85, 0.08);
}

.run-status[data-tone="error"] {
  border-color: rgba(184, 77, 64, 0.28);
  background: rgba(184, 77, 64, 0.08);
}

.action-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.status-pill.is-active {
  border-color: rgba(47, 108, 85, 0.4);
  background: rgba(47, 108, 85, 0.12);
  color: var(--success);
}

.confidence-band {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(140deg, rgba(184, 108, 64, 0.16), rgba(255, 255, 255, 0.48));
}

.confidence-value {
  display: flex;
  align-items: start;
  gap: 2px;
  font-family: "Fraunces", serif;
  font-size: 3rem;
  line-height: 0.9;
}

.confidence-value small {
  margin-top: 8px;
  font-size: 1rem;
}

.confidence-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.confidence-copy {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.summary-strip div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.summary-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.summary-strip strong {
  font-size: 0.96rem;
}

.draft-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.plain-list,
.export-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.plain-list li,
.export-list li {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink);
  line-height: 1.55;
}

.plain-list strong,
.export-list strong {
  display: block;
  margin-bottom: 6px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.sample-list code,
.export-list code {
  font-size: 0.88rem;
}

.plain-list small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-top: 34px;
}

.blueprint-grid article {
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.text-link {
  display: inline-flex;
  margin-top: 28px;
  color: var(--accent);
  font-weight: 700;
}

.blueprint-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 88px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reveal {
  opacity: 1;
  transform: none;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -8px, 0);
  }
}

@media (max-width: 1120px) {
  .hero,
  .studio-grid,
  .workflow-rail,
  .blueprint-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-scene {
    min-height: 520px;
  }

  .section-heading {
    display: grid;
  }

  .section-heading h2 {
    max-width: 18ch;
  }

  .draft-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 24px, 1360px);
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
    border-radius: 28px;
  }

  .topnav {
    flex-wrap: wrap;
    justify-content: start;
    gap: 14px;
  }

  .field-grid.two-up,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .module-head,
  .draft-head,
  .footer {
    display: grid;
  }

  .viewer-head {
    display: grid;
  }

  .tooth-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .hero h1 {
    max-width: 12ch;
  }

  .scene-panel-primary,
  .scene-panel-secondary,
  .scene-panel-tertiary {
    width: auto;
  }

  .scene-panel-primary {
    right: 8%;
  }
}
