:root{
  --bg1:#0f172a;
  --bg2:#1e293b;
  --card: rgba(17, 24, 39, .72);
  --card2: rgba(255,255,255,.08);
  --text: #f8fafc;
  --muted: rgba(248,250,252,.72);
  --line: rgba(255,255,255,.12);
  --accent: #7c3aed;
  --accent2: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 20px 50px rgba(0,0,0,.28);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at top left, #334155 0%, transparent 35%),
    radial-gradient(circle at top right, #312e81 0%, transparent 30%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  overflow-x:hidden;
  overflow-y:auto;
}

.bg-orb{
  position:fixed;
  border-radius:50%;
  filter: blur(60px);
  opacity:.35;
  pointer-events:none;
  z-index:0;
}
.orb1{width:260px;height:260px;background:#7c3aed;top:-40px;left:-60px}
.orb2{width:220px;height:220px;background:#06b6d4;bottom:20px;right:20px}
.orb3{width:180px;height:180px;background:#f59e0b;top:30%;right:20%}

.shell{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:18px;
  min-height:100dvh;
  padding:18px;
}

.sidebar{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
  padding:18px 18px 12px;
}

.logo{
  width:56px;height:56px;
  display:grid;place-items:center;
  border-radius:18px;
  font-size:28px;
  background: linear-gradient(145deg, rgba(124,58,237,.9), rgba(59,130,246,.85));
  box-shadow: var(--shadow);
}

.brand h1{
  margin:0;
  font-size:28px;
  line-height:1.05;
  letter-spacing:-.03em;
}
.brand p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:14px;
}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius:24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.stats{
  padding:16px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.stat{
  padding:14px;
  border-radius:18px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
}
.stat-label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:8px;
}
.stat strong{font-size:18px}

.prompt-card, .tools-card{
  padding:18px;
}

.chip{
  display:inline-flex;
  align-items:center;
  padding:7px 12px;
  border-radius:999px;
  background: rgba(124,58,237,.22);
  border:1px solid rgba(124,58,237,.35);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#ddd6fe;
  margin-bottom:14px;
}

.prompt-card h2{
  margin:0 0 10px;
  font-size:26px;
  line-height:1.15;
  letter-spacing:-.03em;
}
.prompt-card p{
  margin:0;
  color:var(--muted);
  line-height:1.5;
}
code{
  color:#e9d5ff;
  background: rgba(255,255,255,.08);
  padding:2px 6px;
  border-radius:8px;
}

.tool-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  padding:12px 14px;
  border-radius:16px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
}
.tool-row label{
  color:var(--muted);
  font-size:14px;
}
.tool-row input[type="color"]{
  width:42px;height:42px;
  border:0;
  background:transparent;
  padding:0;
  cursor:pointer;
}
.tool-row input[type="range"]{
  width:160px;
  accent-color:#a78bfa;
}

.quick-colors{
  display:grid;
  grid-template-columns:repeat(6, 1fr);
  gap:8px;
  margin:12px 0 16px;
}
.swatch{
  aspect-ratio:1/1;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.18);
  cursor:pointer;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.04);
}
.swatch.active{
  outline:3px solid rgba(255,255,255,.72);
  outline-offset:2px;
}

.tool-modes{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:12px 0 16px;
}

.mode-btn{
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.10);
}

.mode-btn.active{
  outline: 3px solid rgba(255,255,255,.70);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
}

.full{
  grid-column: 1 / -1;
}

.buttons{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

button{
  border:0;
  border-radius:16px;
  padding:13px 14px;
  font-weight:800;
  cursor:pointer;
  color:white;
  transition:transform .12s ease, opacity .12s ease, box-shadow .12s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
button:hover{transform:translateY(-1px)}
button:active{transform:translateY(1px)}
button:disabled{opacity:.45;cursor:not-allowed;transform:none}

.primary{background:linear-gradient(135deg,#7c3aed,#4f46e5)}
.ghost{background:rgba(255,255,255,.12)}
.warn{background:linear-gradient(135deg,#f59e0b,#ef4444)}
.success{background:linear-gradient(135deg,#22c55e,#10b981)}
.big{padding:16px 20px;font-size:16px}

.stage{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.stage-top{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  padding:0 4px;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  color:var(--text);
  font-size:14px;
}
.pill.subtle{color:var(--muted)}

.board{
  position:relative;
  flex:1;
  min-height: calc(100dvh - 90px);
  border-radius:30px;
  overflow:hidden;
  background:
    linear-gradient(0deg, rgba(255,255,255,.92), rgba(255,255,255,.92)),
    radial-gradient(circle at center, #fff, #eef2ff);
  box-shadow: var(--shadow);
  border:1px solid rgba(255,255,255,.15);
}

#drawCanvas{
  width:100%;
  height:100%;
  display:block;
  touch-action:none;
  cursor:crosshair;
  background:
    linear-gradient(to right, rgba(15,23,42,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,.05) 1px, transparent 1px);
  background-size: 32px 32px;
}

.overlay{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  background: rgba(15,23,42,.35);
  backdrop-filter: blur(8px);
}
.overlay.hidden{display:none}
.overlay-card{
  max-width:420px;
  margin:20px;
  padding:28px;
  border-radius:26px;
  background: rgba(17,24,39,.88);
  border:1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  text-align:center;
}
.overlay-card h2{
  margin:0 0 10px;
  font-size:30px;
}
.overlay-card p{
  margin:0 0 18px;
  color:var(--muted);
  line-height:1.5;
}

.modal{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,.58);
  z-index:20;
  padding:18px;
}
.modal.hidden{display:none}
.modal-card{
  width:min(860px, 96vw);
  max-height:92vh;
  overflow:auto;
  background: rgba(15,23,42,.96);
  border:1px solid rgba(255,255,255,.12);
  border-radius:28px;
  box-shadow: var(--shadow);
  padding:18px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.modal-head h3{
  margin:0;
  font-size:22px;
}
.icon-btn{
  width:42px;height:42px;
  border-radius:14px;
  background:rgba(255,255,255,.10);
  font-size:28px;
  line-height:1;
  padding:0;
}
.modal-card img{
  width:100%;
  display:block;
  margin-top:16px;
  border-radius:18px;
  background:white;
}
.modal-foot{
  margin:14px 0 0;
  color:var(--muted);
}

@media (max-width: 1050px){
  .shell{grid-template-columns:1fr}
  .board{min-height:66vh}
}

@media (max-width: 620px){
  .stats{grid-template-columns:1fr}
  .buttons{grid-template-columns:1fr}
  .quick-colors{grid-template-columns:repeat(3, 1fr)}
  .tool-row{flex-direction:column; align-items:flex-start}
  .tool-row input[type="range"]{width:100%}
}

/* lo neww */

html, body {
  height: 100%;
}

body {
  overflow: hidden;
}

.shell {
  height: 100dvh;
}

.sidebar {
  overflow-y: auto;
  max-height: 100%;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 1fr;
    height: 100dvh;
    overflow: hidden;
  }

  .sidebar {
    max-height: 42vh;
  }

  .board {
    min-height: 50vh;
  }
}

@media (max-width: 620px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .buttons {
    grid-template-columns: 1fr;
  }

  .quick-colors {
    grid-template-columns: repeat(3, 1fr);
  }

  .tool-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-row input[type="range"] {
    width: 100%;
  }

  .sidebar {
    max-height: 38vh;
  }
}