/* UPDATE #14 — landing page (khách chưa đăng nhập), phương án C "Cổng thông tin". Dựa trên token của app.css.
   Xanh brand là chủ đạo; cam nhạt CHỈ cho thông tin công khai (kỳ thi, thông báo, con số). */
:root {
  --public-bg: #fff4e8;     /* cam nhạt: nền khối thông tin công khai */
  --public-line: #fde2c6;
  --public: #b3540b;        /* chữ / số trên nền cam nhạt (tương phản ≥ 4.5:1) */
  --hero-ink: #ffffff;
  --hero-soft: rgb(255 255 255 / .82);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --public-bg: #2e2014; --public-line: #4a3220; --public: #f5a35c; }
}
/* UPDATE #15: same dark tokens when the user picks "Tối" in the user menu */
:root[data-theme="dark"] { --public-bg: #2e2014; --public-line: #4a3220; --public: #f5a35c; }
.lp { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.lp-wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 24px; }
@media (max-width: 640px) { .lp-wrap { padding-inline: 16px; } }

/* thanh trên cùng: cùng dải brand với app */
.lp-top { background: var(--brand); color: var(--on-brand); }
.lp-top .lp-wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.lp-brand { display: flex; align-items: center; gap: 12px; color: var(--on-brand); font-weight: 600; min-width: 0; }
.lp-brand:hover { text-decoration: none; }
.lp-brand img { width: 40px; height: 40px; border-radius: 50%; background: #fff; flex: none; }
.lp-brand span { line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-brand small { display: block; font-weight: 400; font-size: .75rem; opacity: .85; }
.lp-top .lp-jump { margin-left: auto; display: none; flex: none; white-space: nowrap; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  background: #fff; color: var(--brand); font-weight: 600; align-items: center; }
.lp-top .lp-jump:hover { text-decoration: none; background: rgb(255 255 255 / .9); }

/* hero xanh */
.lp-hero { background: var(--brand); color: var(--hero-ink); }
.lp-hero a { color: var(--hero-ink); }
.lp-kicker { margin: 0 0 12px; font-size: .8125rem; font-weight: 600; letter-spacing: .02em; color: var(--hero-soft); }
.lp-title { margin: 0; max-width: 20ch; text-wrap: balance; font-size: 2.25rem; line-height: 1.15; font-weight: 700; color: var(--hero-ink); letter-spacing: -.01em; }
.lp-lead { margin: 16px 0 0; max-width: 54ch; text-wrap: pretty; font-size: 1.0625rem; line-height: 1.6; color: var(--hero-soft); }
.lp-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.lp-points li { display: flex; align-items: flex-start; gap: 12px; font-size: .9375rem; line-height: 1.5; }
.lp-points .ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: rgb(255 255 255 / .14); flex: none; }
.lp-points b { display: block; color: var(--hero-ink); font-weight: 600; }
.lp-points span { color: var(--hero-soft); text-wrap: pretty; }
@media (max-width: 860px) { .lp-title { font-size: 1.75rem; } .lp-lead { font-size: 1rem; } }

/* box đăng nhập */
.lp-login { background: var(--surface); color: var(--text); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 48px -12px rgb(0 32 64 / .35); }
.lp-login h2 { margin: 0 0 20px; font-size: 1.25rem; }
.lp-login .field { margin-bottom: 16px; }
.lp-login input[type=text], .lp-login input[type=password] { height: 48px; font-size: 1rem; }
.lp-login .lbl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lp-login .lbl-row label { margin-bottom: 6px; }
.lp-login .lbl-row a, .lp-login .lbl-row button { font-size: .8125rem; font-weight: 500; }
.lp-forgot { border: 0; background: none; min-height: 32px; padding: 0 2px; margin: -6px 0 0; color: var(--brand); font: inherit; cursor: pointer; }
.lp-forgot:hover { text-decoration: underline; text-underline-offset: 3px; }
.lp-pass { position: relative; }
.lp-pass input { padding-right: 48px; }
.lp-eye { position: absolute; top: 50%; right: 6px; translate: 0 -50%; display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.lp-eye:hover { background: var(--item-hover); color: var(--text); }
.lp-login .btn.primary { width: 100%; min-height: 48px; font-size: 1rem; }
.lp-hint { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-soft); font-size: .8125rem; }
.lp-login .alert { margin-bottom: 16px; font-size: .875rem; }
.lp-login input[aria-invalid="true"] { border-color: var(--bad); }

/* khối thông tin công khai (cam nhạt) */
.lp-section { padding: 48px 0 56px; }
.lp-section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.lp-section-head h2 { margin: 0; font-size: 1.375rem; }
.lp-section-head p { margin: 0; color: var(--muted); font-size: .875rem; }
.lp-public-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
  background: var(--public-bg); color: var(--public); font-size: .75rem; font-weight: 600; }
.lp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(168px, 100%), 1fr)); gap: 12px; }
.lp-stat { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius-lg);
  background: var(--public-bg); border: 1px solid var(--public-line); }
