:root {
  --bg: #f2ede6;
  --paper: rgba(255, 252, 247, 0.9);
  --ink: #1d1b19;
  --muted: #6d665e;
  --line: rgba(29, 27, 25, 0.12);
  --accent: #a55b2a;
  --accent-soft: #efe0d4;
  --warn: #a13f34;
  --shadow: 0 24px 60px rgba(45, 35, 24, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.9), rgba(255,255,255,0) 28%),
    linear-gradient(180deg, #ded5c8 0%, var(--bg) 28%, #ede7df 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 20px;
  padding: 28px;
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(255,255,255,0.78), rgba(244,236,226,0.92));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.65);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.98;
  max-width: 12ch;
}

.lead {
  margin-top: 14px;
  max-width: 56ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-self: stretch;
}

.status-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
}

.status-card.warn {
  background: linear-gradient(180deg, #fff1eb, #f8dfd6);
}

.status-card .label {
  color: var(--muted);
  font-size: 0.88rem;
}

.status-card strong {
  font-size: 1.8rem;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  margin-top: 20px;
}

.motif-panel,
.workspace {
  background: var(--paper);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.motif-panel {
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-head p,
#motifNote {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

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

.motif-btn {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.motif-btn.active {
  transform: translateY(-2px);
  border-color: rgba(165, 91, 42, 0.45);
  background: linear-gradient(180deg, #fff7f1, #f7ece3);
}

.motif-btn span {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.9rem;
}

.workspace {
  padding: 22px;
  display: grid;
  gap: 18px;
}

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

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

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #6b3715;
  font-size: 0.9rem;
}

.state-stage,
.object-action,
.scrub-card,
.review-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,255,255,0.7);
}

.object-action {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.object-action-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.object-action-head .eyebrow {
  margin-bottom: 8px;
}

.object-action-head p:not(.eyebrow) {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 62ch;
}

.object-action-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  gap: 10px;
  min-width: min(420px, 100%);
}

.object-action-stats span {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  color: var(--muted);
}

.object-action-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 4px;
}

.object-prototype {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.6fr);
  gap: 18px;
  align-items: center;
}

.extractor-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 24px;
  background: #14110f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  touch-action: none;
}

.extract-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 90ms linear, opacity 90ms linear, filter 90ms linear;
}

.extract-image.base {
  opacity: 0.86;
  filter: saturate(0.96) contrast(0.98);
}

.extract-image.hero-object {
  inset: auto auto 15% 50%;
  width: min(62%, 520px);
  height: min(68%, 420px);
  object-fit: contain;
  transform-origin: 50% 72%;
  opacity: 0;
  filter: drop-shadow(0 26px 30px rgba(0,0,0,0.34));
  z-index: 3;
}

.pressure {
  position: absolute;
  left: 50%;
  bottom: 13%;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  opacity: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255,255,255,0.64) 0 8%, rgba(255,255,255,0.2) 28%, rgba(255,255,255,0) 68%),
    radial-gradient(circle, rgba(165,91,42,0.34), rgba(165,91,42,0) 64%);
  mix-blend-mode: screen;
}

.track {
  position: absolute;
  left: 50%;
  bottom: 10%;
  width: 10px;
  height: 48%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  z-index: 2;
}

.track span {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 28px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
}

.extractor-stage.locked {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 0 0 4px rgba(165,91,42,0.18);
}

.extractor-controls {
  display: grid;
  gap: 12px;
}

.extractor-controls label {
  font-weight: 700;
}

.extractor-controls p {
  color: var(--muted);
  line-height: 1.45;
}

.animation-job-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  max-height: 330px;
  overflow: auto;
  padding-right: 4px;
}

.animation-job {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.76);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.animation-job.active {
  border-color: rgba(165, 91, 42, 0.58);
  background: #fff4eb;
}

.animation-job strong,
.animation-job span {
  display: block;
}

.animation-job span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.state-stage {
  padding: 16px;
}

.stage-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.stage-btn {
  border: 0;
  background: #ece4db;
  color: #5f584f;
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.stage-btn.active {
  background: var(--ink);
  color: white;
}

.stage-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: center;
}

.stage-card img,
.scrub-viewport img,
.compare-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  object-fit: cover;
}

.stage-copy {
  display: grid;
  gap: 10px;
}

.stage-copy p {
  color: var(--muted);
  line-height: 1.45;
}

.scrub-grid,
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.scrub-card,
.review-card {
  padding: 16px;
}

.scrub-copy p {
  margin-top: 6px;
  color: var(--muted);
}

.scrub-viewport {
  margin-top: 14px;
  background: linear-gradient(180deg, #f6f0ea, #ede3d8);
  border-radius: 20px;
  padding: 10px;
  overflow: hidden;
}

.scrub-viewport img {
  transition: transform 260ms ease, filter 260ms ease;
}

.scrub-range {
  width: 100%;
  margin-top: 16px;
}

.scrub-steps {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 8px;
}

.job-box,
.job-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.job-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.76);
}

.job-item strong {
  display: block;
  margin-bottom: 6px;
}

.job-item p {
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.92rem;
}

.job-item.error {
  background: #fff0ee;
  border-color: rgba(161, 63, 52, 0.2);
}

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

.compare-thumb span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .hero,
  .layout,
  .stage-card,
  .object-prototype,
  .scrub-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .hero-status {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .object-action-head {
    flex-direction: column;
    align-items: stretch;
  }

  .extractor-stage {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px 12px 28px;
  }

  .hero,
  .motif-panel,
  .workspace {
    padding: 18px;
    border-radius: 24px;
  }

  .hero-status {
    grid-template-columns: 1fr;
  }

  .stage-nav {
    flex-wrap: wrap;
  }

  .compare-strip {
    grid-template-columns: 1fr;
  }
}
