:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4efe5;
  color: #191714;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 320px);
  align-items: end;
  gap: 16px;
  padding: 18px;
  border: 1px solid #d8cdbb;
  background: #fffaf2;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #6f604c;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 0.95;
}

.slug-field {
  display: grid;
  gap: 7px;
  color: #6f604c;
  font-size: 13px;
}

.slug-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8baa5;
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: #191714;
}

button,
.filebar select {
  min-height: 38px;
  border: 1px solid #191714;
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: #191714;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(360px, 1.05fr);
  gap: 16px;
}

.preview-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid #d8cdbb;
  border-radius: 8px;
  background: #fffaf2;
}

.editor-panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d8cdbb;
  border-radius: 8px;
  background: #fffaf2;
}

.file-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
}

.file-tree-panel {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid #d8cdbb;
  background: #f7f1e8;
}

.file-tree-title {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid #d8cdbb;
  color: #6f604c;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.file-tree-title button {
  min-width: 30px;
  min-height: 30px;
  justify-content: center;
  padding: 0;
  border-color: #c8baa5;
  font-size: 18px;
  line-height: 1;
}

.file-tree {
  padding: 8px 0;
}

.tree-row {
  width: 100%;
  min-height: 30px;
  display: block;
  border: 0;
  border-radius: 0;
  padding: 0 8px 0 calc(12px + var(--indent));
  background: transparent;
  color: #2b261f;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.tree-row:hover,
.tree-row.active {
  background: #e7dccd;
}

.tree-row.folder {
  color: #6f604c;
}

.code-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.filebar,
.preview-bar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #d8cdbb;
}

.filebar select {
  width: min(45%, 280px);
  border-color: #c8baa5;
}

.filebar input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #c8baa5;
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: #191714;
}

.filebar button {
  min-width: 70px;
  border-color: #c8baa5;
}

#editor {
  width: 100%;
  min-height: 0;
  border: 0;
  resize: none;
  padding: 16px;
  outline: none;
  background: #12100d;
  color: #f6ead9;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.preview-bar {
  justify-content: space-between;
  color: #6f604c;
  font-size: 13px;
}

#preview {
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: #ffffff;
}

@media (max-width: 900px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }
}
