:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: rgba(16, 21, 30, 0.86);
  --panel-strong: rgba(22, 29, 41, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --muted: #a9b4c6;
  --cyan: #52d4ff;
  --green: #72f1b8;
  --gold: #ffd36b;
  --red: #ff7676;
  --ink: #0b1018;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overflow-x: hidden;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.9);
  position: sticky;
  top: 0;
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(82, 212, 255, 0.55);
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-weight: 900;
  background: #101825;
}

.title {
  font-size: 17px;
  font-weight: 820;
  line-height: 1.1;
}

.subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(255, 211, 107, 0.6);
}

.main {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  min-height: 0;
}

.control {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.runtime {
  min-width: 0;
  min-height: calc(100vh - 69px);
  background: #05070a;
  position: relative;
}

.runtime iframe {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 69px);
  border: 0;
  background: #05070a;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row + .row {
  margin-top: 8px;
}

input {
  min-width: 0;
  flex: 1;
  height: 38px;
  border: 1px solid var(--line);
  background: #090f17;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

button,
a.button {
  height: 38px;
  border: 1px solid rgba(82, 212, 255, 0.42);
  background: #102234;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
a.button:hover {
  border-color: rgba(114, 241, 184, 0.7);
}

button.secondary,
a.secondary {
  border-color: var(--line);
  background: #0c121b;
}

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.kv strong {
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  background: #05080d;
  border: 1px solid var(--line);
  color: #d8f8ff;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.status-ok {
  color: var(--green);
}

.status-warn {
  color: var(--gold);
}

.status-bad {
  color: var(--red);
}

@media (max-width: 980px) {
  .main {
    grid-template-columns: 1fr;
  }

  .control {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .runtime,
  .runtime iframe {
    min-height: 72vh;
  }
}

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

  .state {
    white-space: normal;
  }

  .row {
    flex-wrap: wrap;
  }

  button,
  a.button {
    width: 100%;
  }
}
