:root{
  --bg:#eef1f7; --ink:#111827; --muted:#6b7280; --line:#e5e9f0;
  --accent:#2f6df6; --accent-soft:#e8efff;
  --green:#0f9d70; --red:#ef4444; --amber:#f59e0b; --violet:#7c3aed;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  background:radial-gradient(1200px 620px at 18% -12%,#ffffff 0%,var(--bg) 62%);
  font-family:"PingFang SC","Microsoft YaHei",-apple-system,"Segoe UI",Roboto,sans-serif;
  color:var(--ink); -webkit-font-smoothing:antialiased; overflow:hidden;
}

.app{
  height:100vh; height:100dvh;
  display:grid;
  grid-template-columns:minmax(0,1fr) 232px;
  grid-template-rows:auto minmax(0,1fr) auto;
  grid-template-areas:
    "bar   bar"
    "stage side"
    "ctrl  ctrl";
  gap:10px;
  padding:12px 14px 14px;
}

.bar{grid-area:bar;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 4px;min-width:0}
.brand{display:flex;align-items:baseline;gap:10px;min-width:0}
.brand .dot{width:9px;height:9px;border-radius:50%;background:var(--accent);
  box-shadow:0 0 0 4px rgba(47,109,246,.14);align-self:center;flex:0 0 auto}
.brand h1{font-size:17px;margin:0;font-weight:700;white-space:nowrap}
.brand .sub{font-size:11px;color:#9aa4b2;letter-spacing:.16em;text-transform:uppercase;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.head-right{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.formula{font-size:12px;color:var(--muted);background:#fff;border:1px solid var(--line);
  padding:5px 12px;border-radius:999px;font-variant-numeric:tabular-nums;white-space:nowrap}
.formula b{color:var(--accent);font-weight:600}
.pill{font-size:11px;padding:4px 10px;border-radius:999px;background:#f1f4f9;
  color:var(--muted);font-weight:600;white-space:nowrap}
.pill.run{background:#ecfdf5;color:#047857}
.pill.pause{background:#fff7ed;color:#c2410c}
.pill.done{background:var(--accent-soft);color:var(--accent)}

.stage{grid-area:stage;background:#fff;border-radius:16px;overflow:hidden;min-height:0;
  box-shadow:0 10px 30px rgba(17,24,39,.07),0 1px 0 rgba(255,255,255,.9) inset;
  position:relative}
.stage canvas{display:block;width:100%;height:100%}

.side{grid-area:side;display:flex;flex-direction:column;gap:10px;min-height:0;overflow-y:auto}
.side::-webkit-scrollbar{width:5px}
.side::-webkit-scrollbar-thumb{background:#dde3ed;border-radius:3px}

.card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:11px 13px}
.card h2{font-size:10px;letter-spacing:.16em;color:#9aa4b2;font-weight:700;
  margin:0 0 7px;text-transform:uppercase}

.line{display:flex;justify-content:space-between;align-items:baseline;
  padding:2.5px 0;font-variant-numeric:tabular-nums;gap:8px}
.line span{font-size:11.5px;color:var(--muted);white-space:nowrap}
.line b{font-size:13px;font-weight:600;white-space:nowrap}
.line b.hi{color:var(--accent)}
.line b.g{color:var(--green)}
.line b.r{color:var(--red)}
.sep{height:1px;background:#f0f3f9;margin:6px 0}

.ctrl{grid-area:ctrl;background:#fff;border:1px solid var(--line);border-radius:14px;
  padding:11px 16px;display:flex;gap:16px;align-items:flex-end;flex-wrap:wrap}
.ctl{flex:1 1 118px;min-width:96px}
.ctl label{display:flex;justify-content:space-between;font-size:11px;
  color:var(--muted);margin-bottom:5px;gap:6px}
.ctl label b{color:var(--ink);font-variant-numeric:tabular-nums;font-weight:600}
input[type=range]{width:100%;height:4px;-webkit-appearance:none;appearance:none;
  background:#e5e9f0;border-radius:2px;outline:none;margin:0;display:block}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;
  border-radius:50%;background:var(--accent);cursor:pointer;
  box-shadow:0 1px 4px rgba(47,109,246,.4);border:0}
input[type=range]::-moz-range-thumb{width:14px;height:14px;border:0;border-radius:50%;
  background:var(--accent);cursor:pointer}

.btns{display:flex;gap:7px;flex:0 0 auto;align-items:center}
.btn{border:1px solid var(--line);background:#fff;color:var(--ink);
  font:inherit;font-size:12.5px;font-weight:600;padding:7px 14px;border-radius:9px;
  cursor:pointer;transition:all .12s ease;white-space:nowrap}
.btn:hover{border-color:#c7d2e4;background:#f8fafd}
.btn.primary{background:var(--accent);color:#fff;border-color:var(--accent)}
.btn.primary:hover{background:#2560e0;border-color:#2560e0}

.ebar{display:flex;align-items:center;gap:7px;margin-bottom:6px}
.ebar span{font-size:10px;color:var(--muted);width:14px;flex:0 0 auto;font-weight:700}
.ebar .track{flex:1;height:8px;background:#f1f4f9;border-radius:4px;overflow:hidden}
.ebar .fill{height:100%;border-radius:4px;transition:width .08s linear}
.ebar b{font-size:10px;width:36px;text-align:right;flex:0 0 auto;
  font-variant-numeric:tabular-nums;color:#475569}

.note{font-size:10.5px;color:#94a3b8;line-height:1.5;margin-top:6px}

@media (max-width:900px){
  body{overflow:auto}
  .app{
    height:auto; min-height:100dvh;
    grid-template-columns:1fr;
    grid-template-rows:auto auto auto auto;
    grid-template-areas:"bar" "stage" "side" "ctrl";
  }
  .stage{height:46vh;min-height:250px}
  .side{flex-direction:row;flex-wrap:wrap;overflow:visible}
  .side .card{flex:1 1 152px}
  .brand h1{font-size:15px}
  .brand .sub{display:none}
  .formula{display:none}
  .ctrl{gap:12px;padding:10px 12px}
  .ctl{flex:1 1 104px}
}
