:root {
  color-scheme: dark;
  --ink: #f5f0e8;
  --muted: #99958d;
  --faint: #68655f;
  --canvas: #141310;
  --panel: #1b1a17;
  --panel-raised: #211f1b;
  --line: #34312b;
  --line-soft: #292721;
  --accent: #e36f45;
  --accent-soft: #f2aa87;
  --ok: #79a883;
  --warn: #d69a61;
  --danger: #d97769;
  font-family: "Segoe UI Variable Text", "Aptos", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% -12%, rgba(227, 111, 69, .09), transparent 29rem),
    var(--canvas);
}

button,
textarea { font: inherit; }

button { color: inherit; }

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 40px 44px;
}

.masthead {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.03em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff8ef;
  background: var(--accent);
  font: 500 16px/1 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.runtime {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font: 400 12px/1.4 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  text-align: right;
}

.runtime-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(214, 154, 97, .1);
}

body.ready .runtime-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(121, 168, 131, .11);
}

body.running .runtime-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(227, 111, 69, .12);
  animation: pulse 1.4s ease-in-out infinite;
}

body.failed .runtime-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(217, 119, 105, .12);
}

main { padding-top: 52px; }

.heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 420px);
  align-items: end;
  gap: 32px;
  margin-bottom: 34px;
}

.eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 -18px;
  color: var(--accent-soft);
  font: 500 11px/1 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 66px);
  line-height: .98;
  letter-spacing: -.065em;
  font-weight: 600;
}

.heading > p:last-child {
  max-width: 390px;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel {
  min-width: 0;
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.input-panel { border-right: 1px solid var(--line); }

.panel-head {
  height: 72px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.panel-head > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.panel-index,
.counter {
  color: var(--faint);
  font: 400 11px/1 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1;
  letter-spacing: -.015em;
  font-weight: 600;
}

textarea {
  width: 100%;
  min-height: 420px;
  flex: 1 1 auto;
  resize: none;
  border: 0;
  outline: 0;
  padding: 24px 26px;
  color: var(--ink);
  caret-color: var(--accent);
  background: transparent;
  font-size: 14px;
  line-height: 1.75;
}

textarea::placeholder { color: #69665f; }

textarea::selection,
.out::selection,
.draft::selection { background: rgba(227, 111, 69, .35); }

.samples {
  min-height: 48px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 22px;
  border-top: 1px solid var(--line-soft);
}

.samples-label {
  color: var(--faint);
  font: 400 10px/1 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sample-options {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sample-button {
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 4px 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  transition: color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.sample-button:hover:not(:disabled) {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.sample-button:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.sample-button:disabled {
  cursor: default;
  opacity: .34;
}

.panel-actions {
  min-height: 72px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 12px 22px;
  border-top: 1px solid var(--line);
}

.run-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  font: 400 10px/1 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

kbd {
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-bottom-color: #454139;
  border-radius: 4px;
  color: var(--muted);
  background: var(--panel-raised);
  font: inherit;
}

.button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 13px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }
.button:disabled { cursor: default; opacity: .34; }

.button-quiet {
  color: var(--muted);
  background: transparent;
}

.button-quiet:hover:not(:disabled) {
  color: var(--ink);
  background: var(--panel-raised);
}

.button-primary {
  min-width: 112px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: #1b130f;
  background: var(--accent);
}

.button-primary:hover:not(:disabled) { background: #ed7c50; }

.button-primary svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress {
  height: 2px;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--line-soft);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.results {
  min-height: 487px;
  max-height: 640px;
  flex: 1 1 auto;
  overflow: auto;
  scrollbar-color: #4a463e transparent;
  scrollbar-width: thin;
}

.empty-state {
  min-height: 487px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--faint);
  text-align: center;
}

.empty-state p { margin: 0; font-size: 13px; }

.empty-glyph {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent-soft);
  font: 400 18px/1 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.result-row {
  position: relative;
  padding: 20px 24px 22px 28px;
  border-bottom: 1px solid var(--line-soft);
  animation: reveal 260ms ease both;
}

.result-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 19px;
  bottom: 19px;
  width: 2px;
  background: var(--ok);
}

.result-row.flagged::before { background: var(--danger); }

.draft {
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
}

.out {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(217, 119, 105, .32);
  border-radius: 999px;
  color: #e9a299;
  background: rgba(217, 119, 105, .08);
  font: 500 9px/1.2 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  vertical-align: 2px;
}

.badge.info {
  border-color: var(--line);
  color: var(--muted);
  background: var(--panel-raised);
}

@keyframes pulse {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .shell { padding: 0 20px 28px; }
  .masthead { min-height: 68px; }
  main { padding-top: 36px; }
  .heading { grid-template-columns: 1fr; gap: 18px; margin-bottom: 26px; }
  .eyebrow { margin-bottom: -6px; }
  .heading > p:last-child { max-width: 520px; }
  .workspace { grid-template-columns: 1fr; }
  .input-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel { min-height: 490px; }
  textarea { min-height: 330px; }
  .results, .empty-state { min-height: 390px; }
}

@media (max-width: 520px) {
  .shell { padding-inline: 12px; }
  .runtime { max-width: 62%; }
  #status { font-size: 0; }
  #status::after { content: attr(data-short); font-size: 10px; }
  main { padding-top: 30px; }
  h1 { font-size: 40px; }
  .heading > p:last-child { font-size: 13px; }
  .panel-head { height: 64px; padding-inline: 16px; }
  textarea { padding: 20px 18px; }
  .samples { align-items: flex-start; gap: 10px; padding-inline: 18px; }
  .sample-options { flex-wrap: wrap; gap: 12px; }
  .panel-actions { padding-inline: 10px 12px; }
  .shortcut { display: none; }
  .result-row { padding-inline: 22px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
