:root {
  color-scheme: light;
  --ink: #16181d;
  --muted: #667085;
  --line: #d7dde7;
  --panel: #ffffff;
  --bg: #eef2f6;
  --accent: #147c72;
  --accent-dark: #0c5f58;
  --warn: #b54708;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

.panel,
.preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 720;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 13px;
}

.pill.ready {
  color: var(--accent-dark);
  border-color: #9bd8d0;
  background: #e8f7f5;
}

.pill.missing {
  color: var(--warn);
  border-color: #fedf89;
  background: #fffaeb;
}

.upload {
  display: grid;
  gap: 16px;
}

.drop {
  min-height: 148px;
  border: 1px dashed #98a2b3;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 16px;
  cursor: pointer;
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
}

.drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.controls {
  display: grid;
  gap: 12px;
}

.controls label {
  display: grid;
  grid-template-columns: 92px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.controls select,
.controls input[type="range"] {
  width: 100%;
}

.controls select {
  grid-column: span 2;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
}

button,
.download {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

button:hover,
.download:hover {
  background: var(--accent-dark);
}

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

.status {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.meter {
  height: 10px;
  background: #e4e7ec;
  border-radius: 999px;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

#statusText {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

#statusText.error {
  color: var(--bad);
}

.preview {
  min-height: 420px;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 12px;
}

.preview video {
  width: 100%;
  max-height: calc(100vh - 88px);
  background: #0b0f16;
  border-radius: 6px;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    margin: 16px auto;
  }

  .preview {
    min-height: 240px;
  }
}
