/* ============================================================================
   KHUNG TRANG CHỦ KIỂU YOUTUBE (29/10/2026, Giang: "steal like an artist")
   Thanh trên cố định 56px (☰ + logo "Shadowing Studio") + thanh điều hướng trái (#ytn).
   Chỉnh tay – KHÔNG nằm trong index.html để _theme/build-light.js không tự đổi màu.
   Kích thước theo YouTube: thanh rộng 240px, mục cao 40px, bo 10px, icon 24px cách chữ 24px;
   thu gọn 72px (mục 74px, chữ 10px); ≥1312px rộng, 792–1311px thu gọn, nhỏ hơn: ngăn kéo.
   ============================================================================ */
:root {
  --ytn-bg: #070b14;
  --ytn-fg: #f1f1f1;
  --ytn-mute: #8b97ad;
  --ytn-hover: rgba(255, 255, 255, .08);
  --ytn-act: rgba(255, 255, 255, .12);
  --ytn-line: rgba(255, 255, 255, .1);
  --ytn-navy: #fff;          /* bản tối: "Shadowing" chữ trắng như logo YouTube bản tối (xanh navy không đọc được trên nền tối) */
  --ytn-red: #e0314f;
}
html[data-ui="light"] {
  --ytn-bg: #fff;
  --ytn-fg: #0f0f0f;
  --ytn-mute: #64748b;
  --ytn-hover: rgba(0, 0, 0, .05);
  --ytn-act: rgba(0, 0, 0, .07);
  --ytn-line: rgba(0, 0, 0, .1);
  --ytn-navy: #0a3161;       /* xanh navy cờ Mỹ (Old Glory Blue) */
  --ytn-red: #b31942;        /* đỏ cờ Mỹ (Old Glory Red) */
}
html[data-ui="light"] #screen-input { background: #fff; }

/* ---------------- THANH TRÊN ---------------- */
#screen-input .home-top-row.ytn-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 56px; margin: 0 !important; padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
  background: var(--ytn-bg);
}
#screen-input { padding-top: 56px !important; }
.ytn-start { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; }
.ytn-burger {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ytn-fg); background: transparent; border: 0; cursor: pointer;
}
.ytn-burger:hover { background: var(--ytn-hover); }
.ytn-burger:active { background: var(--ytn-act); }
.ytn-burger svg { width: 24px; height: 24px; }
.ytn-logo {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 6px;
  text-decoration: none; white-space: nowrap; border-radius: 8px;
}
.ytn-logo img { width: 30px; height: 30px; flex: none; border-radius: 8px; }
.ytn-word { font-size: 20px; line-height: 1; letter-spacing: -.5px; font-weight: 800; }
.ytn-word b { font-weight: inherit; }
.ytn-w1 { color: var(--ytn-navy); }
.ytn-w2 { color: var(--ytn-red); margin-left: 5px; }

/* ---------------- THANH TRÁI ---------------- */
.ytn {
  position: fixed; left: 0; top: 56px; bottom: 0; z-index: 59;
  width: 240px; display: none; flex-direction: column;
  background: var(--ytn-bg); color: var(--ytn-fg);
}
html.ytn-wide .ytn, html.ytn-slim .ytn, html.ytn-drawer .ytn { display: flex; }
.ytn-drawer-head { display: none; flex: none; height: 56px; align-items: center; gap: 8px; padding: 0 16px; }
.ytn-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.ytn-scroll:hover { scrollbar-color: rgba(128, 128, 128, .45) transparent; }
.ytn-sec + .ytn-sec { border-top: 1px solid var(--ytn-line); margin-top: 12px; padding-top: 12px; }
.ytn-sec-title { font-size: 16px; font-weight: 700; padding: 6px 12px 6px; color: var(--ytn-fg); }
.ytn.ytn-no-cats .ytn-sec-cats { display: none; }

