:root {
  --bg: #0b0d10;
  --panel: #11151a;
  --panel-2: #0f1317;
  --text: #e7edf3;
  --muted: #9fb0bf;
  --accent: #54b1ff;
  --error: #ff6b6b;
  --grid: rgba(255, 255, 255, 0.06);

  --green: #6ee7a8;
  --gold: #f3d36b;
  --blue: #54b1ff;
  --comment: #c084fc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
header {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 14px; background: #0a0c0f;
  border-bottom: 1px solid #1a1f25;
}
.brand { font-weight: 700; letter-spacing: 0.3px; }
.brand .ver { color: var(--accent); font-weight: 800; margin-left: 6px; }

.exambar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  color: var(--muted); font-size: 0.9rem;
}
.exambar label { display: flex; gap: 6px; align-items: center; }
.exambar input, .exambar select {
  background: #0f141a; border: 1px solid #2a3138; color: var(--text);
  padding: 4px 8px; border-radius: 6px; min-width: 140px;
}
.exambar button {
  background: #0f141a; border: 1px solid #2a3138; color: var(--text);
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.exambar button:disabled { opacity: 0.5; cursor: not-allowed; }
.exambar button:not(:disabled):hover { border-color: var(--accent); }
.savestatus { color: var(--muted); min-width: 200px; max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toolbar { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.toolbar button {
  background: #0f141a; border: 1px solid #2a3138; color: var(--text);
  padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.toolbar button:hover { border-color: var(--accent); }
.zoomreadout { color: var(--muted); font-size: 0.9rem; min-width: 50px; text-align: right; }

footer {
  padding: 6px 14px; color: var(--muted); background: #0a0c0f;
  border-top: 1px solid #1a1f25; font-size: 0.85rem;
  min-height: 18px;
}

/* flex split */
#layout { display: flex; flex-direction: row; min-height: 0; }
#editor-pane {
  flex: 0 0 20%;
  min-width: 140px;
  max-width: calc(100% - 240px);
  background: var(--panel);
  display: grid; grid-template-rows: auto 1fr;
  overflow: hidden; position: relative; z-index: 2;
}
#render-pane {
  flex: 1 1 auto;
  min-width: 220px;
  background: var(--panel-2);
  display: grid; grid-template-rows: auto 1fr;
  position: relative; z-index: 1;
}
#divider {
  flex: 0 0 6px;
  background: #1a1f25;
  cursor: col-resize;
  position: relative; z-index: 3;
}
.pane-title { padding: 8px 10px; font-size: 0.9rem; color: var(--muted); border-bottom: 1px solid #1a1f25; }
#editor { height: 100%; width: 100%; }
#fallbackEditor{
  width:100%; height:100%; resize:none; border:0; outline:none;
  background:#0f141a; color:var(--text); font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding:10px; line-height:1.4; font-size:14px;
}
#errors { padding: 6px 10px; color: var(--error); font-size: 0.9rem; border-bottom: 1px dashed #2a3138; display: none; }
#canvas {
  width: 100%; height: 100%;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  overflow: hidden; touch-action: none;
}

.exambar input.locked{ opacity:0.75; cursor:not-allowed; border-color:#39424a; }
