:root {
  --fg: #111;
  --bg: #fff;
  --line: #ccc;
  --muted: #777;
  --panel: #f4f4f4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e8;
    --bg: #0d0d0d;
    --line: #333;
    --muted: #888;
    --panel: #191919;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

h1 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

p.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0;
}

section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 12px 0;
  background: var(--bg);
}

.videowrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

video {
  width: 100%;
  max-height: 40vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: block;
  object-fit: contain;
}

button {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 4px;
  padding: 7px 12px;
  margin: 4px 6px 4px 0;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--panel); }
button:disabled { color: var(--muted); border-color: var(--line); cursor: default; }
button.primary { background: var(--fg); color: var(--bg); }
button.primary:hover:not(:disabled) { opacity: 0.85; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

select {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 4px;
  padding: 6px 8px;
  max-width: 100%;
}
select:disabled { color: var(--muted); border-color: var(--line); }
input[type="range"] { accent-color: var(--fg); }

label.file {
  display: inline-block;
  border: 1px solid var(--fg);
  border-radius: 4px;
  padding: 7px 12px;
  margin: 4px 6px 4px 0;
  cursor: pointer;
}
label.file input { display: none; }

pre.out {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  margin: 8px 0 0;
  max-height: 240px;
  overflow: auto;
}
pre.out:empty { display: none; }

table.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 8px;
}
table.kv td {
  border: 1px solid var(--line);
  padding: 3px 8px;
  vertical-align: top;
}
table.kv td:first-child { color: var(--muted); white-space: nowrap; width: 1%; }

.footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.status { font-size: 12px; color: var(--muted); min-height: 1.2em; }
.ok { color: var(--fg); font-weight: 600; }
.warn { color: var(--muted); font-style: italic; }
