:root {
  color-scheme: dark;
  --bg: #071018;
  --bg-2: #0c1822;
  --panel: #10202c;
  --line: #1e3344;
  --text: #e8f0f6;
  --muted: #8aa0b3;
  --accent: #3db8c8;
  --warn: #e0b15a;
  --danger: #e07a6a;
  --tap: 44px;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 14px calc(24px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.brand,
.brand:link,
.brand:visited,
.brand:hover,
.brand:active {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  font-size: 20px;
  flex: 0 0 auto;
  line-height: 1;
}
.brand span { color: var(--accent); }
.tag {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-align: right;
}

.stage {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
}
video { width: 100%; display: block; max-height: 48dvh; background: #000; }
video:not([data-ready]) {
  display: none !important;
  width: 0;
  height: 0;
}
.stage .empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 20px 16px;
  line-height: 1.4;
  font-size: 14px;
}
.stage .empty[hidden] { display: none; }
.timecode {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  background: rgba(7, 16, 24, 0.78);
  padding: 3px 8px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  pointer-events: none;
}
.timecode:empty { display: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.actions .btn.primary { flex: 1 1 140px; }

.btn {
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: var(--accent);
  color: #062026;
  border-color: transparent;
  font-weight: 700;
}
.btn.ghost { background: transparent; }
.btn:disabled,
.file-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.file-btn[aria-disabled="true"] { pointer-events: none; }
.file {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.err { color: var(--danger); font-size: 13px; white-space: pre-wrap; margin: 6px 0 0; }

.progress {
  height: 4px;
  background: #132533;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; }

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.card h2 span { text-transform: none; letter-spacing: 0; font-weight: 500; }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
label.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
label.field input,
label.field select {
  min-height: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.pill[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

details.card { padding: 0; }
details.card > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: "Show";
  float: right;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--accent);
}
details.card[open] > summary::after { content: "Hide"; }
details.card .pad { padding: 0 12px 12px; }

.film {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.cell {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.cell img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.cell span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 16, 24, 0.78);
  font-size: 11px;
  padding: 3px 6px;
}

.safe {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 10px;
  line-height: 1.4;
}

.lock {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 18px;
  margin: 8px 0 16px;
}
.lock h2 { margin: 0 0 8px; font-size: 20px; }
.lock p { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0 0 16px; }
.lock a.btn { display: inline-flex; align-items: center; text-decoration: none; }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
