* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root{
  --bg:#0f1115; --panel:#171a21; --card:#1e222b; --line:#2a2f3a;
  --txt:#e8eaed; --mut:#9aa0ac; --accent:#e8552d; --accent2:#f2763f;
}
html,body{height:100%;}
body{
  font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg); color:var(--txt);
  display:flex; flex-direction:column; height:100vh; overflow:hidden;
}
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px; background:var(--panel); border-bottom:1px solid var(--line);
  flex-shrink:0;
}
.brand{font-weight:700; letter-spacing:1px; font-size:15px;}
.tabs{display:flex; gap:6px;}
.tab{
  background:transparent; color:var(--mut); border:1px solid transparent;
  padding:7px 18px; border-radius:8px; font-size:14px; font-weight:600; cursor:pointer;
}
.tab.active{color:#fff; background:var(--accent);}

.view{display:none; flex:1; min-height:0; overflow:hidden;}
.view.active{display:flex;}

.panel{
  width:320px; flex-shrink:0; background:var(--panel); border-right:1px solid var(--line);
  padding:14px; overflow-y:auto;
}
.stage{
  flex:1; min-width:0; display:flex; align-items:center; justify-content:center;
  padding:16px; background:#0a0c0f;
}
.canvas-wrap{
  position:relative; max-width:100%; max-height:100%;
  display:flex; align-items:center; justify-content:center;
}
canvas{
  max-width:100%; max-height:calc(100vh - 90px);
  background:#000; border-radius:8px; touch-action:none; display:block;
}
.empty{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  color:var(--mut); font-size:15px; pointer-events:none;
}

.group{margin:14px 0; padding-bottom:12px; border-bottom:1px solid var(--line);}
.group-title{font-size:12px; color:var(--mut); text-transform:uppercase; letter-spacing:.5px; margin-bottom:8px;}
.btn{
  background:var(--card); color:var(--txt); border:1px solid var(--line);
  padding:11px 14px; border-radius:9px; font-size:14px; font-weight:600; cursor:pointer;
  text-align:center; display:inline-block;
}
.btn:active{transform:scale(.98);}
.btn.block{display:block; width:100%; margin:4px 0;}
.btn.primary{background:var(--accent); border-color:var(--accent); color:#fff;}
.input{
  width:100%; background:var(--card); border:1px solid var(--line); color:var(--txt);
  padding:10px 12px; border-radius:9px; font-size:14px; margin-bottom:8px;
}
.chips{display:flex; flex-wrap:wrap; gap:6px;}
.chip{
  background:var(--card); color:var(--mut); border:1px solid var(--line);
  padding:8px 14px; border-radius:20px; font-size:13px; font-weight:600; cursor:pointer;
}
.chip.active{background:var(--accent); color:#fff; border-color:var(--accent);}
.slider{display:flex; align-items:center; gap:10px; font-size:13px; color:var(--mut); margin:7px 0;}
.slider input[type=range]{flex:1; accent-color:var(--accent);}
.slider.grow{flex:1;}
.row{display:flex; align-items:center; gap:10px; margin:6px 0;}
.row input[type=color]{width:44px; height:38px; border:none; background:none; border-radius:8px; cursor:pointer;}
.times{display:flex; justify-content:space-between; font-size:12px; color:var(--mut); margin-top:4px;}
.hint{font-size:12px; color:var(--mut); margin-top:10px; line-height:1.5;}
.progress{display:flex; align-items:center; gap:10px; margin-top:10px;}
.progress .bar{flex:1; height:8px; background:var(--card); border-radius:6px; overflow:hidden; position:relative;}
.progress .bar::after{content:""; position:absolute; left:0; top:0; bottom:0; width:var(--p,0%); background:var(--accent);}
#vProgTxt{font-size:12px; color:var(--mut); min-width:36px; text-align:right;}

@media (max-width:760px){
  .view.active{flex-direction:column;}
  .panel{width:100%; border-right:none; border-top:1px solid var(--line); order:2; max-height:50vh;}
  .stage{order:1; flex:1; padding:10px;}
  canvas{max-height:46vh;}
}
