:root {
  --bg: #0b0c0f;
  --panel: #111318;
  --panel-soft: #15171c;
  --line: #292c33;
  --line-soft: #20232a;
  --text: #f0f0ec;
  --muted: #8a8d95;
  --accent: #d6ff3f;
  --accent-dim: rgba(214, 255, 63, 0.12);
  --danger: #ff6b6b;
  --mono: "DM Mono", monospace;
  --sans: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 68% -20%, rgba(214, 255, 63, 0.07), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.noise {
  position: fixed;
  inset: 0;
  opacity: .025;
  pointer-events: none;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.topbar {
  width: min(1180px, calc(100% - 48px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.7px;
}
.brand > span:last-child span { color: var(--accent); }
.brand-mark {
  width: 33px;
  height: 33px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 8px;
  border: 1px solid #3b3f47;
  border-radius: 9px;
  transform: rotate(-3deg);
}
.brand-mark i { width: 3px; background: var(--accent); border-radius: 3px; }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; }
.system-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font: 500 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: #777; box-shadow: 0 0 0 4px rgba(130,130,130,.08); }
.system-state.ready .state-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.system-state.error .state-dot { background: var(--danger); }

main { width: min(960px, calc(100% - 48px)); margin: 0 auto; }
.hero { padding: 112px 0 78px; position: relative; }
.eyebrow, .card-label, .output-field > span {
  color: var(--muted);
  font: 500 10px var(--mono);
  letter-spacing: .16em;
}
.eyebrow { margin-bottom: 26px; }
.eyebrow span { color: var(--accent); margin-right: 9px; }
.hero h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(56px, 8.3vw, 92px);
  font-weight: 500;
  line-height: .97;
  letter-spacing: -.065em;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.hero > p {
  max-width: 570px;
  margin: 30px 0 42px;
  color: #a2a5ad;
  font-size: 16px;
  line-height: 1.75;
}
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-meta span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #747780;
  font: 500 9px var(--mono);
  letter-spacing: .08em;
}

.workspace, .inspect-panel, .progress-panel {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,255,255,.012), transparent 42%), var(--panel);
  padding: 38px;
  margin-bottom: 18px;
}
.workspace-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 27px; }
.workspace-head > div { display: flex; gap: 18px; align-items: baseline; }
.step-number { color: var(--accent); font: 500 10px var(--mono); }
.workspace-head h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.text-button {
  border: 0;
  background: none;
  color: #73767d;
  padding: 5px 0;
  cursor: pointer;
  font: 500 11px var(--mono);
}
.text-button:hover { color: var(--text); }

