:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --panel: #171a21;
  --card: #1f2430;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --accent: #7aa2f7;
  --border: #2a3140;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 12px 28px 0;
}

.top-nav {
  display: flex;
  gap: 16px;
  padding: 0 28px 8px;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.top-nav a:hover {
  color: var(--text);
}

.tab {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  color: #0b0e14;
  border-color: transparent;
}

.tab-panel[hidden] {
  display: none;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.site-header h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.site-header p {
  margin: 0;
  color: var(--muted);
}

.status {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px 28px 40px;
}

.batch {
  padding: 24px 28px 40px;
}

.video {
  padding: 24px 28px 40px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

progress {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: #0b0e14;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.preset-preview {
  max-height: 180px;
}

.clip-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clip-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clip-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.clip-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.clip-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.clip-controls label {
  min-width: 140px;
}

.video-preview {
  width: 100%;
  max-height: 280px;
  background: #0b0e14;
  border: 1px solid var(--border);
  border-radius: 10px;
}

button.tiny {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.row.compact {
  gap: 8px;
  margin-top: 0;
}

.row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.control {
  margin-bottom: 12px;
}

.control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.control input[type="range"] {
  width: 100%;
}

output {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.file-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px dashed var(--border);
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.file-input span {
  font-size: 0.9rem;
  color: var(--muted);
}

.file-input input[type="file"] {
  width: 100%;
}

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

button {
  background: var(--accent);
  color: #0b0e14;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

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

.preview-wrap {
  width: 100%;
  background: #0b0e14;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  min-height: 240px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-wrap.crop-active {
  cursor: crosshair;
}

.crop-overlay[hidden] {
  display: none;
}

canvas {
  max-width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}

.crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 2;
}

.crop-rect {
  position: absolute;
  border: 2px solid rgba(122, 162, 247, 0.9);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.crop-rect::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(255, 255, 255, 0.6);
}

.crop-rect .handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.crop-rect .handle.tl {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.crop-rect .handle.tr {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.crop-rect .handle.bl {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.crop-rect .handle.br {
  bottom: -8px;
  right: -8px;
  cursor: nwse-resize;
}

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

details summary {
  cursor: pointer;
  margin-bottom: 12px;
  font-weight: 600;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0b0e14;
  border-radius: 8px;
  padding: 12px;
  max-height: 240px;
  overflow: auto;
  font-size: 0.8rem;
}

.content-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-question {
  font-weight: 600;
  margin: 12px 0 4px;
}
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

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