* { box-sizing: border-box; }
:root {
  --bg: #0f0f14;
  --surface: #1a1a23;
  --surface-2: #23232f;
  --text: #f2f2f7;
  --muted: #9a9aa8;
  --primary: #7c3aed;
  --primary-dark: #6025c9;
  --danger: #ef4444;
  --success: #22c55e;
  --border: #2e2e3d;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

.screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); padding: 28px 24px; border-radius: var(--radius); border: 1px solid var(--border); }
.login-card h1 { margin: 0 0 4px; font-size: 26px; }
.login-card p { margin-top: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=datetime-local], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 15px;
}
textarea { font-family: inherit; resize: vertical; }
input[type=range] { width: 100%; }

.btn { border: none; border-radius: 12px; padding: 13px 18px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--primary); color: white; width: 100%; margin-top: 18px; }
.btn.primary:active { background: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.icon-btn { background: transparent; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

.error-text { color: var(--danger); font-size: 13px; min-height: 18px; }
.saved-text { color: var(--success); text-align: center; margin-top: 10px; }

.app { display: flex; flex-direction: column; height: 100dvh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; }

#views { flex: 1; overflow-y: auto; padding: 18px; padding-bottom: 90px; }
.view h2 { margin: 0 0 16px; font-size: 20px; }

.dropzone {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px 20px;
  color: var(--muted); background: var(--surface); cursor: pointer; min-height: 180px;
}
#upload-progress { text-align: center; margin-top: 20px; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hint { color: var(--muted); font-size: 13px; margin-top: 14px; line-height: 1.5; }
.hint.small { font-size: 12px; margin-top: 6px; }

.empty-state { color: var(--muted); text-align: center; padding: 40px 0; }

.review-card, .queue-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.review-video { width: 100%; max-height: 420px; border-radius: 10px; background: black; display: block; }
.review-caption { margin-top: 14px; }
.checkbox-row, .schedule-row { display: flex; gap: 18px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.checkbox input { width: 18px; height: 18px; }
.schedule-input { margin-top: 10px; }
.action-row { display: flex; gap: 10px; margin-top: 16px; }
.action-row .btn { margin-top: 0; flex: 1; }
.post-error { color: var(--danger); font-size: 13px; margin-top: 10px; }

.queue-card { display: flex; gap: 12px; align-items: center; }
.queue-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #000; flex-shrink: 0; }
.queue-info { flex: 1; min-width: 0; }
.queue-caption { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; margin-top: 4px; }
.status-badge.scheduled { background: #4338ca44; color: #a5b4fc; }
.status-badge.posted { background: #16653444; color: #86efac; }
.status-badge.failed { background: #7f1d1d44; color: #fca5a5; }
.status-badge.processing, .status-badge.publishing { background: #78350f44; color: #fcd34d; }
.status-badge.ready { background: #1e40af44; color: #93c5fd; }

.watermark-preview { display: flex; align-items: center; margin-top: 8px; }
.watermark-preview img { max-height: 70px; border-radius: 8px; background: repeating-conic-gradient(#33333a 0% 25%, #26262e 0% 50%) 50% / 14px 14px; padding: 6px; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 18px; padding: 4px 14px 14px; }
legend { padding: 0 6px; font-weight: 600; font-size: 14px; }

.tabbar {
  display: flex; border-top: 1px solid var(--border); background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: transparent; border: none; color: var(--muted); padding: 10px 0 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; cursor: pointer;
}
.tab span { font-size: 18px; }
.tab.active { color: var(--primary); }

@media (min-width: 720px) {
  #views { max-width: 640px; margin: 0 auto; width: 100%; }
}
