/* ReelDrop — clean, professional theme */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #111318;
  --muted: #5B616E;
  --faint: #8A909C;
  --line: #E3E6EB;
  --line-strong: #CDD2DA;
  --accent: #1F4FE0;
  --accent-hover: #1941BD;
  --accent-soft: #EEF2FD;
  --ok: #12704F;
  --ok-soft: #E7F5EF;
  --err: #B42318;
  --err-soft: #FDEEEC;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 19, 24, .04), 0 6px 20px rgba(17, 19, 24, .05);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.65 var(--font); }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid rgba(31, 79, 224, .45); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.65rem); font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .98rem var(--font); line-height: 1; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--r-md); padding: 13px 20px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--quiet { background: var(--surface); color: var(--ink); border-color: var(--line); padding: 9px 14px; font-size: .9rem; }
.btn--quiet:hover { border-color: var(--line-strong); color: var(--ink); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .7; cursor: progress; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- header ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner { max-width: 1120px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand:hover { color: var(--ink); }
.logo { width: 30px; height: 30px; flex: none; }
.topnav { display: flex; gap: 26px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.topnav a:hover { color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- hero + tool ---------- */
.hero { text-align: center; padding: 56px 0 8px; }
.hero__title { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; letter-spacing: -0.03em; max-width: 20ch; margin: 0 auto 12px; }
.hero__lead { color: var(--muted); font-size: 1.1rem; max-width: 56ch; margin: 0 auto 28px; }
.tool {
  display: flex; gap: 10px; max-width: 760px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 8px; box-shadow: var(--shadow);
}
.tool__field { flex: 1; display: flex; align-items: center; min-width: 0; padding-left: 12px; }
.tool__icon { width: 20px; height: 20px; color: var(--faint); flex: none; }
.tool__field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 500 1rem var(--font); color: var(--ink); padding: 12px 10px;
}
.tool__field input::placeholder { color: var(--faint); }
.tool:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,79,224,.12), var(--shadow); }
.tool__paste {
  flex: none; font: 600 .88rem var(--font); color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 12px; cursor: pointer; margin-right: 4px;
}
.tool__paste:hover { color: var(--ink); border-color: var(--line-strong); }
.tool__go { flex: none; min-width: 140px; padding: 14px 24px; }
.tool__msg { min-height: 1.5em; margin: 14px auto 0; max-width: 760px; font-weight: 500; color: var(--muted); }
.tool__msg.is-error { color: var(--err); }
.tool__msg:empty { min-height: 0; margin: 0; }
.tool__note { color: var(--faint); font-size: .9rem; margin: 14px 0 0; }
.tool__msg:not(:empty) + .tool__note { margin-top: 4px; }

/* ---------- results ---------- */
.results { max-width: 760px; margin: 22px auto 0; display: grid; gap: 12px; text-align: left; scroll-margin-top: 16px; }
.result {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px;
  animation: appear .25s ease-out;
}
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.result__thumb { width: 96px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.result__title { font-size: 1rem; font-weight: 700; margin: 2px 0 2px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result__meta { color: var(--muted); font-size: .88rem; margin: 0 0 12px; }
.qualities { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
.q {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font: 600 .95rem var(--font);
}
.q small { display: block; white-space: nowrap; font-weight: 500; color: var(--muted); font-size: .78rem; margin-top: 1px; }
.q::after {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 4v11m0 0l-5-5m5 5l5-5M5 20h14" fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg>') center / contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 4v11m0 0l-5-5m5 5l5-5M5 20h14" fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg>') center / contain no-repeat;
  color: var(--accent);
}
.q:hover { border-color: var(--accent); background: var(--accent-soft); }
.q--fhd { border-color: var(--accent); }
.q.is-busy { cursor: progress; opacity: .6; }
.q.is-done { border-color: var(--ok); background: var(--ok-soft); }
.q.is-done::after { color: var(--ok); }
.q.is-failed { border-color: var(--err); }
.result__status { margin: 10px 0 0; font-size: .88rem; color: var(--muted); min-height: 1.3em; }
.result__status.is-error { color: var(--err); }

/* ---------- content ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; margin-top: 56px; }
.cols__side { min-width: 0; }
.block { margin: 0 0 56px; }
.prose p { max-width: 70ch; color: #2A2E36; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; color: var(--muted); }
.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.steps strong { display: block; color: var(--ink); margin-bottom: 4px; }

.feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 32px; }
.feats li { display: flex; gap: 14px; }
.feats svg { width: 40px; height: 40px; flex: none; padding: 9px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.feats h3 { margin: 2px 0 4px; }
.feats p { margin: 0; color: var(--muted); font-size: .95rem; }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 15px 44px 15px 18px; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 12px; font-size: 1.3rem; color: var(--faint); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .88rem; }
.chips a:hover { border-color: var(--line-strong); color: var(--ink); }

.crumbs { font-size: .85rem; color: var(--faint); display: flex; gap: 8px; padding-top: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs + .hero { padding-top: 28px; }

.page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 36px clamp(20px, 5vw, 56px); margin: 32px auto 0; max-width: 820px; }
.page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; }
.page h2 { font-size: 1.2rem; margin-top: 1.8em; }
.page p { color: #2A2E36; }

/* ---------- ads ---------- */
.ad { max-width: 1080px; width: calc(100% - 40px); margin: 24px auto; text-align: center; overflow: hidden; }
main .ad { width: 100%; }
.ad--sidebar { position: sticky; top: 16px; margin-top: 0; }
.ad--placeholder { min-height: 90px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--faint); font-size: .85rem; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(17,19,24,.015) 10px 20px); }
.ad--sidebar.ad--placeholder { min-height: 600px; }
.sticky-ad { display: none; }

/* ---------- footer ---------- */
.foot { background: var(--surface); border-top: 1px solid var(--line); margin-top: 72px; }
.foot__inner { max-width: 1120px; margin: 0 auto; padding: 36px 20px 40px; display: grid; grid-template-columns: 1fr auto; gap: 8px 32px; }
.foot__brand { display: flex; align-items: center; gap: 10px; font-weight: 800; margin: 0; }
.foot__brand .logo { width: 26px; height: 26px; }
.foot__note { grid-column: 1; color: var(--muted); font-size: .9rem; max-width: 56ch; margin: 0; }
.foot__links { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 10px 22px; align-content: start; justify-content: flex-end; max-width: 420px; }
.foot__links a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.foot__links a:hover { color: var(--ink); }
.foot__copy { grid-column: 1 / -1; color: var(--faint); font-size: .85rem; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }

/* ================= admin ================= */
.admin { background: var(--bg); }
.abar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.abar__inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 28px; }
.abar__inner form { margin: 0 0 0 auto; }
.abar__tag { font-size: .72rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; letter-spacing: 0; }
.abar__nav { display: flex; gap: 4px; }
.abar__nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 7px 12px; border-radius: var(--r-sm); }
.abar__nav a:hover { color: var(--ink); background: var(--bg); }
.abar__nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.apage { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }
.apage--narrow { max-width: 860px; }
.apage__head { margin-bottom: 22px; }
.apage__head h1 { font-size: 1.7rem; font-weight: 800; margin: 0 0 4px; }
.apage__head p { color: var(--muted); margin: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.stat__label { color: var(--muted); font-size: .85rem; font-weight: 600; margin: 0 0 6px; }
.stat__value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__value.is-bad { color: var(--err); }
.stat__sub { color: var(--faint); font-size: .82rem; margin: 6px 0 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 16px; min-width: 0; }
.panel h2 { font-size: 1.02rem; margin: 0 0 14px; }
.panel__desc { color: var(--muted); font-size: .9rem; margin: -8px 0 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .panel { margin-bottom: 16px; }

.chart { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 180px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.chart__col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; max-width: 48px; }
.chart__bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; }
.chart__col:hover .chart__bar { opacity: 1; }

.meter { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.meter li { display: grid; grid-template-columns: 120px 1fr 60px; align-items: center; gap: 12px; font-size: .9rem; }
.meter__track { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.meter__track span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.admin table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin th { text-align: left; font-size: .78rem; font-weight: 700; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin tr:last-child td { border-bottom: 0; }
.admin .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin .trunc { max-width: 1px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin .nowrap { white-space: nowrap; color: var(--muted); }
.admin .err { font-family: var(--mono); font-size: .8rem; color: #5A2A26; word-break: break-word; }
.admin .empty { color: var(--faint); padding: 14px 0; }
.scroll { overflow-x: auto; }

.field { display: block; margin: 0 0 18px; }
.field > span { display: block; font-weight: 600; font-size: .92rem; }
.field small { display: block; color: var(--muted); font-size: .82rem; margin: 2px 0 0; }
.field input, .field textarea {
  display: block; width: 100%; margin-top: 8px; font: 400 .95rem var(--font); color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface);
}
.field .mono { font-family: var(--mono); font-size: .84rem; line-height: 1.5; resize: vertical; min-height: 72px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,79,224,.14); }

.toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.toggle input { position: absolute; opacity: 0; }
.toggle__ui { flex: none; width: 40px; height: 22px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background-color .15s; margin-top: 1px; }
.toggle__ui::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle__ui { background: var(--accent); }
.toggle input:checked + .toggle__ui::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle__ui { outline: 3px solid rgba(31,79,224,.45); outline-offset: 2px; }
.toggle__text strong { display: block; font-size: .92rem; }
.toggle__text small { color: var(--muted); font-size: .82rem; }

.savebar { position: sticky; bottom: 0; background: linear-gradient(rgba(246,247,249,0), var(--bg) 30%); padding: 20px 0 8px; display: flex; justify-content: flex-end; }
.notice { background: var(--ok-soft); color: var(--ok); border: 1px solid #BFE3D3; padding: 11px 14px; border-radius: var(--r-md); font-weight: 600; font-size: .92rem; }
.notice--error { background: var(--err-soft); color: var(--err); border-color: #F5C7C1; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; max-width: none; }
.login__box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px 28px; box-shadow: var(--shadow); }
.login__box .brand { margin: 0 0 22px; }
.login__box h1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 20px; }
.login__box .btn { margin-top: 6px; }

/* ---------- cloudflare page ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 6px 16px; padding: 11px 0 11px 28px; border-bottom: 1px solid var(--line); position: relative; font-size: .92rem; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { content: ""; position: absolute; left: 2px; top: 14px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); }
.checklist li.is-ok::before { background: var(--ok); border-color: var(--ok); }
.checklist li.is-bad::before { background: var(--err); border-color: var(--err); }
.checklist li span { color: var(--muted); overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); margin-right: 6px; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: #FFF4E0; color: #8A5300; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 12px; }
.settings .toggle { margin: 2px 0 18px; }
.btnrow .btn--quiet { padding: 13px 18px; font-size: .95rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.guide h3 { font-size: 1rem; margin: 26px 0 8px; }
.guide h3:first-of-type { margin-top: 8px; }
.guide ol, .guide ul { margin: 0 0 8px; padding-left: 20px; color: #2A2E36; font-size: .94rem; }
.guide li { margin: 6px 0; }
.guide p { font-size: .94rem; color: #2A2E36; }
.guide table { margin: 8px 0; }
.admin code { font-family: var(--mono); font-size: .84em; background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.settings.panel .field:first-of-type { margin-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; gap: 0; }
  .ad--sidebar { position: static; }
  .ad--sidebar.ad--placeholder { min-height: 250px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 720px) {
  .topnav { gap: 16px; }
  .topnav a:nth-child(1) { display: none; }
  .hero { padding-top: 36px; }
  .tool { flex-direction: column; padding: 8px; }
  .tool__go { width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .result { grid-template-columns: 72px 1fr; gap: 12px; }
  .result__thumb { width: 72px; }
  .qualities { grid-template-columns: 1fr 1fr; }
  .foot__inner { grid-template-columns: 1fr; }
  .foot__links { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 12px; }
  .sticky-ad { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); }
  .sticky-ad .ad { margin: 0 auto; padding: 4px; width: 100%; }
  body:has(.sticky-ad) .foot { padding-bottom: 100px; }
  .abar__inner { flex-wrap: wrap; gap: 10px 16px; }
  .abar__nav { order: 3; width: 100%; overflow-x: auto; }
  .stat__value { font-size: 1.5rem; }
  .meter li { grid-template-columns: 90px 1fr 44px; }
  .checklist li { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
