:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.08);
  --stroke: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);
  --muted2: rgba(255,255,255,.55);
  --accent: #6ae4ff;
  --accent2: #ff5bd6;
  --good: #72ffa7;
  --warn: #ffd66a;
  --bad: #ff6a6a;
  --r: 16px;
  --shadow: 0 18px 44px rgba(0,0,0,.35);
  color-scheme: dark;
}

body.light{
  --bg: #f6f7fb;
  --panel: rgba(0,0,0,.05);
  --panel2: rgba(0,0,0,.07);
  --stroke: rgba(0,0,0,.14);
  --text: rgba(0,0,0,.88);
  --muted: rgba(0,0,0,.64);
  --muted2: rgba(0,0,0,.50);
  --shadow: 0 16px 40px rgba(0,0,0,.12);
  color-scheme: light;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 10% 10%, rgba(106,228,255,.18), transparent 60%),
              radial-gradient(1000px 600px at 90% 20%, rgba(255,91,214,.14), transparent 62%),
              var(--bg);
  color: var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(8px);
}

.brand{display:flex; align-items:center; gap:12px;}
.logo{
  width:44px; height:44px;
  border-radius: 14px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(106,228,255,.25), rgba(255,91,214,.20));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  font-weight: 800;
  letter-spacing: .5px;
}

.title{font-weight: 800; font-size: 18px; line-height: 1.1}
.subtitle{font-size: 13px; color: var(--muted2)}

.top-actions{display:flex; gap:10px; align-items:center}

.layout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  padding: 14px;
}

@media (max-width: 980px){
  .layout{grid-template-columns: 1fr; }
}

.panel, .main{
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.panel{padding: 14px;}
.panel-title{font-weight: 700; margin: 10px 0 10px;}

.dropzone{
  position: relative;
  border-radius: var(--r);
  border: 1px dashed var(--stroke);
  background: rgba(255,255,255,.03);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  outline: none;
}
.dropzone:focus{box-shadow: 0 0 0 3px rgba(106,228,255,.18)}
.dropzone.dragover{
  border-color: rgba(106,228,255,.7);
  background: rgba(106,228,255,.10);
}
.dz-big{font-weight: 800; font-size: 16px;}
.dz-small{color: var(--muted); margin-top: 4px; font-size: 12px;}
.file{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}

.row{margin-top: 12px;}
.card{
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  padding: 10px;
}
.card-h{font-weight: 700; margin-bottom: 8px; font-size: 13px; color: var(--muted);}
img{
  max-width: 100%;
  display:block;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.08);
}

.controls label{display:block; margin: 10px 0 6px; font-size: 13px;}
.controls input[type="range"]{width:100%;}
.muted{color: var(--muted);}
.tiny{font-size: 12px;}

.toggles{
  display:flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 10px;
}
.toggle{
  display:flex;
  align-items:center;
  gap: 6px;
  background: rgba(0,0,0,.10);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.mode-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-top: 10px;
}
.seg{
  display:flex;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  overflow:hidden;
}
.seg-btn{
  border:0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  cursor:pointer;
  font-size: 12px;
}
.seg-btn.active{
  background: rgba(106,228,255,.14);
}

.btn-row{display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px;}
.btn{
  border: 1px solid rgba(106,228,255,.35);
  background: rgba(106,228,255,.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
  font-weight: 700;
}
.btn.ghost{
  border: 1px solid var(--stroke);
  background: transparent;
}
.btn:disabled{opacity:.55; cursor:not-allowed;}

.main{padding: 14px; display:grid; grid-template-columns: 1.2fr .8fr; gap: 14px;}
@media (max-width: 980px){ .main{grid-template-columns: 1fr;} }

.canvas-wrap{
  position: relative;
  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.08);
  overflow:hidden;
  min-height: 360px;
}
canvas{display:block; width:100%; height:auto;}
#overlay{
  position:absolute;
  inset:0;
  pointer-events:none;
}

.steps{
  background: rgba(0,0,0,.06);
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  padding: 12px;
}

.steps-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.steps-title{font-weight: 800;}
.steps-actions{display:flex; gap:10px; align-items:center;}

.step-card{
  margin-top: 10px;
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  padding: 12px;
  background: var(--panel2);
}
.step-title{font-weight: 800; margin-bottom: 6px;}
.step-text{line-height: 1.45;}
.step-hint{margin-top: 8px;}

.steps-list{
  margin-top: 12px;
  border-top: 1px solid var(--stroke);
  padding-top: 10px;
}
.steps-list ol{margin: 8px 0 0 18px; padding:0; line-height: 1.45;}