/* ============================================================
   site.css — ngôn ngữ website trình chiếu bài 2
   Đỏ son · vàng đồng · đêm xanh. Chữ lớn, sắc, đứng yên khi đọc.
   ============================================================ */
:root {
  --red: #d6282d; --red-d: #8e1219; --gold: #f2c14e; --gold-d: #b98a2e; --ink: #f6efe2; --ink-2: #d9ccb8; --ink-3: #a99a86;
  --glass: rgba(9, 6, 7, .86); --glass-2: rgba(9, 6, 7, .66);
  --f-display: 'Playfair Display', Georgia, serif; --f-sans: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(15px, calc(0.96vw + 7.2px), 32px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050304; color: var(--ink); font-family: var(--f-sans); overflow: hidden; -webkit-font-smoothing: antialiased; }
body.lite { overflow: auto; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font: inherit; color: inherit; }
kbd { font-family: var(--f-sans); font-size: .72em; border: 1px solid rgba(255,255,255,.35); border-radius: 5px; padding: .08em .45em; margin-right: .3em; background: rgba(255,255,255,.06); }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 1.1rem; background: radial-gradient(ellipse at 50% 40%, #2a0b10, #050304 70%); transition: opacity .9s; }
#loader.gone { opacity: 0; pointer-events: none; }
#loader .mark svg { width: 3.4rem; fill: var(--gold); filter: drop-shadow(0 0 18px rgba(242,193,78,.55)); animation: pulse 2.4s ease-in-out infinite; }
#loader .t { font-family: var(--f-display); font-size: 1.8rem; letter-spacing: .02em; }
#loader .bar { width: 16rem; height: 2px; background: rgba(255,255,255,.12); }
#loader .bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }
#loader .s { font-size: .8rem; color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- intro ---------- */
#cine { position: fixed; inset: 0; z-index: 70; background: #000; display: none; opacity: 1; transition: opacity 1.2s ease; cursor: pointer; }
#cine.on { display: block; }
#cine.gone { opacity: 0; pointer-events: none; }
#cine video { width: 100%; height: 100%; object-fit: cover; }
#cine .cine-title { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; background: radial-gradient(ellipse at center, rgba(0,0,0,.25), rgba(0,0,0,.6)); }
#cine .l1 { font-size: 1rem; letter-spacing: .5em; text-transform: uppercase; color: var(--gold); opacity: 0; animation: cineIn 3.2s .8s ease forwards; }
#cine .l2 { font-family: var(--f-display); font-weight: 800; font-size: 5.2rem; line-height: .98; margin: .5em 0 .35em; opacity: 0; text-shadow: 0 6px 40px rgba(0,0,0,.6); animation: cineUp 5s 4.4s cubic-bezier(.2,.8,.2,1) forwards; }
#cine .l3 { font-size: 1.15rem; color: var(--ink-2); letter-spacing: .06em; opacity: 0; animation: cineIn2 4s 6.6s ease forwards; }
#cine.on .l1 { animation-play-state: running; }
@keyframes cineIn { 0% { opacity: 0; letter-spacing: .9em; } 30%, 75% { opacity: 1; letter-spacing: .5em; } 100% { opacity: 0; } }
@keyframes cineUp { 0% { opacity: 0; transform: translateY(40px) scale(.96); filter: blur(8px); } 30% { opacity: 1; transform: none; filter: none; } 100% { opacity: 1; } }
@keyframes cineIn2 { 0% { opacity: 0; } 40%, 100% { opacity: 1; } }
#cine .skip { position: absolute; right: 2rem; bottom: 1.6rem; font-size: .75rem; color: rgba(255,255,255,.6); letter-spacing: .08em; }

/* ---------- khung website ---------- */
#topnav { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; align-items: center; gap: 1.2rem; padding: .65rem 1.4rem; background: linear-gradient(180deg, rgba(6,4,5,.78), rgba(6,4,5,0)); pointer-events: none; }
#topnav > * { pointer-events: auto; }
#topnav .brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: .06em; font-size: .82rem; text-transform: uppercase; white-space: nowrap; }
#topnav .brand svg { width: 1.2rem; fill: var(--gold); }
#topnav .brand em { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: .3em; }
#chapters { display: flex; gap: .2rem; margin: 0 auto; flex-wrap: nowrap; }
#chapters button { background: none; border: 0; padding: .4rem .7rem; font-size: .74rem; letter-spacing: .04em; color: var(--ink-3); cursor: pointer; border-radius: 99px; white-space: nowrap; transition: color .3s, background .3s; }
#chapters button:hover { color: var(--ink); }
#chapters button.on { color: #1a0d05; background: var(--gold); font-weight: 700; }
#topnav .tools { display: flex; gap: .4rem; }
#topnav .tools button { white-space: nowrap; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 99px; padding: .35rem .8rem; font-size: .72rem; cursor: pointer; }
#topnav .tools button:hover, #topnav .tools button.on { border-color: var(--gold); color: var(--gold); }
#editToggle.on { background: var(--gold) !important; color: #1a0d05 !important; }

#rail { position: fixed; right: .9rem; top: 50%; transform: translateY(-50%); z-index: 25; display: flex; flex-direction: column; gap: .32rem; }
#rail button { position: relative; width: .5rem; height: .5rem; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.28); cursor: pointer; transition: transform .3s, background .3s; }
#rail button.major { background: rgba(242,193,78,.55); }
#rail button.on { background: var(--gold); transform: scale(1.7); box-shadow: 0 0 10px var(--gold); }
#rail button:hover::after { content: attr(data-t); position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: .7rem; background: rgba(10,8,8,.88); padding: .25rem .6rem; border-radius: 4px; color: var(--ink); }
#where { position: fixed; left: 1.4rem; bottom: .95rem; z-index: 25; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
#progwrap { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 25; background: rgba(255,255,255,.06); }
#prog { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); transform-origin: left; transform: scaleX(0); transition: transform 1.2s cubic-bezier(.4,0,.2,1); }
#hint { position: fixed; left: 50%; bottom: 2.4rem; transform: translateX(-50%); z-index: 25; font-size: .74rem; color: var(--ink-2); display: flex; align-items: center; gap: .2rem; transition: opacity .6s; animation: bob 2.4s ease-in-out infinite; }
#hint.hide { opacity: 0; pointer-events: none; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- lớp chữ ---------- */
#stage { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.dom { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
.panel { position: absolute; pointer-events: auto; transform-origin: 50% 50%; will-change: transform, opacity; line-height: 1.48;
  padding: 1.1em 1.35em 1.15em; background: linear-gradient(135deg, var(--glass), var(--glass-2)); border-left: 3px solid var(--gold);
  box-shadow: 0 24px 70px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); border-radius: 2px 10px 10px 2px; }
.panel.hero::before, .panel.monument::before { content: ''; position: absolute; inset: -4em -6em -4em -8em; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 38% 50%, rgba(4,2,3,.72), rgba(4,2,3,.35) 45%, transparent 72%); }
.panel.hero, .panel.monument { background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; }
body.measuring .panel { transform: none !important; }
.kicker { font-size: .68em; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: .7em; }
.display { font-family: var(--f-display); font-weight: 800; font-size: 4.1em; line-height: 1.0; margin: .1em 0 .3em; letter-spacing: -.01em; text-shadow: 0 8px 40px rgba(0,0,0,.55); }
.hero .display { background: linear-gradient(180deg, #fff6e2 30%, #f2c14e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 26px rgba(0,0,0,.5)); }
.lead { font-size: 1.22em; line-height: 1.5; color: var(--ink); max-width: 26em; text-shadow: 0 2px 16px rgba(0,0,0,.8); }
.lead em { font-style: normal; color: var(--gold); font-weight: 600; }
.cue { margin-top: 1.6em; font-size: .78em; color: var(--ink-2); }
.title { font-family: var(--f-display); font-weight: 700; font-size: 1.62em; line-height: 1.18; margin: 0 0 .55em; color: #fff7e6; }
.title .thin { display: block; font-family: var(--f-sans); font-weight: 400; font-size: .56em; color: var(--ink-2); margin-top: .3em; letter-spacing: .01em; }
.sub { font-size: 1.02em; font-weight: 700; color: var(--gold); margin: 0 0 .5em; }
.tag-letter { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%; background: var(--red); color: #fff; font-family: var(--f-sans); font-size: .78em; font-weight: 800; margin-right: .2em; vertical-align: .08em; }
.body { font-size: 1em; margin: 0 0 .7em; color: var(--ink); }
.body.small { font-size: .88em; color: var(--ink-2); font-style: italic; }
.body.strong { font-weight: 600; color: #fff3d6; border-top: 1px solid rgba(242,193,78,.35); padding-top: .7em; margin-top: .8em; }
.body.arrow::before { content: '→ '; color: var(--gold); font-weight: 700; }
.body b, .pts b, .defs b { color: #ffe29a; font-weight: 700; }
.body q, .pts q { quotes: '“' '”'; color: #ffe29a; }
.pts { list-style: none; margin: 0; padding: 0; }
.pts li { position: relative; padding-left: 1.2em; margin: 0 0 .6em; }
.pts li::before { content: ''; position: absolute; left: 0; top: .58em; width: .5em; height: .5em; background: var(--red); transform: rotate(45deg); box-shadow: 0 0 10px rgba(214,40,45,.8); }
.defs { margin: 0; }
.defs > div { margin-bottom: .7em; }
.defs dt { font-weight: 800; color: var(--gold); font-size: .95em; letter-spacing: .02em; }
.defs dd { margin: .1em 0 0; }
.credit { margin-top: .9em; font-size: .68em; line-height: 1.45; color: var(--ink-3); }
.credit i { color: var(--ink-2); }
.twin { display: flex; gap: .6em; margin-top: .6em; }
.twin span { flex: 1; padding: .6em .8em; border: 1px solid rgba(242,193,78,.4); border-radius: 6px; font-size: .9em; background: rgba(242,193,78,.06); }
.twin b { display: block; color: var(--gold); }
.triad { display: flex; gap: .5em; margin-top: .6em; }
.triad span { flex: 1; padding: .7em; border-top: 2px solid var(--red); background: rgba(255,255,255,.04); font-weight: 600; font-size: .92em; }
.triad b { display: block; font-family: var(--f-display); font-size: 1.6em; color: var(--gold); line-height: 1; margin-bottom: .2em; }
.num-list { list-style: none; margin: .4em 0 0; padding: 0; }
.num-list li { display: flex; gap: .7em; align-items: baseline; padding: .45em 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.num-list li b { font-family: var(--f-display); color: var(--gold); font-size: 1.35em; min-width: 1em; }
.quote-panel { padding: 1.4em 1.6em; }
.big-quote { font-family: var(--f-display); font-size: 1.62em; line-height: 1.3; margin: 0 0 .6em; color: #fff7e6; }
.big-quote.accent { color: var(--gold); font-style: italic; }
.big-quote small { font-family: var(--f-sans); font-size: .5em; color: var(--ink-3); font-style: normal; }
.verbatim { margin: .4em 0 0; padding: .7em 0 0; border-top: 1px solid rgba(242,193,78,.3); font-size: .86em; color: var(--ink-2); font-style: italic; }
.verbatim cite { display: block; font-style: normal; font-size: .82em; color: var(--ink-3); margin-top: .5em; }
.define { font-family: var(--f-display); font-size: 1.9em; line-height: 1.32; color: #fff7e6; text-shadow: 0 4px 30px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.8); margin: 0; }
.define b { color: var(--gold); }
.monument .kicker { font-size: .8em; }
.warn { border-left-color: #8fb3d9; background: linear-gradient(135deg, rgba(8,12,18,.78), rgba(8,12,18,.5)); }
.warn .kicker { color: #9cc0e6; }
.stat { text-align: left; border-left-color: var(--red); }
.stat-num { font-family: var(--f-display); font-weight: 800; font-size: 3em; line-height: 1; color: var(--gold); }
.stat-lbl { font-size: .82em; margin-top: .4em; }
.stat-src { font-size: .62em; color: var(--ink-3); margin-top: .5em; }
.toc { list-style: none; margin: .6em 0 0; padding: 0; }
.toc li { display: flex; gap: .9em; align-items: baseline; padding: .55em .4em; border-bottom: 1px solid rgba(255,255,255,.1); cursor: pointer; transition: background .25s, padding .25s; }
.toc li:hover { background: rgba(242,193,78,.1); padding-left: .8em; }
.toc li b { font-family: var(--f-display); font-size: 1.5em; color: var(--gold); min-width: 1.4em; }
.toc li span { font-size: 1.02em; }
.toc li.hot span { color: #fff; font-weight: 700; }
.toc li i { font-style: normal; font-size: .62em; background: var(--red); color: #fff; padding: .15em .55em; border-radius: 99px; margin-left: .5em; letter-spacing: .08em; text-transform: uppercase; vertical-align: .2em; }
.thanks { font-size: 1.05em; color: var(--gold); margin-top: 1em; letter-spacing: .04em; }
.outro .display { font-size: 3.5em; }

/* trắc nghiệm */
.quiz .qtext { font-family: var(--f-display); font-size: 1.42em; line-height: 1.3; margin: 0 0 .7em; color: #fff7e6; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: .45em; }
.opt { display: flex; gap: .8em; align-items: baseline; padding: .55em .8em; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; cursor: pointer; background: rgba(255,255,255,.03); transition: background .25s, border-color .25s; font-size: .95em; }
.opt:hover { border-color: var(--gold); background: rgba(242,193,78,.08); }
.opt b { font-family: var(--f-display); color: var(--gold); font-size: 1.2em; min-width: 1em; }
.opt.chosen { border-color: var(--gold); }
.revealed .opt[data-correct] { border-color: #52c27a; background: rgba(82,194,122,.16); }
.revealed .opt[data-correct] b { color: #7fe0a0; }
.revealed .opt.chosen:not([data-correct]) { border-color: #e2554f; background: rgba(226,85,79,.14); }
.qans { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .7s ease, opacity .5s, margin .5s; }
.revealed .qans { max-height: 20em; opacity: 1; margin-top: .8em; }
.ahead { font-weight: 800; color: #7fe0a0; letter-spacing: .06em; font-size: .85em; text-transform: uppercase; }
.why { margin: .3em 0 0; font-size: .86em; color: var(--ink-2); line-height: 1.5; }
.qhint { margin-top: .7em; font-size: .68em; color: var(--ink-3); }
.revealed .qhint { display: none; }

/* nhãn gắn vật thể */
#labels { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.anchor-label { position: absolute; left: 0; top: 0; opacity: 0; margin: -.9em 0 0 1.1em; font-size: .78rem; font-weight: 700; letter-spacing: .06em; padding: .3em .7em; background: rgba(10,8,8,.72); border: 1px solid rgba(242,193,78,.6); border-radius: 99px; color: #fff3d6; white-space: nowrap; }

/* ---------- câu nối khi bay ---------- */
#segue { position: fixed; left: 50%; top: 42%; z-index: 20; transform: translate(-50%, -50%); width: min(30em, 86vw); text-align: center; pointer-events: none; opacity: 0; }
#segue .part { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-bottom: .8em; min-height: 1em; }
#segue .txt { font-family: var(--f-display); font-style: italic; font-size: 1.85rem; line-height: 1.3; color: #fff7e6; text-shadow: 0 1px 2px rgba(0,0,0,.9), 0 2px 18px rgba(0,0,0,.7); }
#segue::before { content: ''; position: absolute; inset: -2.2em -3em; z-index: -1; background: radial-gradient(ellipse at center, rgba(5,3,4,.62), rgba(5,3,4,.3) 50%, transparent 72%); }
#segue.on { animation: segueIn 3.2s linear forwards; }
#segue.topic .txt { font-size: 2.1rem; }
@keyframes segueIn { 0%, 16% { opacity: 0; transform: translate(-50%, -44%); filter: blur(6px); } 24% { opacity: 1; transform: translate(-50%, -50%); filter: none; } 76% { opacity: 1; transform: translate(-50%, -50%); } 84%, 100% { opacity: 0; transform: translate(-50%, -56%); filter: blur(4px); } }
body.edit #segue { pointer-events: auto; }
#cover { position: fixed; inset: 0; z-index: 40; background: radial-gradient(ellipse at center, #3a0c10, #050304 75%); opacity: 0; pointer-events: none; }

/* ---------- lời nói ---------- */
#notes { position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, calc(100% + 3rem)); visibility: hidden; z-index: 35; width: min(56rem, 92vw); max-height: 42vh; overflow: auto; padding: 1rem 1.3rem; background: rgba(8,6,6,.92); border: 1px solid rgba(242,193,78,.35); border-radius: 12px; font-size: .86rem; line-height: 1.55; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
#notes.on { transform: translate(-50%, 0); visibility: visible; }
#notes .nx { margin-top: .6em; color: var(--gold); font-style: italic; }
#notes .src { margin-top: .6em; color: var(--ink-3); font-size: .78rem; }

/* ---------- edit ---------- */
#editbar { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 180%); z-index: 45; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; width: min(64rem, 96vw); padding: .6rem .9rem; background: rgba(12,10,10,.95); border: 1px solid var(--gold); border-radius: 12px; font-size: .72rem; transition: transform .4s; }
body.edit #editbar { transform: translate(-50%, 0); }
#editbar b { color: var(--gold); letter-spacing: .1em; }
#editbar span { color: var(--ink-2); }
#editbar button { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: .3rem .6rem; cursor: pointer; }
#editbar button:hover { border-color: var(--gold); }
#editbar .sep { width: 1px; height: 1.2rem; background: rgba(255,255,255,.2); }
#editbar small { width: 100%; color: var(--ink-3); }
body.edit .panel { outline: 1px dashed rgba(242,193,78,.45); outline-offset: 4px; }
body.edit .panel.edit-selected { outline: 2px solid var(--gold); }
body.edit [contenteditable]:focus { outline: 2px solid #7fe0a0; }
#segueEditor { position: fixed; right: 1.4rem; top: 4.5rem; z-index: 46; width: min(26rem, 90vw); padding: .9rem; background: rgba(12,10,10,.96); border: 1px solid var(--gold); border-radius: 12px; display: none; font-size: .8rem; }
#segueEditor.on { display: block; }
#segueEditor .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
#segueEditor textarea { width: 100%; background: #1a1414; color: var(--ink); border: 1px solid #444; border-radius: 6px; padding: .5rem; font: inherit; }
#segueEditor .acts { display: flex; gap: .4rem; margin-top: .5rem; }
#segueEditor button { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 6px; padding: .3rem .6rem; cursor: pointer; }

/* ---------- lite ---------- */
#lite { display: none; }
body.lite #lite { display: block; padding: 0 0 4rem; background: linear-gradient(#0b0607, #150a0c); }
body.lite canvas#gl, body.lite #topnav, body.lite #rail, body.lite #where, body.lite #progwrap, body.lite #hint, body.lite #cine { display: none !important; }
.lite-head { position: sticky; top: 0; z-index: 5; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .7rem 1rem; background: rgba(10,6,7,.95); border-bottom: 1px solid rgba(242,193,78,.3); font-size: 14px; }
.lite-head b { color: var(--gold); }
.lite-head span { color: var(--ink-3); flex: 1; }
.lite-head a { color: var(--gold); }
.lite-sec { padding: 1.4rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 16px; }
.lite-sec img { width: 100%; border-radius: 8px; margin-bottom: 1rem; display: block; }
.lite-sec .panel { position: static; width: auto !important; transform: none !important; backdrop-filter: none; margin-bottom: 1rem; }
.lite-sec .display { font-size: 2.6em; }

/* ---------- màn hình dọc khi ép 3D ---------- */
@media (max-aspect-ratio: 4/5) {
  :root { font-size: clamp(13px, 3.4vw, 22px); }
  .panel { left: 3% !important; width: 94% !important; top: auto !important; bottom: 4.2rem; max-height: 72vh; overflow: auto; }
  .panel.stat { display: none; }
  .display { font-size: 2.6em; }
  #chapters { display: none; }
  #rail { display: none; }
}
@media (max-width: 1100px) { #chapters button { padding: .35rem .45rem; font-size: .66rem; } }

body.reduce-motion #hint { animation: none; }

.toast { position: fixed; left: 50%; top: 4.2rem; transform: translateX(-50%); z-index: 50; padding: .55rem 1rem; font-size: .78rem; background: rgba(10,8,8,.92); border: 1px solid var(--gold); border-radius: 99px; transition: opacity .8s; }
.toast.gone { opacity: 0; pointer-events: none; }
.toast a { color: var(--gold); }
