:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #14181f;
  --muted: #5b6472;
  --line: #e4e7ec;
  --brand: #d6203c;
  --brand-ink: #ffffff;
  --accent: #0b63d6;
  --radius: 12px;
  --rail-w: 180px;
  --content-w: 720px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Three-column shell: left rail | content | right rail */
.layout {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, var(--content-w)) var(--rail-w);
  gap: 24px;
  justify-content: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  align-items: start;
}

.rail { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.ad-slot {
  background: repeating-linear-gradient(45deg, #f0f1f4, #f0f1f4 10px, #eceef2 10px, #eceef2 20px);
  border: 1px dashed #cfd4dc;
  border-radius: 8px;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab1bd;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.content { min-width: 0; }

.site-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
}
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-weight: 600; }
.langs { display: flex; flex-wrap: wrap; gap: 4px; }
.langs a { font-size: 13px; color: var(--muted); text-decoration: none; padding: 3px 8px; border-radius: 6px; }
.langs a:hover { background: #eef0f3; }
.langs a.active { color: var(--ink); font-weight: 700; }

.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; text-align: center; }
.hero h1 { font-size: 30px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -.02em; }
.subtitle { color: var(--muted); margin: 0 auto 22px; max-width: 46ch; }
#tform { display: flex; gap: 10px; }
#url {
  flex: 1; min-width: 0; padding: 14px 16px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd;
}
#url:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
#go {
  padding: 14px 22px; font-size: 16px; font-weight: 700; white-space: nowrap;
  color: var(--brand-ink); background: var(--brand); border: 0; border-radius: 10px; cursor: pointer;
}
#go:hover { filter: brightness(.95); }
#go:disabled { opacity: .6; cursor: default; }
.hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

.status { margin: 20px 0 0; padding: 14px 16px; border-radius: 10px; font-size: 15px; }
.status.loading { background: #eef4ff; color: #1f4e9c; }
.status.error { background: #fdecef; color: #a11229; }

.result { margin-top: 22px; }
.vid-title { font-size: 18px; margin: 0 0 14px; }
.note { background: #fff7e6; border: 1px solid #ffe2a8; color: #7a5300; padding: 10px 12px; border-radius: 8px; font-size: 14px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-actions { display: flex; gap: 8px; }
.panel-actions button { font-size: 13px; padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; color: var(--ink); }
.panel-actions button:hover { background: #f1f3f6; }
.panel-body { padding: 16px; white-space: pre-wrap; word-wrap: break-word; max-height: 460px; overflow-y: auto; font-size: 14.5px; color: #222b36; }

.faq { margin-top: 40px; }
.faq h2 { font-size: 20px; margin: 0 0 12px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { color: var(--muted); margin: 10px 0 2px; }

.site-foot { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.foot-links { margin-top: 8px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }

/* Tablet: drop the rails (ads move to in-content or hide). */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, var(--content-w)); }
  .rail { display: none; }
}
@media (max-width: 560px) {
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 24px; }
  #tform { flex-direction: column; }
  #go { width: 100%; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #161a20; --ink: #e9edf2; --muted: #9aa4b2;
    --line: #262c34; --accent: #4c9dff;
  }
  #url { background: #10141a; color: var(--ink); }
  .panel-head { background: #12161c; }
  .panel-actions button { background: #12161c; color: var(--ink); }
  .ad-slot { background: repeating-linear-gradient(45deg, #14181e, #14181e 10px, #171c23 10px, #171c23 20px); border-color: #2a313a; color: #4a5462; }
  .status.loading { background: #10233f; color: #9cc2ff; }
  .status.error { background: #331319; color: #ff9fb0; }
  .note { background: #2a2410; border-color: #5a4b1a; color: #e9c96b; }
}
