:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #637083;
  --line: #d8e0ea;
  --brand: #1167d8;
  --brand-strong: #0b4da3;
  --accent: #12a37f;
  --danger: #c24135;
  --warning: #b7791f;
  --shadow: 0 18px 44px rgba(25, 39, 64, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(17, 103, 216, 0.08), transparent 280px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 6vw, 4.4rem);
}

h2 {
  font-size: 1.2rem;
}

.node-pill,
.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 9px 13px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  display: grid;
  gap: 17px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

label,
legend {
  color: #344154;
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 103, 216, 0.18);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  min-height: 38px;
}

.segmented button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
}

.segmented button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.optional {
  display: none;
}

.controls[data-action="dns"] .optional-record,
.controls[data-action="tcp"] .optional-port {
  display: grid;
}

.run-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
}

.run-button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.run-icon {
  font-size: 0.85rem;
}

.result-panel {
  min-height: 520px;
  overflow: hidden;
}

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

.status.ok {
  border-color: rgba(18, 163, 127, 0.35);
  background: rgba(18, 163, 127, 0.11);
  color: #08745a;
}

.status.error {
  border-color: rgba(194, 65, 53, 0.35);
  background: rgba(194, 65, 53, 0.1);
  color: var(--danger);
}

.status.running {
  border-color: rgba(183, 121, 31, 0.36);
  background: rgba(183, 121, 31, 0.12);
  color: var(--warning);
}

pre {
  min-height: 440px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #101820;
  color: #dbeafe;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 640px);
    padding: 18px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .node-pill {
    white-space: normal;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

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

  .result-panel {
    min-height: 420px;
  }

  pre {
    min-height: 330px;
  }
}

