:root {
  /* Exact same palette as other sites (YouTube tool) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-card-hover: #22222e;
  --bg-input: #252530;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #68a1cf;
  --accent-hover: #4638b6;
  --accent-gradient: linear-gradient(135deg, #33a3c9, #466dca);
  --success: #258645;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 18px;
  --radius-sm: 10px;
  --content: 1440px;

  /* Map legacy tokens to the new theme variables so existing styles keep working */
  color-scheme: dark;
  --bg: var(--bg-primary);
  --surface: var(--bg-card);
  --surface-2: var(--bg-card-hover);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border);
  --aqua: var(--accent);
  --coral: var(--accent);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-card: #f0f0f2;
  --bg-card-hover: #e8e8ec;
  --bg-input: #e8e8ec;
  --text-primary: #1a1a1f;
  --text-secondary: #5a5a6a;
  --text-muted: #9090a0;
  --accent: #205076;
  --accent-hover: #68a1cf;
  --accent-gradient: linear-gradient(135deg, #33a3c9, #466dca);
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.15);
  --shadow: 0 8px 32px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; transition: padding-left 0.3s ease; }
/* When the left sidebar is open on desktop, give content space */
body.sidebar-open { padding-left: 320px; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 200; padding: 10px 14px; background: var(--text); color: var(--bg); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.consent-overlay { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.85); }
.consent-overlay[hidden] { display: none; }
.consent-banner { width: 100%; max-width: 500px; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); text-align: center; }
.consent-banner h2 { margin: 0 0 16px; background: var(--accent-gradient); color: transparent; font-size: 22px; font-weight: 700; -webkit-background-clip: text; background-clip: text; }
.consent-banner p { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.consent-banner .highlight { color: var(--text-primary); font-weight: 600; }
.consent-banner a { color: var(--accent); }
.consent-buttons { display: flex; gap: 12px; margin-top: 24px; }
.consent-buttons .button { flex: 1; padding: 14px 20px; }
.consent-buttons .primary { background: var(--accent-gradient); color: #fff; }

.site-header { position: sticky; top: 0; z-index: 1000; min-height: 70px; padding: 0 max(20px, calc((100vw - var(--content)) / 2)); display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--border); background: var(--bg-primary); }
.navbar-left { display: flex; align-items: center; gap: 16px; margin-right: auto; }
.brand { display: flex; }
.brand img { width: 139px; height: auto; }
.navbar-right { display: flex; align-items: center; gap: 12px; }
.site-nav { display: flex; align-items: center; gap: 26px; }
.site-nav a { color: var(--muted); font-size: .88rem; text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.theme-toggle { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text-secondary); transition: all 0.2s; display: flex; align-items: center; }
.theme-toggle:hover { color: var(--text); background: var(--bg-card-hover); border-color: var(--border-hover); }
.theme-toggle svg { width: 18px; height: 18px; }
.queue-toggle { border: 1px solid var(--line); border-radius: 999px; padding: 9px 10px 9px 16px; background: var(--surface); color: var(--text); cursor: pointer; }
.queue-toggle span { display: inline-grid; min-width: 27px; height: 27px; margin-left: 8px; padding: 0 6px; place-items: center; border-radius: 50%; background: var(--coral); color: #160b08; font-weight: 800; }

main { overflow: hidden; }
.container { max-width: var(--content); margin: 0 auto; padding: 0 24px; transition: max-width 0.3s ease; }
body.sidebar-open .container { max-width: var(--content); }
.hero { position: relative; max-width: var(--content); margin: 0 auto; padding: clamp(68px, 10vw, 150px) 20px 86px; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .65fr); align-items: end; gap: clamp(40px, 8vw, 130px); }
/* Remove decorative background element */
.hero::before { content: none !important; }
.kicker { margin: 0 0 15px; color: var(--aqua); font-size: .73rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.kicker span { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px rgba(255,121,95,.12); }
h1 { max-width: 900px; margin: 0; font-size: clamp(3rem, 7.2vw, 7.5rem); line-height: .91; letter-spacing: -.065em; font-weight: 760; }
h1 em { color: var(--aqua); font-family: Georgia, serif; font-weight: 400; }
.intro { max-width: 680px; margin: 30px 0 0; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.2rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.button { min-height: 44px; padding: 11px 17px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 700; }
.button:hover:not(:disabled) { border-color: #4c6067; background: var(--surface-2); }
.button.primary { border-color: var(--accent); background: var(--accent); color: #06110f; }
.button.danger { color: #ff9d8c; }
.button:disabled { opacity: .4; cursor: not-allowed; }
.manifest-card { padding: 25px; border-top: 3px solid var(--accent); background: var(--surface); box-shadow: none; }
.manifest-card > strong { display: block; margin: 2px 0 24px; font: 400 clamp(1.7rem, 3vw, 2.4rem)/1.1 Georgia, serif; }
.manifest-label { margin: 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.manifest-card dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 18px 0; border-block: 1px solid var(--line); }
.manifest-card dl div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.manifest-card dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.manifest-card dd { margin: 4px 0 0; font-weight: 800; }
.feed-note { margin: 18px 0 0; color: var(--muted); font-size: .78rem; }

.toolbar { max-width: var(--content); margin: 0 auto; padding: 18px 20px; display: flex; align-items: center; gap: 28px; border-block: 1px solid var(--line); }
.archive-control { display: none; align-items: center; gap: 10px; flex: none; }
.archive-control label { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
select { max-width: 180px; padding: 8px 30px 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); }
.category-filters { display: flex; gap: 7px; overflow-x: auto; padding: 3px; scrollbar-width: thin; }
.filter { flex: none; padding: 8px 12px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.filter:hover, .filter.active { border-color: var(--line); background: var(--surface); color: var(--text); }

.feed { max-width: var(--content); min-height: 600px; margin: 0 auto; padding: 74px 20px 120px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 42px; }
.section-title h2, .queue-head h2 { margin: 0; font-size: clamp(2rem, 4vw, 4rem); line-height: 1; letter-spacing: -.045em; }
.feed-count { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }
.text-button { padding: 5px 0; border: 0; border-bottom: 1px solid var(--muted); background: none; color: var(--muted); cursor: pointer; }
.text-button:hover { color: var(--text); border-color: var(--text); }
.status { padding: 20px; border: 1px solid var(--line); color: var(--muted); background: var(--bg-secondary); }
.status:empty { display: none; }
.category-section + .category-section { margin-top: 78px; }
.feed-pagination { display: flex; min-height: 48px; justify-content: center; align-items: center; margin-top: 44px; color: var(--muted); }
.feed-pagination button[hidden], .feed-pagination span[hidden] { display: none; }
.load-more-sentinel { height: 1px; }
.category-header { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.category-header h3 { margin: 0; font: 400 1.9rem/1 Georgia, serif; }
.category-header span { color: var(--muted); font-size: .8rem; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 32px 16px; overflow-anchor: none; }
.video-blocks { display: flex; flex-direction: column; gap: 32px; overflow-anchor: none; }
.video-block { flex: none; min-width: 0; }
.video-block[aria-busy="true"] { background: var(--bg-secondary); }
.video-grid-spacer { position: relative; grid-column: 1 / -1; min-height: 0; pointer-events: none; }
.video-grid-top-sentinel { position: absolute; inset: auto 0 0; height: 1px; }
.video-card { min-width: 0; }
.thumbnail { position: relative; display: block; width: 100%; aspect-ratio: 16/9; overflow: hidden; border: 0; padding: 0; background: var(--bg-secondary); color: var(--text); cursor: pointer; }
.thumbnail img { width: 100%; height: 100%; display: block; border: 0; outline: 0; object-fit: cover; background: transparent; transition: transform .3s ease, opacity .2s ease; }
.thumbnail img.thumbnail-image-error { visibility: hidden; }
.thumbnail:hover img { transform: scale(1.025); }
.thumbnail::before { content: ""; position: absolute; z-index: 2; inset: 0; display: none; background: #008dff4d; pointer-events: none; }
.thumbnail.is-adding::before { display: block; animation: thumbnail-added .6s cubic-bezier(.22,1,.36,1) both; }
.thumbnail::after { content: ""; position: absolute; z-index: 2; inset: 0; box-shadow: inset 0 0 0 4px #008dff; opacity: 0; pointer-events: none; }
.thumbnail.is-showing-border::after { animation: queue-border-appear .7s ease .2s both; }
.thumbnail.has-queue-border::after { opacity: 1; }
.thumbnail.is-removing-border::after { opacity: 0; transition: opacity .3s ease; }
@keyframes queue-border-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes thumbnail-added {
  from { transform: translateY(100%); opacity: 1; }
  72% { transform: translateY(0); opacity: 1; }
  82% { transform: translateY(0); opacity: 1; }
  to { transform: translateY(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .thumbnail.is-adding::before { animation-duration: .6s; }
}
.thumbnail-category { position: absolute; left: 0; bottom: 0; z-index: 1; max-width: calc(100% - 58px); overflow: hidden; padding: 3px 7px; background: rgba(10,10,15,.82); color: #fff; font-size: .62rem; font-weight: 700; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
[data-theme="light"] .thumbnail-category { background: rgba(255,255,255,.88); color: #1a1a1f; }
.add-mark { position: absolute; z-index: 3; right: 10px; bottom: 10px; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--accent); color: #07110f; font-size: 1.4rem; font-weight: 400; box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.thumbnail[aria-pressed="true"] .add-mark { background: var(--coral); }
.video-title { margin: 12px 0 5px; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .94rem; line-height: 1.35; }
.video-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr); align-items: baseline; gap: 8px; min-width: 0; color: var(--muted); font-size: .76rem; }
.video-channel, .video-time, .youtube-link { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-channel { color: var(--text); font-weight: 500; }
.video-time { color: var(--muted); text-align: center; }
.youtube-link { justify-self: end; max-width: 100%; color: var(--aqua); font-size: .73rem; font-weight: 600; text-decoration: none; }
.youtube-link::after { content: "\2197"; margin-left: 3px; }
.youtube-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.queue-panel { position: fixed; z-index: 1100; top: 0; right: 0; width: min(440px, 100%); height: 100dvh; padding: 28px; display: flex; flex-direction: column; background: var(--bg-secondary); border-left: 1px solid var(--line); transform: translateX(105%); transition: transform .25s ease; box-shadow: -30px 0 80px rgba(0,0,0,.45); }
.queue-panel.open { transform: none; }
.queue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.queue-head h2 { font-size: 2.5rem; }
.icon-button { width: 42px; height: 42px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); font-size: 1.5rem; cursor: pointer; }
.queue-explainer, .queue-empty { color: var(--muted); font-size: .86rem; }
.queue-list { width: 100%; min-width: 0; min-height: 0; margin: 20px 0; padding: 0; overflow-y: auto; list-style: none; }
.queue-item { display: grid; grid-template-columns: 28px 64px minmax(0, 1fr) 55px; align-items: center; gap: 8px; min-width: 0; padding: 11px 0; border-top: 1px solid var(--line); }
.queue-number { color: var(--muted); font: 400 1.1rem Georgia, serif; }
.queue-item img { width: 64px; aspect-ratio: 16/9; object-fit: cover; }
.queue-item strong { min-width: 0; display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .76rem; line-height: 1.3; }
.item-buttons { display: grid; grid-template-columns: repeat(2, 26px); gap: 3px; width: 55px; }
.item-buttons button { display: grid; width: 26px; height: 26px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.item-buttons .move-icon { display: block; width: 16px; height: 16px; background-color: currentColor; mask-position: center; mask-repeat: no-repeat; mask-size: contain; }
.item-buttons .move-up { mask-image: url("arrow-big-up.svg"); }
.item-buttons .move-down { mask-image: url("arrow-big-down.svg"); }
.item-buttons .remove { grid-column: 1 / -1; width: 55px; color: #ff9d8c; font-size: .68rem; }
.queue-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.queue-actions .danger { grid-column: 1 / -1; }
.scrim { position: fixed; z-index: 1050; inset: 0; display: none; border: 0; background: rgba(0,0,0,.65); }
.scrim.open { display: block; }

.player-dialog { width: min(1000px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 30px 100px #000; }
.player-dialog::backdrop { background: rgba(0,0,0,.82); }
.player-head { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.player-frame { aspect-ratio: 16/9; background: #000; }
.player-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.player-dialog > p { margin: 0; padding: 12px 16px; color: var(--muted); font-size: .75rem; }
footer { max-width: var(--content); margin: 0 auto; padding: 28px 20px 50px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }
.noscript { position: fixed; z-index: 100; inset: auto 20px 20px; padding: 16px; background: var(--coral); color: #180b08; }

@media (max-width: 1050px) {
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .manifest-card { max-width: 500px; }
}
@media (max-width: 760px) {
  body.sidebar-open { padding-left: 0; }
  .site-header { min-height: 62px; gap: 12px; }
  .site-nav { display: none; }
  .hero { padding-top: 72px; padding-bottom: 60px; }
  h1 { font-size: clamp(2.9rem, 15vw, 5rem); }
  .toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .category-filters { width: 100%; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed { padding-top: 55px; }
}
@media (max-width: 650px) {
  .container { padding-inline: 12px; }
  .video-grid { grid-template-columns: 1fr; gap: 30px; }
  .feed { padding: 44px 0 88px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .manifest-card dl { grid-template-columns: 1fr 1fr; }
  .manifest-card dl div:last-child { display: none; }
  .queue-panel { padding: 22px 16px; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Left category sidebar (match other sidebar style) */
.left-sidebar { position: fixed; top: 0; left: 0; width: 320px; height: 100vh; background: var(--bg-secondary); border-right: 1px solid var(--border); z-index: 100; transform: translateX(-100%); transition: transform 0.3s; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.left-sidebar.open,
body.sidebar-open .left-sidebar { transform: translateX(0); }
.left-sidebar-header { height: 70px; min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--border); }
.left-sidebar-header h2 { font-size: 18px; font-weight: 600; margin: 0; }
.left-sidebar-content { flex: 1; overflow-y: auto; padding: 20px; }
.close-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; border-radius: var(--radius-sm); }
.close-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.close-btn svg { width: 20px; height: 20px; stroke: currentColor; }
.category-nav { display: flex; flex-direction: column; gap: 6px; }
.category-menu-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,0.02); }
.cat-link { text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-secondary); cursor: pointer; transition: all .2s; }
.category-menu-group > .cat-link { width: 100%; border: 0; border-radius: 0; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.category-bullet { color: var(--muted); }
.category-count { margin-left: auto; color: var(--text-muted); font-size: 11px; font-weight: 500; }
.subcategory-menu { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px 8px; }
.subcategory-link { width: 100%; border: 0; border-radius: 7px; padding: 8px 12px 8px 32px; background: transparent; font-size: 13px; }
.subcategory-link.active { background: rgb(68 167 248 / 15%); color: var(--accent); }
.cat-link:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-hover); }
.cat-link.active { background: rgb(68 167 248 / 15%); color: var(--accent); border-color: var(--border-hover); }

.left-sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s; }
.left-sidebar-overlay.show { opacity: 1; visibility: visible; }

/* Hide top filter pills on larger screens (sidebar replaces them) */
@media (min-width: 761px) {
  body.sidebar-open .category-filters { display: none !important; }
}

/* Sidebar adjustments for smaller header height on mobile */
@media (max-width: 768px) {
  body,
  body.sidebar-open { padding-left: 0; }
  .left-sidebar { z-index: 1001; width: 100%; }
  .left-sidebar-header { height: 62px; min-height: 62px; }
  .sidebar-toggle { padding: 8px 12px; font-size: 13px; }
  .sidebar-toggle span { display: none; }
}

/* Sidebar toggle button (match other sites) */
.sidebar-toggle { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 10px; color: var(--text-primary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.sidebar-toggle:hover { background: var(--bg-card); border-color: var(--border-hover); }
.sidebar-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
