/* SemShorts: paleta inspirada no YouTube (modo escuro e claro automáticos) */
:root {
  --bg: #0f0f0f;
  --surface: #181818;
  --surface-2: #212121;
  --surface-3: #272727;
  --surface-4: #3f3f3f;
  --border: #303030;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --accent: #ff0033;
  --accent-hover: #e0002d;
  --accent-soft: rgba(255, 0, 51, .14);
  --focus: #3ea6ff;
  --ok: #2ba640;
  --warn: #f2b300;
  --radius: 12px;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f2f2f2;
    --surface-3: #e5e5e5;
    --surface-4: #d9d9d9;
    --border: #e5e5e5;
    --text: #0f0f0f;
    --muted: #606060;
    --accent-soft: rgba(255, 0, 51, .08);
    --focus: #065fd4;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
img { display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.text { color: var(--text); }
.sm { font-size: 12px; }
.center { text-align: center; }
.accent { color: var(--accent); }
.ic { width: 20px; height: 20px; flex: none; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -.03em; }
.logo { width: 32px; height: 24px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav form { margin: 0; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 18px; background: none; color: var(--text);
  font: 500 14px var(--font); cursor: pointer; transition: background .15s;
}
.nav-link:hover { background: var(--surface-3); }
.nav-link.active { background: var(--surface-2); }
.nav-link.active .ic { color: var(--accent); }

.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* Hero + busca no estilo da barra do YouTube */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; letter-spacing: -.03em; }
.lead { color: var(--muted); font-size: 16px; max-width: 520px; margin: 12px auto 28px; }
.search { display: flex; max-width: 620px; margin: 0 auto; }
.search input {
  flex: 1; min-width: 0; height: 48px; padding: 0 20px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-right: 0; border-radius: 24px 0 0 24px;
  font: 400 16px var(--font); transition: border-color .15s, box-shadow .15s;
}
@media (prefers-color-scheme: dark) { .search input { background: #121212; } }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--focus); box-shadow: inset 0 1px 2px rgba(0,0,0,.3); }
.search-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border: 0; border-radius: 0 24px 24px 0;
  background: var(--accent); color: #fff; font: 500 15px var(--font); cursor: pointer;
  transition: background .15s;
}
.search-btn:hover { background: var(--accent-hover); }
.search-btn:disabled { cursor: progress; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border: 0; border-radius: 18px;
  font: 500 14px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-soft:hover { background: var(--surface-3); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 40px; }
.btn.copied, .icon-btn.copied { background: var(--ok); color: #fff; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: none; color: var(--text); cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.danger:hover { color: var(--accent); background: var(--accent-soft); }

/* Cartões */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
@media (prefers-color-scheme: dark) { .card { border-color: transparent; } }

.result { padding: 24px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.channel-head { display: flex; align-items: center; gap: 16px; }
.channel-meta { flex: 1; min-width: 0; }
.channel-meta h2 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-meta p { margin: 2px 0 0; }
.avatar { width: var(--s); height: var(--s); border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }
.avatar-empty { display: grid; place-items: center; font-weight: 700; font-size: calc(var(--s) * .42); color: #fff; background: var(--accent); }

.feed-box { margin-top: 20px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); }
.label { display: flex; align-items: center; gap: 6px; font-weight: 500; margin-bottom: 10px; }
.label .ic { color: var(--accent); width: 18px; height: 18px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input {
  flex: 1; min-width: 0; height: 36px; padding: 0 14px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: 400 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.row-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: 13px; }
.row-links a { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.row-links a:hover { color: var(--accent); }
.row-links .ic { width: 16px; height: 16px; }
.native { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.native summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.native summary:hover { color: var(--text); }

.section-title { font-size: 16px; margin: 24px 0 12px; }
.videos { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.video { display: flex; gap: 12px; padding: 6px; border-radius: 10px; transition: background .15s; }
.video:hover { background: var(--surface-2); }
.thumb { width: 168px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface-3); flex: none; }
.v-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 2px; }
.v-title { font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Alertas */
.alert { padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; font-size: 14px; animation: rise .2s ease-out; }
.alert-error { background: var(--accent-soft); color: var(--text); border-left: 3px solid var(--accent); }
.alert-success { background: rgba(43,166,64,.14); border-left: 3px solid var(--ok); }

/* Páginas internas */
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 20px; }
.page-head h1 { font-size: 24px; }
.empty { padding: 40px 24px; text-align: center; }
.empty p { color: var(--muted); margin: 0 0 16px; }
.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed-row { display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 16px; }
.feed-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-title { font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-title:hover { color: var(--accent); }
.feed-actions { display: flex; align-items: center; gap: 2px; }
.feed-actions form { margin: 0; }

.form-card { padding: 24px; margin-bottom: 16px; }
.form-card h2 { font-size: 17px; margin-bottom: 16px; }
.form-card > p { margin: -8px 0 16px; }
.form { display: grid; gap: 16px; }
.form.inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.form.inline p { margin: 0; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 500; font-size: 13px; }
.field small { color: var(--muted); font-size: 12px; }
.field input {
  height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: 400 14px var(--font);
}
.field input:focus { outline: none; border-color: var(--focus); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.track { width: 36px; height: 20px; border-radius: 10px; background: var(--surface-4); position: relative; transition: background .2s; flex: none; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px;
  border: 1.5px dashed var(--surface-4); border-radius: var(--radius); cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.has-file { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop .ic { width: 28px; height: 28px; color: var(--muted); }
.drop-text { font-weight: 500; }
.drop small { color: var(--muted); }
.backup-list { list-style: none; margin: 0; padding: 0; }
.backup-list li { display: flex; align-items: center; gap: 12px; padding: 4px 0; border-top: 1px solid var(--border); }
.backup-list li span:first-child { flex: 1; font: 12px ui-monospace, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; }

/* Login / instalador */
.auth { max-width: 380px; margin: 48px auto; padding: 32px; display: grid; gap: 16px; }
.auth.wide { max-width: 520px; }
.auth > .logo { width: 48px; height: 36px; margin: 0 auto; }
.auth h1 { text-align: center; font-size: 22px; }
.auth .muted.center { margin: -8px 0 0; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.checks li { display: flex; align-items: center; gap: 10px; }
.dot { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-weight: 700; font-size: 12px; color: #fff; flex: none; }
.dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.checks .ok .dot { background: var(--ok); }
.checks .fail .dot { background: var(--accent); }
.checks .warn .dot { background: var(--warn); color: #000; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 20px; border-radius: 8px; background: var(--text); color: var(--bg);
  font-weight: 500; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .nav-link span { display: none; }
  .nav-link { width: 40px; padding: 0; justify-content: center; }
  .hero { padding: 24px 0 20px; }
  .search-btn { padding: 0 18px; }
  .result, .form-card { padding: 18px; }
  .thumb { width: 128px; }
  .copy-field .btn span { display: none; }
  .copy-field .btn { width: 36px; padding: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .channel-head .btn span { display: none; }
  .feed-row { flex-wrap: wrap; }
  .feed-actions { width: 100%; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
