:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --border: #1e1e1e;
  --fg: #ffffff;
  --muted: #888888;
  --accent: #0080ff;
  --accent-dim: #0060cc;
  --live: #00d68f;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 640px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  width: 100%;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-logo { width: 36px; height: 36px; }

.topbar-back {
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-back:hover { color: var(--fg); }

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 3rem;
}

.container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: var(--max);
  width: 100%;
  text-align: center;
}

.eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lead {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
}

.control label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.control input[type="range"] {
  width: 120px;
  accent-color: var(--accent);
}

.control span {
  font-size: 0.75rem;
  color: var(--muted);
}

.control select {
  background: #0d0d0d;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  width: 120px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

button {
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

button:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.7rem 1.25rem;
}

.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }

#status {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  min-height: 1.25rem;
}

#status.ok { color: var(--live); }
#status.error { color: #f87171; }
#status.busy { color: var(--accent); }

.player-wrap {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.5rem;
}

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.roll-scroll {
  background: #0a0a0a;
  border-radius: var(--radius);
  margin-top: 0.75rem;
  padding: 0.5rem;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

#rollCanvas { display: block; }

.note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1.25rem;
  line-height: 1.5;
}

.hidden { display: none !important; }
