:root {
  --bg:#020617;
  --accent:#6366f1;
  --accent-glow:rgba(99,102,241,.4);
  --text:#f8fafc;
  --muted:#94a3b8;
  --border:rgba(255,255,255,.08);
  --card:rgba(15,23,42,.85);
}

[data-theme="light"] {
  --bg:#f8fafc;
  --text:#0f172a;
  --muted:#64748b;
  --border:rgba(0,0,0,.08);
  --card:#ffffff;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family:Inter,sans-serif;
  background:var(--bg);
  color:var(--text);
  height:100vh;
  display:flex;
  flex-direction:column;
}

header {
  padding:.75rem 1.5rem;
  display:flex;
  justify-content:space-between;
  background:var(--card);
  border-bottom:1px solid var(--border);
}

.logo { display:flex; gap:12px; font-weight:700; }

.logo-icon {
  width:28px;
  height:28px;
  border-radius:6px;
  background:linear-gradient(135deg,var(--accent),#10b981);
}

.header-actions { display:flex; gap:12px; }

.btn-action {
  padding:8px 16px;
  border-radius:10px;
  border:1px solid var(--border);
  background:none;
  color:var(--text);
  cursor:pointer;
}

.btn-action.danger { color:#f87171; }

main { flex:1; display:flex; }

.toolbar {
  width:68px;
  background:var(--card);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:1rem 0;
  gap:1rem;
}

.tool-btn {
  width:42px;
  height:42px;
  border-radius:12px;
  border:none;
  background:none;
  color:var(--muted);
  cursor:pointer;
}

.tool-btn.active {
  background:var(--accent);
  color:white;
  box-shadow:0 8px 20px var(--accent-glow);
}

.canvas-container {
  flex:1;
  position:relative;
  background:
    linear-gradient(var(--border) 1px,transparent 1px),
    linear-gradient(90deg,var(--border) 1px,transparent 1px);
  background-size:40px 40px;
}

canvas { width:100%; height:100%; display:block; }

.controls-bottom {
  position:absolute;
  bottom:24px;
  left:50%;
  transform:translateX(-50%);
  display:flex;
  gap:15px;
  background:var(--card);
  padding:10px 20px;
  border-radius:50px;
  border:1px solid var(--border);
}

.color-swatch {
  width:22px;
  height:22px;
  border-radius:50%;
  cursor:pointer;
}

.color-swatch.active {
  border:2px solid var(--text);
}

#textInputOverlay {
  position:absolute;
  display:none;
  padding:8px 12px;
  border-radius:8px;
  border:1px solid var(--accent);
  background:var(--card);
  color:var(--text);
}

@media(max-width:768px){
  .toolbar{
    width:100%;
    height:65px;
    flex-direction:row;
    position:absolute;
    bottom:0;
  }
  .controls-bottom{ bottom:85px; width:90%; }
  main{ flex-direction:column; }
}
