/*
Theme Name: NTN Exam Portal
Theme URI: https://github.com/
Author: Nguyen Thanh Nhan
Description: Cổng luyện tập online — học sinh (mã lớp/mã đề + mã HS) và giáo viên (tài khoản WordPress), kèm trang site độc lập (Đăng ký VIP, Liên hệ, Điều khoản, Chính sách). Cần plugin NTN Luyện tập.
Version: 2.3.0
Text Domain: ntn-exam
*/

:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-2: #0284c7;
  --ok: #059669;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none !important;
}
body,
body.ntn-portal,
body.ntn-gv {
  font-family: "Segoe UI", "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  width: 100% !important;
  max-width: none !important;
}
body.ntn-portal .wp-site-blocks,
body.ntn-portal .is-layout-constrained,
body.ntn-portal .is-layout-flow,
body.ntn-portal .entry-content {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.ntn-login {
  min-height: calc(100vh - 55px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: #f8fafc;
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.05) 0px, transparent 50%);
}
.ntn-login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
}
.ntn-portal-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 24px;
}
.ntn-portal-tabs a {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s ease;
}
.ntn-portal-tabs a:hover {
  color: var(--ink);
  text-decoration: none;
}
.ntn-portal-tabs a.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
.ntn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color .15s ease;
}
.ntn-back-home:hover {
  color: var(--accent);
  text-decoration: none;
}
.ntn-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.ntn-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.ntn-login-card h1 { margin: 0 0 6px; font-size: 1.45rem; }
.ntn-login-card p.lead { color: var(--muted); margin: 0 0 22px; }
.ntn-field { margin-bottom: 14px; }
.ntn-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.ntn-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}
.ntn-field input:focus { outline: 2px solid #c7d2fe; border-color: var(--accent); }
.ntn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.ntn-btn:hover { filter: brightness(1.05); }
.ntn-error, .ntn-alert {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.ntn-ok {
  background: #ecfdf5;
  color: #047857;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.ntn-teacher-link {
  text-align: center;
  margin: 16px 0 0;
  font-size: .9rem;
}
.ntn-teacher-link a { color: var(--muted); }
.ntn-card-pad { padding: 18px; }
.ntn-inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.ntn-del { color: #b91c1c; }

.ntn-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
.ntn-side {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #e5e7eb;
  padding: 28px 20px;
  min-height: 100vh;
}
.ntn-side h2 { margin: 0 0 4px; font-size: 1.15rem; color: #fff; }
.ntn-side .meta { color: #94a3b8; font-size: .9rem; margin-bottom: 28px; }
.ntn-side a {
  display: block;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.ntn-side a:hover, .ntn-side a.active { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.ntn-main {
  padding: 36px 44px 48px;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
}
.ntn-hero {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid #e0e7ff;
  border-radius: 18px;
  padding: 24px 28px;
  margin-bottom: 22px;
  width: 100%;
}
.ntn-hero h1 { margin: 0 0 8px; font-size: 1.7rem; }
.ntn-hero p { margin: 0; color: var(--muted); line-height: 1.55; }
.ntn-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
  width: 100%;
}
.ntn-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.ntn-stat b { display: block; font-size: 1.6rem; }
.ntn-stat span { color: var(--muted); font-size: .9rem; }
.ntn-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.ntn-card h3 { margin: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ntn-exam {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.ntn-exam:last-child { border-bottom: 0; }
.ntn-exam .title { font-weight: 700; }
.ntn-exam .sub { color: var(--muted); font-size: .9rem; }
.ntn-btn.small { width: auto; padding: 8px 14px; font-size: .92rem; }
.ntn-btn.ghost { background: #eef2ff; color: var(--accent); }
table.ntn-table { width: 100%; border-collapse: collapse; }
table.ntn-table th, table.ntn-table td { text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--line); }
table.ntn-table th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.best { color: var(--ok); font-weight: 800; }

.ntn-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ntn-muted { color: var(--muted); }
.ntn-help { color: var(--muted); font-size: .88rem; margin: 0 0 12px; }
.ntn-section-title { margin: 8px 0 12px; font-size: 1.05rem; }
.ntn-side-label {
  color: #64748b;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 10px;
}
.ntn-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  margin-left: 8px;
  vertical-align: middle;
}
.ntn-badge.open { background: #d1fae5; color: #047857; }
.ntn-badge.scheduled { background: #fef3c7; color: #b45309; }
.ntn-badge.closed { background: #e2e8f0; color: #475569; }
.ntn-chip {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .8rem;
  font-weight: 600;
  margin: 0 4px 4px 0;
}
.ntn-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.ntn-class-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
}
.ntn-class-card:hover { border-color: #c7d2fe; box-shadow: 0 8px 24px rgba(79,70,229,.08); text-decoration: none; }
.ntn-class-card strong { font-size: 1.15rem; }
.ntn-class-card span { color: var(--muted); font-size: .9rem; }
.ntn-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 800;
  letter-spacing: .06em;
  color: #3730a3;
  background: #eef2ff;
  border-radius: 8px;
  padding: 1px 7px;
}
.ntn-copy {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 8px;
  padding: 3px 8px;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
}
.ntn-copy:hover { background: #c7d2fe; }
.ntn-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.ntn-filter-bar label { font-weight: 600; }
.ntn-filter-bar select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
}
.ntn-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px 12px;
  margin: 8px 0 10px;
}
.ntn-check {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.45;
}
.ntn-check input[type="checkbox"] {
  position: static !important;
  opacity: 1 !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 8px 0 0 !important;
  vertical-align: -2px;
  float: none !important;
  display: inline-block !important;
  appearance: auto;
}
.ntn-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ntn-field input[type=datetime-local],
.ntn-field input[type=number],
.ntn-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}
@media (max-width: 860px) {
  .ntn-shell { grid-template-columns: 1fr; }
  .ntn-side { min-height: 0; }
  .ntn-main { padding: 20px 16px 32px; }
  .ntn-grid, .ntn-grid-4 { grid-template-columns: 1fr; }
  .ntn-exam { flex-direction: column; align-items: flex-start; }
  .ntn-field-row { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Site độc lập: topbar / footer / trang nội dung / trang VIP          */
/* ------------------------------------------------------------------ */

.ntn-logo-sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: .8rem;
  flex: none;
}

.ntn-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.ntn-topbar-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.ntn-topbar-brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.ntn-topbar-brand b { font-size: 1rem; }
.ntn-topbar-brand small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; }
.ntn-topbar-brand:hover { text-decoration: none; }
.ntn-topbar-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ntn-topbar-link { color: var(--ink); opacity: .85; font-weight: 600; padding: 8px 10px; border-radius: 10px; }
.ntn-topbar-link:hover { background: #eef2ff; text-decoration: none; opacity: 1; }
.ntn-topbar-vip { color: var(--accent); }

/* Nút hamburger + kiểm tra iframe checkbox menu mobile (ẩn trên desktop) */
.ntn-topbar-check { display: none; }
.ntn-topbar-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
}
.ntn-topbar-burger span {
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: opacity .15s ease;
}
.ntn-topbar-check:checked ~ .ntn-topbar-burger span:nth-child(2) { opacity: .35; }

@media (max-width: 700px) {
  /* Giữ thanh menu gọn trong 1 hàng (~52px) để màn hình chính không bị che. */
  .ntn-topbar { border-bottom: 1px solid var(--line); }
  .ntn-topbar-in {
    padding: 7px 14px;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .ntn-topbar-brand { gap: 8px; min-width: 0; }
  .ntn-topbar-brand b { font-size: .9rem; white-space: nowrap; }
  .ntn-topbar-brand small { display: none; }
  .ntn-topbar-burger { display: inline-flex; }
  .ntn-topbar-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 32px rgba(15, 23, 42, .12);
    z-index: 60;
  }
  .ntn-topbar-check:checked ~ .ntn-topbar-nav { display: flex; }
  .ntn-topbar-link { padding: 11px 12px; border-radius: 10px; opacity: 1; }
  .ntn-topbar-link:hover { background: #f1f5f9; }
}
@media (max-width: 340px) {
  .ntn-topbar-brand b { display: none; } /* màn hình rất hẹp — chỉ còn logo + burger */
}

.ntn-footer { background: var(--sidebar); color: #cbd5e1; margin-top: 0; }
.ntn-footer-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 26px;
  display: grid;
  gap: 26px;
  grid-template-columns: 1.6fr 1fr 1fr;
}
.ntn-footer-brand { display: flex; gap: 12px; align-items: flex-start; }
.ntn-footer-tag { margin: 2px 0 8px; font-size: .92rem; line-height: 1.5; }
.ntn-footer-intro { margin: 0; font-size: .9rem; color: #94a3b8; line-height: 1.55; }
.ntn-footer h4 { color: #fff; margin: 0 0 10px; font-size: .95rem; }
.ntn-footer-col { display: flex; flex-direction: column; gap: 6px; }
.ntn-footer-col a, .ntn-footer-col span { color: #cbd5e1; text-decoration: none; font-size: .92rem; }
.ntn-footer-col a:hover { color: #fff; text-decoration: underline; }
.ntn-footer-base { border-top: 1px solid rgba(255,255,255,.08); text-align: center; padding: 14px 20px; font-size: .84rem; color: #94a3b8; }
@media (max-width: 800px) {
  .ntn-footer-in { grid-template-columns: 1fr; padding: 26px 16px 20px; }
}

.ntn-doc { max-width: 760px; margin: 0 auto; padding: 40px 20px 56px; }
.ntn-doc h1 { font-size: 1.9rem; margin: 0 0 20px; }
.ntn-doc-body h2 { font-size: 1.3rem; margin: 26px 0 10px; }
.ntn-doc-body h3 { font-size: 1.08rem; margin: 20px 0 8px; }
.ntn-doc-body p, .ntn-doc-body li { line-height: 1.65; }
.ntn-doc-body ul, .ntn-doc-body ol { padding-left: 22px; }
.ntn-doc-body table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.ntn-doc-body th, .ntn-doc-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ntn-doc-body blockquote { margin: 14px 0; padding: 10px 18px; border-left: 4px solid var(--accent); background: #eef2ff; border-radius: 0 12px 12px 0; }

.ntn-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
@media (max-width: 700px) { .ntn-plans { grid-template-columns: 1fr; } }
.ntn-plan {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
}
.ntn-plan-year { border-color: #c7d2fe; box-shadow: 0 8px 22px rgba(79,70,229,.10); }
.ntn-plan-tag {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 10px;
  margin-bottom: 10px;
}
.ntn-plan-price { font-size: 1.7rem; font-weight: 800; }
.ntn-plan-time { color: var(--muted); margin-bottom: 10px; }
.ntn-plan ul { margin: 10px 0 0; padding-left: 20px; }
.ntn-plan li { margin-bottom: 6px; line-height: 1.5; }

.ntn-status {
  display: inline-block;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 10px;
  white-space: nowrap;
}
.ntn-status.pending { background: #fef3c7; color: #92400e; }
.ntn-status.approved { background: #d1fae5; color: #065f46; }
.ntn-status.rejected { background: #fee2e2; color: #991b1b; }

.ntn-bank-box {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 18px 18px;
}

body.ntn-gv .ntn-shell { min-height: calc(100vh - 0px); }

/* Sổ tay NTN Note — iframe app chiếm trọn viewport (topbar đã ẩn trên trang này) */
.ntn-note-frame {
  display: block;
  width: 100%;
  height: 100vh;
  border: 0;
  background: #ececee;
}
/* WordPress admin-bar của user đăng nhập đẩy nội dung xuống 32px */
body.admin-bar .ntn-note-frame { height: calc(100vh - 32px); }
@media (max-width: 782px) {
  body.admin-bar .ntn-note-frame { height: calc(100vh - 46px); }
}

/* Thư viện Prompt — nhúng app / web app dưới topbar */
.ntn-prompt-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 58px);
  border: 0;
  background: #f8fafc;
}
body.admin-bar .ntn-prompt-frame { height: calc(100vh - 90px); }
@media (max-width: 782px) {
  body.admin-bar .ntn-prompt-frame { height: calc(100vh - 104px); }
}

/* Form 2 cột gọn — tab Đề thi (cổng GV) */
.ntn-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 18px;
}
.ntn-form-grid .ntn-field { margin: 0; min-width: 0; }
.ntn-form-grid .ntn-field > label { font-weight: 600; font-size: .9rem; }
.ntn-form-grid .span2 { grid-column: 1 / -1; }
.ntn-form-grid .ntn-check { margin-bottom: 8px; }
.ntn-src-name {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .82rem;
  color: #475569;
}
@media (max-width: 900px) {
  .ntn-form-grid { grid-template-columns: 1fr; }
  .ntn-form-grid .span2 { grid-column: 1; }
}

/* ===== Thi đua trực tiếp (kiểu Kahoot) ===== */
/* Overlay fullscreen phía cổng học sinh */
#raceOverlay {
  position: fixed; inset: 0; z-index: 99998;
  background: linear-gradient(160deg, #0f172a, #1e3a8a);
  color: #e2e8f0; font-family: inherit;
  overflow-y: auto; padding: 18px 14px 40px;
}
#raceOverlay[hidden] { display: none; }
#raceOverlayInner { max-width: 780px; margin: 0 auto; }
#raceProgress {
  text-align: center; font-weight: 800; color: #a5b4fc;
  letter-spacing: .04em; margin-bottom: 10px;
}
#raceTimer {
  height: 10px; max-width: 560px; margin: 0 auto 22px;
  background: rgba(255,255,255,.14); border-radius: 99px; overflow: hidden;
}
#raceTimer i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width .3s linear;
}
#raceView .race-q {
  background: #fff; color: var(--ink);
  border-radius: 18px; padding: 20px;
  box-shadow: 0 18px 46px rgba(0,0,0,.4);
}
#raceView h2 { margin: 0 0 10px; color: #1d4ed8; }
#raceView .race-qb { line-height: 1.6; }
#raceView .race-choices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px;
}
#raceView .race-choice {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 12px 14px; display: flex; gap: 8px; gap-align: flex-start;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
#raceView .race-choice:hover { border-color: #2563eb; background: #eff6ff; }
#raceView .race-choice b { color: #2563eb; }
#raceView .race-subs { margin-top: 12px; }
#raceView .race-subrow {
  display: flex; align-items: flex-start; gap: 10px;
  border-top: 1px dashed #e2e8f0; padding: 10px 0;
}
#raceView .race-subrow:first-child { border-top: 0; padding-top: 0; }
#raceView .race-subkey { color: #2563eb; }
#raceView .race-subtext { flex: 1; }
#raceView .race-tf { display: flex; gap: 6px; flex-shrink: 0; }
#raceView .race-tf i {
  font-style: normal; font-weight: 800; font-size: .9rem;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 7px 12px; cursor: pointer;
}
#raceView .race-tf i:hover { background: #eff6ff; }
#raceView .race-tf i.sel { background: #2563eb; border-color: #2563eb; color: #fff; }
#raceView .race-short { display: flex; gap: 8px; max-width: 320px; margin-top: 12px; }
#raceView .race-short input {
  flex: 1; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 10px 12px; font: inherit;
}
#raceView .race-center { text-align: center; margin: 8px 0; }
#raceView .race-pinbig {
  font-size: 4.4rem; font-weight: 900; letter-spacing: .14em;
  color: #fde047; margin: 30px 0 8px;
}
#raceView .race-dim { color: #94a3b8; }
#raceView .race-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 11px 16px; margin-bottom: 8px;
}
#raceView .race-row.top { background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.5); }
#raceView .race-row .medal { font-weight: 900; width: 34px; text-align: center; }
#raceView .race-row .name { flex: 1; font-weight: 700; }
#raceView .race-row .pts { font-weight: 900; color: #fbbf24; }
#raceView .race-title { color: #e2e8f0; text-align: center; margin-bottom: 14px; }
#raceView .race-btn {
  background: #4f46e5; color: #fff; border: 0; border-radius: 12px;
  padding: 11px 26px; font: inherit; font-weight: 800; cursor: pointer;
}
#raceView .race-btn.small { padding: 9px 20px; }
.race-toast {
  position: fixed; top: 14px; left: 0; right: 0; z-index: 99999;
  text-align: center; pointer-events: none;
}
.race-toast span {
  background: #22c55e; color: #052e12; font-weight: 900;
  padding: 10px 22px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(34,197,94,.45); font-size: 1.05rem;
}
@media (max-width: 600px) {
  #raceView .race-choices { grid-template-columns: 1fr; }
  #raceView .race-subrow { flex-wrap: wrap; }
  #raceView .race-pinbig { font-size: 3rem; }
}
/* Badge trạng thái phòng trong tab Thi đua (cổng GV) */
.ntn-badge.lobby { background: #dbeafe; color: #1d4ed8; }
.ntn-badge.live { background: #dcfce7; color: #15803d; }
.ntn-badge.ended { background: #f1f5f9; color: #64748b; }


/* ==========================================================================
   HOMEPAGE STYLES (Professional Corporate EdTech Design)
   ========================================================================== */
.ntn-home {
  background: #ffffff;
  color: var(--ink);
  overflow-x: hidden;
}

/* --- Hero Section --- */
.ntn-home-hero {
  padding: 64px 24px 72px;
  background: linear-gradient(180deg, #f0f7ff 0%, #f8fafc 60%, #ffffff 100%);
  border-bottom: 1px solid #edf2f7;
  text-align: center;
}
.ntn-hero-wrap {
  max-width: 960px;
  margin: 0 auto;
}
.ntn-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 24px;
}
.ntn-home-title {
  font-size: 2.75rem;
  line-height: 1.25;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}
@media (max-width: 768px) {
  .ntn-home-title { font-size: 2rem; }
}
.ntn-home-title span {
  color: #2563eb;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ntn-home-desc {
  font-size: 1.15rem;
  line-height: 1.65;
  color: #475569;
  max-width: 760px;
  margin: 0 auto 36px;
}
.ntn-hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.ntn-btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.ntn-btn-hero.primary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
}
.ntn-btn-hero.primary:hover {
  background: #1d4ed8;
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}
.ntn-btn-hero.secondary {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}
.ntn-btn-hero.secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.ntn-hero-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}
.ntn-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  color: #64748b;
  font-weight: 600;
}
.ntn-stat-pill span {
  color: #10b981;
}

/* --- Section Containers --- */
.ntn-section {
  padding: 80px 24px;
  max-width: 1140px;
  margin: 0 auto;
}
.ntn-section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 52px;
}
.ntn-section-badge {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #2563eb;
  margin-bottom: 10px;
}
.ntn-section-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 14px;
  letter-spacing: -0.015em;
}
.ntn-section-subtitle {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #64748b;
  margin: 0;
}

/* --- Portals Gateway Cards --- */
.ntn-portals-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}
@media (max-width: 820px) {
  .ntn-portals-grid { grid-template-columns: 1fr; }
}
.ntn-portal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  transition: all .25s ease;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
}
.ntn-portal-card:hover {
  transform: translateY(-4px);
  border-color: #cbd5e1;
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.08);
}
.ntn-portal-card.card-student {
  border-top: 4px solid #2563eb;
}
.ntn-portal-card.card-teacher {
  border-top: 4px solid #0f172a;
}
.ntn-portal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.ntn-portal-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.card-student .ntn-portal-icon {
  background: #eff6ff;
  color: #2563eb;
}
.card-teacher .ntn-portal-icon {
  background: #f1f5f9;
  color: #0f172a;
}
.ntn-portal-tag {
  font-size: .82rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.card-student .ntn-portal-tag {
  background: #dbeafe;
  color: #1e40af;
}
.card-teacher .ntn-portal-tag {
  background: #e2e8f0;
  color: #334155;
}
.ntn-portal-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 10px;
}
.ntn-portal-desc {
  font-size: .98rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 24px;
}
.ntn-portal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  flex: 1;
}
.ntn-portal-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .94rem;
  color: #334155;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.ntn-portal-list li:last-child {
  border-bottom: 0;
}
.ntn-portal-list li i {
  color: #10b981;
  font-style: normal;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}
