﻿:root {
  --bg-0: #f8f3e9;
  --bg-1: #f1ead9;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: #fffdf8;
  --line: rgba(55, 44, 30, 0.2);
  --line-strong: rgba(35, 28, 20, 0.45);
  --text: #2b2217;
  --muted: #685f50;
  --accent: #0b8d7f;
  --accent-strong: #0c6e63;
  --danger: #c24f2e;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(40, 30, 18, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #fffaf0 0%, transparent 35%),
    radial-gradient(circle at 90% 15%, #ffeccf 0%, transparent 25%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  min-height: 100vh;
  overflow: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.shape-a {
  width: 360px;
  height: 360px;
  background: rgba(11, 141, 127, 0.12);
  left: -90px;
  bottom: -120px;
}

.shape-b {
  width: 300px;
  height: 300px;
  background: rgba(194, 79, 46, 0.1);
  right: -80px;
  top: -70px;
}

.layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  height: 100vh;
  padding: 18px;
}

.sidebar,
.editor-zone {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
  animation: slideIn 300ms ease-out;
}

.panel-title {
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tree {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.tree-item {
  margin: 2px 0;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-item:hover {
  background: rgba(11, 141, 127, 0.09);
}

.tree-item.active {
  background: rgba(11, 141, 127, 0.2);
  border: 1px solid rgba(11, 141, 127, 0.4);
}

.tree-children {
  list-style: none;
  padding-left: 16px;
  margin: 0;
}

.editor-zone {
  display: grid;
  grid-template-rows: auto 1fr 220px;
  overflow: hidden;
  animation: riseIn 380ms ease-out;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.title-wrap h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
}

.active-file {
  display: inline-block;
  margin-top: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 10px;
  font: 500 13px "Space Grotesk", sans-serif;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.danger {
  border-color: rgba(194, 79, 46, 0.5);
  color: var(--danger);
}

.btn.tiny {
  padding: 5px 9px;
  font-size: 12px;
}

.editor {
  width: 100%;
  height: 100%;
}

.output-panel {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fdf8ee;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.output {
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.stdin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}

.stdin-row input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fffdfa;
  padding: 8px;
  font: 400 13px "IBM Plex Mono", monospace;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stdin-row input.awaiting-input {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 141, 127, 0.2);
  background: #f0faf9;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

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

  .editor-zone {
    min-height: 72vh;
    grid-template-rows: auto minmax(380px, 1fr) 220px;
  }
}