* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  background: #06060c;
  color: #e6e8ef;
  font: 13px/1.45 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.stage { display: flex; flex-direction: column; min-width: 0; height: 100vh; padding: 12px; gap: 8px; }
.viewport { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewport canvas { max-width: 100%; max-height: 100%; background: #111; border-radius: 6px; }
.caption { margin: 0; color: #8b93a7; font-size: 12px; }

.panel { height: 100vh; overflow-y: auto; background: #10121a; border-left: 1px solid #2a2f3d; padding: 14px 16px 40px; }
h1 { font-size: 15px; margin: 0 0 2px; }
.sub { color: #8b93a7; font-size: 12px; margin: 0 0 12px; }
h2 { font-size: 12px; color: #8b93a7; font-weight: 600; margin: 18px 0 6px; letter-spacing: .04em; }
a { color: #8fb0ff; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
button { font: inherit; background: #222838; color: #e6e8ef; border: 1px solid #343b4f; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button.primary { background: #3b6df0; border-color: #3b6df0; }
button.on { background: #34405e; border-color: #5d77c9; }
button:disabled { opacity: .5; cursor: default; }
.result { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #1a1e2a; }
.big { font-size: 22px; font-weight: 700; }
.hit { color: #4ed07a; } .miss { color: #ff6b5e; } .none { color: #8b93a7; }
.stats { color: #b8bfd0; font-size: 12px; margin-top: 4px; }
.status { color: #f2c14e; font-size: 12px; min-height: 16px; margin-top: 6px; }
canvas.chart { width: 100%; background: #0b0d13; border-radius: 6px; display: block; margin-top: 8px; }
canvas.chart.light { background: #fff; }
.grid { display: grid; grid-template-columns: 1fr 96px 46px; gap: 4px 8px; align-items: center; }
.grid label { color: #c7cddb; }
.grid input { width: 100%; background: #0b0d13; color: #e6e8ef; border: 1px solid #343b4f; border-radius: 5px; padding: 3px 6px; font: inherit; }
.grid input[type=color] { padding: 0; height: 24px; }
.grid input[type=range] { grid-column: 1 / -1; padding: 0; border: 0; background: transparent; accent-color: #3b6df0; margin: -2px 0 4px; }
.unit { color: #8b93a7; font-size: 12px; }
.derived { font-size: 12px; color: #b8bfd0; background: #1a1e2a; border-radius: 6px; padding: 8px 10px; margin-top: 8px; }
.derived b { color: #e6e8ef; font-weight: 600; }
.tagrow { display: flex; gap: 10px; align-items: center; }
.tagrow img { width: 72px; height: 72px; background: #fff; border-radius: 4px; object-fit: contain; flex: none; }
.tagrow .name { font-size: 12px; color: #b8bfd0; word-break: break-all; }
.strip { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 6px; margin-top: 6px; }
.strip button { padding: 2px; flex: none; display: flex; flex-direction: column; align-items: center; font-size: 10px; }
.strip img { width: 34px; height: 34px; background: #fff; border-radius: 3px; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 0 6px; }
.seg button { padding: 3px 8px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
th, td { text-align: right; padding: 3px 4px; border-bottom: 1px solid #262b39; }
th:first-child, td:first-child { text-align: left; }
.check { display: flex; gap: 6px; align-items: center; color: #c7cddb; margin-top: 8px; }
.note { color: #8b93a7; font-size: 12px; margin-top: 6px; }
.experiment { background: #1a1e2a; border-radius: 6px; padding: 8px 10px; margin-top: 8px; font-size: 12px; color: #b8bfd0; }
.experiment .row { margin-top: 6px; }
.experiment button { font-size: 12px; padding: 3px 8px; }

@media (max-width: 900px) {
  body { display: block; height: auto; }
  .stage { height: auto; position: sticky; top: 0; z-index: 1; background: #06060c; padding: 6px; }
  .viewport canvas { width: 100%; max-height: 38vh; object-fit: contain; }
  .caption { display: none; }
  .panel { height: auto; border-left: 0; }
}