.ntn-portal-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s ease;
  width: 100%;
}
.card-student .ntn-portal-act {
  background: #2563eb;
  color: #ffffff;
}
.card-student .ntn-portal-act:hover {
  background: #1d4ed8;
  color: #ffffff;
  text-decoration: none;
}
.card-teacher .ntn-portal-act {
  background: #0f172a;
  color: #ffffff;
}
.card-teacher .ntn-portal-act:hover {
  background: #1e293b;
  color: #ffffff;
  text-decoration: none;
}

/* --- Features Grid --- */
.ntn-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 900px) {
  .ntn-features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .ntn-features-grid { grid-template-columns: 1fr; }
}
.ntn-feature-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 24px;
  transition: all .2s ease;
}
.ntn-feature-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}
.ntn-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 18px;
}
.ntn-feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
}
.ntn-feature-desc {
  font-size: .92rem;
  color: #64748b;
  line-height: 1.55;
  margin: 0;
}

/* --- Steps Section --- */
.ntn-steps-bg {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.ntn-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 768px) {
  .ntn-steps-grid { grid-template-columns: 1fr; }
}
.ntn-step-item {
  text-align: center;
  padding: 20px;
}
.ntn-step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.ntn-step-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
}
.ntn-step-desc {
  font-size: .92rem;
  color: #64748b;
  line-height: 1.55;
  margin: 0;
}