.lp-stat .ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--public); flex: none; }
.lp-stat b { display: block; font-size: 1.625rem; line-height: 1.1; color: var(--public); font-variant-numeric: tabular-nums; }
.lp-stat span { color: var(--text-soft); font-size: .8125rem; }
@media (max-width: 640px) { .lp-stats { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); } .lp-stat { padding: 12px 14px; gap: 10px; } .lp-stat .ic { width: 34px; height: 34px; } }

.lp-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .lp-cols { grid-template-columns: minmax(0, 1fr); } }
.lp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.lp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 10px; }
.lp-card-head h3 { margin: 0; font-size: 1rem; }
.lp-card-head .n { color: var(--muted); font-size: .8125rem; }
.lp-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.lp-list li + li { border-top: 1px solid var(--line); }

/* một kỳ thi */
.lp-contest { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; }
.lp-date { display: grid; place-items: center; align-content: center; width: 56px; height: 56px; border-radius: 12px;
  background: var(--public-bg); color: var(--public); line-height: 1.05; }
.lp-date b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.lp-date small { font-size: .75rem; font-weight: 600; text-transform: uppercase; }
.lp-contest .t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600;
  overflow-wrap: anywhere; text-wrap: pretty; }
.lp-contest .m { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; color: var(--muted); font-size: .8125rem; }
.lp-contest .m .i { vertical-align: -2px; }
.lp-live { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px;
  background: var(--public); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }

/* một thông báo */
.lp-note { display: block; padding: 12px; border-radius: var(--radius-sm); color: var(--text); }
.lp-note:hover { text-decoration: none; background: var(--item-hover); }
.lp-note:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.lp-note .row1 { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; }
.lp-note .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px;
  font-weight: 600; overflow-wrap: anywhere; text-wrap: pretty; }
.lp-note p { margin: 4px 0 0; color: var(--text-soft); font-size: .875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lp-new { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; background: var(--public-bg);
  color: var(--public); font-size: .75rem; font-weight: 700; }
.lp-empty { margin: 0; padding: 20px 12px 24px; color: var(--muted); font-size: .875rem; text-align: center; text-wrap: balance; }

/* khung chờ */
.lp-skel { display: block; height: 12px; border-radius: 6px; background: var(--secondary); }
.lp-skel.w60 { width: 60%; } .lp-skel.w40 { width: 40%; } .lp-skel.w80 { width: 80%; }
.lp-skel-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; }
.lp-skel-row .box { width: 56px; height: 56px; border-radius: 12px; background: var(--secondary); }
.lp-skel-row .lines { display: grid; gap: 8px; }

.lp-foot { margin-top: auto; }  /* look: the shared .site-foot (app.css) */

