:root{
  --bg:#140a22; --bg2:#1f0f2c;
  --panel:#24142f; --panel2:#2f1b3d; --panel3:#3a2249;
  --ink:#fbefd9; --ink-soft:#cbb08a;
  --gold:#f2b84b; --gold2:#ffd98a;
  --saffron:#ef7d1f; --saffron-dark:#c25a0c;
  --teal:#2fb3c2; --teal-dark:#1b8592;
  --red:#d9483b;
  --line:rgba(242,184,75,.28);
  --shadow:0 20px 50px rgba(0,0,0,.5);
  --radius:20px;
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:"Be Vietnam Pro", "Noto Sans Devanagari", system-ui, sans-serif; color:var(--ink);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(239,125,31,.25), transparent 60%),
    radial-gradient(700px 400px at 0% 20%, rgba(122,90,184,.18), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  min-height:100vh;
}
.wrap{ max-width:1080px; margin:0 auto; padding:14px 16px 40px; }
button{ font:inherit; }
kbd{ background:var(--panel3); border:1.5px solid var(--line); border-bottom-width:3px; border-radius:6px; padding:0 6px; font-weight:700; font-size:12.5px; color:var(--ink); }

/* ---------- Thanh trên ---------- */
.toolbar{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:10px; }
.brand{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-weight:900; font-size:clamp(19px,3.2vw,26px); display:flex; align-items:center; gap:10px; margin-right:auto; letter-spacing:.3px; }
.brand em{ font-style:normal; background:linear-gradient(180deg,var(--gold2),var(--saffron)); -webkit-background-clip:text; background-clip:text; color:transparent; }
.brand .flag{ width:34px; height:34px; border-radius:10px; display:grid; place-items:center; font-size:19px; background:linear-gradient(160deg,var(--saffron),var(--gold)); box-shadow:inset 0 -3px 0 rgba(0,0,0,.2), 0 0 18px rgba(239,125,31,.4); }
.chip{ display:inline-flex; align-items:center; gap:6px; background:var(--panel); border:1.5px solid var(--line); padding:7px 12px; border-radius:999px; font-weight:800; font-size:14px; }
.chip.coin{ color:var(--gold2); }
.chip.gold-next{ border-color:var(--gold); background:linear-gradient(180deg,#4a3410,#3a2a0c); color:var(--gold2); }
.chip.bump{ animation:bump .45s ease; }
@keyframes bump{ 35%{ transform:scale(1.22) rotate(-3deg); } }
.tbtn{ appearance:none; border:1.5px solid var(--line); background:var(--panel); color:var(--ink); font-weight:700; font-size:14px; padding:8px 13px; border-radius:999px; cursor:pointer; display:inline-flex; align-items:center; gap:6px; position:relative; transition:transform .08s, background .15s; }
.tbtn:hover{ background:var(--panel2); }
.tbtn:active{ transform:scale(.95); }
.tbtn.icon{ width:38px; height:38px; padding:0; justify-content:center; font-size:16px; }
.tbtn.sm{ padding:5px 11px; font-size:12.5px; }
.tbtn.off{ opacity:.45; }
.tbtn .dot{ position:absolute; top:3px; right:3px; width:9px; height:9px; border-radius:50%; background:var(--red); box-shadow:0 0 0 2px var(--panel); animation:pulse 1.2s ease infinite; }
.tbtn .dot[hidden]{ display:none; }
@keyframes pulse{ 50%{ transform:scale(1.35); } }
:focus-visible{ outline:3px solid var(--teal); outline-offset:2px; }

.film-strip{ display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap; margin-bottom:10px; padding:8px 14px; border-radius:14px; font-size:14px; color:var(--ink);
  background:linear-gradient(90deg, rgba(179,38,46,.35), rgba(239,125,31,.3), rgba(179,38,46,.35)); border:1px solid rgba(242,184,75,.35); }
.film-strip .big{ color:var(--gold2); font-size:17px; }

/* ---------- Sân khấu ---------- */
.stage{ position:relative; border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow), 0 0 0 1.5px var(--line); background:#0d1a2a; }
canvas#game{ display:block; width:100%; height:auto; aspect-ratio:960/600; touch-action:none; cursor:crosshair; }
.hud{ position:absolute; top:10px; left:10px; right:10px; display:flex; flex-wrap:wrap; gap:8px; align-items:flex-start; pointer-events:none; transition:opacity .3s; }
.hudbox{ pointer-events:auto; background:rgba(16,12,30,.62); color:#fdf6e7; border-radius:14px; padding:7px 12px; backdrop-filter:blur(4px); font-size:13.5px; font-weight:700; line-height:1.35; border:1px solid rgba(255,217,138,.15); }
.hudbox .small{ display:block; font-size:10.5px; font-weight:700; opacity:.75; letter-spacing:.5px; text-transform:uppercase; }
.hudbox.stones #hudStones{ font-size:17px; color:var(--gold2); }
.hudbox.stones.low{ background:rgba(150,30,30,.8); animation:pulse 1s ease infinite; }
.hudbtn{ appearance:none; cursor:pointer; font-size:12px; letter-spacing:-1px; width:42px; height:42px; display:grid; place-items:center; padding:0; }
.hud .spacer{ flex:1; }
.windbox{ display:flex; align-items:center; gap:9px; }
.wind-arrow{ transition:transform .3s; display:inline-block; }
.wind-bars{ display:flex; gap:2.5px; align-items:flex-end; height:16px; }
.wind-bars i{ width:5px; border-radius:2px; background:rgba(255,255,255,.28); display:block; }
.wind-bars i.on{ background:#ffd166; }
.wind-bars i:nth-child(1){ height:5px; } .wind-bars i:nth-child(2){ height:8px; } .wind-bars i:nth-child(3){ height:11px; } .wind-bars i:nth-child(4){ height:14px; } .wind-bars i:nth-child(5){ height:16px; }
.windbox.gust{ background:rgba(150,40,20,.85); animation:gustPulse .28s ease infinite alternate; }
@keyframes gustPulse{ to{ transform:scale(1.06); } }
.hudbox.combo{ background:rgba(146,52,10,.8); }
.hudbox.combo .cv{ color:#ffd166; font-size:16px; font-weight:800; }
.hudbox[hidden]{ display:none; }
.progress-wrap{ position:absolute; left:0; right:0; bottom:0; height:7px; background:rgba(10,25,38,.4); }
.progress-fill{ height:100%; width:0%; background:linear-gradient(90deg, var(--gold), var(--saffron)); transition:width .4s; }

.power-bar{ position:absolute; left:10px; bottom:16px; display:flex; gap:6px; transition:opacity .3s; }
.pw{ appearance:none; position:relative; width:46px; height:46px; border-radius:14px; cursor:pointer; padding:0; border:1.5px solid rgba(255,217,138,.35); background:rgba(16,12,30,.7); color:#fff; backdrop-filter:blur(4px); display:grid; place-items:center; transition:transform .1s, border-color .15s; }
.pw:hover:not(:disabled){ transform:translateY(-2px); border-color:var(--gold); }
.pw:disabled{ opacity:.45; cursor:not-allowed; }
.pw .pi{ font-size:21px; line-height:1; }
.pw .cnt{ position:absolute; right:-5px; bottom:-5px; min-width:19px; height:19px; padding:0 4px; border-radius:10px; background:var(--saffron); color:#1d1206; font-size:11px; font-weight:800; display:grid; place-items:center; }
.pw .act:empty{ display:none; }
.pw .act{ position:absolute; left:-5px; top:-5px; min-width:18px; height:18px; border-radius:9px; background:var(--teal); color:#04222a; font-size:11px; font-weight:800; display:grid; place-items:center; }
.pw.active{ border-color:var(--teal); box-shadow:0 0 14px rgba(47,179,194,.7); opacity:1; }
.pw.ad{ width:auto; padding:0 10px; display:flex; gap:4px; border-color:rgba(47,179,194,.6); }
.pw.ad .lbl{ font-weight:800; font-size:13px; color:#9be8ff; }
.pw.ad.used{ display:none; }
.stage.in-menu .hud, .stage.in-menu .power-bar{ opacity:0; pointer-events:none; }
.stage.in-menu .hud *{ pointer-events:none; }

/* ---------- Lớp phủ ---------- */
.overlay{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:14px; background:rgba(10,6,20,.55); z-index:5; animation:fadeIn .25s ease; }
.overlay[hidden]{ display:none; }
.overlay.top{ z-index:8; background:rgba(10,6,20,.7); }
.overlay.menu{ background:linear-gradient(180deg, rgba(20,10,34,.35), rgba(20,10,34,.82)); align-items:stretch; }
@keyframes fadeIn{ from{ opacity:0; } }
.card{
  background:radial-gradient(500px 220px at 50% -40px, rgba(239,125,31,.18), transparent 70%), var(--panel);
  color:var(--ink); border-radius:22px; border:1.5px solid var(--line);
  box-shadow:var(--shadow), inset 0 0 0 4px rgba(242,184,75,.06);
  max-width:520px; width:100%; padding:24px 24px 20px; text-align:center; max-height:100%; overflow:auto;
  animation:cardIn .38s cubic-bezier(.2,1.4,.4,1) both; position:relative;
}
.card.wide{ max-width:820px; padding:18px 20px 16px; display:flex; flex-direction:column; }
.card.narrow{ max-width:380px; }
@keyframes cardIn{ from{ transform:translateY(14px) scale(.94); opacity:0; } }
.card h3{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-weight:900; margin:0 0 8px; font-size:clamp(24px,4vw,32px); line-height:1.15; color:var(--gold2); }
.card p{ margin:0 0 12px; color:var(--ink-soft); font-size:15px; line-height:1.55; }
.card p b{ color:var(--ink); }
.mini{ font-size:12.5px !important; color:var(--ink-soft); margin:8px 0 0 !important; }
.btn{
  appearance:none; border:none; cursor:pointer; font-weight:800; font-size:15.5px; padding:12px 24px; border-radius:999px;
  background:linear-gradient(180deg, #f6942f, var(--saffron-dark)); color:#1d1206;
  box-shadow:0 5px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.35);
  transition:transform .08s, filter .15s; display:inline-flex; align-items:center; gap:8px; justify-content:center; position:relative; overflow:hidden;
}
.btn::after{ content:""; position:absolute; top:0; bottom:0; width:36%; left:-60%; background:linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent); transform:skewX(-18deg); transition:left .45s; pointer-events:none; }
.btn:hover::after{ left:130%; }
.btn:hover{ filter:brightness(1.08); }
.btn:active{ transform:translateY(3px); box-shadow:0 2px 0 rgba(0,0,0,.35); }
.btn:disabled{ opacity:.45; cursor:not-allowed; filter:none; }
.btn.teal{ background:linear-gradient(180deg, var(--teal), var(--teal-dark)); color:#04222a; }
.btn.ghost{ background:transparent; color:var(--ink); border:2px solid var(--line); box-shadow:none; }
.btn.ghost:hover{ background:var(--panel2); }
.btn.ghost.off{ opacity:.55; }
.btn.danger{ color:#ff9a8a; border-color:rgba(217,72,59,.5); }
.btn.sm{ padding:7px 14px; font-size:13px; box-shadow:0 3px 0 rgba(0,0,0,.3); }
.btn.big{ font-size:18px; padding:14px 34px; }
.btn[hidden]{ display:none; }
.btn-row{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-top:8px; }
.btn-row.col{ flex-direction:column; align-items:stretch; }
.stars{ font-size:42px; letter-spacing:6px; margin:2px 0 8px; line-height:1; }
.stars[hidden]{ display:none; }
.stars .st{ color:#4a3a52; display:inline-block; }
.stars .st.lit{ color:var(--gold); text-shadow:0 2px 14px rgba(242,184,75,.7); animation:pop .45s ease both; }
.stars .st.lit:nth-child(2){ animation-delay:.15s; } .stars .st.lit:nth-child(3){ animation-delay:.3s; }
@keyframes pop{ 0%{ transform:scale(.3) rotate(-18deg); opacity:0; } 70%{ transform:scale(1.25); } }

/* ---------- Menu chính ---------- */
.hero{ text-align:center; margin-bottom:8px; }
.hero-kicker{ font-size:11.5px; font-weight:800; letter-spacing:3px; text-transform:uppercase; color:var(--saffron); }
.logo{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-weight:900; font-size:clamp(40px,8vw,64px); line-height:1; margin:2px 0 6px; letter-spacing:1px;
  background:linear-gradient(180deg,#fff3cf 10%, var(--gold) 55%, var(--saffron-dark)); -webkit-background-clip:text; background-clip:text; color:transparent;
  filter:drop-shadow(0 3px 0 rgba(0,0,0,.35)) drop-shadow(0 0 18px rgba(239,125,31,.35)); }
.hero-sub{ margin:0 auto 8px !important; max-width:560px; font-size:14px !important; }
.hero-film{ display:inline-block; font-size:13px; padding:5px 14px; border-radius:999px; background:rgba(179,38,46,.35); border:1px solid rgba(242,184,75,.35); }
.hero-film .big{ color:var(--gold2); }
.tabs{ display:flex; gap:4px; overflow-x:auto; border-bottom:1.5px solid var(--line); margin:10px -4px 0; padding:0 4px; scrollbar-width:none; }
.tab{ appearance:none; border:none; background:transparent; color:var(--ink-soft); font-weight:800; font-size:14px; padding:9px 13px; cursor:pointer; border-radius:12px 12px 0 0; white-space:nowrap; position:relative; }
.tab:hover{ color:var(--ink); background:var(--panel2); }
.tab.on{ color:var(--gold2); background:var(--panel2); }
.tab.on::after{ content:""; position:absolute; left:10px; right:10px; bottom:-1.5px; height:3px; border-radius:3px; background:var(--saffron); }
.tab-body{ flex:1; overflow:auto; padding:12px 2px 2px; text-align:left; min-height:0; }
.story-head{ text-align:center; margin-bottom:8px; }
.diff-row{ display:flex; gap:8px; justify-content:center; margin:12px 0 2px; flex-wrap:wrap; }
.diff-btn{ appearance:none; cursor:pointer; font-weight:800; font-size:13.5px; padding:7px 16px; border-radius:999px; border:2px solid var(--line); background:var(--panel2); color:var(--ink-soft); transition:all .15s; }
.diff-btn:hover{ border-color:var(--saffron); color:var(--ink); }
.diff-btn.on{ background:linear-gradient(180deg, #f6942f, var(--saffron-dark)); color:#1d1206; border-color:transparent; }
.chapter{ margin-top:14px; }
.ch-title{ display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 10px; margin-bottom:6px; }
.ch-title b{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-size:18px; color:var(--gold2); }
.ch-title span{ font-size:12.5px; color:var(--ink-soft); }
.lvl-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.lvl{ appearance:none; cursor:pointer; text-align:left; background:var(--panel2); border:1.5px solid var(--line); border-radius:14px; padding:9px 10px 9px 14px; color:var(--ink); position:relative; overflow:hidden; transition:transform .1s, border-color .15s, box-shadow .15s; }
.lvl:hover:not(:disabled){ transform:translateY(-2px); border-color:var(--saffron); box-shadow:0 6px 16px rgba(0,0,0,.3); }
.lvl:disabled{ opacity:.42; cursor:not-allowed; }
.lvl.cur{ border-color:var(--gold); box-shadow:0 0 0 2px rgba(242,184,75,.3), 0 0 18px rgba(242,184,75,.25); }
.lvl.boss{ background:linear-gradient(160deg, #4a1424, var(--panel2)); }
.lvl .bar{ position:absolute; left:0; top:0; bottom:0; width:5px; }
.lvl .n{ font-weight:800; font-size:13.5px; display:block; }
.lvl .s{ font-size:12px; color:var(--ink-soft); display:block; margin-top:1px; line-height:1.3; }
.lvl .meta{ font-size:11px; color:var(--ink-soft); display:block; margin-top:3px; opacity:.85; }
.lvl .st{ color:var(--gold); font-size:13px; letter-spacing:2px; }
.mode-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.mode-card{ border-radius:18px; padding:16px; border:1.5px solid var(--line); text-align:center; display:flex; flex-direction:column; align-items:center; }
.mode-card.endless{ background:linear-gradient(160deg, rgba(47,131,173,.35), var(--panel2)); }
.mode-card.daily{ background:linear-gradient(160deg, rgba(239,125,31,.3), var(--panel2)); }
.mode-card h4{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-size:21px; margin:4px 0 6px; color:var(--gold2); }
.mode-card p{ font-size:13.5px; margin:0 0 6px; }
.mode-card .btn{ margin-top:auto; }
.mode-card .mini{ margin:0 0 10px !important; }
.mc-ico{ font-size:36px; }
h4.sec{ margin:6px 0 8px; font-size:15px; color:var(--gold2); }
h4.sec small{ font-weight:600; color:var(--ink-soft); font-size:12px; margin-left:6px; }
.shop-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px; margin-bottom:12px; }
.shop-item{ background:var(--panel2); border:1.5px solid var(--line); border-radius:14px; padding:10px; display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center; }
.shop-item.eq{ border-color:var(--teal); }
.shop-item b{ font-size:13.5px; }
.shop-item small{ font-size:11.5px; color:var(--ink-soft); line-height:1.35; }
.shop-item .own{ font-size:11.5px; color:var(--gold2); }
.shop-item .btn{ margin-top:auto; }
.si-ico{ font-size:28px; }
.swatch{ width:42px; height:42px; border-radius:12px; border:2px solid rgba(255,255,255,.25); }
.swatch.stone{ display:grid; place-items:center; font-family:"Noto Sans Devanagari", sans-serif; font-weight:700; font-size:13px; color:rgba(30,20,10,.55); }
.card-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(118px,1fr)); gap:8px; margin-top:8px; }
.ccard{ appearance:none; cursor:pointer; border-radius:14px; padding:12px 8px; color:var(--ink); border:1.5px solid color-mix(in srgb, var(--cc) 70%, white 10%);
  background:linear-gradient(170deg, color-mix(in srgb, var(--cc) 55%, transparent), var(--panel2) 70%); display:flex; flex-direction:column; align-items:center; gap:3px; transition:transform .12s; }
.ccard:hover:not(:disabled){ transform:translateY(-3px) rotate(-1deg); }
.ccard.locked{ filter:grayscale(1); opacity:.5; cursor:not-allowed; }
.ccard .cc-ico{ font-size:34px; }
.ccard b{ font-size:13px; }
.ccard small{ font-size:11px; color:var(--ink-soft); text-align:center; line-height:1.3; }
.ach-list{ display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.ach{ display:flex; align-items:center; gap:10px; background:var(--panel2); border:1.5px solid var(--line); border-radius:12px; padding:8px 12px; opacity:.7; }
.ach.done{ opacity:1; border-color:rgba(242,184,75,.6); background:linear-gradient(90deg, rgba(242,184,75,.15), var(--panel2)); }
.ach .ai{ font-size:22px; }
.ach .at{ flex:1; display:flex; flex-direction:column; }
.ach .at b{ font-size:14px; } .ach .at small{ font-size:12px; color:var(--ink-soft); }
.ach .ar{ font-weight:800; font-size:13px; color:var(--gold2); white-space:nowrap; }

/* ---------- Hội thoại ---------- */
.overlay.story{ align-items:flex-end; background:linear-gradient(180deg, transparent 30%, rgba(10,6,20,.75)); cursor:pointer; }
.story-box{ width:100%; max-width:760px; display:flex; gap:14px; align-items:flex-start; background:rgba(28,16,40,.94); border:1.5px solid var(--line); border-radius:20px; padding:14px 16px; box-shadow:var(--shadow); animation:cardIn .35s ease both; cursor:default; }
.story-box.villain{ flex-direction:row-reverse; border-color:rgba(217,72,59,.6); background:rgba(42,12,22,.95); }
.portrait{ flex:0 0 auto; width:68px; height:68px; border-radius:18px; display:grid; place-items:center; font-size:38px; box-shadow:inset 0 -4px 0 rgba(0,0,0,.25), 0 0 0 3px rgba(242,184,75,.4); }
.story-main{ flex:1; min-width:0; }
.story-name{ display:flex; justify-content:space-between; align-items:baseline; }
.story-name b{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-size:19px; color:var(--gold2); }
.story-name small{ color:var(--ink-soft); font-size:12px; }
#storyText{ margin:4px 0 8px; font-size:15.5px; line-height:1.55; color:var(--ink); min-height:48px; }
.story-actions{ display:flex; justify-content:flex-end; gap:8px; }

/* ---------- Thắng / thẻ ---------- */
.new-card{ appearance:none; cursor:pointer; display:flex; align-items:center; gap:10px; margin:4px auto 10px; padding:10px 16px; border-radius:16px; color:var(--ink);
  border:1.5px solid var(--cc); background:linear-gradient(120deg, color-mix(in srgb, var(--cc) 50%, transparent), var(--panel2)); animation:pop .5s .4s ease both; text-align:left; }
.new-card span{ font-size:32px; }
.new-card b{ display:block; } .new-card small{ color:var(--ink-soft); font-size:12px; }
.char-card #cardBody{ border-radius:16px; padding:14px; margin-bottom:6px; background:linear-gradient(170deg, color-mix(in srgb, var(--cc) 45%, transparent), transparent 75%); }
.char-card .big-ico{ font-size:64px; line-height:1.1; }
.char-card .role{ color:var(--gold2) !important; font-weight:700; font-size:13.5px !important; margin-bottom:8px !important; }
.daily-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin:8px 0; }
.dday{ background:var(--panel2); border:1.5px solid var(--line); border-radius:12px; padding:8px 2px; display:flex; flex-direction:column; align-items:center; gap:2px; font-size:12px; }
.dday small{ font-size:10.5px; color:var(--ink-soft); }
.dday b{ font-size:12.5px; color:var(--gold2); white-space:nowrap; }
.dday.got{ opacity:.45; }
.dday.got::after{ content:"✓"; color:var(--teal); font-weight:800; }
.dday.today{ border-color:var(--saffron); box-shadow:0 0 16px rgba(239,125,31,.5); transform:scale(1.06); }

/* ---------- Quảng cáo ---------- */
.ad-tag{ display:inline-block; font-size:10.5px; font-weight:800; letter-spacing:1.2px; text-transform:uppercase; background:#0f0a18; color:var(--gold2); padding:3px 9px; border-radius:6px; margin-bottom:10px; }
.ad-creative{ border-radius:16px; padding:20px 18px; margin-bottom:14px; color:#fff; background:linear-gradient(135deg,#0e7c86, #14666e 45%, #e07b24 130%); text-align:left; }
.ad-brand{ font-weight:800; letter-spacing:1px; font-size:12px; opacity:.85; text-transform:uppercase; color:#ffe9bd; }
.ad-creative .headline{ font-family:"Playfair Display",serif; font-weight:800; font-size:22px; line-height:1.2; margin:6px 0; }
.ad-creative .desc{ font-size:13px; opacity:.92; margin:0; color:#eafcff; }
.ad-count{ font-weight:700; color:var(--ink-soft); font-size:14px; margin-bottom:10px; }
.ad-progress{ height:8px; background:var(--panel2); border-radius:99px; overflow:hidden; margin-bottom:12px; }
.ad-progress i{ display:block; height:100%; width:0%; background:linear-gradient(90deg, var(--gold), var(--saffron)); }
.banner-slot{ margin-top:12px; border:2px dashed var(--line); border-radius:14px; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; gap:10px; padding:12px 14px; font-size:13px; font-weight:600; }
.banner-slot .ad-tag{ margin:0; }

/* ---------- Toast ---------- */
.toasts{ position:fixed; top:14px; left:50%; transform:translateX(-50%); z-index:100; display:flex; flex-direction:column; gap:8px; width:min(92vw,380px); pointer-events:none; }
.toast{ display:flex; gap:10px; align-items:center; background:rgba(36,20,47,.97); border:1.5px solid var(--gold); border-radius:14px; padding:10px 14px; box-shadow:var(--shadow); animation:toastIn .4s cubic-bezier(.2,1.4,.4,1) both; transition:opacity .4s, transform .4s; }
.toast.out{ opacity:0; transform:translateY(-10px); }
.toast .ti{ font-size:26px; }
.toast b{ display:block; font-size:14px; } .toast small{ display:block; font-size:12px; color:var(--ink-soft); }
@keyframes toastIn{ from{ transform:translateY(-20px) scale(.9); opacity:0; } }

/* ---------- Thông tin ---------- */
.cols{ display:grid; grid-template-columns:1.15fr 1fr 1fr; gap:14px; margin-top:20px; }
.panel{ background:var(--panel); border:1.5px solid var(--line); border-radius:var(--radius); padding:18px 20px; }
.panel.film{ background:linear-gradient(160deg, rgba(179,38,46,.3), var(--panel) 70%); }
.panel h2{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-weight:800; font-size:20px; margin:0 0 10px; color:var(--gold2); }
.panel p{ margin:0 0 10px; font-size:14px; line-height:1.65; color:var(--ink-soft); }
.panel p b, .panel li b{ color:var(--ink); }
.panel ul{ margin:0; padding:0; list-style:none; }
.panel li{ font-size:14px; line-height:1.55; color:var(--ink-soft); padding:6px 0 6px 22px; position:relative; border-bottom:1px dashed var(--line); }
.panel li:last-child{ border-bottom:none; }
.panel li::before{ content:""; position:absolute; left:2px; top:13px; width:8px; height:8px; border-radius:2px; background:var(--saffron); transform:rotate(45deg); }
footer{ margin-top:20px; text-align:center; color:var(--ink-soft); font-size:13px; }

/* ---------- Responsive ---------- */
@media (max-width:860px){
  .cols{ grid-template-columns:1fr; }
  .lvl-grid{ grid-template-columns:repeat(3,1fr); }
}
@media (max-width:680px){
  .wrap{ padding:10px 10px 30px; }
  .brand > span:last-child{ font-size:18px; }
  .chip#nextChip{ display:none; }
  .overlay{ position:fixed; inset:0; z-index:60; padding:10px; overflow-y:auto; background:rgba(10,6,20,.78); }
  .overlay.top{ z-index:70; }
  .overlay.menu{ background:var(--bg); align-items:flex-start; }
  .overlay.story{ position:absolute; z-index:5; padding:8px; overflow:visible; background:linear-gradient(180deg, transparent 10%, rgba(10,6,20,.7)); }
  .card{ margin:auto; padding:18px 16px 14px; max-height:none; }
  .card.wide{ padding:14px 12px; }
  .lvl-grid{ grid-template-columns:repeat(2,1fr); }
  .mode-grid{ grid-template-columns:1fr; }
  .daily-grid{ grid-template-columns:repeat(4,1fr); }
  .hudbox{ padding:5px 8px; font-size:12px; border-radius:10px; }
  .hud{ top:6px; left:6px; right:6px; gap:5px; }
  .hudbtn{ width:34px; height:34px; }
  .wind-bars{ display:none; }
  .power-bar{ left:6px; bottom:12px; gap:4px; }
  .pw{ width:36px; height:36px; border-radius:10px; }
  .pw .pi{ font-size:16px; }
  .story-box{ padding:10px; gap:10px; border-radius:14px; }
  .portrait{ width:48px; height:48px; font-size:26px; border-radius:12px; }
  #storyText{ font-size:13.5px; min-height:0; }
  .story-name b{ font-size:16px; }
}
@media (max-width:420px){
  .hudbox:first-child{ display:none; }
}
@media (prefers-reduced-motion: reduce){
  *, .card, .overlay, .stars .st.lit{ animation:none !important; transition:none !important; }
}

/* ---------- Ngôn ngữ, PWA, ảnh minh họa ---------- */
[hidden]{ display:none !important; }
.lang-sel{ appearance:none; cursor:pointer; background:var(--panel); color:var(--ink); border:1.5px solid var(--line); border-radius:999px; font-weight:800; font-size:13px; padding:8px 12px; }
.lang-sel.short{ height:38px; padding:0 12px; }
.lang-sel option{ background:var(--panel); color:var(--ink); }
.lang-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:6px 4px; font-weight:700; }
.lang-row .lang-sel{ flex:1; max-width:200px; }
.portrait img, .cc-ico img, .big-ico img, .new-card span img{ width:100%; height:100%; object-fit:cover; border-radius:inherit; display:block; }
.cc-ico:has(img){ width:64px; height:64px; border-radius:14px; overflow:hidden; }
.big-ico:has(img){ width:140px; height:140px; margin:0 auto 6px; border-radius:20px; overflow:hidden; }
.new-card span:has(img){ width:48px; height:48px; border-radius:12px; overflow:hidden; }
.portrait{ overflow:hidden; }
html[lang=hi] .logo{ letter-spacing:0; line-height:1.25; }
html[lang=hi] .hero-kicker{ letter-spacing:1px; }
/* Chân dung minh họa: khung lớn hơn emoji */
.portrait:has(img){ width:88px; height:88px; background:radial-gradient(circle at 50% 35%, rgba(255,255,255,.18), transparent 70%), var(--panel3) !important; }
.cc-ico:has(img){ width:84px; height:84px; }
.big-ico:has(img){ width:180px; height:180px; }
@media (max-width:680px){ .portrait:has(img){ width:60px; height:60px; } .cc-ico:has(img){ width:68px; height:68px; } }
.skin-thumb{ height:72px; width:auto; max-width:100%; object-fit:contain; filter:drop-shadow(0 3px 4px rgba(0,0,0,.35)); }

/* =================== Hiệu ứng sinh động =================== */
/* --- Bản đồ màn dạng cầu nối --- */
.chapter{ position:relative; margin-top:14px; padding:10px 10px 12px; border-radius:18px; overflow:hidden;
  background:linear-gradient(160deg, color-mix(in srgb, var(--c1) 30%, transparent), color-mix(in srgb, var(--c2) 35%, transparent) 70%, transparent);
  border:1px solid rgba(255,217,138,.15); }
.map-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:4px; margin-top:4px; }
.node-wrap{ position:relative; display:flex; flex-direction:column; align-items:center; text-align:center; padding-top:40px; min-width:0; }
.node-wrap:not(:last-child)::after{
  content:""; position:absolute; top:66px; left:calc(50% + 28px); width:calc(100% - 52px); height:9px; border-radius:3px; z-index:0;
  background:repeating-linear-gradient(90deg, rgba(160,165,175,.35) 0 11px, rgba(110,115,125,.35) 11px 13px);
  border:1px dashed rgba(255,255,255,.18);
}
.node-wrap.done:not(:last-child)::after{
  background:repeating-linear-gradient(90deg, #b48a52 0 11px, #7d6647 11px 13px); border:none;
  box-shadow:0 2px 0 rgba(0,0,0,.35), 0 0 10px rgba(242,184,75,.35);
}
.node{ position:relative; z-index:1; appearance:none; cursor:pointer; width:54px; height:54px; border-radius:50%;
  font-weight:900; font-size:19px; color:#fff; text-shadow:0 2px 0 rgba(0,0,0,.4);
  border:3px solid rgba(255,255,255,.35);
  background:radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), transparent 45%), var(--nc);
  box-shadow:0 5px 0 rgba(0,0,0,.35), inset 0 -5px 0 rgba(0,0,0,.18);
  transition:transform .12s; }
.node:hover:not(:disabled){ transform:translateY(-3px) scale(1.06); }
.node:active:not(:disabled){ transform:translateY(2px); box-shadow:0 2px 0 rgba(0,0,0,.35); }
.node-wrap.done .node{ border-color:var(--gold); }
.node-wrap.cur .node{ border-color:#fff; animation:nodePulse 1.6s ease-in-out infinite; }
.node-wrap.boss .node{ width:62px; height:62px; margin-top:-4px; background:radial-gradient(circle at 35% 30%, rgba(255,180,120,.6), transparent 45%), #8f1f2a; border-color:#ff9a6a; }
.node-wrap.locked .node{ background:#3a3044; color:#9a8fa6; text-shadow:none; cursor:not-allowed; font-size:16px; }
.node-wrap.locked .node-name, .node-wrap.locked .node-meta, .node-wrap.locked .st{ opacity:.45; }
@keyframes nodePulse{ 0%,100%{ box-shadow:0 5px 0 rgba(0,0,0,.35), 0 0 0 0 rgba(242,184,75,.6); } 50%{ box-shadow:0 5px 0 rgba(0,0,0,.35), 0 0 0 10px rgba(242,184,75,0); } }
.node-hero{ position:absolute; top:-2px; left:50%; height:44px; width:auto; transform:translateX(-50%); z-index:2; font-size:28px; line-height:44px;
  filter:drop-shadow(0 3px 3px rgba(0,0,0,.45)); animation:heroBob 1.1s ease-in-out infinite; }
@keyframes heroBob{ 50%{ transform:translate(-50%,-5px); } }
.node-name{ margin-top:7px; font-size:12px; font-weight:800; line-height:1.25; color:var(--ink);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.node-meta{ font-size:10.5px; color:var(--ink-soft); margin-top:2px; }
.node-wrap .st{ color:var(--gold); font-size:12px; letter-spacing:1px; }

/* --- Xuất hiện lần lượt --- */
.rise{ animation:rise .42s cubic-bezier(.2,1.3,.4,1) both; animation-delay:calc(var(--i) * 32ms); }
@keyframes rise{ from{ opacity:0; transform:translateY(12px) scale(.94); } }

/* --- Xu bay về ví --- */
.fly-coin{ position:fixed; z-index:120; pointer-events:none; font-size:20px; line-height:1; filter:drop-shadow(0 2px 3px rgba(0,0,0,.4)); will-change:transform; }

/* --- Sao nổ --- */
.stars .st{ position:relative; }
.burst{ position:absolute; left:50%; top:50%; width:6px; height:6px; margin:-3px 0 0 -3px; border-radius:50%;
  background:#ffd166; box-shadow:0 0 8px 2px rgba(255,209,102,.8); pointer-events:none; animation:burst .7s ease-out forwards; }
@keyframes burst{ to{ transform:translate(var(--x), var(--y)) scale(.2); opacity:0; } }

/* --- Chuyển cảnh --- */
.wipe{ position:fixed; inset:0; z-index:110; display:grid; place-items:center; pointer-events:none;
  background:radial-gradient(circle at 50% 50%, #3a1d4f, #140a22 70%); clip-path:circle(0% at 50% 50%); }
.wipe span{ font-family:"Playfair Display", "Noto Sans Devanagari", serif; font-weight:900; font-size:clamp(22px,5vw,40px); text-align:center; padding:0 20px;
  background:linear-gradient(180deg,#fff3cf, var(--gold) 60%, var(--saffron)); -webkit-background-clip:text; background-clip:text; color:transparent;
  filter:drop-shadow(0 0 18px rgba(239,125,31,.5)); }

/* --- Menu: hạt lửa, logo lấp lánh, nút chính phát sáng --- */
.menu-fx{ position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:0; }
.menu-fx i{ position:absolute; bottom:-12px; width:var(--s); height:var(--s); border-radius:50%; background:#ffb347;
  box-shadow:0 0 10px 3px rgba(255,150,60,.55); opacity:0; animation:ember linear infinite; }
@keyframes ember{ 0%{ transform:translate(0,0); opacity:0; } 12%{ opacity:.95; } 80%{ opacity:.6; } 100%{ transform:translate(var(--dx), -105vh); opacity:0; } }
.overlay.menu .card{ position:relative; z-index:1; }
.logo{ background-size:100% 220%; animation:logoShine 4.5s ease-in-out infinite; }
@keyframes logoShine{ 0%,100%{ background-position:0 0; } 50%{ background-position:0 100%; } }
.story-head .btn.big{ animation:ctaGlow 2.2s ease-in-out infinite; }
@keyframes ctaGlow{ 0%,100%{ box-shadow:0 5px 0 rgba(0,0,0,.35), 0 0 0 0 rgba(239,125,31,.55); } 50%{ box-shadow:0 5px 0 rgba(0,0,0,.35), 0 0 0 12px rgba(239,125,31,0); } }
.hero-film{ animation:filmGlow 3s ease-in-out infinite; }
@keyframes filmGlow{ 50%{ box-shadow:0 0 18px rgba(217,72,59,.55); } }
.toolbar .tbtn, .pw{ transition:transform .12s, background .15s, border-color .15s; }
.pw:not(:disabled):active{ transform:scale(.9); }

@media (max-width:680px){
  .node{ width:46px; height:46px; font-size:16px; }
  .node-wrap{ padding-top:36px; }
  .node-wrap:not(:last-child)::after{ top:58px; left:calc(50% + 24px); width:calc(100% - 44px); }
  .node-wrap.boss .node{ width:52px; height:52px; }
  .node-hero{ height:38px; }
  .node-name{ font-size:11px; }
  .node-meta{ display:none; }
}
@media (prefers-reduced-motion: reduce){ .menu-fx{ display:none; } }

/* =================== Đồ họa minh họa =================== */
.ico{ width:1.3em; height:1.3em; object-fit:contain; vertical-align:-.3em; filter:drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.ico.sm{ width:1.1em; height:1.1em; }
.tbtn .ico.lg{ width:26px; height:26px; vertical-align:middle; }
.chip .ico{ width:22px; height:22px; vertical-align:-6px; }
.hudbox .ico{ width:18px; height:18px; vertical-align:-3px; }
.pw .pi .ico{ width:32px; height:32px; vertical-align:middle; }
.si-ico .ico{ width:48px; height:48px; }
.mc-ico .ico{ width:72px; height:72px; }
.dday .ico{ width:16px; height:16px; }
.fly-coin .ico{ width:24px; height:24px; vertical-align:middle; }
@media (max-width:680px){ .pw .pi .ico{ width:24px; height:24px; } }

/* Huy hiệu tiêu đề & nền menu bằng ảnh chủ đạo */
.hero-emblem{ display:block; width:92px; height:auto; margin:0 auto 2px; filter:drop-shadow(0 4px 12px rgba(239,125,31,.55)); animation:emblemFloat 3.2s ease-in-out infinite; }
@keyframes emblemFloat{ 50%{ transform:translateY(-4px) rotate(-2deg); } }
.overlay.menu{
  background:
    linear-gradient(180deg, rgba(20,10,34,.15) 0%, rgba(20,10,34,.55) 45%, rgba(20,10,34,.9) 100%),
    url("../img/ui/keyart.webp") center 30% / cover no-repeat;
}
.overlay.menu .card.wide{ background:radial-gradient(500px 220px at 50% -40px, rgba(239,125,31,.18), transparent 70%), rgba(36,20,47,.82); backdrop-filter:blur(6px); }
@media (max-width:680px){
  .overlay.menu{ background:linear-gradient(180deg, rgba(20,10,34,.2), rgba(20,10,34,.92) 40%), url("../img/ui/keyart.webp") center top / 180% auto no-repeat, var(--bg); }
  .hero-emblem{ width:72px; }
}

/* Khung viền vàng trang trí cho bảng thắng/thua, thẻ, hộp thoại */
.card:not(.wide), .story-box{
  border:20px solid transparent; border-radius:10px;
  border-image:url("../img/ui/frame.webp") 46 / 20px / 4px round;
  background-clip:padding-box;
}
.card:not(.wide){ padding:16px 18px 14px; }
@media (max-width:680px){
  .card:not(.wide), .story-box{ border-width:14px; border-image-width:14px; }
}

/* =================== Chơi toàn màn hình trên điện thoại =================== */
body.immersive{ overflow:hidden; overscroll-behavior:none; touch-action:none; }
body.immersive .toolbar, body.immersive .film-strip, body.immersive .banner-slot,
body.immersive .cols, body.immersive footer{ display:none; }
body.immersive .wrap{ padding:0; }
body.immersive .stage{
  position:fixed; left:0; top:0; z-index:50; transform-origin:0 0;
  border-radius:0; box-shadow:none; display:grid; place-items:center;
  background:radial-gradient(ellipse at center, rgba(239,125,31,.18), transparent 70%), #0b0614;
}
body.immersive canvas#game{ aspect-ratio:auto; border-radius:0; }
/* HUD & nút: cỡ chạm ngón tay, tránh tai thỏ / thanh điều hướng */
body.immersive .hud{ top:max(8px, env(safe-area-inset-top)); left:max(10px, env(safe-area-inset-left)); right:max(10px, env(safe-area-inset-right)); gap:6px; }
body.immersive.rot .hud{ top:8px; left:12px; right:12px; }
body.immersive .hudbox{ font-size:13px; padding:6px 10px; border-radius:12px; }
body.immersive .hudbtn{ width:44px; height:44px; font-size:13px; }
body.immersive .wind-bars{ display:flex; }
body.immersive .power-bar{ left:max(10px, env(safe-area-inset-left)); bottom:max(14px, env(safe-area-inset-bottom)); gap:7px; }
body.immersive.rot .power-bar{ left:12px; bottom:14px; }
body.immersive .pw{ width:48px; height:48px; border-radius:14px; }
body.immersive .pw .pi .ico{ width:30px; height:30px; }
body.immersive .hudbox:first-child{ display:block; }
/* lớp phủ trong khung xoay: gọn cho màn hình thấp */
body.immersive .overlay{ position:absolute; padding:8px; }
body.immersive .overlay .card{ max-width:460px; padding:12px 16px 10px; }
body.immersive .card h3{ font-size:24px; margin-bottom:4px; }
body.immersive .stars{ font-size:32px; margin:0 0 4px; }
body.immersive .card p{ font-size:13.5px; margin-bottom:8px; }
body.immersive .btn{ padding:10px 18px; font-size:14.5px; }
body.immersive .story-box{ max-width:640px; }
/* Khi xoay ngang giả: thông báo & chữ chuyển cảnh xoay theo */
body.rot .toasts{ top:50%; left:calc(100% - 46px); width:min(80vh, 380px); transform:translate(-50%, -50%) rotate(90deg); }
body.rot .wipe span{ transform:rotate(90deg); white-space:nowrap; }