/* --- CTA Bottom Banner --- */
.ntn-cta-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 24px;
  padding: 56px 40px;
  text-align: center;
  color: #ffffff;
  margin: 40px auto 80px;
  max-width: 1140px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}
.ntn-cta-banner h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: #ffffff;
}
.ntn-cta-banner p {
  font-size: 1.05rem;
  color: #94a3b8;
  max-width: 620px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.ntn-cta-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   NTN EXAM v2.3 — NGANHANGDECHV.TECH INSPIRED SECTIONS, PWA, I18N & AI TUTOR
   ========================================================================== */

/* --- Intro Band (#gioi-thieu) --- */
.ntn-intro-band {
  background: #f3f4f6;
  border-bottom: 1px solid #e2e8f0;
}
.ntn-intro-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 36px;
  align-items: start;
}
@media (max-width: 900px) {
  .ntn-intro-grid { grid-template-columns: 1fr; }
}
.ntn-callout-box {
  background: #ffffff;
  border-left: 4px solid #0058bc;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.ntn-callout-box strong {
  display: block;
  font-size: .98rem;
  color: #191c1e;
  margin-bottom: 4px;
}
.ntn-callout-box p {
  margin: 0;
  font-size: .93rem;
  line-height: 1.65;
  color: #414755;
}
.ntn-intro-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}
@media (max-width: 640px) {
  .ntn-intro-metrics { grid-template-columns: 1fr; }
}
.ntn-metric-card {
  background: #ffffff;
  border: 1px solid #e1e4ec;
  border-radius: 14px;
  padding: 16px;
}
.ntn-metric-card b {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0058bc;
  margin-bottom: 4px;
}
.ntn-metric-card span {
  font-size: .86rem;
  color: #414755;
  line-height: 1.5;
}
.ntn-audience-card {
  background: #ffffff;
  border: 1px solid #e1e4ec;
  border-radius: 20px;
  padding: 28px 26px;
  box-shadow: 0 12px 30px -12px rgba(0, 88, 188, 0.12);
}
.ntn-audience-card h3 {
  margin: 0 0 18px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #191c1e;
}
.ntn-audience-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ntn-audience-card li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: .94rem;
  line-height: 1.6;
  color: #414755;
}
.ntn-aud-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eef4ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
}

