* { box-sizing: border-box; }
:root {
  --bg: #0f1115;
  --panel: #151824;
  --ink: #eef1f7;
  --muted: #8e94a7;
  --accent: #6aa9ff;
  --border: #222739;
}
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #0d0f16;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
}
.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slug {
  width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
}
button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
}
button:hover { border-color: #2d3551; }
.status { color: var(--muted); min-width: 120px; text-align: right; }

#split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 50px);
}

.left, .right {
  position: relative;
  height: 100%;
  overflow: hidden;
}

#editor {
  position: absolute;
  inset: 0 6px 0 0;
  width: calc(100% - 6px);
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 14px;
  background: var(--panel);
  color: var(--ink);
  border-right: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
}

#dragbar {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: linear-gradient(90deg, transparent, #1d2335 50%, transparent);
}

.right iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* desktop focus; but keep it usable on smaller screens */
@media (max-width: 900px) {
  #split { grid-template-columns: 1fr; }
  #editor { border-right: none; }
  #dragbar { display: none; }
  .right { height: 50vh; }
}