:root {
  --bg: #0a0e14;
  --surface: #141b24;
  --border: #2a3441;
  --text: #e7edf4;
  --muted: #8b98a8;
  --accent: #22c55e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
.bar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.bar h1 { margin: 0.25rem 0 0; font-size: 1.15rem; }
.bar .ver { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.bar .hint { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }
.back { color: var(--accent); text-decoration: none; font-size: 0.9rem; }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 86px);
}
.sidebar {
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  min-height: 0;
}
.step { display: grid; gap: 0.5rem; }
.step-title {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
label { display: grid; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
select, input[type="range"] { width: 100%; }
.meta, .status, .value-label {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}
.step button, .link-btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-size: 0.8rem;
}
.step button:hover:not(:disabled), .link-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.step button:disabled { opacity: 0.45; cursor: not-allowed; }

.viewport-wrap {
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#frame-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.viewport-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - 86px);
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 42vh;
  }
}