/* --- 5-Step Learning Workflow --- */
.ntn-workflow-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  position: relative;
}
@media (max-width: 960px) {
  .ntn-workflow-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ntn-workflow-5 { grid-template-columns: 1fr; }
}
.ntn-wf-step {
  position: relative;
  text-align: center;
  padding: 18px 12px;
}
.ntn-wf-step::after {
  content: "→";
  position: absolute;
  right: -14px;
  top: 46px;
  color: #94a3b8;
  font-size: 1.4rem;
  font-weight: 700;
}
.ntn-wf-step:last-child::after { display: none; }
@media (max-width: 960px) {
  .ntn-wf-step::after { display: none; }
}
.ntn-wf-circle {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #0070eb;
  color: #ffffff;
  font-size: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 10px 24px -6px rgba(0, 112, 235, 0.45);
  transition: transform .2s ease;
}
.ntn-wf-step.is-final .ntn-wf-circle {
  background: #84fb42;
  color: #1f5100;
  box-shadow: 0 10px 24px -6px rgba(43, 108, 0, 0.35);
}
.ntn-wf-step:hover .ntn-wf-circle { transform: scale(1.08); }
.ntn-wf-step h4 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
}
.ntn-wf-step p {
  margin: 0;
  font-size: .88rem;
  color: #64748b;
  line-height: 1.55;
}

