/* Live GLSL editor: shared by the Playground (inline) and shader-editor.html (page). */
.shader-editor {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  --code-size: 13px; --code-line: 20px;
}
.shader-editor__bar { display: flex; align-items: center; gap: 12px; }
.shader-editor__status { margin-left: auto; font-size: 12px; color: var(--muted); }
.shader-editor__status[data-state="ok"] { color: #7FC8A9; }
.shader-editor__status[data-state="error"] { color: #FF8A7A; }
.shader-editor__reset {
  min-height: 32px; padding: 0 12px; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text); border: 1px solid var(--border); font: 500 13px var(--font-body);
}
.shader-editor__reset:hover { border-color: #5A4A3E; }
.shader-editor__reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Code pane: line numbers + textarea share font metrics so rows line up. */
.shader-editor__code {
  display: flex; min-height: 0; flex: 1 1 auto;
  background: #120F0C; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.shader-editor__code:focus-within { border-color: var(--accent); }
.shader-editor__gutter {
  flex: none; width: 44px; padding: 12px 8px 12px 0; overflow: hidden; user-select: none;
  font: var(--code-size) / var(--code-line) var(--font-mono); color: #6F6357; text-align: right;
  border-right: 1px solid var(--border-soft);
}
.shader-editor__gutter span { display: block; }
.shader-editor__gutter .is-error { color: #FF8A7A; background: rgba(255, 138, 122, 0.12); }
.shader-editor__input {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 12px 14px; resize: none; border: 0; outline: none;
  background: transparent; color: var(--text); caret-color: var(--accent-text);
  font: var(--code-size) / var(--code-line) var(--font-mono); white-space: pre; overflow: auto; tab-size: 2;
  font-variant-ligatures: none; /* show >= and == as typed; must follow the font shorthand */
}
.shader-editor__input::selection { background: rgba(224, 102, 47, 0.35); }

/* Errors */
.shader-editor__errors { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow: auto; }
.shader-editor__errors button {
  width: 100%; min-height: 32px; padding: 6px 10px; border-radius: 7px; text-align: left; cursor: pointer;
  background: rgba(255, 138, 122, 0.08); border: 1px solid rgba(255, 138, 122, 0.35); color: #FFB3A8;
  font: 12px / 1.4 var(--font-mono);
}
.shader-editor__errors button:disabled { cursor: default; }

/* Uniform controls */
.shader-editor__uniforms { display: flex; flex-direction: column; gap: 8px; }
.shader-editor__uniform-list { display: flex; flex-direction: column; gap: 6px; }
.shader-editor__uniform { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.shader-editor__fields { display: flex; gap: 6px; }
.shader-editor__fields input[type="number"] {
  width: 72px; min-height: 32px; padding: 0 8px; border-radius: 7px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font: 12px var(--font-mono);
}
.shader-editor__fields input[type="color"] { width: 44px; height: 32px; padding: 2px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.shader-editor__fields input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.shader-editor__fields input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shader-editor__hint { margin: 0; font-size: 13px; color: var(--muted); }

/* Layouts */
.shader-editor--inline .shader-editor__code { height: 320px; }
.shader-editor--page { height: 100%; }
.shader-editor--page .shader-editor__code { min-height: 320px; }
