:root {
  --bg: #0e0f13;
  --bg-glow: #17141c;
  --card: #16181f;
  --card-2: #1c1f28;
  --line: #272b36;
  --text: #e8eaf0;
  --muted: #939aab;
  --accent: #ff3d43;
  --accent-2: #ff7a3d;
  --ok: #3ddc84;
  --bad: #ff6b6b;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8;
    --bg-glow: #ffffff;
    --card: #ffffff;
    --card-2: #f1f2f6;
    --line: #e2e5ec;
    --text: #171a21;
    --muted: #6b7280;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 40px 20px 60px;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 50% -10%, var(--bg-glow), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- header ---------- */

.head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 6px;
}

.logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px -8px var(--accent);
  flex: none;
}

h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.3px;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- cards ---------- */

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

.card.warn {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--card));
}

.card.warn h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.checks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  font-size: 13.5px;
}

.checks li::before {
  display: inline-block;
  width: 1.3em;
  font-weight: 700;
}

.checks .ok  { color: var(--muted); }
.checks .bad { color: var(--text); }
.checks .ok::before  { content: "\2713"; color: var(--ok); }
.checks .bad::before { content: "\2715"; color: var(--bad); }

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

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
}

/* ---------- form ---------- */

.field {
  display: flex;
  gap: 8px;
}

input[type="url"] {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input[type="url"]::placeholder { color: var(--muted); }

input[type="url"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.btn {
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s, opacity .15s, filter .15s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:active { transform: translateY(1px); }

.btn.primary {
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -10px var(--accent);
}

.btn.primary:hover { filter: brightness(1.07); }

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  filter: none;
}

.btn.wide {
  width: 100%;
  margin-top: 14px;
}

.btn.save {
  color: #06210f;
  background: var(--ok);
  flex: 1;
}

.err {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: #fff;
  background: color-mix(in srgb, var(--bad) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent);
}

@media (prefers-color-scheme: light) {
  .err { color: #7a1020; }
}

/* ---------- video card ---------- */

.video { animation: rise .25s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

.meta {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.thumb {
  position: relative;
  width: 148px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-2);
  aspect-ratio: 16 / 9;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, .78);
}

.titles { min-width: 0; }

.titles h2 {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.by {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- format pills ---------- */

.formats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.pill {
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.pill:hover { color: var(--text); }

.pill[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* ---------- progress ---------- */

.progress { margin-top: 16px; }

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease;
}

.pstats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- done ---------- */

.done {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.fname {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- footer ---------- */

.foot {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 4px;
}

.foot a { color: var(--muted); }

@media (max-width: 480px) {
  body { padding: 24px 14px 40px; }
  .meta { flex-direction: column; }
  .thumb { width: 100%; }
  .field { flex-direction: column; }
}

/* ---------- note under the format pills ---------- */

.note {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- check.php ---------- */

.wide-shell { max-width: 760px; }

.ctitle {
  margin: 0 0 8px;
  font-size: 15px;
}

.good {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text);
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
}

.diag {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.diag li {
  padding: 12px 12px 12px 34px;
  position: relative;
  border-radius: 10px;
}

.diag li + li { border-top: 1px solid var(--line); border-radius: 0; }

.diag li::before {
  position: absolute;
  left: 12px;
  top: 12px;
  font-weight: 700;
}

.diag .ok::before  { content: "\2713"; color: var(--ok); }
.diag .bad::before { content: "\2715"; color: var(--bad); }
.diag .bad { background: color-mix(in srgb, var(--bad) 9%, transparent); }

.dlabel { font-weight: 600; font-size: 14px; }

.ddetail {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  overflow-wrap: anywhere;
}

.dfix {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.log {
  margin: 12px 0;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card .btn:not(.primary):not(.save) {
  color: var(--text);
  background: var(--card-2);
  border-color: var(--line);
  margin-right: 6px;
}

.diag .warn::before { content: "!"; color: #f0b429; }
.diag .warn { background: color-mix(in srgb, #f0b429 10%, transparent); }