/* --- Contact Band (#lien-he) --- */
.ntn-contact-band {
  background: #0058bc;
  color: #ffffff;
}
.ntn-contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 36px;
  align-items: center;
}
@media (max-width: 820px) {
  .ntn-contact-grid { grid-template-columns: 1fr; }
}
.ntn-contact-band h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 10px;
  color: #ffffff;
}
.ntn-contact-lead {
  font-size: 1.04rem;
  color: rgba(255, 255, 255, 0.88);
  margin: 0 0 24px;
  line-height: 1.6;
}
.ntn-contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ntn-contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #ffffff !important;
  text-decoration: none;
}
.ntn-contact-item:hover { opacity: .88; text-decoration: none; }
.ntn-contact-ico {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.ntn-contact-item small {
  display: block;
  font-size: .8rem;
  opacity: .75;
}
.ntn-contact-item strong {
  font-size: 1.08rem;
  word-break: break-word;
}
.ntn-contact-card {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 26px;
  backdrop-filter: blur(10px);
}
.ntn-contact-card h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  color: #ffffff;
}
.ntn-contact-card p {
  margin: 0 0 18px;
  font-size: .95rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.9);
}

/* --- Floating Language Pill (VI | EN) + PWA Back --- */
.ntn-lang-pill {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 88, 188, 0.28);
  border-radius: 999px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
  font-size: 12px;
  font-weight: 700;
}
.ntn-lang-pill a {
  padding: 7px 12px;
  text-decoration: none !important;
  color: #0058bc;
  background: #ffffff;
  line-height: 1;
  transition: background .15s, color .15s;
}
.ntn-lang-pill a.is-active {
  background: #0058bc;
  color: #ffffff;
}
.ntn-lang-pill a.ntn-lang-back {
  color: #334155;
  border-right: 1px solid #e2e8f0;
}

