/* RecapTube — tokens follow the "YouTube-adjacent" direction from the design canvas. */
:root {
  --bg: #f9f9f9;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --border: #e5e5e5;
  --border-strong: #d0d0d0;
  --text: #0f0f0f;
  --muted: #606060;
  --faint: #909090;
  --accent: #cc0000;
  --accent-text: #ffffff;
  --link: #065fd4;
  --danger: #b00000;
  --danger-bg: #fdecec;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  --skeleton: #ececec;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f0f0f; --surface: #1c1c1c; --surface-2: #272727; --border: #303030; --border-strong: #3a3a3a;
    --text: #f1f1f1; --muted: #aaaaaa; --faint: #8a8a8a; --accent: #e53935; --link: #3ea6ff;
    --danger: #ff6b6b; --danger-bg: #3a1a1a; --shadow: 0 16px 40px rgba(0, 0, 0, 0.5); --skeleton: #2a2a2a;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f0f0f; --surface: #1c1c1c; --surface-2: #272727; --border: #303030; --border-strong: #3a3a3a;
  --text: #f1f1f1; --muted: #aaaaaa; --faint: #8a8a8a; --accent: #e53935; --link: #3ea6ff;
  --danger: #ff6b6b; --danger-bg: #3a1a1a; --shadow: 0 16px 40px rgba(0, 0, 0, 0.5); --skeleton: #2a2a2a;
  color-scheme: dark;
}

