:root {
  --ink: #17130f;
  --paper: #f4efe4;
  --panel: rgba(255, 250, 239, .92);
  --line: rgba(52, 40, 28, .18);
  --red: #b83d2f;
  --teal: #17766f;
  --gold: #c2943c;
  --muted: #70685f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(194, 148, 60, .35), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(23, 118, 111, .24), transparent 32rem),
    linear-gradient(135deg, #e6dbc7, #f8f1e2 42%, #d8c2a2);
  font-family: Georgia, "Times New Roman", serif;
}

button, input, textarea { font: inherit; }

button {
  border: 0;
  border-radius: 999px;
  padding: .7rem 1rem;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: .75rem .85rem;
  color: var(--ink);
  background: rgba(255,255,255,.72);
}

textarea {
  min-height: 9rem;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  line-height: 1.45;
}

.shell {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}

.hero {
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: rgba(255,255,255,.34);
  box-shadow: 0 24px 80px rgba(47, 34, 18, .16);
}

.hero h1 {
  max-width: 980px;
  margin: .25rem 0 .75rem;
  font-size: clamp(2.2rem, 5vw, 5.6rem);
  line-height: .9;
  letter-spacing: -.06em;
}

.hero p:last-child {
  max-width: 870px;
  margin: 0;
  color: #473d32;
  font-size: 1.08rem;
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .74rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 1rem;
  margin-top: 1rem;
}

.stage-card, .panel {
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: rgba(36, 30, 24, .12);
  box-shadow: 0 24px 80px rgba(47, 34, 18, .14);
}

.stage-card {
  position: relative;
  overflow: hidden;
  min-height: 760px;
}

#stage {
  position: absolute;
  inset: 0;
}

#loading {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  padding: .65rem .9rem;
  border-radius: 999px;
  background: rgba(0,0,0,.64);
  color: #fff;
}

.panel {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1rem;
  background: var(--panel);
}

.block {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: rgba(255,255,255,.42);
}

.block h2 {
  margin: 0 0 .75rem;
  font-size: 1.1rem;
}

.row {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.samples {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .65rem;
}

.samples button, .row button, #load-mapping {
  background: #5d4430;
}

.note {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}

.trace {
  display: grid;
  gap: .65rem;
  max-height: 240px;
  overflow: auto;
  padding-right: .25rem;
}

.event {
  padding: .7rem;
  border-radius: 1rem;
  background: rgba(23, 118, 111, .09);
  border: 1px solid rgba(23, 118, 111, .2);
  font-size: .9rem;
  line-height: 1.4;
}

.event strong { display: block; }

.event span {
  display: block;
  color: var(--muted);
  margin-top: .18rem;
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .stage-card { min-height: 620px; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 1rem, 1440px); padding: .5rem 0; }
  .hero, .stage-card, .panel { border-radius: 1.25rem; }
  .hero { padding: 1.25rem; }
  .row { flex-wrap: wrap; }
}
