* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #172033;
  background: #eef3f8;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.app-header p {
  margin: 8px 0 0;
  color: #536278;
  font-size: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

button {
  border: 1px solid #c8d4e3;
  border-radius: 6px;
  padding: 9px 14px;
  color: #172033;
  background: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  border-color: #6f91c4;
  background: #f7faff;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 140px);
}

.editor-panel {
  display: flex;
  min-width: 0;
  min-height: 540px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d5dfeb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(26, 44, 72, 0.08);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5ebf2;
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.panel-head span {
  color: #6b7890;
  font-size: 12px;
}

.status {
  min-height: 38px;
  padding: 10px 16px;
  border-bottom: 1px solid #e5ebf2;
  font-size: 13px;
  line-height: 1.35;
}

.status-ok {
  color: #1f6b3c;
  background: #edf9f0;
}

.status-error {
  color: #9d2b20;
  background: #fff0ed;
}

.editor-wrap {
  width: 100%;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  background: #fbfdff;
}

.editor-wrap > textarea {
  width: 100%;
  height: 100%;
  min-height: 420px;
  resize: none;
  border: 0;
  padding: 16px;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.CodeMirror {
  height: 100%;
  min-height: 420px;
  color: #142033;
  background: #fbfdff;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.CodeMirror-focused {
  box-shadow: inset 0 0 0 2px rgba(87, 123, 178, 0.22);
}

.CodeMirror-gutters {
  border-right: 1px solid #e2e8f0;
  background: #f4f7fb;
}

.CodeMirror-linenumber {
  color: #91a0b5;
}

.cm-property {
  color: #1d5f9f;
  font-weight: 650;
}

.cm-string {
  color: #a24619;
}

.cm-number {
  color: #267a64;
}

.cm-atom {
  color: #8b4fa8;
}

.cm-comment {
  color: #78869a;
  font-style: italic;
}

.cm-variable-2 {
  color: #7f58a8;
  font-weight: 700;
}

.syntax-comment {
  color: #78869a;
  font-style: italic;
}

.syntax-key {
  color: #1d5f9f;
  font-weight: 650;
}

.syntax-separator,
.syntax-list-marker {
  color: #7f58a8;
  font-weight: 700;
}

.syntax-string {
  color: #a24619;
}

.syntax-number {
  color: #267a64;
}

.syntax-boolean {
  color: #8b4fa8;
}

.syntax-null {
  color: #8b5e35;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding: 14px 0;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .editor-panel {
    min-height: 420px;
  }

  .editor-wrap,
  .editor-wrap > textarea,
  .CodeMirror {
    min-height: 300px;
  }
}