*, *::before, *::after { 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 15px/1.5 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .inner { max-width: 1280px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 16px; }
@media (min-width: 900px) { .site-header .inner { padding: 0 80px; } }
.logo { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { flex-shrink: 0; }
.logo .mark-stroke { stroke: var(--accent); }
.logo .mark-fill { fill: var(--accent); }
.header-search { flex: 1; display: none; align-items: center; max-width: 520px; margin: 0 auto; }
@media (min-width: 760px) { .header-search { display: flex; } }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.url-form { display: flex; width: 100%; height: 40px; }
.url-form input {
  flex: 1; min-width: 0; border: 1px solid var(--border-strong); border-right: 0; border-radius: 20px 0 0 20px;
  padding: 0 16px; background: var(--surface); outline: none;
}
.url-form input:focus { border-color: var(--link); }
.url-form button {
  border: 0; border-radius: 0 20px 20px 0; padding: 0 18px; background: var(--accent); color: var(--accent-text);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.url-form.large { height: 52px; }
.url-form.large input { border-radius: 26px 0 0 26px; padding: 0 20px; font-size: 16px; }
.url-form.large button { border-radius: 0 26px 26px 0; padding: 0 28px; font-size: 15px; }
.url-form input[aria-invalid='true'] { border: 2px solid var(--accent); border-right: 0; }
.field-error { margin: 8px 0 0; display: flex; gap: 8px; color: var(--danger); font-size: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 0;
  background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.pill:hover { text-decoration: none; filter: brightness(0.97); }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
@media (min-width: 760px) { .icon-btn.mobile-search { display: none; } }
.theme-toggle .sun { display: none; }
:root[data-theme='dark'] .theme-toggle .sun { display: block; }
:root[data-theme='dark'] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .moon { display: none; }
}

/* Page layout: reading column + right rail */
.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px 16px 48px; flex: 1; }
@media (min-width: 900px) { .page { padding: 24px 80px 64px; } }
.watch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; max-width: 760px; margin: 0 auto; }
@media (min-width: 1100px) { .watch { grid-template-columns: minmax(0, 720px) 300px; justify-content: space-between; gap: 48px; max-width: none; } }
.main-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.summary { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.rail { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
@media (min-width: 1100px) { .rail .sticky { position: sticky; top: 80px; } }

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips .note { font-size: 13px; color: var(--muted); }

/* Player */
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.player img { width: 100%; height: 100%; object-fit: cover; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 68px; height: 48px; border: 0;
  border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.player .length { position: absolute; right: 12px; bottom: 12px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 600; }
@media (max-width: 599px) { .player { border-radius: 0; margin: 0 -16px; width: calc(100% + 32px); } }

.video-title { margin: 4px 0 0; font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
@media (min-width: 600px) { .video-title { font-size: 22px; } }
.byline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.channel { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.channel .name { font-weight: 600; }
.channel .sub { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 599px) { .card { padding: 16px; } }
.card h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.tldr { margin: 0; font-size: 16px; line-height: 1.6; }
.points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.points li { display: flex; gap: 14px; align-items: flex-start; line-height: 1.55; }
.ts {
  flex-shrink: 0; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--link);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr;
  min-width: 58px; text-align: center; line-height: 20px;
}
.ts:hover { text-decoration: none; filter: brightness(0.95); }
.chapters { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 24px; font-size: 14px; }
@media (min-width: 600px) { .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chapters li { display: flex; gap: 10px; align-items: center; }
.chapters .ts { font-size: 12px; padding: 1px 6px; min-width: 52px; }
[dir='rtl'] .points li, [dir='rtl'] .chapters li { flex-direction: row; }

.feedback { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* Rail */
.rail h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.variant-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.variant-list a { display: flex; justify-content: space-between; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.variant-list a span:first-child { font-weight: 600; }
.variant-list a span:last-child { color: var(--muted); }
.recent-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.recent-list a { display: flex; gap: 10px; align-items: center; }
.recent-list img { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.recent-list .t { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-list .m { font-size: 12px; color: var(--muted); }

/* Ad slots: space is reserved now so the layout doesn't move when ads arrive. */
.ad-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ad-slot.placeholder { border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--faint); font-size: 12px; letter-spacing: .04em; background: var(--surface); }
.ad-inline { width: 100%; min-height: 100px; }
@media (max-width: 599px) { .ad-inline { min-height: 100px; } }
.ad-rail { width: 300px; height: 600px; }
@media (max-width: 1099px) { .ad-rail { display: none; } }

/* Language menu (chip + popover) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--text); color: var(--bg); }
.menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 300px; max-height: 420px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 8px;
}
.menu-panel input[type='search'] { width: 100%; height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 12px; background: var(--bg); outline: none; margin-bottom: 6px; }
.menu-panel .group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.menu-panel ul { margin: 0; padding: 0; list-style: none; }
.menu-panel li a { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 10px; border-radius: 8px; font-size: 14px; }
.menu-panel li a:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel li a[aria-current='true'] { background: var(--surface-2); font-weight: 600; }
.menu-panel li a .hint { font-size: 12px; color: var(--muted); }
.menu-panel .foot { padding: 8px 10px 2px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 6px; }

/* States: panels, skeleton, errors */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 599px) { .panel { padding: 20px; } }
.panel .head { display: flex; gap: 16px; }
.panel .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.panel .icon.danger { background: var(--danger-bg); color: var(--accent); }
.panel h1, .panel h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.panel p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: 22px; border: 0; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.secondary { background: var(--surface-2); color: var(--text); font-weight: 500; }
.meta { font-size: 12px; color: var(--faint); }
.video-card { display: flex; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.video-card img { width: 160px; height: 90px; object-fit: cover; border-radius: 8px; }
@media (max-width: 599px) { .video-card img { width: 112px; height: 63px; } }
.video-card .t { font-weight: 700; line-height: 1.3; }
.video-card .c { font-size: 13px; color: var(--muted); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.steps .n { width: 28px; height: 28px; border-radius: 999px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.bookmarklet {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 2px dashed var(--accent);
  border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--accent); cursor: grab; background: var(--surface);
}
.bookmarklet:hover { text-decoration: none; }
.bookmarklet-hint { font-size: 13px; color: var(--muted); }
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton span { display: block; height: 14px; border-radius: 7px; background: var(--skeleton); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton span { animation: none; } }
.spinner { width: 20px; height: 20px; border-radius: 999px; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-line { display: flex; gap: 12px; align-items: center; font-weight: 600; }

/* Home */
.hero { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 48px 0 40px; text-align: center; }
@media (min-width: 900px) { .hero { padding: 72px 0 48px; } }
.hero h1 { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; max-width: 760px; text-wrap: balance; }
@media (min-width: 900px) { .hero h1 { font-size: 44px; } }
.hero p { margin: 0; font-size: 17px; color: var(--muted); max-width: 600px; }
.hero form { width: 100%; max-width: 680px; margin-top: 8px; }
.how { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .how { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.how .step { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.how .step .label { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.how .step h2 { margin: 0; font-size: 17px; }
.how .step p { margin: 0; font-size: 14px; color: var(--muted); }
.section-title { margin: 40px 0 14px; font-size: 18px; font-weight: 700; }
.grid-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.grid-videos a { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.grid-videos a:hover { text-decoration: none; border-color: var(--border-strong); }
.grid-videos img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.grid-videos .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.grid-videos .t { font-size: 14px; font-weight: 600; line-height: 1.3; }
.grid-videos .m { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.site-footer .inner { max-width: 1280px; margin: 0 auto; padding: 20px 16px; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
@media (min-width: 900px) { .site-footer .inner { padding: 20px 80px; } }
.rail .sticky:empty { display: none; }