/* ---- Phương án A: hero chia đôi (giới thiệu trái, đăng nhập phải) */
.lp-a .lp-hero .lp-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 64px; align-items: center; padding-block: 56px 64px; }
@media (max-width: 960px) {
  .lp-a .lp-hero .lp-wrap { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 32px 36px; }
  .lp-a .lp-login { max-width: none; }
}
/* ---- Phương án B: đăng nhập trước, giữa màn */
.lp-b .lp-hero .lp-wrap { display: grid; justify-items: center; text-align: center; padding-block: 48px 56px; gap: 24px; }
.lp-b .lp-hero .lp-lead { margin-inline: auto; }
.lp-b .lp-login { text-align: left; }
.lp-b .lp-section .lp-wrap { max-width: 880px; }
.lp-b .lp-title { font-size: 2rem; }
@media (max-width: 860px) { .lp-b .lp-title { font-size: 1.5rem; } .lp-b .lp-hero .lp-wrap { padding-block: 28px 32px; } }
/* ---- Phương án C: cổng thông tin (bảng tin trái, đăng nhập dính phải) */
.lp-c .lp-hero .lp-wrap { padding-block: 28px 32px; }
.lp-c .lp-title { font-size: 1.75rem; max-width: 32ch; }
.lp-c .lp-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; padding-block: 24px 56px; }
.lp-c .lp-aside { position: sticky; top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.lp-c .lp-login { max-width: none; box-shadow: none; border: 1px solid var(--line); }
.lp-c .lp-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
@media (max-width: 960px) {
  .lp-c .lp-body { grid-template-columns: minmax(0, 1fr); }
  .lp-c .lp-aside { position: static; order: -1; }
}
@media (max-width: 960px) { .lp-top .lp-jump { display: inline-flex; } .lp-b .lp-top .lp-jump { display: none; } }
@media (max-width: 640px) { .lp-brand small { display: none; } .lp-kicker { font-size: .75rem; } }
@media (max-width: 640px) { .lp-contest .m .dur { display: none; } .lp-note p { -webkit-line-clamp: 1; } }

/* nhãn ngày giờ của trang thật: icon cùng cỡ chữ meta */
.lp .m .i { vertical-align: -2px; }
.lp-points .ic .i, .lp-stat .ic .i { width: 18px; height: 18px; }
.lp-section-head .i, .lp-public-tag .i { width: 14px; height: 14px; }

/* box 7 — bảng xếp hạng công khai, top 5 mỗi loại (dưới box đăng nhập) */
.lp-rank { padding: 0; }
.lp-rank .lp-card-head { padding: 18px 20px 6px; }
.lp-rank .tabs { margin: 0 12px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.lp-rank .tabs::-webkit-scrollbar { display: none; }
.lp-rank .tabs a { white-space: nowrap; }
.lp-rank-hint { margin: 10px 20px 4px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.lp-rank ol { list-style: none; margin: 0; padding: 4px 8px 10px; }
.lp-rank li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--radius-sm); }
.lp-rank li + li { border-top: 1px solid var(--line); }
.lp-rank .pos { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2);
  color: var(--text-soft); font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lp-rank .pos.top { background: var(--public-bg); color: var(--public); }
.lp-rank .who { min-width: 0; }
.lp-rank .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-rank .who span { display: block; color: var(--muted); font-size: .75rem; }
.lp-rank .sc { font-weight: 600; font-variant-numeric: tabular-nums; }
.lp-rank .lp-empty { padding: 16px 20px 20px; }

/* trang thật: main của landing không dùng padding / max-width của khung app */
main.lp-body { max-width: 1200px; }
.lp-eye .eye-off, .lp-eye.showing .eye-on { display: none; }
.lp-eye.showing .eye-off { display: block; }

/* ---- UPDATE #16.1: thông báo = bài viết (trang /tin-tuc/<id>/ trình bày như bài báo) */
.lp-lead.md p { margin: 0; } .lp-lead.md p + p { margin-top: 8px; }
.lp-lead.md a { color: var(--hero-ink); text-decoration: underline; text-underline-offset: 3px; }
.lp-note .lp-more { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; color: var(--brand); font-size: .8125rem; font-weight: 600; }
.lp-note .lp-more .i { vertical-align: -2px; }

.ar-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; padding-block: 28px 56px; }
.ar-crumbs, .ar-draft { grid-column: 1 / -1; }
.ar-crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .8125rem; }
.ar-crumbs a { color: var(--muted); } .ar-crumbs a:hover { color: var(--brand); }
.ar { min-width: 0; padding: 40px 48px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ar-head { padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.ar-kicker { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; color: var(--brand); font-size: .8125rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; }
.ar-title { margin: 0; max-width: 34ch; font-size: 2.25rem; line-height: 1.2; font-weight: 800; letter-spacing: -.015em; text-wrap: balance;
  overflow-wrap: anywhere; }
.ar-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 14px 0 0; color: var(--muted); font-size: .875rem; }
/* chữ bài báo: khổ đọc ~70 ký tự, chữ lớn, giãn dòng rộng */
.ar-body { max-width: 70ch; font-size: 1.0625rem; line-height: 1.8; color: var(--text); overflow-wrap: break-word; }
.ar-body > :first-child { margin-top: 0; }
.ar-body > p:first-child { font-size: 1.1875rem; line-height: 1.7; color: var(--text); }
.ar-body p, .ar-body ul, .ar-body ol, .ar-body blockquote, .ar-body pre, .ar-body table { margin: 0 0 1.15em; }
.ar-body h1, .ar-body h2, .ar-body h3, .ar-body h4 { margin: 1.8em 0 .6em; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.ar-body h1, .ar-body h2 { font-size: 1.5rem; } .ar-body h3 { font-size: 1.25rem; } .ar-body h4 { font-size: 1.0625rem; }
.ar-body ul, .ar-body ol { padding-left: 1.4em; } .ar-body li + li { margin-top: .35em; }
.ar-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.ar-body strong { font-weight: 700; }
.ar-body blockquote { padding: .25em 0 .25em 1.1em; border-left: 4px solid var(--brand); color: var(--text-soft); font-style: italic; }
.ar-body blockquote p:last-child { margin-bottom: 0; }
.ar-body hr { margin: 2em auto; width: 40%; border: 0; border-top: 1px solid var(--line); }
.ar-body code { padding: .1em .35em; border-radius: 5px; background: var(--surface-2); font-size: .9em; }
.ar-body pre { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); overflow-x: auto; line-height: 1.55; }
.ar-body pre code { padding: 0; background: none; font-size: .875rem; }
.ar-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .9375rem; line-height: 1.5; }
.ar-body th, .ar-body td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.ar-body th { background: var(--surface-2); font-weight: 600; }
.ar-body img { display: block; max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 10px; }
.ar-body .katex-display { overflow-x: auto; overflow-y: hidden; }
.ar-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px;
  border-top: 1px solid var(--line); }