/* --- Offline / Network Banner --- */
.ntn-net-banner {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9995;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.ntn-net-banner.warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.ntn-net-banner.ok   { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.ntn-net-banner.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* --- AI Tutor Modal --- */
.ntn-ai-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ntn-ai-modal[hidden] { display: none !important; }
.ntn-ai-dialog {
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ntn-ai-head {
  padding: 16px 20px;
  background: linear-gradient(135deg, #0058bc, #0070eb);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.ntn-ai-head h3 { margin: 0 0 3px; font-size: 1.12rem; color: #ffffff; }
.ntn-ai-sub { margin: 0; font-size: .82rem; color: rgba(255, 255, 255, 0.88); }
.ntn-ai-close {
  background: rgba(255, 255, 255, 0.18);
  border: 0;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.ntn-ai-context {
  padding: 10px 18px;
  background: #eef4ff;
  border-bottom: 1px solid #dbeafe;
  font-size: .86rem;
  color: #1e3a8a;
}
.ntn-ai-ctx-body { margin-top: 4px; color: #334155; }
.ntn-ai-ctx-ans { margin-top: 4px; color: #047857; }
.ntn-ai-messages {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}
.ntn-ai-msg {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.6;
  max-width: 88%;
}
.ntn-ai-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}
.ntn-ai-msg.user {
  align-self: flex-end;
  background: #0058bc;
  color: #ffffff;
}
.ntn-ai-msg.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.ntn-ai-quick {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #ffffff;
  border-top: 1px solid #eef0f4;
}
.ntn-ai-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: .8rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}
.ntn-ai-chip:hover { background: #eef4ff; border-color: #93c5fd; color: #0058bc; }
.ntn-ai-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}
.ntn-ai-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
  font-size: .93rem;
}
.ntn-ai-form input:focus { outline: none; border-color: #0058bc; }
