/* ============================================================
   DrawStudio — style.css
   Dark studio theme
   ============================================================ */
:root {
  --bg: #0f1420;
  --panel: #1a2233;
  --panel-2: #212c42;
  --border: rgba(255, 255, 255, 0.09);
  --text: #e9edf7;
  --muted: #93a0bd;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --danger: #ff5e78;
  --radius: 12px;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 1.2rem; font-weight: 900; letter-spacing: 0.3px; white-space: nowrap; }
.brand span { color: var(--accent-2); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.tool-group, .swatches {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-2); padding: 6px; border-radius: var(--radius);
}
.tool {
  width: 42px; height: 42px; border-radius: 9px; font-size: 1.15rem;
  display: grid; place-items: center;
  border: 2px solid transparent; transition: 0.2s;
}
.tool:hover { background: rgba(255, 255, 255, 0.07); }
.tool.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.divider { width: 1px; height: 34px; background: var(--border); }

/* ---------- Swatches ---------- */
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25); transition: transform 0.15s, border-color 0.15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 0 3px rgba(255,255,255,0.18); }

.color-picker-wrap {
  display: flex; align-items: center; gap: 4px;
  background: var(--panel-2); padding: 8px 10px; border-radius: var(--radius);
  font-size: 1rem; cursor: pointer;
}
.color-picker-wrap input { width: 30px; height: 30px; border: none; background: none; cursor: pointer; }

/* ---------- Size ---------- */
.size-ctl {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); padding: 8px 14px; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 700; color: var(--muted);
}
.size-ctl input[type="range"] { width: 110px; accent-color: var(--accent); }
.size-val { min-width: 2ch; text-align: center; color: var(--text); }

.dot-preview-wrap {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--panel-2); border-radius: var(--radius);
}
#dotPreview { display: block; border-radius: 50%; width: 8px; height: 8px; background: #111827; border: 1px solid rgba(255,255,255,0.5); }

/* ---------- Action buttons ---------- */
.act {
  height: 42px; padding: 0 14px; border-radius: var(--radius);
  background: var(--panel-2); font-weight: 700; font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 6px; transition: 0.2s;
  border: 1px solid transparent;
}
.act:hover { background: #2a3853; }
.act.primary {
  background: linear-gradient(135deg, var(--accent), #6d28d9); color: #fff;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35);
}
.act.primary:hover { filter: brightness(1.12); }

/* ---------- Stage ---------- */
.stage {
  flex: 1; display: grid; place-items: center; padding: 18px; overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(34, 211, 238, 0.07), transparent 40%);
}
.canvas-wrap {
  position: relative; width: min(100%, 1000px); aspect-ratio: 1200 / 750;
  max-height: 100%;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
  background: #fff;
}
#board { display: block; width: 100%; height: 100%; cursor: none; touch-action: none; }

.brush-cursor {
  position: absolute; pointer-events: none;
  border: 1.5px solid rgba(0, 0, 0, 0.65);
  outline: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: none;
}
.canvas-wrap:hover .brush-cursor { display: block; }

/* ---------- Status bar ---------- */
.statusbar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 18px; font-size: 0.8rem; font-weight: 600; color: var(--muted);
  background: var(--panel); border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 54px; left: 50%; transform: translate(-50%, 20px);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 24px; border-radius: 999px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: 0.3s; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body { overflow: auto; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .size-ctl input[type="range"] { width: 80px; }
  .act { padding: 0 10px; }
  .divider { display: none; }
}
