/* v2.1: mặc định giao diện "đêm xanh – vàng kim"; giao diện sáng "giấy" là tùy chọn */
:root, :root[data-theme="dark"] {
  --bg: #0a1520; --bg-2: #0d1b29; --surface: #102131; --surface-2: #17293b; --ink: #f2e8d5; --muted: #9db0c1; --line: #22394d;
  --accent: #d9b26a; --accent-2: #f0cf8e; --accent-ink: #1a1206; --gold: #d9b26a; --good: #6fcf97; --bad: #ef7d6e; --big: #f0cf8e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .35); --glow: 0 0 0 1px rgba(217, 178, 106, .25), 0 10px 40px rgba(217, 178, 106, .08);
  --r: 16px; --serif: 'Lora', Georgia, serif; --display: 'Playfair Display', 'Lora', Georgia, serif; --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4eee2; --bg-2: #efe6d4; --surface: #fffaf1; --surface-2: #efe6d6; --ink: #1d1a14; --muted: #6d6355; --line: #e2d6c2;
  --accent: #a87a22; --accent-2: #8a6215; --accent-ink: #fff; --gold: #a87a22; --good: #2c7a4b; --bad: #b3261e; --big: #8a5a12;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 24px rgba(60, 40, 10, .07); --glow: 0 0 0 1px rgba(168, 122, 34, .2), 0 10px 30px rgba(168, 122, 34, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(1200px 600px at 70% -10%, rgba(217, 178, 106, .08), transparent 60%), var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.screen { display: none; }
.screen.active { display: block; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.brand { display: flex; align-items: baseline; gap: 10px; font-family: var(--serif); font-size: 20px; font-weight: 600; cursor: pointer; }
.brand .seal { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-size: 15px; transform: translateY(5px); }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; transform: translateY(8px); box-shadow: 0 2px 8px rgba(143, 29, 23, .25); }
.top nav { display: flex; gap: 6px; align-items: center; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 14px 28px; font-size: 17px; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }

/* hero */
.hero { padding: 28px 0 8px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: clamp(40px, 8vw, 76px); letter-spacing: -.02em; margin: 6px 0 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 17px; max-width: 680px; margin: 0; }
.counters { display: flex; gap: 28px; flex-wrap: wrap; margin: 22px 0 6px; }
.counter b { display: block; font: 600 30px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.counter span { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.section { margin: 28px 0; }
.section > h2 { font-size: 24px; margin-bottom: 4px; }
.section > p.sub { margin: 0 0 14px; color: var(--muted); }

.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-left: 4px solid var(--gold); }

/* setup */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin-bottom: 18px; }
.tab { flex: 1; border: 0; background: transparent; padding: 10px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
select, input[type=text], textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
select:focus, input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.sub { font-size: 13px; padding: 6px 12px; }
.subchips { margin-top: 8px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.go-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.notice { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 12px; }

/* bars */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 56px; gap: 10px; align-items: center; font-size: 14px; }
.bar-row .track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.mem-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.mem { padding: 16px; cursor: pointer; }
.mem h3 { font-size: 18px; }
.mem .yrs { font-size: 13px; color: var(--muted); }
.mem p { font-size: 13.5px; margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* birth certificate */
.cert { max-width: 760px; margin: 18px auto 40px; overflow: hidden; }
.cert-head { display: flex; justify-content: space-between; align-items: center; background: var(--accent); color: var(--accent-ink); padding: 12px 20px; font-family: var(--serif); font-weight: 600; }
.cert-head small { font-family: var(--sans); font-weight: 400; opacity: .85; font-size: 12px; }
.cert-body { padding: 22px 22px 26px; }
.cert .name { font-size: clamp(32px, 6vw, 48px); margin: 4px 0 2px; }
.cert .native { color: var(--muted); font-size: 18px; margin-bottom: 10px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; margin: 18px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact .k { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fact .v { font-weight: 600; }
.dots { letter-spacing: 2px; color: var(--gold); }
.odds { background: var(--surface-2); padding: 12px 14px; border-radius: 10px; font-size: 14.5px; }
.cohort { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.cohort .c { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cohort .c b { display: block; }
.cohort .c span { font-size: 13px; color: var(--muted); }

/* life screen */
.lifebar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.lifebar .wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.agebox { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; }
.agebox .age { font: 600 28px/1 var(--serif); white-space: nowrap; }
.agebox .meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.speeds { display: flex; gap: 2px; background: var(--surface-2); border-radius: 9px; padding: 2px; }
.speeds button { border: 0; background: transparent; padding: 5px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); }
.speeds button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.toggle.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.yearprog { height: 3px; background: var(--surface-2); }
.yearprog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

.lifegrid { display: grid; grid-template-columns: 300px 1fr 300px; gap: 16px; padding-top: 16px; padding-bottom: 60px; align-items: start; }
.col { display: grid; gap: 14px; }
.panel { padding: 16px; }
.panel h3 { font-size: 13px; letter-spacing: .07em; text-transform: uppercase; font-family: var(--sans); color: var(--muted); margin-bottom: 10px; }
.idcard .nm { font: 600 22px/1.2 var(--serif); }
.idcard .nm small { display: block; font: 400 14px var(--sans); color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; font-size: 13.5px; margin-top: 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.mrz { font: 12px/1.35 ui-monospace, Consolas, monospace; color: var(--muted); margin-top: 12px; word-break: break-all; letter-spacing: .04em; }
.stat { margin-bottom: 9px; }
.stat .row { display: flex; justify-content: space-between; font-size: 13.5px; }
.stat .track { height: 7px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin-top: 3px; }
.stat .fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.money { font: 600 22px/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.fam li { margin: 3px 0; }
.fam { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.fam .dead { color: var(--muted); text-decoration: line-through; }

.focus .chips { gap: 6px; }
.focus .chip { font-size: 13.5px; }
.focus .desc { font-size: 13px; color: var(--muted); margin-top: 8px; }
.loglist { list-style: none; margin: 0; padding: 0; }
.loglist li { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; animation: fadein .35s ease; }
.loglist li .a { color: var(--muted); font-size: 12.5px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.loglist li.good .t { color: var(--good); }
.loglist li.bad .t { color: var(--bad); }
.loglist li.big .t { font-weight: 600; color: var(--big); }
.loglist li.death .t { font-weight: 700; }
.loglist li.decision .t { font-style: italic; }
.loglist li.refl .t { font-family: var(--serif); font-style: italic; color: var(--muted); }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.lifemap { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.lifemap i { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); position: relative; }
.lifemap i.lived { background: var(--accent); }
.lifemap i.exp { outline: 2px solid var(--gold); outline-offset: -1px; }
.lifemap i.now { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.cohort-live .c { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.cohort-live .c:last-child { border-bottom: 0; }
.cohort-live .c span { display: block; color: var(--muted); font-size: 12.5px; }
.cohort-live .c.gone b { text-decoration: line-through; color: var(--muted); }
.statlist { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.statlist dt { color: var(--muted); }
.statlist dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(15, 10, 5, .55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fadein .2s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; }
.modal h2 { font-size: 24px; margin-bottom: 8px; }
.modal .agep { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.opts { display: grid; gap: 8px; margin-top: 16px; }
.opt { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.opt:hover, .opt.picked { border-color: var(--accent); }
.opt.picked { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.opt b { display: block; }
.opt span { font-size: 13px; color: var(--muted); }
.autonote { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* end */
.end { max-width: 820px; margin: 20px auto 60px; }
.end .years { color: var(--muted); font-size: 16px; }
.end .epitaph { font-family: var(--serif); font-size: 18px; line-height: 1.7; margin: 16px 0; }
.end .lifemap { grid-template-columns: repeat(20, 1fr); }
.endstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.endstats .s { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.endstats .s b { display: block; font: 600 20px var(--serif); }
.endstats .s span { font-size: 12px; color: var(--muted); }
.refl-list blockquote { margin: 8px 0; padding: 8px 14px; border-left: 3px solid var(--gold); font-family: var(--serif); font-style: italic; }
.helpline { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }

/* v2: nhân cách, tài chính, hành động, khúc cuối */
.track.karma { position: relative; }
.track.karma .fill { position: absolute; top: 0; }
.track.karma::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--muted); opacity: .5; }
.statlist.fin dd.pos, .finev b.pos, .finsave.pos { color: var(--good); }
.finev b.neg, .finsave.neg { color: var(--bad); }
.finsave { font-weight: 700; margin-top: 8px; font-size: 14px; }
.finev { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12.5px; }
.finev li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.finev li span { color: var(--muted); }
.actgroup { margin-bottom: 10px; }
.actg { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.chip.act { font-size: 13px; padding: 6px 11px; }
.chip.act:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.chip.act.off { opacity: .4; cursor: not-allowed; }
.loglist li.money .t { color: var(--muted); font-size: 13px; }
.loglist li.quiet .t { color: var(--muted); font-style: italic; }
/* v2.3: đánh dấu ⭐ khoảnh khắc */
.loglist li { grid-template-columns: 54px 1fr 26px; }
.loglist li .star { background: none; border: 0; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: .35; transition: opacity .15s, transform .15s; align-self: start; }
.loglist li:hover .star, .loglist li .star:focus-visible { opacity: .9; }
.loglist li.starred .star { color: var(--accent); opacity: 1; }
.loglist li.starred { background: linear-gradient(90deg, rgba(217, 178, 106, .1), transparent 70%); }
.loglist li .star:active { transform: scale(1.3); }
@media (hover: none) { .loglist li .star { opacity: .6; } }
/* v2.3: nhạc nền, ảnh thẻ, đời nối tiếp */
.vol { width: 84px; accent-color: var(--accent); vertical-align: middle; }
.modal.cardmodal { width: min(520px, 100%); }
.cardprev { display: block; width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; margin: 8px 0 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.card.heir { margin-top: 22px; border: 1px solid var(--accent); background: linear-gradient(135deg, rgba(217, 178, 106, .1), transparent); }
@media (max-width: 640px) { .vol { display: none; } }
.modal.dark-tone { border-top: 4px solid var(--bad); }
/* v2.2: hai tầng lựa chọn */
.tier { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-bottom: 8px; }
.tier.major { background: var(--accent); color: #1a1408; }
.tier.minor { border: 1px solid var(--line, rgba(127,127,127,.35)); color: var(--muted); }
.modal.major { border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(217, 178, 106, .15), 0 20px 50px rgba(0, 0, 0, .35); }
.modal.major.dark-tone { border-top: 4px solid var(--bad); }
.modal.minor h2 { font-size: 21px; }
.tierwarn { font-size: 13px; color: var(--accent-2); margin: -2px 0 10px; }
/* v2.2: sổ tay nghề nghiệp */
.modal.jobs { width: min(760px, 100%); }
.jobcat details { border-top: 1px solid var(--line, rgba(127,127,127,.25)); padding: 8px 0; }
.jobcat summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.joblist { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 8px; }
.joblist li { padding: 8px 10px; border-radius: 10px; background: rgba(127, 127, 127, .08); }
.joblist .jt { font-size: 13.5px; line-height: 1.45; }
.joblist .jp { font-size: 13px; margin-top: 3px; color: var(--accent-2); }
[data-theme="light"] .joblist .jp, [data-theme="light"] .tierwarn { color: #8a5a10; }
.modal.finale { width: min(620px, 100%); padding: 28px; }
.modal.finale h2 { font-size: 28px; }
.finale-x { font-family: var(--serif); font-size: 17px; line-height: 1.75; }
.finale-list { padding-left: 18px; margin: 8px 0 0; font-family: var(--serif); line-height: 1.7; }
.finale-list li { margin: 6px 0; animation: fadein .6s ease both; }
.finale-list li:nth-child(2) { animation-delay: .5s; } .finale-list li:nth-child(3) { animation-delay: 1s; } .finale-list li:nth-child(4) { animation-delay: 1.5s; } .finale-list li:nth-child(5) { animation-delay: 2s; } .finale-list li:nth-child(6) { animation-delay: 2.5s; }
.fin-wrap { display: grid; gap: 10px; }
.fin-block { border-left: 3px solid var(--gold); padding: 4px 14px; }
.fin-block h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 16px; }
.fin-block p { margin: 0; font-family: var(--serif); line-height: 1.7; }
.fin-block ul { margin: 6px 0 0; padding-left: 18px; font-family: var(--serif); line-height: 1.65; }
blockquote.words { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--accent); font-family: var(--serif); font-style: italic; }
.mem.recent { display: flex; flex-direction: column; justify-content: space-between; }
.mem.recent > div[data-recent] { cursor: pointer; }
.mem-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ===================== v2.1: trang chủ mới ===================== */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-family: var(--display); letter-spacing: .04em; text-transform: uppercase; font-size: 21px; white-space: nowrap; flex-shrink: 0; }
.brand .logo { box-shadow: 0 0 0 1px rgba(217, 178, 106, .4), 0 4px 16px rgba(217, 178, 106, .2); }
.navpills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.pill:hover { border-color: var(--accent); }
.pill.gold { border-color: rgba(217, 178, 106, .55); color: var(--accent); background: transparent; }
.pill .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; box-shadow: 0 0 8px var(--accent); }
.herobox { position: relative; overflow: hidden; margin: 22px 0 10px; padding: 26px; border-radius: 26px; border: 1px solid var(--line); background: linear-gradient(160deg, var(--surface) 0%, var(--bg-2) 100%); box-shadow: var(--glow); }
.herobox .skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; opacity: .5; pointer-events: none; }
.herogrid { position: relative; display: grid; grid-template-columns: 1.25fr 1fr; gap: 26px; align-items: start; }
.tagline { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(217, 178, 106, .4); border-radius: 999px; padding: 7px 16px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.bigtitle { font-family: var(--display); font-size: clamp(46px, 7.4vw, 92px); line-height: .98; margin: 20px 0 16px; letter-spacing: -.02em; }
.bigtitle .goldtxt { background: linear-gradient(180deg, #f6deaa, #c99a4e 70%, #a77a35); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .bigtitle .goldtxt { background: linear-gradient(180deg, #c89a45, #8a5e14); -webkit-background-clip: text; background-clip: text; }
.statrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 22px 0; }
.stile { border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 10px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.stile b { display: block; font: 700 24px/1.1 var(--display); color: var(--accent-2); }
.stile span { font-size: 11.5px; color: var(--muted); }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.gold { background: linear-gradient(180deg, #f2d08f, #c99a4e); border-color: #c99a4e; color: #1a1206; font-weight: 700; box-shadow: 0 6px 24px rgba(217, 178, 106, .25); }
.btn.gold:hover { filter: brightness(1.06); }
.profile { border: 1px solid var(--line); border-radius: 20px; padding: 20px; background: color-mix(in srgb, var(--surface) 85%, transparent); }
.profile .eyebrow { color: var(--accent); letter-spacing: .14em; font-weight: 700; font-size: 11.5px; }
.profile h3 { font-size: 28px; margin: 4px 0 10px; }
.prow { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line); font-size: 13.5px; }
.prow span:first-child { color: var(--muted); text-transform: uppercase; font-size: 11.5px; letter-spacing: .08em; padding-top: 2px; }
.prow span:last-child { text-align: right; font-weight: 600; }
.ptags { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.ptag { border: 1px solid rgba(217, 178, 106, .4); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: var(--accent-2); }
.profile .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.feat { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: var(--surface); }
.feat .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 12px; font-size: 18px; }
.feat h3 { font-size: 19px; margin-bottom: 6px; }
.feat p { margin: 0; font-size: 13.5px; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.step { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface-2); }
.step .n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(180deg, #f2d08f, #c99a4e); color: #1a1206; font-weight: 800; font-size: 13px; margin-bottom: 10px; }
.step b { display: block; margin-bottom: 4px; }
.step span { font-size: 13.5px; color: var(--muted); }
.section > h2 { font-size: 30px; }

/* ===================== v2.1: quay số phận ===================== */
.roll { width: min(760px, 100%); padding: 24px; text-align: center; }
.roll h2 { font-size: 30px; margin-bottom: 4px; }
.reels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 10px; }
.reel { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); overflow: hidden; }
.reel .lab { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px 6px 4px; border-bottom: 1px solid var(--line); }
.reel .win { position: relative; height: 132px; overflow: hidden; -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.reel .win::after { content: ''; position: absolute; left: 6px; right: 6px; top: 44px; height: 44px; border: 1px solid rgba(217, 178, 106, .55); border-radius: 10px; pointer-events: none; }
.reel ul { list-style: none; margin: 0; padding: 0; will-change: transform; }
.reel li { height: 44px; display: grid; place-items: center; font-weight: 700; font-size: 15px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel.done li.final { color: var(--accent-2); text-shadow: 0 0 14px rgba(240, 207, 142, .55); }
.reel.done { box-shadow: 0 0 0 1px rgba(217, 178, 106, .5), 0 0 30px rgba(217, 178, 106, .15); }
.rollmsg { min-height: 26px; font-family: var(--display); font-size: 22px; color: var(--accent-2); }

/* ===================== v2.1: tranh pixel ===================== */
svg.px { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.scenecard { padding: 0; overflow: hidden; }
.scenecard svg.scene { border-bottom: 1px solid var(--line); }
.scenecard .cap { padding: 10px 16px 12px; font-size: 13.5px; color: var(--muted); }
.idhead { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.idhead svg.avatar { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); }
.cert .avatarbox { float: right; width: 96px; margin: 0 0 8px 12px; }
.cert .avatarbox svg { border-radius: 12px; border: 1px solid var(--line); }
.cert-head { background: linear-gradient(90deg, #c99a4e, #f2d08f 50%, #c99a4e); color: #1a1206; }

footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 13px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; animation: fadein .2s; }

@media (max-width: 1000px) {
  .lifegrid { grid-template-columns: 1fr 1fr; }
  .lifegrid .col.mid { grid-column: 1 / -1; order: -1; }
  .herogrid { grid-template-columns: 1fr; }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .grid2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .cohort { grid-template-columns: 1fr; }
  .lifegrid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 48px; }
  .endstats { grid-template-columns: repeat(2, 1fr); }
  .end .lifemap { grid-template-columns: repeat(10, 1fr); }
  .agebox .age { font-size: 22px; }
  .lifebar .wrap { gap: 6px; }
  .hide-sm { display: none !important; }
  .herogrid { grid-template-columns: 1fr; }
  .statrow { grid-template-columns: repeat(3, 1fr); }
  .features, .steps { grid-template-columns: 1fr; }
  .reels { grid-template-columns: repeat(2, 1fr); }
  .navpills .pill:not(.keep) { display: none; }
  .herobox { padding: 18px; border-radius: 20px; }
  .brand { font-size: 17px; }
  .top nav .btn { white-space: nowrap; }
  .counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .counter b { font-size: 22px; }
  .counter span { font-size: 11.5px; line-height: 1.35; display: block; }
  .hero p.lead { font-size: 15.5px; }
  .tab { padding: 9px 6px; }
}

/* v2.5: thu nhỏ hộp lựa chọn */
.decmin-row { display: flex; justify-content: center; margin-top: 12px; }
.decmin-row .btn { font-size: 13px; opacity: .85; }
.decpill { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 999px; border: 1px solid var(--accent); background: var(--surface); color: var(--ink); box-shadow: var(--shadow), var(--glow); cursor: pointer; font-size: 14px; text-align: left; }
.decpill b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.decpill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; animation: decpulse 1.4s ease-in-out infinite; }
.decpill .go { color: var(--accent); font-weight: 700; white-space: nowrap; }
@keyframes decpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .decpill .dot { animation: none; } }

/* v2.7: khung "Việc bạn muốn làm" gọn — hàng nhóm việc, mở từng nhóm */
.actgroups { gap: 6px; }
.actgroups .chip small { opacity: .6; margin-left: 2px; }
.actgroups .chip.off { opacity: .45; }
.actlist { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.actnote { margin: 8px 0 0; }
.chip.sm { padding: 5px 11px; font-size: 13px; }

/* v2.8: bảng chia tài sản ròng */
.statlist.wb { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.statlist.wb dd { text-align: right; color: var(--ink); }
.statlist.wb dd.neg { color: var(--bad); }
.statlist.wb dt[title] { cursor: help; text-decoration: underline dotted rgba(157, 176, 193, .5); text-underline-offset: 3px; }
.joblist li.sub { margin-left: 14px; border-left: 2px solid var(--line); padding-left: 10px; }