.ar-foot p { margin: 0; }
.ar-more { position: sticky; top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ar-more h2 { margin: 0; padding: 18px 20px 10px; font-size: 1rem; }
@media (max-width: 1000px) {
  .ar-wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .ar-more { position: static; }
}
@media (max-width: 640px) {
  .ar-wrap { padding-block: 16px 32px; }
  .ar { padding: 24px 18px 20px; border-radius: 12px; }
  .ar-title { font-size: 1.625rem; }
  .ar-body { font-size: 1rem; line-height: 1.75; } .ar-body > p:first-child { font-size: 1.0625rem; }
}

/* UPDATE #16.2 — UI 3.0 "Đêm lập trình": khung tối cho trang giới thiệu và bài viết */
.lp-top { background: var(--nav-bg-2); position: relative; }
.lp-top::after { content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: var(--accent-grad); opacity: .85; }
.lp-hero { background: radial-gradient(60% 120% at 100% 0%, rgb(139 92 246 / .35), transparent 60%),
  radial-gradient(50% 120% at 0% 100%, rgb(34 211 238 / .22), transparent 60%), var(--nav-bg); }
.lp-kicker { color: #67e8f9; }
.lp-login .btn.primary { background: var(--cta-grad); }
.ar-kicker { color: #0e7490; }
.ar-body blockquote { border-left-color: var(--accent-2); }

/* Thống kê công khai (cột giữa): hai biểu đồ mỗi hàng, biểu đồ theo thời gian trải hết chiều ngang */
.lp-charts-head { margin: 8px 0 0; }
.lp-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.lp-charts .wide { grid-column: 1 / -1; }
.lp-chart { display: flex; flex-direction: column; min-width: 0; }
.lp-chart-body { padding: 4px 20px 18px; min-width: 0; }
.lp-chart .lp-card-head { align-items: baseline; flex-wrap: wrap; }
@media (max-width: 700px) { .lp-charts { grid-template-columns: minmax(0, 1fr); } }
/* 26-10: "Học sinh nộp bài nhiều nhất" — tên + lớp xuống dòng thay vì cắt "…" (tên lớp luôn đầy đủ) */
.lp-chart[aria-labelledby="h-ch-top"] .ch-lab { white-space: normal; overflow-wrap: anywhere; }

/* ---- UX 80–20 (18/10/2026): hero mới + kỳ thi nổi bật + lối vào chức năng (component .ux-* trong ux.css) ---- */
.lp-topnav { display: flex; gap: 4px; margin-left: auto; }
.lp-topnav a { color: var(--on-brand); opacity: .9; padding: 6px 10px; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; }
.lp-topnav a:hover { background: rgb(255 255 255 / .14); text-decoration: none; opacity: 1; }
.lp-top .lp-topnav + .lp-jump { margin-left: 8px; }
.lp-hero2 { background: var(--brand); padding: 8px 0 40px; }
.lp-hero-card { border-radius: 20px; padding: 40px; background: radial-gradient(900px 360px at 100% 0, var(--ux-hero-c), transparent 60%), linear-gradient(135deg, var(--ux-hero-a), var(--ux-hero-b)); }
.lp-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: center; position: relative; z-index: 1; }
.lp-title2 { margin: 0; font-size: var(--ux-fs-3xl); line-height: 1.12; letter-spacing: -.015em; text-wrap: balance; color: #fff; max-width: 22ch; }
.lp-spot { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--elevation-modal); }
.lp-spot .ux-chip { align-self: flex-start; }
.lp-spot-title { font-size: 1.15rem; line-height: 1.3; }
.lp-spot-meta { color: var(--muted); font-size: .875rem; }
.lp-spot .ux-count small { color: var(--muted); opacity: 1; }
.lp-spot .ux-count b { color: var(--brand); }
.lp-cd { display: block; margin-top: 4px; color: var(--public); }
#bat-dau { margin-top: 8px; }
@media (max-width: 900px) { .lp-hero-grid { grid-template-columns: 1fr; } .lp-hero-card { padding: 28px 20px; } }
@media (max-width: 640px) { .lp-topnav { display: none; } .lp-top .lp-jump { margin-left: auto; } }
.lp-hero-card .lp-lead { margin: 12px 0 0; max-width: 62ch; font-size: 1.1rem; color: rgb(255 255 255 / .9); }
.lp-hero-card .lp-lead p { margin: 0 0 .4em; }