.ytn-item {
  position: relative; display: flex; align-items: center; gap: 24px;
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  font-size: 14px; font-weight: 400; color: var(--ytn-fg); text-align: left; text-decoration: none;
  background: transparent; border: 0; cursor: pointer;
}
.ytn-item:hover { background: var(--ytn-hover); }
.ytn-item.active { background: var(--ytn-act); font-weight: 600; }
.ytn-item:focus-visible { outline: 2px solid #3b82f6; outline-offset: -2px; }
.ytn-ico { flex: none; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.ytn-ico svg { width: 100%; height: 100%; display: block; }
.ytn-ico.ytn-line svg { width: 22px; height: 22px; }
.ytn-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ytn-mini { display: none; }
.ytn-num, .ytn-count { flex: none; font-size: 12px; font-weight: 500; color: var(--ytn-mute); }
/* Số từ + số cần ôn sát chữ (khoảng 24px của hàng làm chữ "Từ vựng đã lưu" bị cắt "Từ vựn…") */
/* 30/10 (Giang): thanh trái chỉ hiện SỐ TỪ CẦN ÔN (không hiện tổng số từ), màu ĐỎ như huy hiệu thông báo YouTube */
.ytn-item .ytn-count { display: none !important; }
html .ytn .ytn-item .vocab-due-badge { margin-left: -16px; background-color: #e5242b; background-image: none; color: #fff; }
.ytn-cat { gap: 20px; }
/* 31/10/2026 đề xuất 50 (Giang chốt): tên thể loại LUÔN 1 dòng, dài thì cắt "…" như YouTube (mọi chế độ: rộng ≥1312px + ngăn kéo ☰);
   đã BỎ số đếm video cạnh tên (index.html ytn-script) để tên có thêm chỗ; rê chuột thấy đủ tên (title). Thay luật 2 dòng + cờ ytn-cat-1line. */
.ytn-cat .ytn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- THU GỌN 72px ---------------- */
html.ytn-slim:not(.ytn-drawer) .ytn { width: 72px; }
html.ytn-slim:not(.ytn-drawer) .ytn-scroll { padding: 4px; scrollbar-width: none; }
html.ytn-slim:not(.ytn-drawer) .ytn-sec + .ytn-sec { border-top: 0; margin-top: 0; padding-top: 0; }
html.ytn-slim:not(.ytn-drawer) .ytn-sec-cats { display: none; }
html.ytn-slim:not(.ytn-drawer) .ytn-item {
  flex-direction: column; justify-content: center; gap: 6px;
  height: 74px; padding: 14px 0 12px; font-size: 10px; text-align: center;
}
html.ytn-slim:not(.ytn-drawer) .ytn-item.active { font-weight: 400; }
html.ytn-slim:not(.ytn-drawer) .ytn-label, html.ytn-slim:not(.ytn-drawer) .ytn-count { display: none !important; }
html.ytn-slim:not(.ytn-drawer) .ytn-mini { display: block; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ytn-slim:not(.ytn-drawer) .ytn-item .vocab-due-badge { position: absolute; top: 8px; left: 50%; margin: 0 0 0 4px; }

/* ---------------- NGĂN KÉO (màn nhỏ / thu gọn bấm ☰) ---------------- */
html.ytn-drawer .ytn { top: 0; z-index: 2001; box-shadow: 0 0 24px rgba(0, 0, 0, .35); }
html.ytn-drawer .ytn-drawer-head { display: flex; }
/* Logo trong ngăn kéo 240px: thu gọn như điện thoại để không tràn ra ngoài (iPad mini…) */
.ytn-drawer-head { padding: 0 8px 0 4px; gap: 0; overflow: hidden; }
.ytn-drawer-head .ytn-logo { padding: 0 4px 0 2px; gap: 5px; }
.ytn-drawer-head .ytn-logo img { width: 26px; height: 26px; }
.ytn-drawer-head .ytn-word { font-size: 17px; letter-spacing: -.4px; }
.ytn-drawer-head .ytn-w2 { margin-left: 4px; }
.ytn-scrim { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .5); }
.ytn-scrim[hidden] { display: none; }
html.ytn-drawer, html.ytn-drawer body { overflow: hidden; }

/* ---------------- CHỪA CHỖ CHO THANH TRÁI ---------------- */
html.ytn-wide #screen-input { padding-left: calc(240px + 24px) !important; }
html.ytn-slim #screen-input { padding-left: calc(72px + 16px) !important; }

/* ---------------- ĐIỆN THOẠI ---------------- */
@media (max-width: 560px) {
  #screen-input .home-top-row.ytn-head { padding: 0 8px 0 4px; gap: 4px; }
  .ytn-drawer-head { padding: 0 8px 0 4px; gap: 0; }
  .ytn-start { gap: 0; }
  .ytn-logo { padding: 0 4px 0 2px; gap: 5px; }
  .ytn-logo img { width: 26px; height: 26px; }
  .ytn-word { font-size: 17px; letter-spacing: -.4px; }
  .ytn-w2 { margin-left: 4px; }
}
@media (max-width: 360px) {
  .ytn-word { font-size: 15.5px; }
  .ytn-logo img { width: 24px; height: 24px; }
}
.ytn-theme-item { display: none; }
@media (max-width: 560px) {
  #screen-input .ytn-head .ui-tg-home { display: none; }
  .ytn-head .ss-top-right { margin-left: auto; }
  .ytn-theme-item { display: flex; }
}

/* ---------------- NỘI DUNG PHẲNG NHƯ YOUTUBE: bỏ khung bọc #main-card + khung "Thư viện video" ---------------- */
#screen-input #main-card { background: transparent !important; border: 0 !important; box-shadow: none !important; padding-left: 0 !important; padding-right: 0 !important; padding-top: 8px !important; }
#screen-input .lib-wrap { border-top: 0 !important; }
html #screen-input .lib-wrap > div, html #screen-input #main-card:has(#video-input-mode:not(.hidden)) > .lib-wrap > div { border-radius: 0 !important; background: transparent !important; background-image: none !important; border: 0 !important; box-shadow: none !important; padding-left: 0 !important; padding-right: 0 !important; }

/* ---------------- 30/10/2026 (Giang): ĐIỆN THOẠI – thanh trên CHỈ CÒN BIỂU TƯỢNG logo (bỏ chữ "SS" – trông như lỗi);
   chữ "Shadowing Studio" đầy đủ chỉ hiện trong ngăn kéo khi bấm ☰ (.ytn-drawer-head không bị ảnh hưởng) ---------------- */
@media (max-width: 560px) {
  #screen-input .ytn-head .ytn-word { display: none; }
}
