/* Vibe Code cùng Jinny — phong cách MasterClass: dark cinematic, serif editorial.
   Không cần build. Mobile-first. */
:root {
  --bg: #0a0a0a;
  --bg-soft: #131313;
  --bg-raised: #1a1a1a;
  --text: #f5f2ea;
  --muted: #a8a29e;
  --faint: #6b6560;
  --line: rgba(255, 255, 255, 0.13);
  --cta: #f5f2ea;
  --cta-text: #0a0a0a;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Top bar tối giản ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.4rem;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}
.brand span { color: var(--muted); font-weight: 500; }
.topbar-progress {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Hero cinematic ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1100px 480px at 78% -8%, rgba(245, 242, 234, 0.09), transparent 60%),
    radial-gradient(800px 500px at 8% 110%, rgba(140, 120, 90, 0.10), transparent 60%),
    linear-gradient(180deg, #101010 0%, #0a0a0a 100%);
}
.hero-inner {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  padding: 4.5rem 1.4rem 3.5rem;
}
.eyebrow {
  margin: 0 0 1.1rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.9rem, 7.5vw, 5rem);
  line-height: 1.04;
  letter-spacing: 0.005em;
  margin: 0 0 1.2rem;
  color: var(--text);
  text-wrap: balance;
}
.byline {
  margin: 0 0 1.4rem;
  font-size: 1.06rem;
  color: var(--muted);
  max-width: 34rem;
}
.summary-line {
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.summary-line .dot { color: var(--faint); margin: 0 0.5rem; }
.progress-thin {
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 2rem;
  max-width: 26rem;
}
.progress-thin > div {
  height: 100%;
  background: var(--text);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.streak-line {
  margin: 0 0 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- CTA ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 0.95rem 2.4rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--cta); color: var(--cta-text); }
.btn-primary:hover { background: #ffffff; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.btn-outline:hover { border-color: var(--text); }
.btn-cta { margin-bottom: 3rem; }
.btn-row { display: flex; gap: 0.8rem; flex-wrap: wrap; margin: 2.2rem 0 1rem; }
.btn:disabled { opacity: 0.55; cursor: wait; }

/* ---------- Skills checklist ---------- */
.skills { margin-top: 0.5rem; }
.skills-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
.skills ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}
@media (min-width: 720px) {
  .skills ul { grid-template-columns: 1fr 1fr; gap: 0.55rem 2.5rem; }
}
.skills li {
  position: relative;
  padding-left: 1.7rem;
  font-size: 0.96rem;
  color: #d8d3c8;
}
.skills li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--text);
  font-weight: 600;
}

/* ---------- Khung nội dung ---------- */
.container { max-width: 880px; margin: 0 auto; padding: 0 1.4rem; }
.lesson-wrap { max-width: 760px; margin: 0 auto; padding: 3rem 1.4rem 2rem; }

.notice {
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.07);
  color: #fcd34d;
  border-radius: var(--radius);
  padding: 0.8rem 1.1rem;
  margin: 1.6rem 0 0;
  font-size: 0.9rem;
}