.editor-shell { border: 1px solid #2d3037; background: #0e1014; transition: border-color .2s, box-shadow .2s; }
.editor-shell:focus-within { border-color: #4a4f58; box-shadow: 0 0 0 3px rgba(214,255,63,.04); }
.editor-shell.has-error { border-color: var(--danger); }
.editor-toolbar {
  height: 45px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 14px;
  color: #5f626b;
  font: 500 10px var(--mono);
}
.window-dots { display: flex; gap: 6px; margin-right: 17px; }
.window-dots span { width: 6px; height: 6px; border-radius: 50%; background: #34373e; }
.editor-toolbar > button {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: #858891;
  cursor: pointer;
  font: 500 10px var(--mono);
}
.editor-toolbar > button:hover { color: var(--accent); }
.editor-toolbar svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.editor-body { display: flex; min-height: 230px; }
.line-numbers {
  width: 48px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  gap: 0;
  border-right: 1px solid #1c1f25;
  color: #3f4249;
  font: 400 12px/24px var(--mono);
}
textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  outline: 0;
  border: 0;
  padding: 18px 21px;
  background: transparent;
  color: #cfd1d4;
  caret-color: var(--accent);
  font: 400 12px/24px var(--mono);
}
textarea::placeholder { color: #474a52; }
.field-error { min-height: 18px; margin: 8px 0 0; color: var(--danger); font-size: 11px; }
.action-row { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; }
.privacy-note { display: flex; gap: 9px; align-items: center; color: #686b72; font-size: 11px; }
.privacy-note svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.primary-button, .secondary-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: #10120a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .15s, filter .15s;
}
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: wait; transform: none; }
.primary-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

.inspect-panel, .progress-panel { animation: reveal .35s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } }
.is-hidden { display: none !important; }
.valid-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font: 500 9px var(--mono);
  letter-spacing: .08em;
}
.valid-badge svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.request-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 10px; margin-bottom: 22px; }
.info-card { min-width: 0; min-height: 120px; padding: 20px; border: 1px solid var(--line-soft); background: #0e1014; }
.source-line { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px; }
.source-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px var(--mono); }
.protocol { padding: 4px 6px; color: var(--accent); background: var(--accent-dim); font: 500 8px var(--mono); }
.source-card code { display: block; overflow: hidden; color: #686b73; font: 400 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.headers-card strong { display: block; margin: 12px 0 3px; color: var(--accent); font-size: 34px; line-height: 1; }
.headers-card > span:last-child { display: block; overflow: hidden; color: #686b73; font: 400 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.output-field { display: block; margin: 27px 0 22px; }
.output-field > span { display: block; margin-bottom: 10px; }
.output-field > div { position: relative; }
.output-field input {
  width: 100%;
  height: 50px;
  outline: 0;
  border: 1px solid #2d3037;
  background: #0e1014;
  color: #d8d9db;
  padding: 0 70px 0 16px;
  font: 400 12px var(--mono);
}
.output-field input:focus { border-color: #4a4f58; }
.extension { position: absolute; right: 17px; top: 17px; color: #777a81; font: 400 12px var(--mono); }
.download-button {
  width: 100%;
  display: flex;
  align-items: center;
  border: 0;
  background: var(--accent);
  color: #10120a;
  padding: 16px 20px;
  cursor: pointer;
  text-align: left;
  transition: filter .15s, transform .15s;
}
.download-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.download-button:disabled { opacity: .5; cursor: wait; transform: none; }
.download-icon { width: 35px; height: 35px; display: grid; place-items: center; margin-right: 14px; border: 1px solid rgba(0,0,0,.25); }
.download-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.download-button > span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; }
.download-button strong { font-size: 13px; }
.download-button small { font: 500 8px var(--mono); letter-spacing: .1em; opacity: .6; }
.button-arrow { margin-left: auto; }

.progress-panel { padding-bottom: 31px; }
.progress-top { display: flex; align-items: center; }
.status-icon { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border: 1px solid #3b3f47; color: var(--accent); }
.status-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.progress-title { min-width: 0; margin-left: 16px; }
.progress-title span { color: var(--accent); font: 500 8px var(--mono); letter-spacing: .12em; }
.progress-title h2 { overflow: hidden; margin: 5px 0 0; font: 500 14px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.percent { margin-left: auto; color: var(--accent); font: 500 27px var(--mono); }
.progress-track { height: 3px; margin: 28px 0 24px; background: #292c31; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); box-shadow: 0 0 12px rgba(214,255,63,.45); transition: width .4s ease; }
.progress-track span.indeterminate { width: 35%; animation: indeterminate 1.3s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
.progress-stats { display: flex; gap: 48px; }
.progress-stats span { display: flex; flex-direction: column; gap: 5px; }
.progress-stats small { color: #5c5f67; font: 500 8px var(--mono); letter-spacing: .1em; }
.progress-stats strong { color: #a7a9ae; font: 400 11px var(--mono); }
.job-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.secondary-button { min-height: 40px; border-color: #363941; background: transparent; color: #999ca4; }
.secondary-button:hover { border-color: #5b5f68; color: var(--text); }
.job-error { padding: 14px; margin: 22px 0 0; border: 1px solid rgba(255,107,107,.25); background: rgba(255,107,107,.06); color: #ff8f8f; font: 400 11px/1.6 var(--mono); white-space: pre-wrap; }
.progress-panel.failed .status-icon { color: var(--danger); border-color: rgba(255,107,107,.35); }
.progress-panel.failed .progress-title span { color: var(--danger); }

footer { min-height: 190px; display: flex; justify-content: space-between; align-items: center; color: #4e5158; }
footer p { font-size: 11px; }
footer div { display: flex; align-items: center; gap: 12px; font: 500 8px var(--mono); letter-spacing: .1em; }
footer i { width: 3px; height: 3px; border-radius: 50%; background: #3d4047; }
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  border: 1px solid #3b3e45;
  background: #191b20;
  color: #cfd0d2;
  font-size: 11px;
  transform: translate(-50%, 30px);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 700px) {
  .topbar, main { width: min(100% - 28px, 960px); }
  .topbar { height: 72px; }
  .system-state span:last-child { display: none; }
  .hero { padding: 72px 0 55px; }
  .hero h1 { font-size: clamp(48px, 15vw, 70px); }
  .hero > p { font-size: 14px; }
  .workspace, .inspect-panel, .progress-panel { padding: 24px 18px; }
  .request-grid { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; flex-direction: column; gap: 18px; }
  .primary-button { width: 100%; }
  .progress-stats { justify-content: space-between; gap: 12px; }
  .job-actions { flex-direction: column; }
  .job-actions .secondary-button { width: 100%; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 14px; }
}

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