/* Design tokens — SSOT for editor chrome (not for game layouts, see src/data/tokens.js) */
:root {
  --bg-0: #0e1116;
  --bg-1: #151a21;
  --bg-2: #1c222b;
  --bg-3: #242c37;
  --line: #2e3742;
  --line-soft: #232b35;
  --fg-0: #e8edf4;
  --fg-1: #a7b3c2;
  --fg-2: #6f7c8d;
  --accent: #4f8cff;
  --accent-2: #7b5cff;
  --ok: #38d39f;
  --warn: #ffb545;
  --danger: #ff5c72;
  --radius: 8px;
  --radius-sm: 5px;
  --rail-l: 268px;
  --rail-r: 288px;
  --topbar-h: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

#workspace {
  display: grid;
  grid-template-columns: var(--rail-l) 1fr var(--rail-r);
  flex: 1; min-height: 0;
}

#left-rail, #right-rail {
  background: var(--bg-1);
  overflow-y: auto;
  overflow-x: hidden;
}
#left-rail { border-right: 1px solid var(--line); }
#right-rail { border-left: 1px solid var(--line); }

#stage { position: relative; overflow: hidden; background: var(--bg-0); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-3); border-color: #3a4552; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-1); }
.btn.ghost:hover { background: var(--bg-2); color: var(--fg-0); }
.btn.sm { padding: 4px 7px; font-size: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Form controls */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-2); }
/* Nhãn số kéo được — báo bằng con trỏ, không thêm chữ */
label.scrub { cursor: ew-resize; user-select: none; width: fit-content; }
label.scrub:hover { color: var(--accent); }
body.scrubbing { cursor: ew-resize; user-select: none; }
body.scrubbing * { cursor: ew-resize !important; }
input[type="text"], input[type="search"], input[type="number"], select, textarea {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
input[type="color"] { padding: 2px; height: 28px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.row { display: flex; gap: 6px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.muted { color: var(--fg-2); }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3441; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4552; }

/* Toasts */
#toast-root {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90; pointer-events: none;
}
.toast {
  background: var(--bg-3); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 9px 14px; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.45);
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
