/* ===== Hành Trình Chân Lý – theme đỏ/vàng, responsive, không dùng thư viện ngoài ===== */
:root {
    --red-900: #6d0a0a;
    --red-700: #b71c1c;
    --red-600: #c62828;
    --red-50: #fff3f1;
    --gold: #f9c74f;
    --gold-600: #e0a800;
    --cream: #fffaf0;
    --ink: #2b1d1d;
    --muted: #7a6a66;
    --line: #f0e2d8;
    --green: #2e7d32;
    --green-50: #e8f5e9;
    --radius: 16px;
    --shadow: 0 6px 24px rgba(109, 10, 10, .08);
    --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --serif: "Noto Serif", "Times New Roman", Times, serif; /* font có đủ dấu tiếng Việt */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; /* chừa chỗ cho thanh menu dính trên cùng */ }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--cream);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
p { margin: 0 0 .75rem; }

.container { width: min(1100px, 100% - 2rem); margin-inline: auto; }
.main { flex: 1; padding: 1.5rem 0 3rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.gold, .gold-text { color: var(--gold); }
.gold-text { color: var(--gold-600); }
.link { color: var(--red-700); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--red-700); margin-bottom: .25rem; }
.section-title { margin: 2rem 0 1rem; font-size: 1.35rem; }
.section-title::after { content: ""; display: block; width: 56px; height: 4px; border-radius: 4px; background: var(--gold); margin-top: .4rem; }

/* ---------- Header ---------- */
.topbar {
    background: linear-gradient(90deg, var(--red-900), var(--red-700));
    color: #fff;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.topbar-inner { display: flex; align-items: center; gap: 1rem; min-height: 62px; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-size: 1.15rem; white-space: nowrap; }
.brand b { color: var(--gold); }
.brand-star { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--red-700); font-size: 1.1rem; }
.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav > a { white-space: nowrap; text-decoration: none; padding: .5rem .8rem; border-radius: 10px; font-weight: 600; font-size: .95rem; opacity: .9; }
.nav > a:hover, .nav > a.active { background: rgba(255,255,255,.14); opacity: 1; }
.nav > a.active { box-shadow: inset 0 -3px 0 var(--gold); }
.nav-user { display: flex; align-items: center; gap: .5rem; margin: 0 0 0 .5rem; }
.nav-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--red-900); font-weight: 800; flex-shrink: 0; }
.avatar.big { width: 56px; height: 56px; font-size: 1.4rem; }
.nav-toggle, .nav-burger { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .65rem 1.2rem; border-radius: 12px; border: 2px solid transparent;
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
    transition: transform .1s ease, box-shadow .2s ease, background .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .35rem .75rem; font-size: .85rem; border-radius: 9px; }
