@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #131417;
  --surface: rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.06);
  --surface3: rgba(255,255,255,0.10);
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --text: #edeef2;
  --text2: #9a9da6;
  --text3: #b3b3b3;
  --accent: #1ECC7A;
  --accent2: #15B06B;
  --accent-glow: rgba(30,204,122,0.18);
  --red: #f55b5b;
  --green: #5bf5a0;
  --yellow: #f5d05b;
  --panel-w: 300px;
  --toolbar-h: 44px;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;

  /* Glass / depth system — neutral charcoal */
  --glass-blur: 18px;
  --glass-bg: rgba(38,39,43,0.76);
  --glass-bg-strong: rgba(31,32,36,0.74);
  --glass-border: rgba(255,255,255,0.09);
  --glass-highlight: inset 0 1px 0 rgba(255,255,255,0.07);
  --glass-shadow: 0 10px 34px rgba(0,0,0,0.45);
}

html, body {
  width: 100%; height: 100%; overflow: hidden; color: var(--text);
  font-family: var(--sans); font-size: 14px;
  background:
    radial-gradient(820px 460px at 50% -4%, rgba(170,178,194,0.13), transparent 60%),
    radial-gradient(900px 640px at 50% 44%, rgba(150,160,176,0.05), transparent 64%),
    linear-gradient(180deg, #202226 0%, #191a1e 46%, #111215 100%);
}

/* Layout — canvas is full-bleed; the panels and toolbar float over it */
#app { position: relative; height: 100vh; overflow: hidden; }

/* Non-design modes (Model / API) hide all design-only chrome */
body:not(.design-mode) #toolbar,
body:not(.design-mode) .toolbar-right,
body:not(.design-mode) #props-panel,
body:not(.design-mode) #profile-card,
body:not(.design-mode) #action-bar,
body:not(.design-mode) #claude-panel,
body:not(.design-mode) #canvas,
body:not(.design-mode) #selection-box,
body:not(.design-mode) #ruler-corner,
body:not(.design-mode) #ruler-h-canvas,
body:not(.design-mode) #ruler-v-canvas { display: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ───────── Shared confirmation modal (dashboard + editor; see confirm.js) ───────── */
.cmodal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8,9,11,0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: cmodal-fade 0.15s ease;
}
.cmodal-overlay[hidden] { display: none; }
.cmodal {
  width: 100%; max-width: 400px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 22px 22px 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: cmodal-pop 0.17s cubic-bezier(0.2,0.85,0.3,1);
}
.cmodal-title { margin: 0 0 8px; font-size: 17px; font-weight: 650; color: var(--text); }
.cmodal-msg { margin: 0 0 20px; font-size: 13.5px; line-height: 1.55; color: var(--text2); }
.cmodal-msg strong { color: var(--text); font-weight: 600; }
.cmodal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.cmodal-btn {
  padding: 9px 18px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, filter 0.15s;
}
.cmodal-btn.ghost { background: var(--surface3); color: var(--text); border-color: var(--border); }
.cmodal-btn.ghost:hover { background: rgba(255,255,255,0.16); }
.cmodal-btn.danger { background: var(--red); color: #fff; }
.cmodal-btn.danger:hover { filter: brightness(1.08); }
.cmodal-btn.accent { background: var(--accent); color: #06231a; }
.cmodal-btn.accent:hover { background: var(--accent2); }
.cmodal-btn:disabled { opacity: 0.55; cursor: not-allowed; }
@keyframes cmodal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmodal-pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Toggle switch — shared by the dashboard settings and the editor's property panel */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: var(--surface3); border-radius: 999px; cursor: pointer; transition: background 0.15s; }
.switch-track::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
