/* =============================================================
 *  HÀNH TRÌNH SỬ VIỆT — giao diện hoành tráng dùng chung
 * ============================================================= */
:root {
  --accent: #b91c1c;
  --gold: #f59e0b;
  --gold-2: #fde047;
  --ink: #1a120b;
  --paper: #fbf3e3;
  --paper-2: #f3e6cd;
  --ok: #16a34a;
  --bad: #dc2626;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(245, 158, 11, .18), transparent 60%),
    linear-gradient(180deg, #2a1408, #160a04 60%, #0d0603);
  min-height: 100vh;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 18px; }

/* hoa văn trống đồng mờ trên nền */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .05; z-index: 0;
  background-image: radial-gradient(circle, #f59e0b 1px, transparent 1.5px);
  background-size: 26px 26px;
}

/* ---------- TOP BAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: rgba(22, 10, 4, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(245, 158, 11, .25);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 900; letter-spacing: .5px; }
.brand .seal {
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold) 55%, #b45309);
  display: grid; place-items: center; color: #3b1d05; font-size: 20px;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .25), var(--shadow);
}
.brand b { font-size: 1.15rem; }
.brand small { display: block; font-weight: 600; font-size: .62rem; opacity: .75; letter-spacing: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  border: none; cursor: pointer; border-radius: 10px; font-weight: 800;
  padding: 10px 16px; font-size: .9rem; transition: transform .12s, box-shadow .12s; color: #fff;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--accent)); box-shadow: var(--shadow); }
.btn-ghost { background: rgba(255, 255, 255, .1); color: #fde9c8; border: 1px solid rgba(245, 158, 11, .35); }
.btn-icon { background: rgba(255, 255, 255, .08); color: #fde9c8; width: 42px; height: 42px; padding: 0; border-radius: 10px; font-size: 1.05rem; }

.user-chip { color: #fde9c8; font-size: .85rem; display: flex; align-items: center; gap: 8px; }
.user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ---------- HERO (hub) ---------- */
.hero { position: relative; z-index: 1; text-align: center; padding: 70px 18px 40px; color: #fff; }
.hero .kicker {
  display: inline-block; padding: 6px 16px; border-radius: 999px; font-weight: 800; letter-spacing: 3px;
  font-size: .7rem; color: var(--gold-2); border: 1px solid rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .08); margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.18; font-weight: 900; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff 30%, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 4px 30px rgba(245, 158, 11, .25);
}
.hero p { max-width: 640px; margin: 16px auto 0; color: #f1dcc0; font-size: 1.08rem; }
.hero .hero-cta { margin-top: 26px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- GAME CARDS (hub) ---------- */
.games { position: relative; z-index: 1; padding: 30px 0 60px; }
.section-title { color: #fff; text-align: center; margin-bottom: 28px; }
.section-title h2 { font-size: 1.8rem; font-weight: 900; }
.section-title span { color: var(--gold); }
.section-title p { color: #cbb699; margin-top: 6px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.game-card {
  position: relative; border-radius: 18px; overflow: hidden; min-height: 280px; color: #fff; text-decoration: none;
  display: flex; flex-direction: column; justify-content: flex-end;
  border: 1px solid rgba(245, 158, 11, .25); box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s; isolation: isolate;
}
.game-card:hover { transform: translateY(-6px); box-shadow: 0 20px 44px rgba(0, 0, 0, .45); }
.game-card .gc-bg {
  position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center;
  transition: transform .4s;
}
.game-card:hover .gc-bg { transform: scale(1.08); }
.game-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 5, 2, .1), rgba(10, 5, 2, .92)); }
.game-card .gc-num { position: absolute; top: 14px; left: 16px; font-size: 2.4rem; font-weight: 900; opacity: .35; }
.game-card .gc-badge { position: absolute; top: 16px; right: 16px; background: rgba(0, 0, 0, .4); border: 1px solid rgba(245, 158, 11, .5); color: var(--gold-2); font-size: .68rem; font-weight: 800; padding: 5px 10px; border-radius: 999px; }
.game-card .gc-body { padding: 20px; }
.game-card h3 { font-size: 1.4rem; font-weight: 900; line-height: 1.4; }
.game-card p { color: #e7d3b6; font-size: .9rem; margin-top: 4px; }
.game-card .gc-go { margin-top: 14px; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold-2); }
.game-card .gc-prog { margin-top: 10px; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.game-card .gc-prog span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); width: 0; }

/* ---------- GAME PAGE LAYOUT ---------- */
.game-head { position: relative; z-index: 1; text-align: center; padding: 44px 18px 10px; color: #fff; }
.game-head h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; line-height: 1.2; padding-bottom: 4px;
  background: linear-gradient(180deg, #fff, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.game-head p { color: #e7d3b6; max-width: 620px; margin: 10px auto 0; }

.progress-wrap { position: relative; z-index: 1; max-width: 720px; margin: 22px auto 8px; padding: 0 18px; }
.progress-bar { height: 14px; border-radius: 999px; background: rgba(0, 0, 0, .4); border: 1px solid rgba(245, 158, 11, .3); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--gold-2)); transition: width .5s; }
.progress-label { text-align: center; color: var(--gold-2); font-weight: 800; font-size: .85rem; margin-top: 8px; }

