:root {
  color-scheme: light;
  --bg: #fffaf3;
  --surface: #ffffff;
  --surface-strong: #fff3df;
  --text: #1c1917;
  --muted: #6f675e;
  --line: #eadfce;
  --orange: #f97316;
  --amber: #f59e0b;
  --green: #15803d;
  --green-soft: #e8f7ed;
  --red-soft: #fff1f2;
  --blue: #2563eb;
  --shadow: 0 18px 55px rgba(71, 45, 14, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 247, 237, 0.85), rgba(255, 251, 245, 0.2) 34rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  max-width: 760px;
  font-size: clamp(1.7rem, 3vw, 2.65rem);
  font-weight: 840;
}

h2 {
  font-size: 0.98rem;
}

.status-pill {
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  padding: 10px 14px;
  text-align: center;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 750;
}

.status-pill.ready {
  border-color: rgba(21, 128, 61, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.busy {
  border-color: rgba(249, 115, 22, 0.35);
  background: #fff7ed;
  color: #9a3412;
}

.status-pill.error {
  border-color: rgba(190, 18, 60, 0.25);
  background: var(--red-soft);
  color: #be123c;
}

.model-strip,
.controls,
.pane,
.blocks-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.model-strip {
  margin-bottom: 12px;
  padding: 12px 14px;
}

.model-strip > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.model-strip strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 9px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1e3cf;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--orange), var(--blue));
  transition: width 160ms ease;
}

.controls {
  padding: 14px;
}

.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.13);
}

input {
  height: 42px;
  padding: 0 12px;
}

.primary,
.secondary,
.example-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 780;
}

.primary {
  background: var(--text);
  color: #fffaf3;
}

.secondary,
.example-button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: #7c2d12;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.example-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.86rem;
}

.input-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

textarea {
  min-height: 180px;
  max-height: 33vh;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.87rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.pane,
.blocks-section {
  min-width: 0;
  overflow: hidden;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
}

.pane-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

pre,
.clean-output {
  height: 255px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  line-height: 1.48;
  font-size: 0.88rem;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: #2b2520;
  background: #fffdfa;
}

.clean-output {
  background: #ffffff;
}

.clean-output h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.clean-output p,
.clean-output li,
.empty-state {
  color: #2b2520;
  line-height: 1.55;
}

.clean-output p {
  margin: 0 0 10px;
}

.clean-output ul {
  margin: 0 0 10px 20px;
  padding: 0;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.blocks-section {
  margin-top: 12px;
}

.blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 8px;
  max-height: 245px;
  overflow: auto;
  padding: 10px;
}

.block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 10px;
}

.block.main {
  border-color: rgba(21, 128, 61, 0.28);
  background: var(--green-soft);
}

.block.other {
  opacity: 0.62;
}

.block-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.block.main .block-top {
  color: var(--green);
}

.block.other .block-top {
  color: var(--muted);
}

.block p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: #2b2520;
  line-height: 1.38;
}

@media (max-width: 840px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .url-row,
  .compare,
  .stats {
    grid-template-columns: 1fr;
  }

  .url-row button {
    width: 100%;
  }

  pre,
  .clean-output {
    height: 210px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  h1 {
    font-size: 1.72rem;
  }

  .controls,
  .model-strip {
    padding: 11px;
  }

  .examples {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
