@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Space+Grotesk:wght@400;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f8f4f0;
  --bg-strong: #efe4d9;
  --ink: #1f1b16;
  --muted: #6b5e52;
  --accent: #e7602a;
  --accent-2: #1b7f79;
  --panel: #ffffff;
  --panel-border: #e2d5c7;
  --shadow: 0 24px 60px rgba(39, 27, 16, 0.15);
  --topbar-height: 72px;
  --pane-height: 34vh;
  --frame-size: 10px;
  --frame: #444444;
  --frame-strong: #444444;
  --frame-depth: rgba(31, 27, 22, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: var(--frame-size) solid var(--frame);
  border-top: 0;
  border-bottom: 0;
  box-shadow: inset 0 0 0 2px var(--frame-strong), inset 0 0 24px var(--frame-depth);
}

body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--frame-size);
  background: var(--frame);
  z-index: 4;
  pointer-events: none;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(231, 96, 42, 0.2), transparent 60%),
    radial-gradient(circle at 30% 20%, rgba(27, 127, 121, 0.15), transparent 55%),
    linear-gradient(120deg, var(--bg), var(--bg-strong));
  z-index: -1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: var(--topbar-height);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--frame);
  border-bottom: 1px solid var(--frame-strong);
}

.title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #f5efe8;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  border: 1px solid #2f2f2f;
  background: #3a3a3a;
  color: #f5efe8;
  padding: 10px 16px;
  border-radius: 2px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  box-shadow: none;
}

.btn.primary {
  background: #f07a42;
  border-color: #f07a42;
  color: #fff;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:not(:disabled):hover {
  background: #4b4b4b;
}

.status {
  padding: 6px 12px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status.pending {
  background: #2f2f2f;
  color: #c9c3bb;
}

.status.ok {
  background: #214242;
  color: #bfe8e4;
}

.status.error {
  background: #5b2b1f;
  color: #f2b5a4;
}

.editor-shell {
  flex: 1;
  padding: 0;
}

.editor {
  height: calc(100vh - var(--topbar-height));
  width: 100%;
}

body.pane-open .editor {
  height: calc(100vh - var(--topbar-height) - var(--pane-height));
}

.output {
  min-height: 160px;
  padding: 16px;
  border-radius: 0;
  background: transparent;
  color: #f5efe8;
  font-family: "DM Mono", ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 0;
  overflow: auto;
}

.pane {
  position: fixed;
  left: var(--frame-size);
  right: var(--frame-size);
  bottom: var(--frame-size);
  background: var(--panel);
  border: 2px solid var(--frame-strong);
  box-shadow: inset 0 0 0 2px var(--frame), 0 -12px 30px rgba(31, 27, 22, 0.18);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  height: var(--pane-height);
  max-height: var(--pane-height);
}

.pane.is-hidden {
  display: none;
}

.pane-splitter {
  height: 20px;
  cursor: row-resize;
  background: var(--frame-strong);
  border-bottom: 1px solid var(--frame-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f8f4f0;
  font-size: 18px;
  letter-spacing: 4px;
}

.pane-splitter-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  line-height: 1;
  opacity: 0.7;
  user-select: none;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
}

.pane-chrome {
  position: relative;
}

.output-shell {
  position: relative;
  flex: 1;
  background: #11100f;
  display: flex;
  min-height: 0;
}

.pane-close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(17, 16, 15, 0.6);
  color: #f5efe8;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 2px;
  cursor: pointer;
  z-index: 1;
}

.pane-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pane .output {
  flex: 1;
  min-height: 0;
  height: 100%;
  border-radius: 0;
  overflow: auto;
}

@media (max-width: 960px) {
  .topbar {
    padding: 12px 16px;
    min-height: 86px;
  }

  .actions {
    width: 100%;
  }

  .btn {
    flex: 1;
  }

  .editor {
    height: calc(100vh - 86px);
  }

  body.pane-open .editor {
    height: calc(100vh - 86px - 45vh);
  }

  :root {
    --pane-height: 45vh;
  }
}