/* ---------- LEVEL MAP ---------- */
.map-section { position: relative; z-index: 1; padding: 18px 0 40px; }
.level-map {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; padding: 0 4px;
}
.node {
  position: relative; border: none; cursor: pointer; text-align: left; color: #fff;
  border-radius: 16px; overflow: hidden; min-height: 184px; padding: 16px 16px 20px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: #2a1408; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; isolation: isolate;
}
.node .node-bg { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center; opacity: .55; }
.node::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 5, 2, .15), rgba(10, 5, 2, .9)); }
.node:not(.locked):hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 16px 36px rgba(0, 0, 0, .45); }
.node-num { position: absolute; top: 10px; left: 14px; font-size: 1.6rem; font-weight: 900; opacity: .6; }
.node-title { font-weight: 800; font-size: .95rem; line-height: 1.6; padding-bottom: 3px; }
.node-era { font-size: .72rem; color: var(--gold-2); font-weight: 700; margin-top: 6px; }
.node-check { position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; font-weight: 900; box-shadow: 0 0 12px rgba(22, 163, 74, .7); }
.node-lock { position: absolute; top: 10px; right: 12px; font-size: 1.1rem; }
.node-sword, .node-q { position: absolute; top: 10px; right: 12px; font-size: 1.1rem; filter: drop-shadow(0 0 6px var(--gold)); }
.node.locked { filter: grayscale(.8) brightness(.6); cursor: not-allowed; }
.node.open { box-shadow: 0 0 0 2px rgba(245, 158, 11, .55), var(--shadow); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(245, 158, 11, .5), var(--shadow); } 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, .18), var(--shadow); } }
.node.done .node-bg { opacity: .7; }

