:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2125;
  --muted: #646b73;
  --border: #d9dde2;
  --accent: #1a73e8;
  --error: #c5221f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --panel: #161b22;
    --text: #e6edf3;
    --muted: #8b949e;
    --border: #30363d;
    --accent: #58a6ff;
    --error: #ff7b72;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Roboto, system-ui, sans-serif;
}

main {
  max-width: 1100px;
  margin: 0 auto;
}

nav {
  font-size: 13px;
  margin-bottom: 8px;
}

a {
  color: var(--accent);
}

h1 {
  font-size: 24px;
  margin: 0 0 4px;
}

h1 code {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--muted);
}

p {
  margin: 0 0 12px;
  max-width: 70ch;
}

code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}

input[type="text"] {
  flex: 1 1 320px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  font: inherit;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
}

select,
button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--muted);
}

.examples button {
  padding: 2px 8px;
  font-size: 12px;
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 24px;
  color: var(--muted);
}

.status progress {
  width: 160px;
  height: 6px;
  accent-color: var(--accent);
}

.status progress[hidden] {
  display: none;
}

.status.error {
  color: var(--error);
}

.result {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.result[hidden] {
  display: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.toolbar .spacer {
  flex: 1;
}

.toolbar button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.view {
  position: relative;
  background: #000;
}

.view canvas {
  display: block;
  width: 100%;
}

.sphere {
  aspect-ratio: 16 / 9;
  max-height: 75vh;
  cursor: grab;
  touch-action: none;
}

.sphere:active {
  cursor: grabbing;
}

.sphere canvas {
  height: 100%;
}

.hint {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 12px;
  pointer-events: none;
}

.credit {
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.credit:empty {
  display: none;
}
