/* Giao diện Dailies, hướng "Bảng dựng": nền trắng, chữ đen, lưới kẻ đường mảnh như contact sheet, điểm nhấn cam.
   Mobile-first: lưới 2 cột sát mép và thanh tab đen dính đáy; từ 760px tab lên dải đầu trang, lưới 3–4 cột.
   Đường kẻ: mỗi khối tự vẽ viền dưới; lưới ô dùng khe 1px trên nền đen. */
:root {
  --bg: #FFFFFF;
  --ink: #0A0A0A;
  --ink-2: #1F1F1F;
  --muted: #555555;
  --soft: #F2F2F2;
  --line-soft: #D9D9D9;
  --on-dark: #B5B5B5;
  --edge-dark: #6B6B6B;
  --accent: #FF4D00;
  --accent-soft: #FFF1EA;
  --bad: #B3261E;
  --tabbar: 68px;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --pad: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; border-radius: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; flex-shrink: 0; }
.ic.solid { fill: currentColor; stroke: none; }
.lab { font-family: var(--mono); font-size: 10.5px; line-height: 14px; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 11px; line-height: 16px; color: var(--muted); }
.sub { font-family: var(--mono); font-size: 11px; line-height: 16px; color: var(--muted); }
.note { font-size: 12px; line-height: 17px; color: var(--muted); }
@media (max-width: 759px) { .only-wide { display: none !important; } }