.btn-lg { padding: .85rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-red { background: var(--red-700); color: #fff; box-shadow: 0 4px 14px rgba(183,28,28,.3); }
.btn-red:hover { background: var(--red-600); }
.btn-gold { background: var(--gold); color: var(--red-900); box-shadow: 0 4px 14px rgba(249,199,79,.4); }
.btn-gold:hover { background: #ffd56b; }
.btn-outline { border-color: var(--red-700); color: var(--red-700); background: #fff; }
.btn-outline-light { border-color: rgba(255,255,255,.7); color: #fff; background: transparent; }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.btn-fb { background: #1877f2; color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }
.btn-row.center { justify-content: center; }
.btn-row form { margin: 0; }

/* ---------- Cards / layout ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.narrow { max-width: 440px; margin: 2rem auto; }
.narrow-wide { max-width: 760px; margin: 0 auto; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head > div:first-child { max-width: 720px; }

.toast {
    position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 12px; z-index: 60;
    box-shadow: var(--shadow); animation: toast 4.5s ease forwards; max-width: 90vw;
}
@keyframes toast { 0% { opacity: 0; top: 60px } 8%, 85% { opacity: 1; top: 76px } 100% { opacity: 0; visibility: hidden } }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #f3ebe6; color: var(--muted); }
.badge-green { background: var(--green-50); color: var(--green); }
.bar { height: 8px; border-radius: 8px; background: #f3ebe6; overflow: hidden; margin: .75rem 0 1rem; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--red-700)); border-radius: 8px; }

/* ---------- Hero ---------- */
.hero {
    display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: center;
    background: radial-gradient(circle at 85% 20%, rgba(249,199,79,.35), transparent 40%), linear-gradient(135deg, var(--red-900), var(--red-600));
    color: #fff; border-radius: 24px; padding: clamp(1.5rem, 4vw, 3rem); box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.hero::after { content: "★"; position: absolute; right: -40px; bottom: -110px; font-size: 340px; color: rgba(255,255,255,.05); line-height: 1; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.hero .eyebrow { color: var(--gold); }
.lead { font-size: 1.1rem; opacity: .95; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0; }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 1rem; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 1.6rem; color: var(--gold); }
.stats span { font-size: .85rem; opacity: .85; }
.hero-quote { margin: 0; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); border-radius: 20px; padding: 1.5rem; backdrop-filter: blur(4px); z-index: 1; }
.hero-quote p { font-family: var(--serif); font-size: 1.35rem; font-style: italic; }
.hero-quote cite { color: var(--gold); font-style: normal; font-size: .9rem; }
.quote-mark { font-family: var(--serif); font-size: 4rem; line-height: .5; color: var(--gold); display: block; }

.step { position: relative; padding-top: 2rem; }
.step-num { position: absolute; top: -14px; left: 1.25rem; width: 36px; height: 36px; border-radius: 50%; background: var(--red-700); color: #fff; display: grid; place-items: center; font-weight: 800; box-shadow: 0 0 0 4px var(--cream); }
.mini-board { list-style: none; padding: 0; margin: 0 0 1rem; }
.mini-board li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }

/* ---------- Quiz ---------- */
.progress-ring {
    --p: 0; width: 110px; height: 110px; border-radius: 50%;
    background: conic-gradient(var(--red-700) calc(var(--p) * 1%), #f3ebe6 0);
    display: grid; place-content: center; text-align: center; position: relative;
}
.progress-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--cream); }
.progress-ring b, .progress-ring span { position: relative; }
.progress-ring b { font-size: 1.5rem; color: var(--red-700); }
.progress-ring span { font-size: .72rem; color: var(--muted); }
.chapter { display: flex; flex-direction: column; }
.chapter h3 { font-size: 1.05rem; flex: 1; }
.chapter.is-passed { border-color: #c8e6c9; }
.chapter-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.chapter-no { font-weight: 800; color: var(--red-700); }
.chapter-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .88rem; color: var(--muted); }
.chapter .btn { align-self: flex-start; }

.question { border: 1px solid var(--line); }
fieldset.question { margin: 0 0 1rem; min-width: 0; }
.question legend { padding: 0; }
.q-no { display: inline-block; background: var(--red-700); color: #fff; padding: .15rem .65rem; border-radius: 8px; font-weight: 700; font-size: .85rem; }
.q-text { font-weight: 600; font-size: 1.05rem; margin: .5rem 0 1rem; }
.options { display: grid; gap: .6rem; }
.option {
    display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .9rem; text-align: left;
    border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: inherit;
    transition: border-color .15s, background .15s, transform .1s;
}
.option:hover { border-color: var(--gold); background: #fffdf5; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:has(input:checked) { border-color: var(--red-700); background: var(--red-50); }
.option:has(input:checked) .opt-letter { background: var(--red-700); color: #fff; }
.option:has(input:focus-visible) { outline: 3px solid var(--gold); }
.opt-letter { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #f6ece5; font-weight: 800; color: var(--red-700); }
.opt-text { padding-top: .2rem; }
.option.static { cursor: default; }
.option.static:hover { border-color: var(--line); background: #fff; }
.option.correct, .option.correct:hover { border-color: var(--green); background: var(--green-50); }
.option.correct .opt-letter { background: var(--green); color: #fff; }
.option.wrong, .option.wrong:hover { border-color: var(--red-600); background: var(--red-50); }
.option.wrong .opt-letter { background: var(--red-600); color: #fff; }
.sticky-submit {
    position: sticky; bottom: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    background: var(--ink); color: #fff; padding: .75rem .75rem .75rem 1.25rem; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.review.is-correct { border-left: 6px solid var(--green); }
.review.is-wrong { border-left: 6px solid var(--red-600); }
.q-head { display: flex; gap: .75rem; align-items: center; font-weight: 700; }
.explain { margin-top: 1rem; padding: .9rem 1rem; background: #fff8e6; border-radius: 12px; border-left: 4px solid var(--gold); font-size: .95rem; }
.source { margin-top: .4rem; font-size: .82rem; color: var(--muted); }

.result-banner { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.result-banner.is-passed { background: linear-gradient(135deg, #fff, #fff8e1); border-color: var(--gold); }
.result-score { width: 130px; height: 130px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: var(--red-700); color: #fff; flex-shrink: 0; }
.result-score b { font-size: 2rem; }
.is-passed .result-score { background: var(--green); }

/* ---------- Game ---------- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; background: var(--ink); color: #fff; }
.rules div { display: flex; flex-direction: column; }
.rules b { color: var(--gold); font-size: 1.1rem; }
.rules span { font-size: .85rem; opacity: .8; }
.level-map { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.level { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 0; }
.level-icon { font-size: 2.2rem; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--red-50); flex-shrink: 0; }
.level-body { flex: 1; min-width: 160px; }
.level-body h3 { font-size: 1.1rem; margin: 0; }
.level-body .muted { font-size: .88rem; margin: .2rem 0; }
.level-best { font-size: .85rem; margin: 0; color: var(--green); }
.level.locked { opacity: .75; background: #faf6f3; }
.level.locked .level-icon { background: #eee4de; filter: grayscale(1); }
.level.final { grid-column: 1 / -1; background: linear-gradient(135deg, var(--red-900), var(--red-600)); color: #fff; border: none; }
.level.final .eyebrow, .level.final .level-best { color: var(--gold); }
.level.final .muted { color: rgba(255,255,255,.8); }
.level.final .level-icon { background: rgba(255,255,255,.15); }
.level.final.locked { opacity: .85; }
.lock-hint { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.lock-hint small { color: var(--muted); }
.level.final .lock-hint small { color: rgba(255,255,255,.85); }

.game { max-width: 820px; margin: 0 auto; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .75rem; }
.hud-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .5rem .75rem; text-align: center; }
.hud-item span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hud-item b { font-size: 1.25rem; }
.hud-item.combo.hot { background: linear-gradient(135deg, #ff8a00, var(--red-600)); color: #fff; border: none; animation: pulse 1.2s infinite; }
.hud-item.combo.hot span { color: rgba(255,255,255,.85); }
@keyframes pulse { 50% { transform: scale(1.04); } }

.timer { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.timer-bar { flex: 1; height: 12px; border-radius: 12px; background: #f1e3db; overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 12px; transition: width .25s linear; }
.timer.warn .timer-bar i { background: linear-gradient(90deg, var(--red-600), #ff8a00); }
.timer.warn #timer-text { color: var(--red-600); animation: pulse .6s infinite; }
#timer-text { font-weight: 800; font-size: 1.2rem; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }

.cipher { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.cipher-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); margin-bottom: .5rem; flex-wrap: wrap; }
.cipher-text { font-family: var(--serif); font-size: clamp(1.05rem, 2.6vw, 1.4rem); line-height: 1.9; margin: 0; display: flex; flex-wrap: wrap; gap: .1rem .5rem; }
.word.hidden { color: rgba(255,255,255,.35); letter-spacing: .08em; }
.word.revealed { color: #fff; }
.word.fresh { color: var(--gold); animation: reveal .8s ease; text-shadow: 0 0 12px rgba(249,199,79,.7); }
@keyframes reveal { 0% { opacity: 0; transform: translateY(8px) scale(.9); } 100% { opacity: 1; transform: none; } }

.grid-options { grid-template-columns: 1fr 1fr; }
.option-btn { width: 100%; }
.option-btn:hover .opt-letter { background: var(--gold); color: var(--red-900); }
.option-btn.chosen { border-color: var(--red-700); background: var(--red-50); }

.feedback { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.feedback h1 { margin: 0 0 .25rem; }
.feedback-icon { font-size: 3rem; }
.feedback-correct { border-color: #a5d6a7; background: linear-gradient(135deg, #fff, var(--green-50)); }
.feedback-wrong, .feedback-timeout { border-color: #ef9a9a; background: linear-gradient(135deg, #fff, var(--red-50)); }
.feedback-score { text-align: center; padding: .5rem 1rem; border-radius: 12px; background: var(--ink); color: #fff; }
.feedback-score span { display: block; font-size: .72rem; text-transform: uppercase; opacity: .8; }
.feedback-score b { font-size: 1.5rem; color: var(--gold); }
.calc { margin: 0; }
.points { color: var(--green); font-size: 1.3rem; }
.combo-flash { color: #e65100; font-weight: 800; margin: .25rem 0 0; animation: pulse .8s 3; }
.finish { text-align: center; border: 2px solid var(--gold); background: linear-gradient(180deg, #fff, #fff8e1); }
.final-quote { font-family: var(--serif); font-size: 1.3rem; font-style: italic; margin: 1rem auto; max-width: 620px; }
.final-quote cite { display: block; font-size: .9rem; color: var(--muted); font-style: normal; margin-top: .5rem; }
.finish-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
.finish-stats div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .5rem 1rem; min-width: 110px; }
.finish-stats span { display: block; font-size: .75rem; color: var(--muted); }
.finish-stats b { font-size: 1.3rem; }

/* ---------- Leaderboard ---------- */
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: 1rem; scrollbar-width: thin; }
.tabs a { white-space: nowrap; text-decoration: none; padding: .45rem .9rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.tabs a.active { background: var(--red-700); color: #fff; border-color: var(--red-700); }
.me-card { background: var(--ink); color: #fff; }
.me-card b { color: var(--gold); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: .75rem; margin: 1.5rem 0; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 150px; text-align: center; }
.podium-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.medal { font-size: 2rem; }
.podium-block { width: 100%; border-radius: 12px 12px 0 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: #fff; }
.p1 .podium-block { height: 110px; background: linear-gradient(180deg, var(--gold), var(--gold-600)); color: var(--red-900); }
.p2 .podium-block { height: 80px; background: linear-gradient(180deg, #cfd8dc, #90a4ae); }
.p3 .podium-block { height: 60px; background: linear-gradient(180deg, #ffcc80, #b87333); }
.table-wrap { padding: 0; overflow-x: auto; }
.board { width: 100%; border-collapse: collapse; }
.board th, .board td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.board th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fdf7f2; }
.board .num { text-align: right; }
.board tr.me { background: #fff8e1; }
.board tr.inactive { opacity: .5; }
.rank { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #f3ebe6; font-weight: 800; font-size: .9rem; }
.rank-1 { background: var(--gold); color: var(--red-900); }
.rank-2 { background: #cfd8dc; }
.rank-3 { background: #ffcc80; }
.admin-table td.actions { display: flex; gap: .4rem; white-space: nowrap; }
.admin-table td.actions form { margin: 0; }

/* ---------- Share ---------- */
.share-page { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: start; }
.honor-card {
    background: radial-gradient(circle at 90% 10%, rgba(249,199,79,.35), transparent 35%), linear-gradient(135deg, var(--red-900), var(--red-600));
    color: #fff; border-radius: 24px; padding: clamp(1.25rem, 4vw, 2.5rem); position: relative;
    box-shadow: 0 20px 50px rgba(109,10,10,.35); outline: 3px solid var(--gold); outline-offset: -14px;
}
.honor-top { color: var(--gold); font-weight: 800; letter-spacing: .2em; font-size: .8rem; }
.honor-card h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: .05em; margin: .5rem 0; }
.honor-name { font-size: 1.6rem; font-weight: 800; margin: 0; }
.honor-title { color: var(--gold); font-style: italic; }
.honor-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem; margin: 1rem 0; }
.honor-stats div { background: rgba(0,0,0,.22); border-radius: 12px; padding: .6rem; text-align: center; }
.honor-stats span { display: block; font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); }
.honor-stats b { font-size: 1.5rem; }
.honor-card blockquote { margin: 1rem 0 0; font-family: var(--serif); font-size: 1.2rem; font-style: italic; }
.honor-card cite { display: block; font-size: .85rem; color: #ffcdd2; margin-top: .4rem; font-style: normal; }
.honor-foot { text-align: right; font-size: .8rem; color: #ffcdd2; margin-top: 1rem; }
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.share-status { min-height: 1.5em; margin-top: .5rem; }

/* ---------- Tư liệu ---------- */
.small { font-size: .85rem; }
.tulieu-hero { grid-template-columns: 1.4fr .8fr; }
.hero-portrait { margin: 0; justify-self: center; text-align: center; z-index: 1; }
.hero-portrait img { width: min(240px, 60vw); border-radius: 18px; border: 4px solid var(--gold); box-shadow: 0 16px 40px rgba(0,0,0,.35); filter: sepia(.15); }
.hero-portrait figcaption { font-size: .8rem; opacity: .85; margin-top: .5rem; }

.timeline { list-style: none; margin: 0 0 1rem; padding: 0 0 0 1.5rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: .45rem; top: .5rem; bottom: .5rem; width: 3px; border-radius: 3px; background: linear-gradient(var(--gold), var(--red-700)); }
.timeline li { position: relative; display: grid; grid-template-columns: 120px 1fr; gap: 1rem; align-items: start; }
.timeline li::before { content: ""; position: absolute; left: -1.5rem; top: .85rem; width: 15px; height: 15px; border-radius: 50%; background: var(--red-700); border: 3px solid var(--gold); }
.tl-date { font-weight: 800; color: var(--red-700); padding-top: .7rem; font-variant-numeric: tabular-nums; }
.tl-card { margin-bottom: .75rem; padding: .9rem 1.1rem; }
.tl-card h4 { font-size: 1.05rem; margin: 0 0 .3rem; }
.tl-card p { margin-bottom: .5rem; }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tl-head .section-title { margin-bottom: .5rem; }
.period-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .5rem; margin: 1rem 0 1.5rem; }
.period-nav a { text-decoration: none; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--red-700); border-radius: 10px; padding: .55rem .75rem; display: flex; flex-direction: column; font-size: .82rem; line-height: 1.35; transition: background .15s; }
.period-nav a:hover { background: #fff8e6; }
.period-nav b { color: var(--red-700); font-size: .92rem; }
.period { margin-bottom: 1.5rem; }
.period-head { background: linear-gradient(135deg, var(--red-900), var(--red-600)); color: #fff; border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.period-head h3 { margin: .2rem 0 .4rem; font-size: 1.2rem; }
.period-head p { margin: 0; opacity: .92; font-size: .95rem; }
.period-range { display: inline-block; background: var(--gold); color: var(--red-900); font-weight: 800; border-radius: 999px; padding: .1rem .7rem; font-size: .82rem; }
.tl-details { margin: .25rem 0 .6rem; }
.tl-details summary { cursor: pointer; font-weight: 700; color: var(--red-700); list-style: none; display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 8px; background: var(--red-50); font-size: .88rem; }
.tl-details summary::-webkit-details-marker { display: none; }
.tl-details summary::before { content: "▸"; transition: transform .2s; }
.tl-details[open] summary::before { transform: rotate(90deg); }
.tl-details[open] summary { margin-bottom: .75rem; }
.tl-details p { text-align: justify; line-height: 1.7; }
.tl-quote { margin: .75rem 0; padding: .75rem 1rem; border-left: 4px solid var(--gold); background: #fffaf0; font-family: var(--serif); font-style: italic; border-radius: 0 10px 10px 0; }
.tl-quote cite { display: block; font-family: var(--font); font-style: normal; font-size: .82rem; color: var(--muted); margin-top: .35rem; }
.tl-meaning { background: var(--green-50); border-radius: 10px; padding: .6rem .85rem; font-size: .92rem; }
.tl-meaning b { color: var(--green); }

.tabs-sub a { font-size: .82rem; padding: .3rem .75rem; }
.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 1rem; }
.media-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; margin: 0; }
.media-frame { background: var(--ink); }
.media-frame iframe, .media-frame video, .yt-lite { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.yt-lite { position: relative; cursor: pointer; background: #000 center / cover no-repeat; }
.yt-lite::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.45)); }
.yt-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 68px; height: 48px; border-radius: 14px; background: var(--red-600); color: #fff; font-size: 1.4rem; display: grid; place-items: center; z-index: 1; transition: transform .15s, background .15s; }
.yt-lite:hover .yt-play { transform: translate(-50%, -50%) scale(1.1); background: #f00; }
.img-zoom { display: block; }
.img-zoom img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; transition: transform .3s; }
.img-zoom:hover img { transform: scale(1.03); }
.audio-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; aspect-ratio: 16 / 9; padding: 1rem; background: radial-gradient(circle at 50% 30%, var(--red-600), var(--red-900)); }
.audio-icon { font-size: 2.6rem; }
.audio-box audio { width: 100%; }
.media-body { padding: .9rem 1.1rem 1.1rem; flex: 1; display: flex; flex-direction: column; }
.media-body h3 { font-size: 1rem; }
.media-body .muted { font-size: .9rem; flex: 1; }
.media-meta { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; font-weight: 700; color: var(--red-700); margin-bottom: .35rem; }
.media-credit { font-size: .78rem; color: var(--muted); margin: .25rem 0 0; border-top: 1px dashed var(--line); padding-top: .5rem; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 95vw; max-height: 95vh; overflow: visible; }
.lightbox::backdrop { background: rgba(20, 8, 8, .85); }
.lightbox img { display: block; max-width: 95vw; max-height: 85vh; border-radius: 12px; margin: 0 auto; }
.lightbox-caption { color: #fff; text-align: center; margin: .6rem 0 0; }
.lightbox-close { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--gold); color: var(--red-900); font-weight: 800; cursor: pointer; z-index: 1; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: .35rem; }
.form label { font-weight: 600; font-size: .9rem; margin-top: .5rem; }
.form input:not([type=radio]):not([type=checkbox]), .form textarea, .form select, .filter input, .filter select {
    width: 100%; padding: .7rem .85rem; border-radius: 10px; border: 1.5px solid var(--line); font: inherit; background: #fff;
}
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--red-700); box-shadow: 0 0 0 3px rgba(183,28,28,.12); }
.form .btn { margin-top: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.option-input { display: flex; gap: .6rem; align-items: center; }
.option-input input[type=radio] { width: 20px; height: 20px; accent-color: var(--green); flex-shrink: 0; }
.checkbox { display: flex; gap: .5rem; align-items: center; }
.field-error { color: var(--red-600); font-size: .82rem; }
.alert-error { color: var(--red-700); background: var(--red-50); border-radius: 10px; padding: 0 1rem; }
.alert-error:empty, .validation-summary-valid { display: none; }
.alert-error ul { margin: .5rem 0; padding-left: 1rem; }
.auth h1 { margin-bottom: .25rem; }
.filter { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter select { width: auto; }
.filter input { flex: 1; min-width: 180px; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #f5e6e0; padding: 1.5rem 0; font-size: .9rem; text-align: center; }
.footer p { margin: .25rem 0; }
.footer .muted { color: #b9a7a2; font-size: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .hero, .share-page, .tulieu-hero { grid-template-columns: 1fr; }
}
/* Menu đủ 5 mục + tài khoản cần ~1100px; hẹp hơn thì thu gọn thành nút ☰ */
@media (max-width: 1100px) {
    .nav-burger { display: flex; flex-direction: column; gap: 5px; margin-left: auto; cursor: pointer; padding: .5rem; }
    .nav-burger span { width: 24px; height: 3px; background: #fff; border-radius: 3px; transition: .2s; }
    .nav {
        position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; align-items: stretch;
        background: var(--red-900); padding: .5rem 1rem 1rem; display: none; box-shadow: 0 10px 20px rgba(0,0,0,.2);
    }
    .nav > a { padding: .8rem 1rem; }
    .nav-user { margin: .5rem 0 0; padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.15); }
    .nav-toggle:checked ~ .nav { display: flex; }
    .nav-toggle:checked + .nav-burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .nav-toggle:checked + .nav-burger span:nth-child(2) { opacity: 0; }
    .nav-toggle:checked + .nav-burger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}
@media (max-width: 600px) {
    .main { padding-top: 1rem; }
    .card { padding: 1rem; }
    .grid-options, .form-row, .share-buttons { grid-template-columns: 1fr; }
    .grid-2, .level-map, .media-grid { grid-template-columns: 1fr; }
    .timeline li { grid-template-columns: 1fr; gap: .25rem; }
    .hero-portrait img { width: 140px; }
    .tl-date { padding-top: .45rem; }
    .hud { gap: .35rem; }
    .hud-item { padding: .35rem .2rem; }
    .hud-item span { font-size: .6rem; letter-spacing: .04em; }
    .hud-item b { font-size: 1rem; }
    .feedback { gap: .5rem .75rem; }
    .feedback-icon { font-size: 2.2rem; }
    .feedback .grow { min-width: 200px; }
    .feedback-score { width: 100%; display: flex; justify-content: space-between; align-items: center; }
    .hide-sm { display: none; }
    .board th, .board td { padding: .6rem .5rem; }
    .podium-col { width: 31%; }
    .podium-name { font-size: .85rem; }
    .result-score { width: 100px; height: 100px; }
    .sticky-submit { bottom: .5rem; }
    .level .btn, .level form { width: 100%; }
    .level form .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