/* ---------- ALL DONE BANNER ---------- */
.all-done { display: none; position: relative; z-index: 1; margin: 10px 0 30px; text-align: center;
  border-radius: 16px; padding: 26px; color: #3b1d05;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); box-shadow: var(--shadow); }
.all-done.show { display: block; animation: rise .5s; }
.all-done h3 { font-size: 1.5rem; font-weight: 900; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- LIBRARY (đọc sử đã mở khóa) ---------- */
.lib-section { position: relative; z-index: 1; padding: 10px 0 70px; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.lib-card { background: var(--paper); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s; border: 1px solid rgba(0, 0, 0, .08); }
.lib-card.open:hover { transform: translateY(-4px); }
.lib-card.locked { cursor: default; }
.lib-img { height: 130px; background-size: cover; background-position: center; background-color: #3a2412; position: relative; display: grid; place-items: center; }
.lib-card.locked .lib-img { background: repeating-linear-gradient(45deg, #2a1810, #2a1810 12px, #1f1109 12px, #1f1109 24px); }
.lib-lock { font-size: 1.8rem; opacity: .7; }
.lib-meta { padding: 14px; }
.lib-era { font-size: .7rem; font-weight: 800; color: var(--accent); }
.lib-meta h4 { margin: 4px 0 6px; font-size: 1.02rem; line-height: 1.45; color: var(--ink); }
.lib-meta p { font-size: .85rem; color: #6b5640; }

/* ---------- MODAL ---------- */
.modal { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(8, 4, 2, .82); backdrop-filter: blur(6px); padding: 20px; overflow-y: auto; }
.modal.show { display: flex; align-items: flex-start; justify-content: center; }
.modal-card { background: var(--paper); border-radius: 20px; max-width: 640px; width: 100%; margin: 30px auto; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); position: relative; animation: pop .25s; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.1rem; }

/* read / story scene (kể chuyện) */
.story-hero { position: relative; height: 240px; overflow: hidden; background: #3a2412; display: flex; align-items: flex-end; }
.story-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.kenburns { animation: kenburns 16s ease-in-out infinite alternate; transform-origin: center; }
@keyframes kenburns { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.18) translate(-2%, -3%); } }
.story-hero-ov { position: relative; z-index: 2; width: 100%; padding: 18px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .9)); color: #fff; }
.story-title { font-size: 1.6rem; font-weight: 900; line-height: 1.4; padding-bottom: 4px; animation: rise .5s; }
.read-era { font-size: .74rem; font-weight: 800; color: var(--gold-2); }
.narrate-btn { position: absolute; top: 12px; left: 12px; z-index: 3; border: 1px solid rgba(245,158,11,.6); background: rgba(0,0,0,.5); color: #fde9c8; font-weight: 800; font-size: .8rem; padding: 7px 12px; border-radius: 999px; cursor: pointer; backdrop-filter: blur(4px); }
.narrate-btn:hover { background: rgba(0,0,0,.7); }
.story-body { padding: 22px; }
.story-text { font-size: 1.06rem; color: #2e2113; min-height: 90px; line-height: 1.75; border-left: 3px solid var(--gold); padding-left: 14px; }
.read-body { padding: 22px; }
.read-body > p { font-size: 1.02rem; color: #3a2c1c; }

/* các mục cinematic trong cảnh kể chuyện */
.sect { margin-top: 18px; }
.sect-h { font-weight: 800; color: var(--accent); font-size: 1rem; margin-bottom: 8px; }
.sect-body { font-size: .98rem; color: #3a2c1c; line-height: 1.7; }
.gen-list { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-chip { border: 2px solid #e3d3b4; background: #fff; border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: .9rem; cursor: pointer; transition: all .12s; }
.gen-chip:hover { transform: translateY(-2px); }
.gen-chip.side-ta { border-color: #b45309; color: #92400e; background: #fff7ed; }
.gen-chip.side-dich { border-color: #6b7280; color: #374151; background: #f3f4f6; }
.gen-chip.side-fig { border-color: #0d9488; color: #115e59; background: #f0fdfa; }
.fact-list { margin: 0; padding-left: 20px; }
.fact-list li { font-size: .95rem; color: #3a2c1c; line-height: 1.65; margin-bottom: 6px; }
.gen-note { margin-top: 10px; font-size: .92rem; color: #4a3826; min-height: 4px; background: #fff; border-radius: 10px; padding: 0; }
.gen-note:not(:empty) { padding: 12px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.06); animation: rise .3s; }
.gen-note .lnk { background: none; border: none; color: var(--accent); cursor: pointer; font-weight: 800; text-decoration: underline; }
.place-list { display: grid; gap: 8px; }
.place-item { background: #fff; border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 13px; font-size: .92rem; color: #4a3826; cursor: context-menu; }
.place-item b { color: var(--accent); }
.read-cta { margin-top: 20px; text-align: center; }
.enemy-tag { font-size: .9rem; color: #6b5640; margin-bottom: 12px; }
.enemy-tag b { color: var(--accent); }
.btn-start, .btn-next, .btn-retry, .btn-reread {
  border: none; cursor: pointer; border-radius: 12px; font-weight: 800; font-size: 1rem; padding: 13px 24px; color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--accent)); box-shadow: var(--shadow); transition: transform .12s; margin: 6px;
}
.btn-start:hover, .btn-next:hover, .btn-retry:hover, .btn-reread:hover { transform: translateY(-2px); }
.btn-reread { background: #6b5640; }

/* mission */
.mission { padding: 22px; }
.quiz-progress { text-align: center; font-weight: 800; color: var(--accent); margin-bottom: 14px; }
.q-card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
.q-text { font-size: 1.12rem; font-weight: 800; color: var(--ink); margin-bottom: 14px; }
.q-opts { display: grid; gap: 10px; }
.opt {
  text-align: left; border: 2px solid #e7d8bf; background: var(--paper); color: var(--ink);
  border-radius: 10px; padding: 12px 14px; font-size: .98rem; font-weight: 600; cursor: pointer; transition: all .12s;
}
.opt:hover:not(:disabled) { border-color: var(--gold); transform: translateX(3px); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--ok); background: #dcfce7; color: #14532d; }
.opt.wrong { border-color: var(--bad); background: #fee2e2; color: #7f1d1d; }
.q-feedback { text-align: center; margin-top: 14px; min-height: 24px; font-weight: 800; }
.q-feedback .ok { color: var(--ok); }
.q-feedback .bad { color: var(--bad); }

/* battle stage */
.battle-stage { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px;
  background: linear-gradient(135deg, #2a1408, #4a1d0c); border-radius: 14px; padding: 16px; }
.combatant { flex: 1; text-align: center; color: #fff; }
.cbt-img { width: 78px; height: 78px; margin: 0 auto 8px; border-radius: 12px; background-size: cover; background-position: center;
  background-color: #1a0c05; border: 2px solid rgba(245, 158, 11, .5); display: grid; place-items: center; font-size: 2.2rem; }
.cbt-name { font-size: .8rem; font-weight: 800; margin-bottom: 6px; }
.hpbar { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, .5); overflow: hidden; border: 1px solid rgba(255, 255, 255, .2); }
.hpbar span { display: block; height: 100%; background: linear-gradient(90deg, #dc2626, #f87171); transition: width .4s; }
.hearts { font-size: 1.05rem; letter-spacing: 2px; }
.vs { color: var(--gold-2); font-weight: 900; font-size: 1.1rem; }
.battle-stage.hit-enemy .enemy .cbt-img { animation: shake .4s; }
.battle-stage.hit-hero .hero .cbt-img { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px) rotate(-4deg); } 75% { transform: translateX(7px) rotate(4deg); } }

/* result */
.result { padding: 34px 24px; text-align: center; }
.rs-emoji { font-size: 3.6rem; animation: rise .4s; }
.result h2 { font-size: 1.8rem; font-weight: 900; margin: 6px 0; }
.result.win h2 { color: var(--ok); }
.result.lose h2 { color: var(--bad); }
.result p { color: #5a4632; max-width: 420px; margin: 0 auto; }
.rs-points { margin: 16px auto 0; display: inline-block; padding: 10px 18px; border-radius: 999px; font-weight: 800;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #3b1d05; }
.rs-points.muted { background: #efe2c8; color: #6b5640; }
.rs-actions { margin-top: 20px; }

/* bản đồ thế trận thư pháp */
.map-thupphap { position: relative; margin: 2px 0 12px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .12); box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.map-thupphap img { width: 100%; display: block; }
.map-thupphap span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 12px 7px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); color: #fde9c8; font-size: .74rem; font-weight: 700; }

/* cutscene "chém tướng" hoành tráng */
.cutscene { position: relative; height: 430px; overflow: hidden; background: #000; animation: cutshake .5s; }
@keyframes cutshake { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-6px, 4px); } 40% { transform: translate(6px, -4px); } 60% { transform: translate(-4px, -3px); } 80% { transform: translate(4px, 3px); } }
.cut-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.cut-img.kenburns { animation: kenburns 6s ease-out both; }
.cutscene::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, transparent 40%, rgba(0, 0, 0, .55)); }
.cut-slash::before, .cut-slash::after { content: ""; position: absolute; top: 45%; left: -30%; width: 160%; height: 10px; background: linear-gradient(90deg, transparent, #fff, transparent); transform: rotate(-20deg); box-shadow: 0 0 26px #fff, 0 0 60px #f59e0b; animation: slash .45s ease-out forwards; z-index: 3; }
.cut-slash::after { top: 52%; animation-delay: .12s; }
@keyframes slash { 0% { transform: rotate(-20deg) translateX(-70%); opacity: 0; } 25% { opacity: 1; } 100% { transform: rotate(-20deg) translateX(70%); opacity: 0; } }
.cut-text { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 20px; }
.cut-big { font-size: clamp(2rem, 7vw, 3rem); font-weight: 900; letter-spacing: 2px; color: #fde047; text-shadow: 0 4px 18px rgba(0, 0, 0, .85), 0 0 34px rgba(245, 158, 11, .7); opacity: 0; animation: stamp .5s .3s both; }
.cut-cap { margin-top: 12px; color: #fff; font-weight: 700; font-size: 1.05rem; max-width: 84%; text-shadow: 0 2px 10px #000; opacity: 0; animation: rise .6s .75s both; }
@keyframes stamp { 0% { transform: scale(2.5); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.cut-skip { position: absolute; z-index: 5; bottom: 14px; right: 14px; border: 1px solid rgba(245, 158, 11, .5); cursor: pointer; background: rgba(0, 0, 0, .5); color: #fde9c8; padding: 9px 15px; border-radius: 999px; font-weight: 800; }
.cut-skip:hover { background: rgba(0, 0, 0, .75); }

/* màn thua bi tráng (trận đánh) */
.result.lose.bitrang { background: linear-gradient(180deg, #2a1810, #1a0f08); border-radius: 16px; }
.result.lose.bitrang h2 { color: #d8c3a3; letter-spacing: 1px; }
.result.lose.bitrang .rs-emoji { filter: grayscale(.4) brightness(.95); }
.result.lose.bitrang p { color: #b9a585; }

/* leaderboard */
.lb-section { position: relative; z-index: 1; padding: 0 0 60px; }
.lb-box { max-width: 560px; margin: 0 auto; background: rgba(22, 10, 4, .6); border: 1px solid rgba(245, 158, 11, .3); border-radius: 16px; overflow: hidden; }
.lb-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; color: var(--gold-2); font-weight: 900; border-bottom: 1px solid rgba(245, 158, 11, .2); }
#leaderboard { padding: 8px; }
.sv-lb-row { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: #f1dcc0; }
.sv-lb-row:nth-child(odd) { background: rgba(255, 255, 255, .04); }
.sv-lb-player { background: rgba(245, 158, 11, .15) !important; }
.sv-lb-rank { font-weight: 900; text-align: center; color: var(--gold-2); }
.sv-lb-name { font-weight: 700; }
.sv-lb-score { font-weight: 900; color: var(--gold-2); }
.sv-lb-score::after { content: " 🪙"; }
.sv-lb-levels { font-size: .78rem; opacity: .7; }
.sv-lb-levels::after { content: " ải"; }

/* points panel */
.pts-panel { padding: 18px; text-align: center; color: #f1dcc0; }
.pts-panel p { margin-bottom: 12px; }
.pts-acc { font-size: .9rem; color: #e7d3b6; }
.pts-acc b { color: var(--gold-2); }
.pts-score { font-size: 2rem; font-weight: 900; color: var(--gold-2); margin: 6px 0 14px; }
.pts-score span { font-size: 1rem; font-weight: 700; color: #cbb699; }
.pts-score.muted { font-size: .9rem; color: #cbb699; }
.pts-panel small { display: block; margin-top: 10px; color: #9c8467; font-size: .76rem; }
.pts-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.pts-ok { color: #34d399; font-weight: 700; font-size: .9rem; margin: 6px 0; }
.pts-pool { margin-top: 10px; color: var(--gold-2); font-size: .85rem; }
.pts-panel .lnk { background: none; border: none; color: #f59e0b; cursor: pointer; font-size: .8rem; text-decoration: underline; padding: 0; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .2; } }

/* footer */
.site-foot { position: relative; z-index: 1; text-align: center; padding: 26px 18px; color: #93785a; font-size: .82rem; border-top: 1px solid rgba(245, 158, 11, .15); }
.eco-links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; align-items: center; font-size: .78rem; }
.eco-links .eco-label { color: #7a6547; }
.eco-links a { color: #c9a96a; text-decoration: none; }
.eco-links a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .battle-stage { flex-direction: column; }
  .cbt-img { width: 64px; height: 64px; }
  .hero h1 { font-size: 2.4rem; }
}

/* =========================================================
 *  TRANG BÀI HỌC (bai-hoc/...) + HUB MỤC LỤC
 * ========================================================= */
.lesson-page .topbar-actions .btn { text-decoration: none; }
.ls-wrap { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 18px 18px 40px; }
.ls-crumb { font-size: .82rem; color: #c9a96a; margin: 6px 2px 16px; }
.ls-crumb a { color: var(--gold-2); text-decoration: none; }
.ls-crumb a:hover { text-decoration: underline; }
.ls-crumb span { color: #e8d4ad; }

.ls-article { background: var(--paper); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.ls-hero { position: relative; height: 300px; background-size: cover; background-position: center; display: flex; align-items: flex-end; }
.ls-hero-ov { width: 100%; padding: 22px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .9)); color: #fff; }
.ls-era { font-size: .78rem; font-weight: 800; color: var(--gold-2); }
.ls-title { font-size: 2rem; font-weight: 900; line-height: 1.3; margin-top: 4px; }
.ls-lead { font-size: 1.12rem; color: #2e2113; line-height: 1.8; border-left: 4px solid var(--gold); padding: 4px 0 4px 16px; margin: 22px; }

.ls-sect { margin: 22px; }
.ls-h { font-weight: 800; color: var(--accent); font-size: 1.12rem; margin-bottom: 10px; }
.ls-p { font-size: 1rem; color: #3a2c1c; line-height: 1.75; }
.ls-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ls-people li { background: #fff; border-radius: 10px; padding: 11px 14px; font-size: .96rem; color: #3a2c1c; line-height: 1.6; border-left: 4px solid #b45309; }
.ls-people li.side-dich { border-left-color: #6b7280; }
.ls-people li.side-fig { border-left-color: #0d9488; }
.ls-people li b { color: var(--accent); }
.ls-places { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ls-places li { background: #fff; border-left: 4px solid var(--gold); border-radius: 10px; padding: 11px 14px; font-size: .95rem; color: #4a3826; }
.ls-places li b { color: var(--accent); }
.ls-facts { margin: 0; padding-left: 20px; }
.ls-facts li { font-size: .97rem; color: #3a2c1c; line-height: 1.7; margin-bottom: 7px; }
.ls-quiz { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.ls-quiz li { font-size: .97rem; color: #3a2c1c; line-height: 1.6; }
.ls-quiz .ls-q { display: block; font-weight: 700; }
.ls-quiz .ls-a { display: block; color: #6b5640; font-size: .9rem; margin-top: 2px; }

.ls-cta { margin: 26px 22px 6px; text-align: center; }
.ls-cta .btn-start { display: inline-block; text-decoration: none; }

.ls-nav { display: flex; gap: 10px; align-items: stretch; margin: 8px 22px 24px; flex-wrap: wrap; }
.ls-nav-a { flex: 1 1 30%; min-width: 0; display: flex; align-items: center; gap: 6px; text-decoration: none; background: #fff; border: 1px solid #e3d3b4; border-radius: 12px; padding: 12px 14px; font-size: .9rem; font-weight: 700; color: #6b4f2e; transition: all .12s; }
.ls-nav-a:hover { transform: translateY(-2px); border-color: var(--gold); }
.ls-nav-a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-nav-a.next { justify-content: flex-end; text-align: right; }
.ls-nav-a.all { flex: 0 0 auto; justify-content: center; color: var(--accent); }
.ls-nav-a.is-empty { background: none; border: none; pointer-events: none; }

/* Hub mục lục */
.hub-head { text-align: center; margin: 14px 0 26px; }
.hub-head h1 { font-size: 2.1rem; background: linear-gradient(180deg, #fff, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hub-head p { color: #d9bd8a; margin-top: 6px; }
.hub-sect { margin-bottom: 34px; }
.hub-sect .section-title h2 { font-size: 1.5rem; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.hub-card { display: flex; flex-direction: column; background: var(--paper); border-radius: 14px; overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s; }
.hub-card:hover { transform: translateY(-3px); }
.hub-img { display: block; height: 120px; background-size: cover; background-position: center; background-color: #3a2412; }
.hub-meta { padding: 12px 14px; }
.hub-era { display: block; font-size: .72rem; font-weight: 800; color: #b45309; }
.hub-t { display: block; font-weight: 800; color: var(--ink); margin-top: 3px; line-height: 1.4; }
.hub-play { margin-top: 14px; }
.hub-play .btn { text-decoration: none; }

/* =========================================================
 *  NÚT CHIA SẺ SOCIAL (share.js)
 * ========================================================= */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 22px 18px; padding-top: 16px; border-top: 1px dashed #e0cda8; }
.share-lead { font-weight: 800; color: #6b4f2e; font-size: .9rem; margin-right: 4px; }
.sh-btn { display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer; text-decoration: none; border-radius: 10px; padding: 8px 13px; font-size: .85rem; font-weight: 800; font-family: inherit; color: #fff; transition: transform .12s, filter .12s; }
.sh-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.sh-ic { font-size: 1rem; line-height: 1; }
.sh-fb { background: #1877f2; }
.sh-zalo { background: #0068ff; }
.sh-x { background: #0f1419; }
.sh-tg { background: #2aabee; }
.sh-copy, .sh-native { background: #6b5640; }
.sh-btn.done { background: #16a34a; }

/* share trong modal game */
.lv-share-slot { margin-top: 16px; }
.lv-share-slot .share-bar { margin: 0; }
.lv-lesson-link { display: inline-block; margin-bottom: 10px; font-weight: 800; font-size: .9rem; color: var(--accent); text-decoration: none; }
.lv-lesson-link:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .ls-title { font-size: 1.5rem; }
  .ls-hero { height: 220px; }
  .ls-lead, .ls-sect, .ls-cta, .ls-nav, .share-bar { margin-left: 14px; margin-right: 14px; }
  .sh-tx { display: none; }
  .sh-btn { padding: 9px 12px; }
  .share-lead { width: 100%; margin-bottom: 2px; }
}

/* =========================================================
 *  HOẠT CẢNH — sân khấu role-play (mỗi tướng một giọng)
 * ========================================================= */
/* nút mở hoạt cảnh trong trang đọc sử */
.sect-rp { margin-top: 20px; }
.btn-roleplay {
  display: block; width: 100%; cursor: pointer; border: none;
  font-family: inherit; font-weight: 900; font-size: 1.02rem; color: #fff;
  padding: 14px 16px; border-radius: 14px; text-align: center;
  background: linear-gradient(135deg, #7c2d12, #b91c1c 55%, #ea580c);
  box-shadow: 0 8px 22px rgba(185, 28, 28, .35);
  transition: transform .12s, filter .12s;
}
.btn-roleplay:hover { transform: translateY(-2px); filter: brightness(1.08); }
.rp-hint { margin-top: 8px; font-size: .85rem; color: #6b5640; text-align: center; }

/* ---------- nút mini-game tương tác trong bài học ---------- */
.sect-mg { margin-top: 16px; }
.btn-minigame {
  display: block; width: 100%; cursor: pointer; border: none;
  font-family: inherit; font-weight: 900; font-size: 1.02rem; color: #3b1d05;
  padding: 14px 16px; border-radius: 14px; text-align: center;
  background: linear-gradient(135deg, #fde047, #f59e0b 60%, #b45309);
  box-shadow: 0 8px 22px rgba(245, 158, 11, .35);
  transition: transform .12s, filter .12s;
}
.btn-minigame:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-minigame .mg-done-tick { color: #166534; }

/* sân khấu chiếm trọn thân modal */
.theater { position: relative; height: 540px; max-height: 80vh; overflow: hidden; background: #0c0603; color: #fff; }
.th-bgwrap { position: absolute; inset: 0; }
.th-bgwrap::after { content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(120% 80% at 50% 0%, transparent 35%, rgba(8,4,2,.85) 100%),
              linear-gradient(180deg, rgba(8,4,2,.4), rgba(8,4,2,.92)); }
.th-bg { position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.4s ease; }
.th-bg.show { opacity: .55; }

.th-top { position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; font-weight: 800; font-size: .9rem; }
.th-scene { color: var(--gold-2); text-shadow: 0 2px 8px #000; }
.th-dots { display: flex; gap: 6px; flex-wrap: wrap; max-width: 50%; justify-content: flex-end; }
.th-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25); transition: all .2s; }
.th-dots i.on { background: var(--gold); transform: scale(1.35); box-shadow: 0 0 8px var(--gold); }
.th-dots i.past { background: rgba(245,158,11,.55); }

/* khu diễn viên */
.th-stage { position: absolute; left: 0; right: 0; top: 46px; bottom: 168px; z-index: 4;
  display: flex; align-items: flex-end; justify-content: space-between; padding: 0 16px; }
.tactor { width: 40%; max-width: 220px; text-align: center; opacity: 0; transform: translateY(24px) scale(.92);
  transition: opacity .35s, transform .35s, filter .35s; filter: grayscale(.4) brightness(.6); }
.tactor.shown { opacity: 1; transform: translateY(0) scale(1); }
.tactor.right { transform: translateY(24px) scale(.92); }
.tactor.speaking { filter: none; transform: translateY(-6px) scale(1.05); }
.tactor.speaking .ta-img { box-shadow: 0 0 0 3px var(--gold), 0 12px 30px rgba(0,0,0,.5); }
.ta-img { width: 150px; height: 150px; margin: 0 auto 10px; border-radius: 16px;
  background-size: cover; background-position: center top; background-color: #2a1810;
  box-shadow: 0 10px 26px rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.15); }
.tactor.right .ta-img { background-position: center top; }
.ta-img img { width: 100%; height: 100%; object-fit: cover; object-position: center top; border-radius: 14px; }
.ta-fallback { display: grid; place-items: center; font-size: 4rem; }
.tactor.left  .ta-fallback { background: radial-gradient(circle at 40% 35%, #b45309, #7c2d12); }
.tactor.right .ta-fallback { background: radial-gradient(circle at 40% 35%, #475569, #1f2937); }
.ta-name { display: inline-block; font-weight: 800; font-size: .9rem; padding: 4px 12px; border-radius: 999px;
  background: rgba(0,0,0,.55); text-shadow: 0 1px 3px #000; }
.tactor.left  .ta-name { color: #fde68a; }
.tactor.right .ta-name { color: #cbd5e1; }
@keyframes talk { 0%,100% { transform: translateY(-6px) scale(1.05); } 50% { transform: translateY(-9px) scale(1.07); } }
.tactor.speaking.anim { animation: talk 1.1s ease-in-out infinite; }

/* banner người dẫn truyện */
.th-narr { position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%); z-index: 6;
  max-width: 78%; text-align: center; font-size: 1.05rem; font-weight: 700; line-height: 1.6;
  color: #ffedd5; text-shadow: 0 2px 10px #000; opacity: 0; transition: opacity .3s; pointer-events: none; }
.th-narr.on { opacity: 1; }
.th-narr::before { content: "✦ "; color: var(--gold); }
.th-narr::after  { content: " ✦"; color: var(--gold); }

/* bong bóng thoại */
.tbubble { position: absolute; left: 16px; right: 16px; bottom: 70px; z-index: 7;
  min-height: 84px; background: rgba(251,243,227,.97); color: #1a120b; border-radius: 16px;
  padding: 14px 18px 16px; box-shadow: 0 -6px 24px rgba(0,0,0,.4); border-top: 4px solid var(--gold);
  transition: opacity .2s; }
.tbubble.side-ta   { border-top-color: #ea580c; }
.tbubble.side-dich { border-top-color: #64748b; }
.tbubble.side-narrator { background: rgba(20,12,6,.92); color: #ffedd5; border-top-color: var(--gold); }
.tb-name { display: inline-block; font-weight: 900; font-size: .92rem; margin-bottom: 4px; color: var(--accent); }
.tbubble.side-dich .tb-name { color: #475569; }
.tbubble.side-narrator .tb-name { color: var(--gold-2); }
.tb-text { font-size: 1.04rem; line-height: 1.6; min-height: 1.6em; }
.tb-cursor { display: inline-block; width: 8px; margin-left: 1px; animation: blink .8s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* thanh điều khiển */
.th-ctrls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: linear-gradient(0deg, rgba(8,4,2,.95), transparent); }
.th-btn { cursor: pointer; border: 1px solid rgba(245,158,11,.4); background: rgba(0,0,0,.45); color: #fde68a;
  font-family: inherit; font-weight: 800; font-size: .85rem; padding: 9px 13px; border-radius: 10px;
  transition: transform .12s, background .12s; }
.th-btn:hover { transform: translateY(-1px); background: rgba(245,158,11,.18); }
.th-btn.primary { margin-left: auto; background: linear-gradient(135deg, #b91c1c, #ea580c); color: #fff; border: none; }
.th-btn.primary.big { font-size: .95rem; padding: 11px 18px; box-shadow: 0 6px 18px rgba(234,88,12,.4); }
.th-spacer { margin-left: auto; }

@media (max-width: 600px) {
  .theater { height: 92vh; max-height: 92vh; }
  .th-stage { bottom: 188px; }
  .ta-img { width: 104px; height: 104px; }
  .ta-fallback { font-size: 2.6rem; }
  .tactor { max-width: 44%; }
  .tb-text { font-size: .98rem; }
  .th-btn { padding: 8px 10px; font-size: .78rem; }
}

/* =========================================================
 *  CHẾ ĐỘ NHÚNG (?embed=1) — thầy cô nhúng vào bài giảng
 *  Ẩn mọi khung chrome, chỉ còn đúng mô phỏng/game cần trình chiếu.
 * ========================================================= */
.embed-mode .topbar,
.embed-mode .site-foot,
.embed-mode #reset-progress,
.embed-mode .lb-section,
.embed-mode .lv-share-slot,
.embed-mode .share-bar,
.embed-mode .ls-crumb,
.embed-mode .lv-lesson-link { display: none !important; }
.embed-mode .ls-wrap { padding-top: 8px; }

/* Trang game khi nhúng 1 mô phỏng riêng lẻ: chỉ hiện đúng mô phỏng, ẩn hub */
.embed-mode.solo .game-head,
.embed-mode.solo .progress-wrap,
.embed-mode.solo .map-section,
.embed-mode.solo .lib-section,
.embed-mode.solo .all-done { display: none !important; }
.embed-mode.solo .container { padding: 0; max-width: none; }

/* modal chiếm trọn iframe, không nền tối mờ khi nhúng solo */
.embed-mode.solo .modal { padding: 0; background: transparent; }
.embed-mode.solo .modal-card { margin: 0; max-width: none; height: 100vh; border-radius: 0; display: flex; flex-direction: column; }
.embed-mode.solo #modal-body { flex: 1; overflow-y: auto; }
.embed-mode.solo .modal-close { display: none; }

/* nút mở lại mô phỏng khi người xem lỡ đóng (chỉ ở chế độ nhúng) */
.embed-relaunch { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center;
  background: radial-gradient(80% 60% at 50% 40%, #2a1408, #0d0603); text-align: center; padding: 24px; }
.embed-relaunch .btn-start { font-size: 1.15rem; }
.embed-relaunch p { color: #e7d3b6; margin-bottom: 16px; max-width: 420px; }
.embed-relaunch h3 { color: #fde047; font-size: 1.3rem; font-weight: 900; margin-bottom: 8px; }

/* badge "nhúng bởi Sử Việt" nhỏ góc dưới, giữ thương hiệu khi phát trên slide */
.embed-mode .embed-badge { position: fixed; right: 8px; bottom: 8px; z-index: 90;
  font-size: .7rem; font-weight: 800; letter-spacing: .3px; color: #fde9c8;
  background: rgba(12,6,3,.62); border: 1px solid rgba(245,158,11,.4);
  padding: 4px 10px; border-radius: 999px; text-decoration: none; backdrop-filter: blur(4px); opacity: .85; }
.embed-mode .embed-badge:hover { opacity: 1; }

/* =========================================================
 *  JUICE TRẬN ĐÁNH — cảm giác "đã tay" + ambience theo bối cảnh
 * ========================================================= */
.mission { position: relative; }
.battle-stage { position: relative; overflow: hidden; }
.battle-stage .combatant, .battle-stage .vs { position: relative; z-index: 2; }

/* lớp ambience nền sân khấu (khói/lửa/sóng/bụi theo bối cảnh) */
.stage-amb { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .9; }
.scape-siege .stage-amb {           /* công thành: lửa cháy rực dưới chân + khói */
  background:
    radial-gradient(120% 80% at 50% 130%, rgba(249,115,22,.55), rgba(180,50,10,.15) 45%, transparent 65%),
    linear-gradient(0deg, rgba(120,30,8,.35), transparent 55%);
  animation: ambFlicker 2.6s ease-in-out infinite; }
.scape-sea .stage-amb {             /* thủy chiến: ánh nước lam gợn */
  background:
    radial-gradient(120% 90% at 50% 120%, rgba(34,120,160,.45), transparent 60%),
    linear-gradient(0deg, rgba(10,40,70,.4), transparent 60%);
  animation: ambDrift 5s ease-in-out infinite; }
.scape-field .stage-amb {           /* dã chiến: bụi mù chiến trận */
  background: radial-gradient(120% 90% at 50% 120%, rgba(120,90,50,.4), transparent 62%);
  animation: ambDrift 6s ease-in-out infinite; }
.scape-modern .stage-amb {          /* cận đại: khói súng */
  background:
    radial-gradient(120% 90% at 50% 120%, rgba(90,90,90,.5), transparent 60%),
    linear-gradient(0deg, rgba(30,30,30,.45), transparent 55%);
  animation: ambFlicker 3.4s ease-in-out infinite; }
@keyframes ambFlicker { 0%,100% { opacity: .78; } 45% { opacity: 1; } 70% { opacity: .68; } }
@keyframes ambDrift { 0%,100% { transform: translateX(-2%); } 50% { transform: translateX(2%); } }

/* rung mạnh hơn khi đánh trúng + đòn kết liễu */
.battle-stage.hit-enemy .enemy .cbt-img { animation: shakeHard .4s; }
.battle-stage.hit-hero .hero .cbt-img { animation: shakeHard .4s; }
@keyframes shakeHard { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-6deg); } 50% { transform: translateX(9px) rotate(5deg); } 80% { transform: translateX(-5px) rotate(-3deg); } }
.battle-stage.hit-crit { animation: stageQuake .6s; }
.battle-stage.hit-crit .enemy .cbt-img { animation: critHit .6s; }
@keyframes stageQuake { 0%,100% { transform: translate(0,0); } 15% { transform: translate(-8px,4px); } 30% { transform: translate(7px,-5px); } 50% { transform: translate(-6px,-3px); } 70% { transform: translate(5px,4px); } 85% { transform: translate(-3px,-2px); } }
@keyframes critHit { 0% { transform: scale(1); } 25% { transform: scale(1.18) rotate(-8deg); filter: brightness(1.6); } 100% { transform: scale(1); } }

/* hitstop: khựng animation một nhịp */
.battle-stage.hitstop, .battle-stage.hitstop * { animation-play-state: paused !important; }
.battle-stage.hitstop { transform: scale(1.015); }

/* số sát thương bay lên */
.dmg-float { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); z-index: 5;
  font-weight: 900; font-size: 1.5rem; color: #fde047; text-shadow: 0 2px 10px #000, 0 0 14px rgba(245,158,11,.8);
  pointer-events: none; animation: dmgUp 1s ease-out forwards; }
.dmg-float.big { font-size: 2rem; color: #fff; text-shadow: 0 2px 12px #000, 0 0 22px #f59e0b; }
@keyframes dmgUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); } 20% { opacity: 1; transform: translate(-50%,-6px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%,-42px) scale(1); } }

/* huy hiệu liên trảm */
.combo-badge { position: absolute; top: 8px; right: 10px; z-index: 6; font-weight: 900; font-size: .82rem;
  color: #fff; background: linear-gradient(135deg, #ef4444, #b45309); padding: 5px 12px; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4); pointer-events: none; animation: comboPop .9s ease-out forwards; }
.combo-badge b { color: #fde047; }
@keyframes comboPop { 0% { opacity: 0; transform: scale(.4) rotate(-8deg); } 25% { opacity: 1; transform: scale(1.2) rotate(4deg); } 60% { transform: scale(1) rotate(0); } 100% { opacity: 0; transform: scale(1) translateY(-10px); } }

/* trùm sắp gục -> nổi điên */
.combatant.enemy.enrage .cbt-img { border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.5), 0 0 20px rgba(239,68,68,.6); animation: enrage 1s ease-in-out infinite; }
@keyframes enrage { 0%,100% { transform: translateX(0); box-shadow: 0 0 0 3px rgba(239,68,68,.5), 0 0 18px rgba(239,68,68,.5); } 50% { transform: translateX(-2px); box-shadow: 0 0 0 4px rgba(239,68,68,.7), 0 0 30px rgba(239,68,68,.85); } }
.combatant.enemy.enrage .cbt-name::after { content: " 😡"; }

/* chớp màn hình */
.screen-flash { position: absolute; inset: 0; z-index: 8; pointer-events: none; border-radius: 14px; }
.screen-flash.hurt { background: radial-gradient(circle, transparent 40%, rgba(220,38,38,.55)); animation: flashOut .45s ease-out forwards; }
.screen-flash.crit { background: radial-gradient(circle, rgba(253,224,71,.5), transparent 60%); animation: flashOut .45s ease-out forwards; }
@keyframes flashOut { 0% { opacity: 1; } 100% { opacity: 0; } }

/* cutscene: nhát chém thứ 2 + chớp trắng + tàn lửa bay */
.cut-slash.s2::before, .cut-slash.s2::after { transform: rotate(24deg); animation-delay: .18s; }
.cut-slash.s2::after { animation-delay: .3s; }
.cut-flash { position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; animation: cutFlash .5s ease-out .28s both; }
@keyframes cutFlash { 0% { opacity: 0; } 12% { opacity: .85; } 100% { opacity: 0; } }
.cut-embers { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.cut-embers::before, .cut-embers::after { content: ""; position: absolute; left: 0; right: 0; bottom: -20px; height: 140%;
  background-image:
    radial-gradient(2px 2px at 12% 90%, #fde047, transparent), radial-gradient(2px 2px at 28% 80%, #f59e0b, transparent),
    radial-gradient(3px 3px at 44% 95%, #fbbf24, transparent), radial-gradient(2px 2px at 62% 85%, #fde047, transparent),
    radial-gradient(2px 2px at 78% 92%, #f59e0b, transparent), radial-gradient(3px 3px at 90% 88%, #fbbf24, transparent),
    radial-gradient(2px 2px at 36% 70%, #fde047, transparent), radial-gradient(2px 2px at 70% 74%, #f59e0b, transparent);
  animation: emberRise 3s linear infinite; opacity: .85; }
.cut-embers::after { animation-duration: 4.4s; animation-delay: -1.6s; opacity: .6; }
@keyframes emberRise { 0% { transform: translateY(0); } 100% { transform: translateY(-45%); } }

/* ---- KHÓI BAY THÁI BÌNH (khi dẹp xong non sông) ---- */
.smoke-drift { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.smoke-drift::before, .smoke-drift::after { content: ""; position: absolute; left: -20%; right: -20%; bottom: -12%; height: 150%;
  background:
    radial-gradient(closest-side, rgba(235,235,235,.18), transparent 70%) 10% 62%/42% 55% no-repeat,
    radial-gradient(closest-side, rgba(220,220,220,.14), transparent 70%) 54% 42%/50% 60% no-repeat,
    radial-gradient(closest-side, rgba(210,210,210,.12), transparent 70%) 82% 72%/44% 52% no-repeat;
  filter: blur(7px); animation: smokeDrift 15s ease-in-out infinite; opacity: .9; }
.smoke-drift::after { animation-duration: 23s; animation-delay: -9s; opacity: .55; transform: scaleX(-1); }
@keyframes smokeDrift { 0% { transform: translate(-4%, 5%) scale(1); } 50% { transform: translate(4%, -3%) scale(1.1); } 100% { transform: translate(-4%, 5%) scale(1); } }
/* ánh vàng thái bình dịu phủ lên màn thắng */
.result.win.thaibinh { background: radial-gradient(120% 90% at 50% 0%, rgba(253,224,71,.14), transparent 60%); border-radius: 16px; }

/* "Ghi nhớ" — điểm nhấn kiến thức khắc sâu ngay lúc thắng */
.rs-remember { position: relative; z-index: 2; text-align: left; max-width: 460px; margin: 16px auto 0;
  background: #fff; border: 1px solid rgba(245,158,11,.35); border-left: 4px solid var(--gold);
  border-radius: 12px; padding: 12px 16px 12px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.rs-remember .rs-rem-h { font-weight: 900; color: var(--accent); font-size: .95rem; margin-bottom: 6px; }
.rs-remember ul { margin: 0; padding-left: 20px; }
.rs-remember li { font-size: .92rem; color: #3a2c1c; line-height: 1.6; margin-bottom: 5px; }
.rs-remember li:last-child { margin-bottom: 0; }

/* tàn lửa nhẹ trên cảnh kể chuyện (làm mọi mô phỏng — kể cả triều đại — hoành tráng hơn) */
.story-hero { position: relative; }
.story-hero .story-embers { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.story-hero .story-embers::before { content: ""; position: absolute; inset: 0; height: 160%; bottom: -30%;
  background-image:
    radial-gradient(2px 2px at 15% 90%, rgba(253,224,71,.8), transparent), radial-gradient(2px 2px at 40% 80%, rgba(245,158,11,.7), transparent),
    radial-gradient(2px 2px at 66% 92%, rgba(251,191,36,.7), transparent), radial-gradient(2px 2px at 85% 84%, rgba(253,224,71,.7), transparent);
  animation: emberRise 5s linear infinite; opacity: .6; }
