:root {
  --bg: #1b1c20;
  --panel: #25262c;
  --line: #34363e;
  --text: #e8e9ee;
  --muted: #8b8e99;
  --accent: #ff7a45;
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

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

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { font-weight: 700; letter-spacing: 0.04em; margin-right: 8px; color: var(--accent); }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.spacer { flex: 1; }
.zoom { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

button {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #30323a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 11px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
button:hover { background: #3a3d47; border-color: #4a4d59; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1b1c20; font-weight: 600; }
button.primary:hover { background: #ff8c5e; }
button:disabled { opacity: 0.4; cursor: default; }

/* Icons: 24x24 stroke symbols from the sprite in index.html, coloured by the surrounding text colour. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
button.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; padding: 0; }
.lang { gap: 4px; }
.lang .icon { width: 16px; height: 16px; }

.tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #202127;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tool.active { background: var(--accent); border-color: var(--accent); color: #1b1c20; font-weight: 600; }
.ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ctl input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.ctl input[type="range"] { width: 90px; accent-color: var(--accent); }
.ctl select {
  font: inherit; font-size: 13px; color: var(--text); background: #30323a;
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px;
}
.swatches { display: inline-flex; gap: 4px; }
.swatch { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid #5a5d69; }
.swatch:hover { transform: scale(1.15); border-color: var(--text); }

.text-editor {
  position: absolute;
  z-index: 2;
  margin: 0;
  border: 1px dashed var(--accent);
  border-radius: 4px;
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre;
  user-select: text;
}

#stage { position: relative; flex: 1; min-height: 0; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  pointer-events: none;
  text-align: center;
  padding: 24px;
}
.hint-title { font-size: 22px; color: var(--text); }
kbd {
  background: #30323a;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

.dropmask {
  position: absolute;
  inset: 12px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: rgba(255, 122, 69, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  pointer-events: none;
}

.toast {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #000c;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: none;
}

button.version {
  margin-right: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
  border-radius: 999px;
  user-select: none;
  -webkit-touch-callout: none;
}

.changelog {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}
.changelog-card {
  width: min(480px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}
.changelog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.changelog-head h2 { margin: 0; font-size: 16px; }
.changelog-list { overflow-y: auto; padding: 4px 16px 14px; user-select: text; }
.changelog-list h3 { margin: 14px 0 6px; font-size: 14px; color: var(--accent); }
.changelog-list ul { margin: 0; padding-left: 20px; color: var(--text); font-size: 13px; line-height: 1.6; }

[hidden] { display: none !important; }