/* ---------- Danh sách bài học: rows tối giản ---------- */
.lesson-plan { padding: 3rem 0 1rem; }
.plan-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: 0 0 0.4rem;
}
.plan-sub { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.6rem; }
.lesson-rows { border-top: 1px solid var(--line); }
.lesson-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 0.4rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
a.lesson-row:hover { background: rgba(255, 255, 255, 0.035); }
.lesson-row.locked { opacity: 0.42; cursor: not-allowed; }
.row-num {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--faint);
  font-weight: 500;
}
.row-main { min-width: 0; }
.row-title {
  display: block;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.45;
}
a.lesson-row:hover .row-title { text-decoration: underline; text-underline-offset: 4px; }
.row-sub {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}
.row-side { text-align: right; white-space: nowrap; }
.row-dur {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.row-state { display: block; font-size: 0.78rem; margin-top: 0.25rem; letter-spacing: 0.1em; }
.row-state.done { color: var(--green); font-weight: 600; }
.row-state.today { color: var(--amber); font-weight: 600; }
.row-state.missed { color: var(--red); }
.row-state.locked { color: var(--faint); }
.lesson-row.status-done .row-title { color: #d8d3c8; }
@media (max-width: 560px) {
  .lesson-row { grid-template-columns: 2.4rem 1fr; }
  .row-side { grid-column: 2; text-align: left; display: flex; gap: 0.8rem; align-items: baseline; }
  .row-dur, .row-state { display: inline; margin-top: 0; }
}

/* ---------- Trang bài học ---------- */
.lesson-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
.lesson-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.lesson-meta {
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding-bottom: 1.6rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.lesson-meta .dot { color: var(--faint); margin: 0 0.5rem; }

.section { padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: none; }
.section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  margin: 0.6rem 0 1.1rem;
}
.section h4 { margin: 1.4rem 0 0.6rem; font-size: 1.15rem; }
.section p, .section li { font-size: 1.06rem; line-height: 1.75; color: #ddd8cc; text-align: justify; }
.section ul, .section ol { padding-left: 1.35rem; margin: 0.5rem 0; }
.section li { margin-bottom: 0.35rem; }
.section code {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  font-size: 0.87em;
  color: var(--text);
}
.section pre {
  background: #111111;
  border: 1px solid var(--line);
  color: #e8e4d8;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.95rem;
  line-height: 1.65;
}
.section pre code { background: none; border: none; padding: 0; color: inherit; }
.adapt-note {
  border-left: 2px solid var(--muted);
  padding: 0.2rem 0 0.2rem 1rem;
  font-size: 1rem;
  color: var(--muted);
  margin-top: 1rem;
}
.repo-modules { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.repo-modules li { margin: 0.4rem 0; font-size: 0.94rem; }
.repo-modules a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.coming-soon { text-align: center; padding: 2.5rem 1rem; }
.coming-soon-icon { font-size: 2.2rem; margin: 0 0 0.6rem; }
.coming-soon p { color: var(--muted); }
.sources { font-size: 0.88rem; }
.sources ul { list-style: none; padding: 0; }
.sources li { margin: 0.35rem 0; }
.sources a { color: var(--muted); }
.sources a:hover { color: var(--text); }

/* ---------- Quiz ---------- */
.quiz-q { border-top: 1px solid var(--line); padding: 1.1rem 0; }
.quiz-q:first-of-type { border-top: none; }
.quiz-q > p { font-weight: 600; margin: 0 0 0.7rem; color: var(--text); }
.quiz-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 0.65rem 0.95rem;
  margin: 0.4rem 0;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--text); background: rgba(255, 255, 255, 0.04); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { border-color: var(--green); background: rgba(74, 222, 128, 0.08); }
.quiz-opt.wrong { border-color: var(--red); background: rgba(248, 113, 113, 0.08); }
.quiz-explain { font-size: 0.95rem; color: var(--muted); margin: 0.5rem 0 0; display: none; }
.quiz-explain.show { display: block; }
.quiz-score { font-weight: 600; margin-top: 1rem; letter-spacing: 0.04em; }

/* ---------- Footer mini ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 1.8rem 1.4rem 2.4rem;
  text-align: center;
  color: var(--faint);
  font-size: 0.82rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 1.2rem;
}
.back-link:hover { color: var(--text); }

/* --- Gặp gỡ Jinny (instructor portraits, MasterClass-style) --- */
.instructors { padding: 8px 0 40px; }
.instructor-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 24px; }
.instructor { margin: 0; }
.instructor img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 1px solid #2a2a2a; display: block; }
.instructor figcaption { margin-top: 10px; }
.instructor figcaption strong { display: block; color: #fff; font-size: 16px; }
.instructor figcaption span { color: #a0a0a0; font-size: 13px; }
@media (max-width: 720px) { .instructor-grid { grid-template-columns: repeat(2, 1fr); } }

/* --- Cover từng bài học (trang lesson) --- */
.lesson-cover { width: 100%; border-radius: 12px; border: 1px solid #2a2a2a; margin: 18px 0 6px; display: block; }

/* --- Layout 2 cột + sidebar mục lục (desktop) --- */
.section { scroll-margin-top: 90px; }
.lesson-toc { display: none; }
@media (min-width: 1024px) {
  .lesson-wrap { max-width: 1140px; }
  .lesson-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; align-items: start; }
  .lesson-toc { display: block; position: sticky; top: 96px; border-right: 1px solid #2a2a2a; padding-right: 20px; order: -1; }
  .toc-title { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #6a6a6a; margin: 0 0 12px; }
  .lesson-toc ul { list-style: none; margin: 0; padding: 0; }
  .lesson-toc li { margin: 0 0 10px; }
  .lesson-toc a { color: #a0a0a0; text-decoration: none; font-size: 14px; line-height: 1.45; }
  .lesson-toc a:hover { color: #fff; }
}

/* --- Banner 4 Jinny full-bleed 16:9 --- */
.team-banner { position: relative; width: 100%; margin: 0; }
.team-banner { overflow: hidden; }
.team-banner img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.team-banner::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.28) 0%, rgba(0,0,0,.62) 100%); pointer-events: none; }
.team-banner-caption { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; opacity: 0; transform: translateY(70px); transition: opacity .9s ease, transform .9s ease; }
.team-banner.inview .team-banner-caption { opacity: 1; transform: none; }
.team-banner-caption h2 { font-family: "Cormorant Garamond", serif; font-size: clamp(2.6rem, 6vw, 4.6rem); color: #fff; margin: 0 0 14px; text-shadow: 0 3px 30px rgba(0,0,0,.9), 0 1px 6px rgba(0,0,0,.9); }
.team-banner-caption p { color: #f2ecdc; margin: 0; font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.6; max-width: 660px; text-shadow: 0 2px 16px rgba(0,0,0,.9), 0 1px 4px rgba(0,0,0,.9); }
@media (prefers-reduced-motion: reduce) { .team-banner-caption { transition: none; opacity: 1; transform: none; } }

/* --- Trang 404 --- */
.error-page { text-align: center; padding: 72px 1.4rem 96px; }
.error-dog { width: 220px; height: 220px; object-fit: cover; border-radius: 50%; border: 3px solid #2a2a2a; margin-bottom: 24px; }
.btn-row-center { justify-content: center; }
.btn-row-stack { flex-direction: column; align-items: stretch; }
.btn-row-stack .btn { text-align: center; }

/* --- Popup chúc mừng hoàn thành --- */
.congrats-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: congratsIn .25s ease; }
@keyframes congratsIn { from { opacity: 0; } to { opacity: 1; } }
.congrats-card { background: #141414; border: 1px solid #2a2a2a; border-radius: 18px; max-width: 430px; width: 100%; padding: 36px 30px 30px; text-align: center; }
.congrats-card img { width: 170px; height: 170px; object-fit: cover; border-radius: 50%; border: 3px solid #2a2a2a; margin-bottom: 18px; }
.congrats-card h2 { font-family: "Cormorant Garamond", serif; font-size: 2rem; color: #fff; margin: 0 0 10px; }
.congrats-card p { color: #c9c9c9; font-size: 1rem; line-height: 1.6; margin: 0 0 22px; }
.congrats-card .btn-row { justify-content: center; margin-bottom: 14px; }
.congrats-link { color: #a0a0a0; font-size: 0.92rem; text-decoration: none; }
.congrats-link:hover { color: #fff; }

/* --- Fix căn giữa chữ ở các trang centered (404, locked, landing) --- */
.error-page .byline, .locked-page .byline, .landing-hero .byline { margin-left: auto; margin-right: auto; }
.error-page .eyebrow, .locked-page .eyebrow, .landing-hero .eyebrow { text-indent: 0.24em; }

/* --- Trang bài chưa mở (cún ngủ) --- */
.locked-page { text-align: center; padding: 72px 1.4rem 96px; }

/* --- Landing: cún chào + feature pills --- */
.greeter-dog { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; border: 3px solid #2a2a2a; margin-bottom: 22px; }
.feature-pills { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 6px 0 8px; }
.feature-pills span { border: 1px solid #2a2a2a; border-radius: 999px; padding: 8px 18px; font-size: 0.92rem; color: #c9c9c9; background: #111; }

/* --- Chat Jinny (trợ giảng AI) --- */
#jinny-chat-fab { position: fixed; right: 20px; bottom: 20px; width: 62px; height: 62px; border-radius: 50%; border: 2px solid #2a2a2a; padding: 0; overflow: hidden; cursor: pointer; z-index: 90; box-shadow: 0 6px 24px rgba(0,0,0,.5); background: #111; }
#jinny-chat-fab img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* --- Tab chat trượt bên phải (desktop, kiểu side panel) --- */
#jc-side { position: fixed; top: 0; right: 0; height: 100dvh; width: 400px; max-width: 94vw; background: #0e0e0e; border-left: 1px solid #2a2a2a; z-index: 90; transform: translateX(103%); transition: transform .32s ease; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.5); }
body.jc-side-open #jc-side { transform: none; }
#jc-side .jc-head { padding: 16px 18px; }
#jc-side .jc-msgs { flex: 1; }
#jinny-chat-fab { transition: opacity .25s ease; }
@media (min-width: 821px) {
  body.jc-side-open .lesson-wrap {
    margin-right: 400px;
    margin-left: max(0px, calc((100vw - 400px - 1140px) / 2));
  }
  body.jc-side-open #jinny-chat-fab { opacity: 0; pointer-events: none; }
}

/* --- Nút về đầu trang (cuối bài học) --- */
.back-top-wrap { text-align: center; margin: 52px 0 6px; }
.jc-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid #2a2a2a; background: #0d0d0d; }
.jc-head strong { display: block; color: #fff; font-size: 1rem; }
.jc-head span { display: block; color: #8a8a8a; font-size: 0.74rem; margin-top: 2px; }
.jc-close { background: none; border: none; color: #8a8a8a; font-size: 1rem; cursor: pointer; padding: 4px; }
.jc-close:hover { color: #fff; }
.jc-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.jc-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.jc-user { align-self: flex-end; background: #fff; color: #111; border-bottom-right-radius: 4px; }
.jc-model { align-self: flex-start; background: #1f1f1f; color: #e8e4d8; border: 1px solid #2a2a2a; border-bottom-left-radius: 4px; }
.jc-typing { opacity: .55; font-style: italic; }
.jc-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #2a2a2a; }
.jc-form input { flex: 1; min-width: 0; background: #0d0d0d; border: 1px solid #2a2a2a; border-radius: 999px; padding: 10px 16px; color: #fff; font-size: 0.95rem; outline: none; }
.jc-form input:focus { border-color: #555; }
.jc-form button { width: 42px; height: 42px; flex: none; border-radius: 50%; border: none; background: #fff; color: #111; font-size: 1.05rem; cursor: pointer; }
.jc-code { background: #0d0d0d; border: 1px solid #2a2a2a; padding: 1px 7px; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 0.86em; }
.jc-pre { background: #0d0d0d; border: 1px solid #2a2a2a; border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 4px 0; }
.jc-pre code { font-family: ui-monospace, monospace; font-size: 0.84rem; line-height: 1.55; }

/* --- Chat nhúng cuối bài học (mobile) --- */
.lesson-chat-section { margin: 56px 0 16px; border: 1px solid #2a2a2a; border-radius: 16px; background: #141414; overflow: hidden; scroll-margin-top: 90px; }
.lesson-chat-section .jc-msgs { height: 380px; max-height: 62vh; }
.lesson-chat-section .jc-head strong { font-size: 1.15rem; }

/* --- Đa khóa học: hình trong bài, bảng, quiz tự luận --- */
.lesson-figure { margin: 1.4rem 0; }
.lesson-figure img { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); }
.lesson-figure figcaption { color: var(--muted); font-size: 0.9rem; text-align: center; margin-top: 0.5rem; font-style: italic; }
.section table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.98rem; }
.section th, .section td { border: 1px solid var(--line); padding: 0.5rem 0.7rem; text-align: left; }
.section th { background: var(--bg-raised); font-weight: 600; }
.quiz-essay {
  width: 100%; box-sizing: border-box; margin: 0 0 0.7rem; padding: 0.7rem 0.8rem;
  background: var(--bg-soft); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; font: inherit; resize: vertical;
}
.essay-answer { white-space: pre-wrap; }
