:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121418;
  --bg-glow: rgba(110, 231, 183, 0.08);
  --panel: #1b1f27;
  --line: #2c3340;
  --text: #e8eaef;
  --muted: #9aa3b2;
  --accent: #6ee7b7;
  --accent-2: #93c5fd;
  --danger: #fca5a5;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --input: #10131a;
  --btn: #151922;
  --video: #0b0d11;
  --card: #10131a;
  --hover: rgba(255, 255, 255, 0.04);
  --bar-track: #0e1117;
  --primary-ink: #082016;
  --lightbox: rgba(6, 8, 12, 0.92);
  --strip: rgba(0, 0, 0, 0.45);
  --nav: rgba(21, 25, 34, 0.9);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-glow: rgba(16, 124, 92, 0.1);
  --panel: #ffffff;
  --line: #d8dee8;
  --text: #1b2230;
  --muted: #5d6675;
  --accent: #0f9f70;
  --accent-2: #2563eb;
  --danger: #c24141;
  --shadow: 0 10px 28px rgba(28, 40, 58, 0.08);
  --input: #f7f8fb;
  --btn: #eef1f6;
  --video: #111318;
  --card: #f7f8fb;
  --hover: rgba(15, 23, 42, 0.04);
  --bar-track: #e4e8ef;
  --primary-ink: #06281c;
  --lightbox: rgba(248, 250, 252, 0.94);
  --strip: rgba(255, 255, 255, 0.72);
  --nav: rgba(255, 255, 255, 0.92);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--bg-glow), transparent 50%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.02em;
}

.theme-toggle {
  flex: 0 0 auto;
  min-width: 76px;
}

.sub {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.drop {
  margin: 24px 0;
  padding: 28px;
  text-align: center;
  border-style: dashed;
}

.drop.over {
  border-color: var(--accent);
  background: rgba(110, 231, 183, 0.06);
}

.drop-copy {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 16px;
}

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

.link,
button.link {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 16px;
}

.preview-wrap {
  padding: 12px;
  min-height: 280px;
}

video {
  width: 100%;
  max-height: 360px;
  background: var(--video);
  border-radius: 10px;
  display: block;
}

.meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}

.controls {
  padding: 16px 18px 18px;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.choice:hover {
  background: var(--hover);
}

.choice b {
  display: block;
}

.choice small {
  color: var(--muted);
}

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

.row label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.grow {
  flex: 1;
}

input[type="number"],
select {
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  width: 92px;
}

select {
  width: auto;
}

input[type="range"] {
  flex: 1;
}

.estimate {
  margin: 14px 0 0;
  color: var(--accent-2);
  font-size: 13px;
}

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

button {
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  color: var(--primary-ink);
  border-color: transparent;
  font-weight: 650;
}

.progress {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar {
  flex: 1;
  height: 8px;
  background: var(--bar-track);
  border-radius: 99px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.results {
  margin-top: 16px;
  padding: 16px;
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.results-head h2 {
  margin: 0;
  font-size: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
  display: block;
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: stretch;
  background: var(--lightbox);
  padding: 48px 72px 0;
}

.lightbox[hidden] {
  display: none;
}

.lb-stage {
  margin: 0;
  flex: 1;
  min-height: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.lb-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 160px);
  max-height: calc(100vh - 196px);
  object-fit: contain;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
}

.lb-stage figcaption {
  color: var(--muted);
  font-size: 13px;
}

.lb-strip-wrap {
  flex: 0 0 96px;
  width: 100vw;
  margin-top: 8px;
  padding: 8px 16px 12px;
  background: var(--strip);
  border-top: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
}

.lb-strip {
  display: flex;
  gap: 6px;
  height: 76px;
  width: max-content;
}

.lb-thumb {
  flex: 0 0 112px;
  height: 76px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: var(--video);
}

.lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.lb-thumb.active {
  border-color: var(--accent);
}

.lb-close,
.lb-nav {
  position: absolute;
  background: var(--nav);
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
}

.lb-close {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
}

.lb-nav {
  top: 42%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  border-radius: 12px;
  font-size: 36px;
  line-height: 1;
}

.lb-nav.prev {
  left: 16px;
}

.lb-nav.next {
  right: 16px;
}

.lb-nav:disabled {
  opacity: 0.25;
}

.card footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

.card a {
  color: var(--accent-2);
}

.warn {
  color: var(--danger);
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