/* ---------- Dải đầu trang và thanh tab ---------- */
.top { background: var(--ink); color: #fff; }
.top-in { max-width: 1200px; margin: 0 auto; min-height: 68px; padding: 12px var(--pad); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; font-family: var(--cond); font-size: 28px; line-height: 28px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tally { width: 12px; height: 12px; background: var(--accent); display: block; }
#top-slot { display: flex; align-items: center; min-height: 44px; min-width: 0; font-family: var(--mono); font-size: 12px; }
#top-slot .sq, #top-slot .slot-btn {
  min-width: 44px; height: 44px; padding: 0 12px; border: 1px solid var(--edge-dark); background: transparent; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--mono); font-size: 12px; text-transform: uppercase;
}
#top-slot .sq { padding: 0; }
#top-slot .sq + .sq, #top-slot .when + .sq { border-left: 0; }
#top-slot .sq:disabled { color: var(--edge-dark); }
#top-slot .when { height: 44px; padding: 0 12px; border: 1px solid var(--edge-dark); border-left: 0; display: flex; align-items: center; white-space: nowrap; }
#top-slot .plain { color: var(--on-dark); text-transform: uppercase; padding-right: 12px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--ink); display: flex; }
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--on-dark);
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase;
}
.tabs a[aria-current="page"] { color: #fff; font-weight: 600; box-shadow: inset 0 4px 0 var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding-bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-width: 0; overflow-x: clip; }

/* ---------- Nút, ô nhập ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--ink); background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--soft); }
.btn.solid { background: var(--ink); color: #fff; }
.btn.solid:hover:not(:disabled) { background: #2A2A2A; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn:hover:not(:disabled) { background: var(--soft); }
.icon-btn:disabled { color: var(--line-soft); }
.ctl, textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); font-size: 14px; }
textarea { padding: 12px; min-height: 110px; font-size: 15px; line-height: 22px; resize: vertical; display: block; }
input::placeholder, textarea::placeholder { color: #767676; }
.sw { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; flex-shrink: 0; }
.switch { appearance: none; -webkit-appearance: none; margin: 0; width: 46px; height: 26px; border: 1px solid var(--ink); background: var(--bg); position: relative; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--ink); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Đầu trang từng màn, hàng ô ---------- */
.mast { padding: 18px var(--pad) 14px; border-bottom: 1px solid var(--ink); display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 12px; }
.mast h1 { font-family: var(--cond); font-size: 64px; line-height: 64px; font-weight: 700; letter-spacing: -0.005em; text-transform: uppercase; }
.mast.long h1 { font-size: 52px; line-height: 54px; }
.mast-meta { margin: 0 0 6px auto; font-family: var(--mono); font-size: 11px; line-height: 15px; text-transform: uppercase; text-align: right; }

.cells { display: grid; gap: 1px; background: var(--ink); border-bottom: 1px solid var(--ink); list-style: none; margin: 0; padding: 0; }
.cells > * { background: var(--bg); min-width: 0; }
.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cell { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.cell .lab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.hot { background: var(--accent); }
.cell.hot .lab { color: var(--ink); }
.numx { font-family: var(--cond); font-size: 36px; line-height: 36px; font-weight: 700; }
.cell.dim .numx { color: var(--muted); }
.fill { display: none; background: var(--bg); }

.sec-head { padding: 22px var(--pad) 10px; border-bottom: 1px solid var(--ink); display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head h2 { font-family: var(--cond); font-size: 26px; line-height: 28px; font-weight: 700; text-transform: uppercase; }
.sec-head span { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.blk { padding: var(--pad); border-bottom: 1px solid var(--ink); min-width: 0; }
.blk-h { font-family: var(--cond); font-size: 24px; line-height: 26px; font-weight: 700; text-transform: uppercase; }

/* ---------- Nhãn, điểm ---------- */
.score { display: inline-flex; align-items: center; height: 14px; padding: 0 4px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 10.5px; font-weight: 600; flex-shrink: 0; }
.score.low { background: none; border: 1px solid var(--ink); color: var(--ink); padding: 0 3px; }
.ltag { display: inline-flex; align-items: center; height: 14px; padding: 0 4px; background: var(--accent); color: var(--ink); font-family: var(--mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase; flex-shrink: 0; }
.vtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 14px; }
.vlabel { font-family: var(--mono); font-size: 10.5px; line-height: 14px; text-transform: uppercase; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vright { display: flex; gap: 4px; flex-shrink: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border: 1px solid var(--ink); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

/* ---------- Thẻ video ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--ink); border-bottom: 1px solid var(--ink); }
.vcard { display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.vcard:hover, .feature:hover { background: #FAFAFA; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #E6E6E6; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ftag { position: absolute; left: 0; top: 0; height: 22px; padding: 0 7px; background: var(--ink); color: #fff; font-family: var(--cond); font-size: 15px; font-weight: 700; display: flex; align-items: center; }
.tcode { position: absolute; right: 0; bottom: 0; height: 18px; padding: 0 6px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 10.5px; font-weight: 500; display: flex; align-items: center; }
.vbody { padding: 10px 12px 12px; display: flex; flex-direction: column; min-width: 0; }
.vtitle { margin-top: 6px; font-size: 14px; line-height: 18px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vmeta { margin-top: 6px; font-family: var(--mono); font-size: 10.5px; line-height: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vkp { display: none; }

/* Thẻ nổi bật */
.feature { display: flex; flex-direction: column; border-bottom: 1px solid var(--ink); min-width: 0; }
.feature .ftag { height: 30px; padding: 0 10px; font-size: 20px; }
.feature .tcode { height: 22px; padding: 0 8px; font-size: 11.5px; }
.f-thumb { display: block; min-width: 0; }
.f-body { padding: 14px var(--pad) 16px; display: flex; flex-direction: column; min-width: 0; }
.f-body .vtop { min-height: 16px; }
.f-body .vlabel { font-size: 11px; line-height: 16px; }
.f-body .score { height: 16px; padding: 0 6px; font-size: 11px; }
.f-title { margin-top: 8px; font-size: 19px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; text-wrap: pretty; }
.f-body .mono { margin-top: 8px; overflow-wrap: anywhere; }
.points { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.points li { display: flex; gap: 12px; }
.points .num { width: 26px; height: 22px; flex-shrink: 0; background: var(--ink); color: #fff; font-family: var(--cond); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.points p { font-size: 14px; line-height: 21px; color: var(--ink-2); }
.feature .points li:nth-child(n+2) { display: none; }
.feature .points .num { display: none; }
.cta { margin-top: 12px; min-height: 44px; padding: 0 12px; border: 1px solid var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.cta:hover { background: var(--ink); color: #fff; }
.pending { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* ---------- Khối gập, danh sách ---------- */
.fold { border-bottom: 1px solid var(--ink); }
.fold > summary, .tech > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fold > summary { min-height: 56px; padding: 0 var(--pad); font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.fold > summary span { color: var(--muted); }
summary::-webkit-details-marker { display: none; }
summary .chev { transition: transform .15s; }
details[open] > summary .chev { transform: rotate(180deg); }
.fold-body { padding: 0 var(--pad) 16px; font-size: 14px; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rows li { padding: 10px 0; border-top: 1px solid var(--line-soft); min-width: 0; }
.rows .t { font-weight: 600; }
.rows .sub { display: block; margin-top: 2px; }

/* ---------- Dòng thời gian ---------- */
.ctl-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.pager { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.pager .p { display: flex; align-items: baseline; gap: 8px; }
.pager .p b { font-family: var(--cond); font-size: 24px; line-height: 26px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.pager .p span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.segb { min-width: 72px; padding: 0 14px; border: 0; background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.segb[aria-pressed="true"] { background: var(--ink); color: #fff; }
.filters label.cell { padding: 8px 12px 6px; gap: 0; }
.filters select { width: 100%; height: 36px; padding: 0; border: 0; background: transparent; font-size: 14px; font-weight: 500; }

/* ---------- Hàng đợi học ---------- */
.q-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qtab { border: 0; text-align: left; color: var(--ink); }
.qtab:hover { background: var(--soft); }
.qtab[aria-pressed="true"] { background: var(--ink); color: #fff; }
.qtab[aria-pressed="true"] .lab { color: var(--on-dark); }
.fill.qfill { display: block; }
.vnote { position: relative; margin-top: 8px; padding-left: 14px; font-size: 12.5px; line-height: 17px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vnote::before { content: ''; position: absolute; left: 0; top: 5px; width: 7px; height: 7px; background: var(--accent); }

/* ---------- Chi tiết video ---------- */
.bar-row { border-bottom: 1px solid var(--ink); display: flex; }
.linkbtn { min-height: 48px; padding: 0 var(--pad) 0 12px; border: 0; background: none; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.linkbtn:hover { background: var(--soft); }
.detail { display: flex; flex-direction: column; }
.d-main, .d-side { display: contents; }
.d-hero { order: 1; border-bottom: 1px solid var(--ink); }
.d-learn { order: 2; }
.d-points { order: 3; }
.d-moments { order: 4; }
.d-caveat { order: 5; }
.d-tech { order: 6; }
.d-why { order: 7; }
.d-note { order: 8; }
.detail .d-desc { order: 9; }
.d-hero .tcode { height: 22px; padding: 0 8px; font-size: 11.5px; }
.play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; }
.play:hover { background: var(--accent); color: var(--ink); }
.d-hero .body { padding: 14px var(--pad) 16px; display: flex; flex-direction: column; }
.d-hero .vlabel { font-size: 11px; line-height: 16px; }
.d-hero .score { height: 16px; padding: 0 6px; font-size: 11px; }
.d-hero h1 { margin-top: 10px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.015em; text-wrap: pretty; }
.d-hero .mono { margin-top: 8px; overflow-wrap: anywhere; }
.d-hero .tags { margin-top: 12px; }
.learn-pills { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.learn-pills button { height: 44px; padding: 0 14px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.learn-pills button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.d-points .points { margin-top: 12px; gap: 14px; }
.d-points .points p { font-size: 15px; line-height: 23px; color: var(--ink); }
.d-moments { padding-bottom: 6px; }
.d-moments .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.d-moments .why { margin: 10px 0 8px; font-size: 14px; line-height: 21px; color: var(--ink-2); }
.moments { list-style: none; margin: 0; padding: 0; }
.moments a { min-height: 52px; padding: 6px 0; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 20px; }
.moments a:hover .ts { background: var(--accent); color: var(--ink); }
.moments .ts { width: 58px; height: 28px; flex-shrink: 0; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.d-caveat { background: var(--accent-soft); }
.d-caveat .lab { color: var(--ink); display: flex; align-items: center; gap: 8px; font-weight: 600; }
.d-caveat .lab i { width: 10px; height: 10px; background: var(--accent); display: block; }
.d-caveat p { margin-top: 8px; font-size: 13.5px; line-height: 20px; color: var(--ink-2); }
.d-tech { padding-bottom: 0; }
.d-tech > .blk-h { margin-bottom: 12px; }
.tech { border-top: 1px solid var(--ink); margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
.tech > summary { min-height: 56px; padding: 8px 0; justify-content: flex-start; }
.tech > summary .num { width: 26px; height: 22px; flex-shrink: 0; border: 1px solid var(--ink); font-family: var(--cond); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tech[open] > summary .num { background: var(--ink); color: #fff; }
.tech > summary .t { flex: 1; font-size: 15px; line-height: 20px; font-weight: 600; }
.tech > summary .sub { display: none; white-space: nowrap; text-transform: uppercase; }
.tech-body { padding: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.tech-body ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 21px; }
.tech-body .settings { padding: 10px 12px; background: var(--soft); font-size: 13px; line-height: 19px; color: var(--ink-2); }
.tech-body .settings b { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; font-weight: 600; color: var(--ink); margin-right: 4px; }
.prompt { border: 1px solid var(--ink); }
.prompt .bar-top { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 0 0 12px; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; }
.prompt .bar-top button { height: 40px; padding: 0 12px; border: 0; border-left: 1px solid var(--ink); background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.prompt .bar-top button:hover { background: var(--ink); color: #fff; }
.prompt pre { margin: 0; padding: 12px; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; line-height: 19px; background: var(--soft); }
.d-why p { margin-top: 6px; font-size: 14px; line-height: 21px; }
.d-note .note { margin: 4px 0 12px; }
.d-note .btn { margin-top: 12px; }
.d-desc .fold-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }

/* ---------- Cài đặt ---------- */
.spend { padding: 12px; gap: 8px; }
.spend .l { display: flex; justify-content: space-between; gap: 8px; }
.spend .v { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.spend .v span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.bar { height: 8px; border: 1px solid var(--ink); background: var(--bg); }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar.over i { background: var(--bad); }
.ready { grid-template-columns: minmax(0, 1fr); }
.ready li { min-height: 48px; padding: 0 var(--pad); display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.ready li .sub { margin-left: auto; font-weight: 400; text-align: right; text-transform: uppercase; }
.ready .no { color: var(--bad); }
.runb { min-height: 56px; padding: 0 12px; border: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--ink); }
.runb.hot { background: var(--accent); font-weight: 600; }
.runb:hover:not(:disabled):not(.hot) { background: var(--soft); }
.runb:disabled { color: var(--muted); }
.form-tile { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form label > span { min-height: 28px; display: flex; align-items: flex-end; font-family: var(--mono); font-size: 10.5px; line-height: 14px; text-transform: uppercase; color: var(--muted); }
.form label.full { grid-column: 1 / -1; }
.form label.full > span { min-height: 0; }
.ch { padding: 12px 8px 6px 12px; display: flex; flex-direction: column; min-width: 0; }
.ch-info { display: flex; flex-direction: column; min-width: 0; }
.ch-info a { font-size: 14px; line-height: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-info small { margin-top: 3px; font-family: var(--mono); font-size: 10.5px; line-height: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-info small.err { color: var(--bad); white-space: normal; }
.ch.off .ch-info { opacity: .5; }
.ch-ctl { margin-top: 4px; display: flex; align-items: center; justify-content: space-between; }
.add-row { display: flex; }
.add-row input { flex: 1; min-width: 0; }
.add-row .btn { border-left: 0; }
.kw-tabs button { min-height: 44px; }
.kw-cols { display: grid; grid-template-columns: minmax(0, 1fr); border-bottom: 1px solid var(--ink); }
.kw-tier { display: none; flex-direction: column; min-width: 0; padding: 12px var(--pad) var(--pad); }
.kw-tier.active { display: flex; }
.kw-tier h3 { display: none; font-family: var(--cond); font-size: 22px; line-height: 24px; font-weight: 700; text-transform: uppercase; }
.kw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 6px; }
.kw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kw-list li { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 4px; border-top: 1px solid var(--line-soft); font-size: 14px; min-width: 0; }
.kw-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-list li.off span { opacity: .5; text-decoration: line-through; }
.kw-list .icon-btn { margin-right: -12px; }
.kw-tier .add-row { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; white-space: nowrap; }
th { height: 32px; text-align: left; font-family: var(--mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase; color: var(--muted); }
td { height: 44px; border-top: 1px solid var(--line-soft); }
td.num, th.num { text-align: right; padding-left: 16px; }
td.num { font-family: var(--mono); font-size: 12px; }
td.strong { font-weight: 600; }
.cost-blk { padding-top: 8px; padding-bottom: 8px; display: flex; flex-direction: column; gap: 16px; }
.kinds, .runs { list-style: none; margin: 0; padding: 0 var(--pad); border-bottom: 1px solid var(--ink); }
.kinds li { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line-soft); }
.kinds li:first-child, .runs li:first-child { border-top: 0; }
.kinds .k { min-width: 0; display: flex; flex-direction: column; }
.kinds .k b { font-size: 14px; line-height: 18px; font-weight: 600; }
.kinds .k span { font-family: var(--mono); font-size: 10.5px; line-height: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kinds .u { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.runs li { min-height: 56px; padding: 8px 0; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); min-width: 0; }
.runs .no { color: var(--bad); }
.runs .r { min-width: 0; display: flex; flex-direction: column; }
.runs .r b { font-size: 14px; line-height: 18px; font-weight: 600; }
.runs .r span { font-family: var(--mono); font-size: 11px; line-height: 16px; color: var(--muted); overflow-wrap: anywhere; }
.runs li.foot { min-height: 44px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- Trạng thái ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px var(--pad); border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; text-transform: uppercase; }
.skeleton { height: 140px; border-bottom: 1px solid var(--ink); background: linear-gradient(90deg, #F4F4F4, #E9E9E9, #F4F4F4); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .switch::after, summary .chev { transition: none; } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  max-width: calc(100vw - 32px); padding: 12px 16px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; box-shadow: 4px 4px 0 var(--accent);
}
.toast.err { background: var(--bad); box-shadow: 4px 4px 0 var(--ink); }

/* ---------- Điện thoại ---------- */
@media (max-width: 759px) {
  .only-wide { display: none !important; }
  .fill.f2 { display: block; }
  /* Nhóm có số video lẻ: thẻ cuối trải ngang hết hàng */
  .vcard.lone { grid-column: 1 / -1; flex-direction: row; }
  .vcard.lone .thumb { width: 50%; flex-shrink: 0; align-self: flex-start; }
  .vcard.lone .vbody { flex: 1; justify-content: center; }
}

/* ---------- Từ 760px: tab lên dải đầu trang, trang thành một tờ có viền ---------- */
@media (min-width: 760px) {
  :root { --pad: 24px; }
  .only-narrow { display: none !important; }
  .top-in { flex-wrap: wrap; gap: 8px 32px; }
  .brand { font-size: 32px; }
  .tally { width: 14px; height: 14px; }
  .tabs { position: static; height: auto; padding: 0; background: none; flex: 1; gap: 4px; }
  .tabs a { flex: none; flex-direction: row; gap: 8px; height: 44px; padding: 0 14px; font-size: 12px; }
  .tabs a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  main { padding-bottom: 0; margin-bottom: 64px; border-left: 1px solid var(--ink); border-right: 1px solid var(--ink); }
  .toast { bottom: 32px; }

  .mast { padding: 28px var(--pad) 20px; }
  .mast h1, .mast.long h1 { font-size: 104px; line-height: 96px; }
  .mast-meta { font-size: 12px; line-height: 17px; margin-bottom: 8px; }
  .cell { padding: 16px var(--pad); gap: 6px; }
  .numx { font-size: 60px; line-height: 56px; }
  .lab { font-size: 11px; }
  .sec-head { padding: 32px var(--pad) 12px; }
  .sec-head h2 { font-size: 34px; line-height: 36px; }
  .blk-h { font-size: 28px; line-height: 30px; }

  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fill.f3 { display: block; }
  .ftag { height: 26px; padding: 0 9px; font-size: 18px; }
  .tcode { height: 20px; padding: 0 7px; font-size: 11px; }
  .vbody { padding: 14px 16px 18px; }
  .vtitle { margin-top: 8px; font-size: 15px; line-height: 20px; -webkit-line-clamp: 2; }
  .vmeta { margin-top: 8px; font-size: 11px; }
  .vkp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 8px; font-size: 13px; line-height: 19px; color: var(--ink-2); }

  .feature { flex-direction: row; }
  .f-thumb { flex: 1 1 50%; border-right: 1px solid var(--ink); background: #E6E6E6; }
  .f-thumb .thumb { height: 100%; aspect-ratio: auto; min-height: 320px; }
  .feature .ftag { height: 40px; padding: 0 14px; font-size: 28px; }
  .f-body { flex: 1 1 50%; padding: 24px var(--pad); }
  .f-title { margin-top: 12px; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
  .f-body .mono { font-size: 12px; line-height: 17px; }
  .feature .points { margin-top: 16px; }
  .feature .points li:nth-child(n+2) { display: flex; }
  .feature .points .num { display: flex; }
  .feature .points p { font-size: 15px; line-height: 22px; }
  .cta { margin-top: auto; }
  .f-body .points { margin-bottom: 20px; }
  .fold > summary { min-height: 60px; }

  .filters.c2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .q-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .fill.qfill { display: none; }
  .vnote { font-size: 13px; line-height: 19px; -webkit-line-clamp: 3; }
  .filters label.cell { padding: 12px var(--pad) 8px; }
  .pager { padding: 8px 12px; min-height: 72px; }
  .pager .p b { font-size: 34px; line-height: 36px; }
  .segb { min-width: 120px; }

  .detail { flex-direction: row; align-items: stretch; border-bottom: 1px solid var(--ink); }
  .d-main { display: flex; flex-direction: column; flex: 999 1 560px; min-width: 0; border-right: 1px solid var(--ink); }
  .d-side { display: flex; flex-direction: column; flex: 1 1 340px; max-width: 400px; min-width: 0; }
  .d-main > :last-child, .d-side > :last-child { border-bottom: 0; }
  .play { width: 80px; height: 80px; margin: -40px 0 0 -40px; }
  .d-hero .body { padding: 20px var(--pad) 24px; }
  .d-hero h1 { margin-top: 12px; font-size: 34px; line-height: 40px; letter-spacing: -0.025em; text-wrap: balance; }
  .d-hero .mono { font-size: 12px; line-height: 17px; }
  .d-points .points p { font-size: 16px; line-height: 24px; }
  .tech > summary { min-height: 60px; gap: 14px; }
  .tech > summary .t { font-size: 16px; line-height: 22px; }
  .tech > summary .sub { display: inline; }
  .tech-body { padding: 0 0 20px 40px; gap: 12px; }
  .tech-body ol { font-size: 15px; line-height: 23px; }
  .prompt pre { font-size: 13px; line-height: 20px; }

  .spend { padding: 16px var(--pad); }
  .ready { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ready li { min-height: 56px; }
  .run-grid.c2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .runb { min-height: 64px; }
  .check { justify-content: flex-end; flex-direction: row-reverse; gap: 14px; }
  .form { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
  .form label > span { min-height: 0; font-size: 11px; }
  .form label.full { grid-column: auto; }
  .form-tile .btn { align-self: flex-start; padding: 0 26px; }
  .ch-grid.c2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ch { flex-direction: row; align-items: center; gap: 6px; padding: 12px 8px 12px var(--pad); }
  .ch-info { flex: 1; }
  .ch-info a { font-size: 15px; line-height: 20px; }
  .ch-ctl { margin-top: 0; gap: 2px; }
  .add-ch { max-width: 600px; }
  .kw-tabs { display: none; }
  .kw-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--ink); }
  .kw-tier { display: flex; background: var(--bg); padding: 20px var(--pad) var(--pad); gap: 12px; }
  .kw-tier h3 { display: block; }
  .kw-head { padding-bottom: 0; }
  .kw-list { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .kw-list li { min-height: 36px; max-width: 100%; padding: 0 0 0 10px; border: 1px solid var(--ink); font-size: 13px; gap: 0; }
  .kw-list .icon-btn { width: 34px; height: 34px; margin-right: 0; }
  .kw-tier .add-row { margin-top: auto; padding-top: 4px; }
  .cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1px; background: var(--ink); }
  .cols > * { background: var(--bg); min-width: 0; }
  .cols .kinds, .cols .runs, .cols .cost-blk { border-bottom: 0; }
  .cost-blk { padding-top: 12px; padding-bottom: 16px; gap: 24px; }
  table { font-size: 14px; }
  th { height: 36px; font-size: 11px; }
}
@media (min-width: 1040px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fill.f3 { display: none; }
  .fill.f4 { display: block; }
  .ch-grid.c2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
