/* ================= Người Que — MonBlock ================= */
:root {
  --bg: #0d1117;
  --panel: #151c26;
  --panel-2: #1b2431;
  --line: #2b3646;
  --txt: #e8eef6;
  --muted: #93a3b8;
  --accent: #ffcf5a;
  --red: #e5484d;
  --coin: #ffcf4d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 10% -10%, #3a1a1a 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 0%, #2a2414 0%, transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 8px 16px 32px; }
.screen { animation: fade .18s ease; }
/* No slide-in on the match screen: a transform there would make its fixed layout measure 0 while controls are placed. */
#scPlay { animation: none; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
h2 { font-size: 17px; margin: 18px 0 10px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .no-touch { display: none; }

/* ---------- trang chủ ---------- */
.me-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 10px; margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(135deg, #36161a, var(--panel)); }
.me-av { width: 64px; height: 64px; flex: none; border-radius: 14px; background: radial-gradient(circle at 50% 70%, #2a3446, #121822); }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.me-info b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-info span { color: var(--muted); font-size: 13px; }
.xpbar { height: 6px; border-radius: 9px; background: var(--panel-2); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ff8a3d); border-radius: 9px; }
.me-chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: 14px; font-weight: 700; white-space: nowrap; }

.big { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0 0 10px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-size: 17px; font-weight: 800; text-align: left; }
.big small { color: var(--muted); font-size: 13px; font-weight: 600; }
.big-ladder { background: linear-gradient(135deg, #4a2a10, #151c26); border-color: #8a5a20; }
.big-ai { background: linear-gradient(135deg, #3a1616, #151c26); border-color: #6a2a2a; }
.big-local { background: linear-gradient(135deg, #1c3324, #151c26); border-color: #2e5a3c; }
.big-online { background: linear-gradient(135deg, #142a44, #151c26); border-color: #2a5480; }

/* ---------- đấu online ---------- */
.on-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0; font-size: 17px; }
.on-elo { color: var(--accent); font-weight: 800; }
.on-actions h2 { margin-top: 14px; }
.on-actions .pick { margin-bottom: 10px; }
.on-join { display: flex; gap: 8px; margin-top: 4px; }
.on-join input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--txt); font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.on-join .small { padding: 12px 16px; }
.on-wait { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 10px; text-align: center; }
.on-code { font-size: 44px; font-weight: 900; letter-spacing: 8px; color: var(--accent); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { padding: 8px 14px; border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: underline; }
.netmsg { position: absolute; left: 50%; top: 22%; z-index: 4; transform: translateX(-50%); padding: 8px 14px; border-radius: 12px; background: rgba(8, 10, 16, .82); color: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; pointer-events: none; }
.netping { position: absolute; left: 8px; bottom: 8px; z-index: 3; padding: 2px 7px; border-radius: 8px; background: rgba(8, 10, 16, .6); color: #9fe8a8; font-size: 11px; font-weight: 700; pointer-events: none; }
.netping.slow { color: #ffb02e; }
.netping.bad { color: #ff6b5b; }
.big-go { align-items: center; margin-top: 18px; background: linear-gradient(180deg, #ffd76a, #f0a82a); border: 0; color: #2a1800; font-size: 19px; }
.homegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.small { padding: 12px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 14px; font-weight: 700; }

/* ---------- chọn mức / sàn ---------- */
.pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pick-row { grid-template-columns: repeat(3, 1fr); }
/* Arena picker: a little picture of each arena (R.stageCard), 2 per row on phones */
.pick-arena { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .pick-arena { grid-template-columns: repeat(4, 1fr); } }
.opt.arena-opt { padding: 0; overflow: hidden; gap: 0; }
.arena-opt canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; background: #1d2433; }
.arena-opt .dice { display: grid; place-items: center; width: 100%; aspect-ratio: 8 / 3; background: linear-gradient(135deg, #335fff, #b57bff); font-size: 30px; }
.arena-opt span { padding: 6px 10px; font-size: 13.5px; }
.opt { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--panel); text-align: left; font-weight: 700; }
.opt small { color: var(--muted); font-size: 12px; font-weight: 600; }
.opt.on { border-color: var(--accent); background: #2a2414; }
.keys2 { display: grid; gap: 10px; margin-top: 16px; }
.keys2 > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 14px; line-height: 1.8; color: var(--muted); }
.keys2 b { display: block; color: var(--txt); }
.keys2 span { margin: 0 3px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--txt); font-weight: 700; }

/* ---------- tháp ---------- */
.ladder { display: flex; flex-direction: column; gap: 8px; }
.ladder { gap: 10px; }
/* Each floor: a strip of its arena with both fighters (R.stageCard), name + quote over the bottom, floor number badge */
.floor { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 2px solid #1f2733; border-radius: 18px; background: #121822; text-align: left; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.floor canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; }
.floor.done { border-color: #2ea05a; }
.floor.locked { cursor: default; filter: saturate(.7) brightness(.85); }
.fl-num { position: absolute; z-index: 1; left: 10px; top: 8px; min-width: 34px; padding: 4px 8px; border-radius: 12px; background: rgba(10, 14, 22, .78); color: #fff; font-size: 16px; font-weight: 900; text-align: center; }
.fl-body { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; gap: 1px; padding: 7px 12px 26px 54px; background: linear-gradient(rgba(8, 10, 16, .78), transparent); color: #fff; }
.fl-body small { color: rgba(255, 255, 255, .78); font-size: 11.5px; font-weight: 700; }
.fl-body b { font-size: 16px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.fl-body i { color: rgba(255, 255, 255, .8); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-state { position: absolute; right: 10px; bottom: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent, #335fff); color: #fff; font-size: 16px; font-weight: 900; }
.floor.done .fl-state { background: #2ea05a; }
.floor.locked .fl-state { background: rgba(10, 14, 22, .78); }
.floor.boss { border-color: #e0b02a; box-shadow: 0 0 0 2px rgba(224, 176, 42, .35), 0 4px 14px rgba(0, 0, 0, .3); }
.floor.boss .fl-num { background: #e0b02a; color: #2a1f00; }
/* Thẻ chương của tháp */
.ltabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px; scrollbar-width: thin; }
.ltabs button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-weight: 800; font-size: 13px; white-space: nowrap; }
.ltabs button small { font-size: 11px; font-weight: 700; color: var(--muted); }
.ltabs button.on { border-color: var(--accent); color: var(--accent); background: var(--panel-2); }
.ltabs button.locked { opacity: .5; }

/* ---------- tủ đồ ---------- */
.shop-top { display: flex; align-items: center; gap: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.shop-top canvas { width: 120px; height: 120px; border-radius: 14px; background: radial-gradient(circle at 50% 70%, #2a3446, #121822); }
.shop-top small { color: var(--muted); }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 2px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 13px; }
.item.on { border-color: var(--accent); }
.item small { color: var(--muted); font-weight: 700; }
.item .sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); }
.item .gi { font-size: 28px; font-style: normal; line-height: 34px; }
/* Clip of a skill / weapon in the buy dialog (a tiny live match, js/main.js skillDemo) */
canvas.demo { display: block; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 8px; border-radius: 12px; background: #121822; }
/* Item icons (js/icons.js): smooth round-stroke drawings, 96×96 shown smaller */
.nqi { display: inline-block; width: 38px; height: 38px; vertical-align: middle; }
.item .gi .nqi { width: 42px; height: 42px; }
.sp .nqi { width: 66%; height: 66%; }
/* Icons on the touch-pad buttons: big and clear like the shop (class name must not be "big": that is the shared mode-card class). */
.nqi.nqi-pad { width: 72%; height: 72%; pointer-events: none; }
.bundle li .nqi, .dlg-btns .nqi, .quote + p .nqi, #dialog p .nqi { width: 22px; height: 22px; }

.tabs { display: flex; gap: 6px; margin: 14px 0 4px; }
.tabs button { flex: 1; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; font-size: 14px; }
.tabs button.on { border-color: var(--accent); background: #2a2414; color: var(--accent); }
h2 small { color: var(--muted); font-size: 12px; font-weight: 600; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.skill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--panel); text-align: left; }
.skill > i { font-size: 28px; font-style: normal; }
.skill span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.skill small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.skill em { color: var(--accent); font-size: 12px; font-style: normal; font-weight: 700; }
.skill u { flex: none; text-decoration: none; font-size: 12.5px; font-weight: 800; color: var(--coin); white-space: nowrap; }
.skill.own u { color: var(--muted); }
.skill.on { border-color: #4fd18b; background: #13261b; }
.skill.on u { color: #4fd18b; }
/* Phone held upright: two columns of upright cards (icon on top, name, 3-line description, price at the bottom) */
@media (max-width: 559px) {
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; text-align: center; }
  .skill > i { align-self: center; }
  .skill > i .nqi { width: 46px; height: 46px; }
  .skill span { align-items: center; }
  .skill span b { font-size: 14.5px; line-height: 1.25; }
  .skill small { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .skill u { white-space: normal; text-align: center; font-size: 12px; margin-top: auto; }
}
.item .sw.glove { border-radius: 12px; }
.item .sw.facepv { width: 46px; height: 46px; border-radius: 12px; border: 0; background: radial-gradient(circle at 50% 45%, #2a3446, #121822); }
.item .sw.aura { background: radial-gradient(circle, var(--a) 0 30%, transparent 70%); border-color: transparent; color: var(--muted); line-height: 28px; font-style: normal; }
.bundles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.bundle { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid #8a5a20; border-radius: 16px; background: linear-gradient(135deg, #3a2610, var(--panel)); }
.b-head { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.b-head i { font-size: 26px; font-style: normal; }
.bundle ul { margin: 0; padding-left: 4px; list-style: none; line-height: 1.7; font-size: 14px; }
.bundle li.got { color: var(--muted); text-decoration: line-through; }
.bundle button { padding: 10px; border: 0; border-radius: 12px; background: var(--accent); color: #1c1608; font-weight: 900; }
.bundle button s { opacity: .55; font-weight: 600; }
.bundle button:disabled { background: var(--panel-2); color: var(--muted); }

/* ---------- cách chơi ---------- */
.help { line-height: 1.6; }
.help ul { padding-left: 20px; }
kbd { padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; background: var(--panel-2); font: 700 13px/1.4 "Segoe UI", Roboto, sans-serif; }

/* ---------- trận đấu ---------- */
.stage { position: relative; display: flex; flex-direction: column; gap: 10px; }
#cv { display: block; width: 100%; max-height: calc(100dvh - var(--mb-top, 52px) - 60px); aspect-ratio: 16 / 9; object-fit: contain; border-radius: 14px; background: #000; touch-action: none; }
.cv-wrap { position: relative; }
.pause-btn { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 38px; height: 30px; padding: 0; border: 1px solid rgba(255, 255, 255, .25); border-radius: 10px; background: rgba(8, 10, 16, .6); color: #fff; font-size: 14px; }
#keysHint { text-align: center; }
/* Column of owned specials at the right edge: each has its own energy ring (its own cost), the selected one is outlined. */
.splist { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 3; display: flex; flex-direction: column; gap: 6px; --sp: 46px; }
.sp { position: relative; display: grid; place-items: center; width: var(--sp); height: var(--sp); padding: 0; border: 2px solid rgba(255, 255, 255, .2); border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 26, 36, .92) 0 60%, transparent 61%), conic-gradient(var(--ring, #ff7a1a) calc(var(--en, 0) * 360deg), rgba(60, 70, 86, .85) 0);
  color: #fff; font-size: calc(var(--sp) * .44); opacity: .72; touch-action: none; -webkit-user-select: none; }
.sp.ready { opacity: 1; box-shadow: 0 0 10px var(--ring, #ff7a1a); }
.sp.sel { border-color: #ffcf5a; outline: 2px solid rgba(255, 207, 90, .45); outline-offset: 2px; }
.sp kbd { position: absolute; right: -4px; bottom: -4px; padding: 0 4px; border-width: 1px; font-size: 10px; line-height: 14px; }
body.touch .sp kbd { display: none; }
.sp.down { transform: scale(.92); background: rgba(255, 207, 90, .85); }
.tctl { display: none; }

/* Phones / tablets: the match takes the whole viewport (under the shell top bar when held upright) — arena on top,
   the controls fill what is left and are sized from that area (container units): nothing can end up off-screen. */
body.touch #scPlay .stage { position: fixed; z-index: 5; left: 0; right: 0; top: calc(var(--mb-top, 52px) + env(safe-area-inset-top)); bottom: 0; gap: 0; background: #07090d; }
body.touch #scPlay #cv { max-height: 52dvh; border-radius: 0; }
@media (orientation: portrait) { body.touch #scPlay #cv { aspect-ratio: 4 / 3; max-height: 58dvh; } }
body.touch .tctl { display: block; position: relative; flex: 1; min-height: 0; container-type: size; touch-action: none; user-select: none; -webkit-user-select: none;
  --s: min(64cqh, 42cqw); --b: min(31cqh, 16cqw); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --sb: env(safe-area-inset-bottom, 0px); }
.stickzone { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; touch-action: none; }
.stick { position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; will-change: transform;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), rgba(255, 255, 255, .05)); border: 2px solid rgba(255, 255, 255, .35); opacity: .45; transition: opacity .12s; }
.stick.live { opacity: 1; }
.knob { position: absolute; left: 50%; top: 50%; width: 44%; height: 44%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(255, 255, 255, .7); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); pointer-events: none; }
.tbtns { position: absolute; right: calc(10px + var(--sr)); bottom: calc(10px + var(--sb)); display: grid; gap: calc(var(--b) * .14);
  grid-template-columns: repeat(3, var(--b)); grid-template-rows: repeat(2, var(--b)); grid-template-areas: "su sp bl" ". ki pu"; touch-action: none; }
.tb { display: grid; place-items: center; width: var(--b); height: var(--b); padding: 0; border: 2px solid rgba(255, 255, 255, .22); border-radius: 50%;
  background: rgba(30, 40, 56, .88); color: #fff; font-size: calc(var(--b) * .42); touch-action: none; -webkit-user-select: none; box-shadow: 0 6px 14px rgba(0, 0, 0, .4); }
.p-su { grid-area: su; } .p-sp { grid-area: sp; } .p-bl { grid-area: bl; } .p-ki { grid-area: ki; } .p-pu { grid-area: pu; }
.p-bl { background: rgba(20, 60, 110, .88) !important; }
.tbtns:not(.has-super) .p-su { display: none; }
/* 🔥 / 💥: a ring fills with energy (--en 0..1); full = glowing */
.p-sp, .p-su { background: radial-gradient(circle, rgba(20, 26, 36, .92) 0 60%, transparent 61%), conic-gradient(var(--ring, #ff7a1a) calc(var(--en, 0) * 360deg), rgba(60, 70, 86, .85) 0) !important; opacity: .8; }
.p-su { --ring: #b57bff; }
.p-sp.ready, .p-su.ready { opacity: 1; box-shadow: 0 0 14px var(--ring, #ff7a1a); border-color: #fff; }
.tb.down { background: rgba(255, 207, 90, .85) !important; transform: scale(.93); }
.nope { animation: nope .35s; }
@keyframes nope { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
/* Phones: the column sits at the right edge of the control area, above the action buttons. */
.tctl .splist { top: 8px; bottom: calc(var(--b) * 2.14 + 18px + var(--sb)); right: calc(10px + var(--sr)); transform: none; justify-content: flex-end;
  --sp: min(calc((100cqh - var(--b) * 2.14 - 40px) / 5.4), 13cqw, 54px); }
.rotate-hint { position: absolute; top: 6px; left: 0; right: 0; margin: 0; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }

/* Phone sideways: arena fills the screen (shell hidden), the stick + buttons float on top of it */
@media (orientation: landscape) {
  body.touch.mb-full #scPlay .stage { top: 0; }
  body.touch.mb-full #scPlay .cv-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
  /* the canvas already has the screen's shape (render.js view height from main.js viewH) → fill it edge to edge */
  body.touch.mb-full #scPlay #cv { width: 100%; height: 100%; max-width: none; max-height: none; aspect-ratio: auto; object-fit: contain; }
  body.touch.mb-full .tctl { position: absolute; inset: 0; pointer-events: none; --s: min(40cqh, 24cqw); --b: min(19cqh, 9.5cqw); }
  body.touch.mb-full .stickzone, body.touch.mb-full .tb, body.touch.mb-full .sp { pointer-events: auto; }
  /* sideways: one row right above the action buttons (a column would be squeezed between the health bar and the buttons) */
  body.touch.mb-full .tctl .splist { top: auto; bottom: calc(var(--b) * 2.14 + 18px + var(--sb)); flex-direction: row-reverse; --sp: min(12cqh, 5.4cqw, 48px); }
  body.touch.mb-full .stickzone { height: 75%; top: auto; }
  body.touch.mb-full .tb:not(.p-sp):not(.p-su) { background: rgba(30, 40, 56, .5); }
  body.touch.mb-full .rotate-hint { display: none; }
}
@media (orientation: landscape) { body.touch:not(.mb-full) .rotate-hint { display: none; } }

/* ---------- hộp thoại ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 12, .72); }
.dialog { width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.dialog h3 { margin: 0 0 8px; font-size: 20px; }
.dialog p { line-height: 1.5; }
.dialog .score { margin: 4px 0; font-size: 34px; font-weight: 900; text-align: center; color: var(--accent); }
.dialog .quote { font-style: italic; color: var(--muted); }
.dialog .tip { color: var(--muted); font-size: 13.5px; }
.dialog .rw { padding-left: 18px; line-height: 1.8; font-weight: 700; }
.dlg-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dlg-btns button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-weight: 800; }
.dlg-btns button.pri { border-color: var(--accent); background: var(--accent); color: #1c1608; }
/* Mặc thử trong hộp mua: bây giờ (nhỏ, mờ) → mặc thử (to, có cử động) */
.tryon { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 4px 0 8px; }
.tryon figure { margin: 0; text-align: center; }
.tryon canvas { display: block; width: 96px; height: 96px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #222c3a, #10151d); opacity: .7; }
.tryon .new canvas { width: 150px; height: 150px; opacity: 1; border: 2px solid var(--accent); }
.tryon figcaption { margin-top: 4px; font-size: 12px; color: #9fb0c6; }
.tryon .new figcaption { color: var(--accent); font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: calc(80px + var(--sab, env(safe-area-inset-bottom))); z-index: 90; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: #222c3a; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.updatebar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.updatebar button { padding: 8px 12px; border: 0; border-radius: 10px; background: var(--accent); color: #1c1608; font-weight: 800; }

@media (max-width: 520px) {
  .pick-row { grid-template-columns: 1fr; }
}

/* ---------- kim cương + sự kiện (cửa hàng) ---------- */
.gem-chip b, .gem { color: #7fd8ff; }
.evtag { display: inline-block; margin: 2px 0; padding: 1px 8px; border-radius: 999px; background: linear-gradient(90deg, #ff9a3c, #ff4fa0); color: #fff; font-size: 11px; font-style: normal; font-weight: 800; }
.item.ev { border-color: #ff9a3c; box-shadow: 0 0 0 1px rgba(255, 154, 60, .35), 0 0 16px rgba(255, 79, 160, .18); }
.rank .row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rank .row.me { background: #1d2a1d; border-radius: 10px; }
.rank .no { width: 28px; color: var(--muted); font-weight: 800; text-align: center; }
.rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank .nm small { color: var(--muted); font-weight: 600; }
.rank .sc { font-weight: 900; color: var(--accent); }
/* Account avatar badge on the fighter portrait of the player card */
.me-avwrap { position: relative; flex: none; display: block; }
.me-avbadge { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--line); font-size: 17px; font-style: normal; line-height: 1; }

/* 🎡 Vòng quay chương */
.big-spin { background: linear-gradient(135deg, #5a2a6e, #2a1f3a); border-color: #b57bff; animation: spin-glow 1.6s ease-in-out infinite; }
@keyframes spin-glow { 50% { box-shadow: 0 0 18px rgba(181, 123, 255, .55); } }
.wheel-wrap { position: relative; width: min(280px, 72vw); aspect-ratio: 1; margin: 10px auto 6px; }
.wheel { position: absolute; inset: 0; border-radius: 50%; border: 6px solid #ffcf5a; box-shadow: 0 0 0 4px #2b3646, 0 12px 30px rgba(0, 0, 0, .5); transition: transform 4s cubic-bezier(.15, .85, .2, 1); }
.wheel span { position: absolute; left: 50%; top: 0; height: 50%; width: 0; transform-origin: 50% 100%; }
.wheel span b { position: absolute; top: 12%; left: 50%; transform: translateX(-50%) rotate(0deg); white-space: nowrap; font-size: 13px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; writing-mode: vertical-rl; }
.wheel-pin { position: absolute; z-index: 2; left: 50%; top: -10px; transform: translateX(-50%); width: 0; height: 0; border: 12px solid transparent; border-top: 22px solid #ffcf5a; filter: drop-shadow(0 2px 2px #000); }
.wheel-msg { text-align: center; margin: 6px 0 0; }
.wheel-msg .win { font-size: 18px; color: #ffcf5a; }

/* ================= Cầm máy dọc: cả trang xoay nằm ngang bằng bộ chung sdk/land.js (html.ls) ================= */
.nq-exit { display: none; }

html { --ls-bg: #0d1117; }
/* .wrap stays the scroller (the ‹ bar below is sticky inside it); the game has its own ‹ + screen title, not land.js's round one */
html.ls .wrap {
  position: relative; height: 100%; max-width: none; margin: 0;
  padding: 6px max(10px, var(--sar)) max(8px, var(--sab)) max(10px, var(--sal));
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
}
html.ls .ls-back { display: none !important; }
/* Khung chung đã ẩn (PortalShell.full): nút ‹ riêng ở góc trên trái của mọi màn trừ lúc đang đấu */
body.mb-full:not(.on-play) .nq-exit {
  display: grid; place-items: center; position: fixed; z-index: 30; left: max(8px, env(safe-area-inset-left)); top: 8px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #fff; color: #191b1d; font-size: 24px; font-weight: 900; line-height: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); padding: 0 0 3px;
}
html.ls .wrap > .nq-exit { position: absolute; left: max(8px, var(--sal)); }

/* chừa chỗ cho nút ‹ nổi ở góc trên trái của các màn con */
body.mb-full:not(.on-play) > .wrap { padding-top: 52px; }

/* Máy cầm dọc đã xoay: mép TRÁI của game = mép trên màn hình (tai thỏ / giờ), mép PHẢI = mép dưới (thanh home), mép DƯỚI = mép trái */
html.ls .tctl { --sl: var(--sal, 0px); --sr: var(--sar, 0px); --sb: var(--sab, 0px); }

.nq-exit-title { display: none; }
body.mb-full:not(.on-play) .nq-exit-title { display: block; position: fixed; z-index: 30; left: calc(max(8px, env(safe-area-inset-left)) + 50px); top: 8px; height: 44px; line-height: 44px; font-size: 17px; color: #191b1d; }
html.ls .wrap > .nq-exit-title { position: absolute; left: calc(max(8px, var(--sal)) + 50px); }

/* ===== v2: logo SVG, nút / khung kiểu game có viền đậm; Leo tháp 2 cột; cửa hàng gọn ===== */

/* Leo tháp: 2 cột, thẻ tầng thấp */
body.mb-full #scLadder .note { margin: 0 0 4px; font-size: 12px; }
body.mb-full .ltabs { gap: 5px; margin-bottom: 2px; padding-bottom: 4px; }
body.mb-full .ltabs button { flex-direction: row; gap: 6px; padding: 3px 10px; font-size: 12px; border-radius: 12px; }
body.mb-full .ladder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
body.mb-full .floor { border-radius: 12px; border-width: 2px; }
body.mb-full .floor canvas { aspect-ratio: 16 / 5; }
body.mb-full .fl-num { left: 6px; top: 5px; min-width: 24px; padding: 2px 6px; font-size: 13px; border-radius: 9px; }
body.mb-full .fl-body { padding: 4px 10px 14px 38px; }
body.mb-full .fl-body b { font-size: 14px; }
body.mb-full .fl-body small { font-size: 10.5px; }
body.mb-full .fl-body i { font-size: 11px; }
body.mb-full .fl-state { width: 24px; height: 24px; right: 7px; bottom: 6px; font-size: 12px; }

/* Cửa hàng: đầu gọn, chiêu thức 3 cột */
body.mb-full .shop-top { padding: 6px 10px; gap: 10px; border-radius: 14px; }
body.mb-full .shop-top canvas { width: 64px; height: 64px; border-radius: 10px; }
body.mb-full .shop-top br { display: none; }
body.mb-full .shop-top small { display: block; font-size: 11px; line-height: 1.3; }
body.mb-full .shop-top small:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.mb-full #shopTabs button { padding: 6px 8px; font-size: 13px; border-radius: 10px; }
body.mb-full #shopBody h2 { margin: 10px 0 6px; font-size: 15px; }
body.mb-full #shopBody h2 small { font-size: 11px; }
body.mb-full .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
body.mb-full .skill { display: grid; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto; gap: 1px 8px; align-items: center; padding: 6px 9px; border-radius: 11px; text-align: left; }
body.mb-full .skill > i { grid-row: 1 / span 2; align-self: center; }
body.mb-full .skill > i .nqi { width: 38px; height: 38px; }
body.mb-full .skill span { align-items: flex-start; gap: 0; }
body.mb-full .skill span b { font-size: 13px; }
body.mb-full .skill small { font-size: 11px; -webkit-line-clamp: 2; }
body.mb-full .skill em { font-size: 11px; }
body.mb-full .skill u { grid-column: 2; white-space: nowrap; text-align: left; font-size: 11.5px; margin-top: 0; }
body.mb-full .shop { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
@media (min-width: 760px) {
  .ladder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
body.mb-full .skill u .gem, body.mb-full .skill u .mb-coin { display: inline; }
body.mb-full .skill u .mb-coin { display: inline-block; vertical-align: -3px; }

/* Trang đã xoay: nền quanh trang tối (--ls-bg), màn con nền xám nhạt */
html.ls body:not(.on-play) .wrap { background: #f2f4f5; }

/* Nút ‹ + tên màn đứng yên khi cuộn (khung xoay là vùng cuộn nên không dùng fixed / absolute): thanh sticky cao 0, hai nút nằm trong nó */
.nq-bar { display: contents; }
html.ls .wrap > .nq-bar { display: block; position: sticky; top: 2px; height: 0; z-index: 30; }
html.ls .wrap > .nq-bar .nq-exit { position: absolute; top: 2px; left: 0; }
html.ls .wrap > .nq-bar .nq-exit-title { position: absolute; top: 2px; left: 50px; padding: 0 12px; border-radius: 20px; background: rgba(255, 255, 255, .92); }
html.ls body.on-play .wrap > .nq-bar { display: none; }

/* Khung xoay: Safari tính vị trí sticky từ mép TRONG vùng đệm → không để đệm 52px ở khung cuộn, chừa chỗ cho nút ‹ ngay trên từng màn con */
html.ls body.mb-full:not(.on-play) .wrap { padding-top: 6px; }

/* ===== Trang chủ tranh vẽ (design system 17/11/2026 — bố cục chuẩn: ‹ trên trái, loa + sách trên phải, logo + CHƠI, 4 ô đáy) ===== */
#scHome { position: fixed; inset: 0; z-index: 5; overflow: hidden; padding: 0; max-width: none; background: #9cc7e8; animation: none; container-type: size; }
#scHome .hm-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
body:has(#scHome:not(.hidden)) .mb-nav { display: none !important; }
#scHome button { -webkit-appearance: none; appearance: none; font-family: inherit; }
.hm-back, .hm-gear { position: absolute; top: max(10px, var(--sat)); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); }
.hm-back { left: max(10px, var(--sal)); background: #fff; border: 3px solid #e3e5e8; color: #191b1d; font: 700 28px/1 system-ui; padding-bottom: 4px; }
.hm-gear { right: max(10px, var(--sar)); border-radius: 12px; background: linear-gradient(#5ab4ff, #2a6fd8); border: 3px solid #e8f7ff; color: #fff; }
.hm-gear svg { width: 26px; height: 26px; display: block; }
.hm-mute { display: none; position: absolute; left: 7px; right: 7px; top: 50%; height: 3px; background: #ff4d4d; border-radius: 2px; transform: rotate(-45deg); }
.hm-gear.off .hm-mute { display: block; }
.hm-book { top: calc(max(10px, var(--sat)) + 54px); border-radius: 50%; }
.hm-top { position: absolute; left: calc(max(10px, var(--sal)) + 52px); top: max(10px, var(--sat)); display: flex; align-items: center; gap: 8px; }
.hm-av { position: relative; flex: none; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 3px solid #d8a13a; background: #fff3d6; display: grid; place-items: center; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); cursor: pointer; }
.hm-av .me-avemo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; line-height: 1; border-radius: 50%; overflow: hidden; color: var(--px, #e5484d); font-weight: 900; }
.hm-lv { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 8px; border-radius: 8px; background: #7a4a1c; border: 2px solid #d8a13a; color: #fff; font: 900 12px/1.2 system-ui, sans-serif; white-space: nowrap; }
.hm-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hm-xp, .hm-pts { display: none; }
.hm-bar { display: flex; align-items: center; gap: 4px; min-width: 84px; height: 32px; padding: 0 10px 0 4px; border-radius: 16px; background: rgba(20, 60, 90, .78); border: 2px solid rgba(255, 255, 255, .55); }
.hm-bar img { width: 24px; height: auto; flex: none; }
.hm-bar b { flex: 1; color: #fff !important; font: 900 14px/1 system-ui, sans-serif; text-align: center; }
.hm-stack { position: absolute; left: 0; right: 0; top: calc(max(10px, var(--sat)) + 64px); bottom: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqh; padding: 0 5cqw; }
.hm-logo { flex: 0 1 auto; min-height: 0; max-height: 16cqh; max-width: 84cqw; width: auto; height: auto; filter: drop-shadow(0 5px 6px rgba(0, 0, 0, .3)); pointer-events: none; }
.hm-hero { flex: 0 1 auto; min-height: 0; max-height: 28cqh; max-width: 72cqw; width: auto; height: auto; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); pointer-events: none; }
.hm-play { flex: none; width: min(70cqw, 330px); padding: 1.2cqh 3cqw 1.4cqh; border-radius: 999px; text-align: center; color: #fff; background: linear-gradient(#8aea5a, #2fae2a 60%, #238a22); border: 4px solid #fff5cf; box-shadow: 0 5px 0 #1b6b1a, 0 9px 12px rgba(0, 0, 0, .35); }
.hm-play b { display: block; font: 900 clamp(26px, 5.2cqh, 44px)/1.05 "Arial Rounded MT Bold", system-ui, sans-serif; -webkit-text-stroke: .12em #1d6a1d; paint-order: stroke fill; letter-spacing: 2px; }
.hm-play small { display: block; font: 900 clamp(12px, 1.8cqh, 15px)/1.2 system-ui, sans-serif; -webkit-text-stroke: .2em #1d6a1d; paint-order: stroke fill; }
.hm-play:active, .hm-ic:active { transform: scale(.96); }
.hm-row { position: absolute; left: 50%; bottom: max(14px, var(--sab)); transform: translateX(-50%); display: flex; gap: 2cqw; }
.hm-ic { position: relative; width: min(21cqw, 96px); padding: 0; background: none; border: 0; box-shadow: none; color: #fff; }
.hm-ic img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); }
.hm-ic span { display: block; margin-top: -2px; text-align: center; font: 900 clamp(12px, 1.7cqh, 14px)/1.1 system-ui, sans-serif; -webkit-text-stroke: .22em #4a2a14; paint-order: stroke fill; white-space: nowrap; }
.hm-dot { position: absolute; top: 2px; right: 2px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #e5374f; border: 2px solid #fff; color: #fff; font: 900 12px/18px system-ui; font-style: normal; }
.hm-dot.hidden { display: none; }
#scHome .hm-seo { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
#scBook a.bk-link { display: flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--skin-card-line, #e3e5e8); border-radius: 12px; background: var(--skin-card, #f7f8f9); color: var(--skin-ink, #191b1d); font-size: 15px; font-weight: 700; text-decoration: none; }
#scBook .bk-list, #scModes { display: flex; flex-direction: column; gap: 8px; }
#scModes .big { margin: 0; }
#scHelp .help ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.4; }
.big-hist { margin-top: 12px; }

/* Người Que: avatar = hình người que của game (khách) / avatar tài khoản phủ lên khi đã đăng nhập */
.hm-av .me-avc { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 50% 70%, #2a3446, #121822); }
.hm-av .me-avemo.hidden { display: none; }
.hm-pts small { font-size: 12px; }
/* Trang chủ có ‹ riêng (#btnHomeBack): ẩn thanh ‹ + tên màn của các màn con */
body.on-home .nq-bar, body.on-home .nq-exit, body.on-home .nq-exit-title { display: none !important; }
html.ls body.on-home .wrap { background: none; }
/* Khung ngang (chính: điện thoại xoay 844×390): tranh lấy phần sân giữa, logo + hero + CHƠI gọn trong khoảng giữa thanh trên và 4 ô */
@container (orientation: landscape) {
  #scHome .hm-bg { object-position: center 52%; }
  .hm-stack { top: calc(max(10px, var(--sat)) + 58px); bottom: calc(max(10px, var(--sab)) + min(11cqw, 22cqh) + 22px); gap: 1.2cqh; }
  .hm-logo { max-height: 19cqh; max-width: 46cqw; }
  .hm-hero { max-height: 25cqh; max-width: 40cqw; }
  .hm-play { width: min(46cqw, 340px); padding: 0.8cqh 3cqw 1cqh; }
  .hm-play small { white-space: nowrap; }
  .hm-play b { font-size: clamp(24px, 7cqh, 40px); }
  .hm-play small { font-size: clamp(12px, 3.2cqh, 15px); }
  .hm-row { bottom: max(10px, var(--sab)); gap: 1.6cqw; }
  .hm-ic { width: min(11cqw, 22cqh, 96px); }
  .hm-ic span { font-size: clamp(12px, 3.2cqh, 14px); }
}
/* Nhiệm vụ (hộp nổi nhỏ) */
#scQuests { display: flex; flex-direction: column; gap: 8px; }
#scQuests .big { margin: 0; }
#scQuests .note { margin: 0; }
.qd-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: 1px solid #e3e5e8; border-radius: 12px; background: #f7f8f9; }
.qd-card b { font-size: 16px; color: #191b1d; }
.qd-card small { color: #606368; font-size: 14px; line-height: 1.4; }
.qd-done { margin: 4px 0 0; color: #00a862; font-size: 14px; font-weight: 800; }
/* Chấm báo Nhiệm vụ: một kiểu chấm trống cho mọi game (như Cờ Vây) */
#questDot { min-width: 16px; width: 16px; height: 16px; padding: 0; top: 6px; right: 10px; }

/* Sheet skin "slate": small sheets take the colours of the painted home (owner 30/11/2026). */
body.mb-light { --skin-frame: #2c3440; --skin-head: linear-gradient(#46546a, #2c3440); --skin-head-ink: #f4f6fa; --skin-line: #f2b632;
  --skin-paper: #eceff3; --skin-card: #ffffff; --skin-card-line: #cfd5de; --skin-ink: #1b2230; --skin-muted: #525d6c; --skin-hover: #f6f8fb; }
