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

:root {
  --bg: #0d0d11;
  --surface: #16161d;
  --border: #232330;
  --text: #e0e0e8;
  --muted: #55556a;
  --accent: #6c63ff;
  --accent-h: #5a52e0;
  --green: #2ecc71;
  --orange: #e67e22;
  --red: #e74c3c;
  --blue: #3498db;
  --grey: #555568;
  --radius: 10px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ── Login ── */
.login-box {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 340px;
  text-align: center;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  margin-bottom: 4px;
}

.logo-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 32px;
}

.login-box form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.login-box input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}

.login-box input:focus { border-color: var(--accent); }

.login-box button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  padding: 12px 16px;
  cursor: pointer;
  display: flex; align-items: center;
  transition: background .15s;
}

.login-box button:hover { background: var(--accent-h); }
.error-msg { color: var(--red); font-size: 13px; min-height: 18px; }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Main ── */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Form ── */
.url-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.url-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

.url-row input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-h); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.form-options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.format-toggle {
  display: flex;
  gap: 8px;
}

.radio-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color .15s;
  user-select: none;
}

.radio-btn input { display: none; }
.radio-btn.active { border-color: var(--accent); color: var(--accent); }

.gdrive-row { flex: 1; min-width: 200px; }

.gdrive-row input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

.gdrive-row input:focus { border-color: var(--accent); }
.gdrive-row input::placeholder { color: var(--muted); }

/* ── Preview ── */
.preview {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.preview-thumb {
  width: 100px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.preview-title {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-meta { font-size: 12px; color: var(--muted); }

/* ── Section head ── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Tasks ── */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.task-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.task-thumb-empty {
  width: 80px;
  height: 45px;
  background: var(--border);
  border-radius: 6px;
  flex-shrink: 0;
}

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.task-format { font-size: 11px; color: var(--muted); }

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .3s;
}

.drive-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.drive-link:hover { text-decoration: underline; }

.task-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  word-break: break-all;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: #1a3a2a; color: var(--green); }
.badge-blue   { background: #1a2a3a; color: var(--blue); }
.badge-orange { background: #3a2a1a; color: var(--orange); }
.badge-red    { background: #3a1a1a; color: var(--red); }
.badge-grey   { background: #1e1e2a; color: var(--muted); }

/* ── Buttons ── */
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  font-family: inherit;
}

.btn-ghost:hover { border-color: var(--text); color: var(--text); }

.btn-small { padding: 4px 10px; font-size: 11px; }

.btn-auth {
  display: inline-block;
  padding: 5px 12px;
  background: #1a2a1a;
  color: var(--green);
  border: 1px solid #2a4a2a;
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
  transition: background .15s;
}

.btn-auth:hover { background: #203520; }

/* ── Cookies ── */
.cookies-card { padding: 14px 20px; }

.cookies-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cookies-info { display: flex; flex-direction: column; gap: 3px; }

.cookies-label { font-size: 13px; font-weight: 500; color: var(--text); }
.cookies-label.ok { color: var(--green); }

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

.btn-upload {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
  font-family: inherit;
}

.btn-upload:hover { border-color: var(--accent); color: var(--accent); }
.btn-upload.uploading { opacity: .6; pointer-events: none; }

@media (max-width: 500px) {
  header { padding: 12px 16px; }
  main { padding: 16px 12px; }
  .url-row { flex-direction: column; }
  .form-options { flex-direction: column; }
  .gdrive-row { min-width: unset; width: 100%; }
}
