/* =========================================================
   Rubik 3×3 — Lớp giao diện mới (đợt 2), theo bản thiết kế Claude Design.
   Nạp SAU style.css và theme.css. Chỉ dùng biến trong theme.css.
   ========================================================= */

body { -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }
.hint, .lib-hint, .pane-hint { color: var(--muted); font-size: var(--fs-sm); }
code, kbd { font-family: var(--font-mono); }
svg { flex-shrink: 0; }
.ni svg, .icon-btn svg, .cam-ico svg, .t-last svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
button.link {
  min-height: 0; padding: 0; border: 0; background: none; box-shadow: none;
  color: var(--accent); font-weight: var(--fw-semibold); font-size: inherit;
}
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
button.link.danger-link { color: var(--danger); font-weight: var(--fw-medium); }
button.soft { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.icon-btn { width: var(--tap-sm); min-width: var(--tap-sm); padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-pill); background: var(--surface); }
textarea { padding: var(--sp-3) var(--sp-4) !important; line-height: 1.45; min-height: 0; }
.row { gap: var(--sp-2); }
.row.three { display: grid; grid-template-columns: repeat(3, 1fr); }
.row.two { display: grid; grid-template-columns: 1fr 1fr; }
.status { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.status.ok { color: var(--success); }
.status.error { color: var(--danger); }

/* ---------- Thanh trên cùng ---------- */
.topnav {
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: var(--fw-black); font-size: var(--fs-lg); }
.logo { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 26px; height: 26px; padding: 2px; border-radius: 7px; background: var(--cube-body); }
.logo i { border-radius: 3px; }
.logo i:nth-child(1) { background: var(--cube-r); }
.logo i:nth-child(2) { background: var(--cube-y); }
.logo i:nth-child(3) { background: var(--cube-b); }
.logo i:nth-child(4) { background: var(--cube-g); }
.nav-tabs a { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); border-radius: var(--r-pill); padding: 8px 14px; font-weight: var(--fw-semibold); }
.nav-tabs a:hover { background: var(--surface-2); color: var(--text); }
.nav-tabs a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-tabs a .ni { margin: 0; display: inline-flex; }
.nav-tabs a .ni svg { width: 20px; height: 20px; }
.nav-tabs a.nav-vip { color: var(--gold-text); }
.nav-tabs a.nav-vip.active { background: var(--gold-soft); color: var(--gold-text); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.install { min-height: 36px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); border: 0; font-size: var(--fs-sm); }

/* ---------- Trang Giải Rubik ---------- */
header h1 { font-size: var(--fs-2xl); }
header .sub { color: var(--muted); }
main, .timer-layout, .page-wrap { gap: var(--sp-4); }
.view-panel { padding: var(--sp-4); }
.scene { border-radius: var(--r-md); }
.view-panel > .hint { margin: 4px 0 8px; }

.skin-picker { gap: 6px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 2px; scrollbar-width: none; }
.skin-picker::-webkit-scrollbar { display: none; }
@media (min-width: 601px) { .skin-picker { justify-content: center; flex-wrap: wrap; } }
.skin-btn {
  flex-direction: row; min-width: 0; flex-shrink: 0; white-space: nowrap; min-height: 34px; padding: 0 12px 0 6px; gap: 6px;
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface-2);
  font-size: var(--fs-sm);
}
.skin-btn.active { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; box-shadow: none; }
.skin-sw { grid-template-columns: repeat(2, 7px); gap: 1px; padding: 2px; border-radius: 6px; }
.skin-sw i { width: 7px; height: 7px; border-radius: 2px; }
.skin-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.skin-lock { position: static; font-size: 0; }
.skin-btn.locked::after {
  content: 'VIP'; font-size: 10px; font-weight: var(--fw-black); letter-spacing: .06em;
  padding: 2px 6px; border-radius: var(--r-pill); background: var(--gold-grad); color: var(--gold-ink);
}
.skin-btn.locked .skin-sw { opacity: .6; }

/* Lời giải */
.solution { border-top: 1px solid var(--border); margin-top: var(--sp-4); padding-top: var(--sp-4); }
.sol-head { align-items: baseline; margin-bottom: var(--sp-3); color: var(--text); }
.sol-head h2 { margin: 0; font-size: var(--fs-xl); }
.sol-meta { color: var(--muted); font-size: var(--fs-sm); }
.sol-meta b { color: var(--text); }
.moves-list { max-height: 460px; display: flex; flex-direction: column; flex-wrap: nowrap; gap: var(--sp-2); overflow-y: auto; padding-right: 2px; }
.stage { margin: 0; transition: background .15s, border-color .15s; }
.stage.finished { opacity: 1; }
.stage-title { justify-content: flex-start; align-items: center; gap: 8px; margin-bottom: var(--sp-2); }
.st-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: var(--fw-bold);
  background: var(--surface-3); color: var(--muted);
}
.stage.active .st-num { background: var(--accent); color: var(--on-accent); }
.stage.finished .st-num { background: var(--success); color: #fff; }
.st-name { font-weight: var(--fw-bold); }
.st-sub { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-title small { margin-left: auto; font-size: var(--fs-xs); }
.stage .chips { display: grid; grid-template-columns: repeat(auto-fill, 48px); gap: 6px; }
.stage.finished .move-chip { opacity: .45; }
.stage:not(.active):not(.finished) .move-chip { background: var(--surface-2); color: var(--text-2); }
.stage.active .move-chip { background: var(--surface); }
.stage.active .move-chip.done { opacity: .4; }
.stage.active .move-chip.current { background: var(--accent); color: var(--on-accent); }
.move-chip { width: 100%; min-width: 0; cursor: pointer; }
.stage .alg { font-family: var(--font-mono); }
.current-move { font-size: var(--fs-md); font-weight: var(--fw-medium); margin: var(--sp-3) 0; }
.current-move code { color: var(--accent); font-weight: 700; font-size: 1.05em; }
.player { display: grid; grid-template-columns: 48px 48px 1fr 48px 48px; gap: 6px; }
.player button { min-height: var(--tap); padding: 0; font-size: var(--fs-md); }
.player #btnPlay { font-weight: var(--fw-bold); }
.speed { justify-content: stretch; gap: var(--sp-3); margin-top: var(--sp-3); font-size: var(--fs-sm); }
.speed input { flex: 1; accent-color: var(--accent); }
#speedVal { min-width: 36px; text-align: right; font-family: var(--font-mono); color: var(--text-2); }
.alt-algs button { border-radius: var(--r-sm); }

/* Ô nhập: tab Tô màu / Nhập scramble / Camera */
.in-tabs { margin-bottom: var(--sp-4); }
.in-pane { margin-bottom: var(--sp-4); }
.pane-hint { margin: 0 0 var(--sp-3); }
.palette { gap: var(--sp-2); margin-bottom: var(--sp-4); }
.swatch { width: 44px; height: 44px; border-radius: var(--r-sm); border: 1.5px solid var(--border-strong); }
.swatch.active { outline: 3px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.net { gap: 3px; max-width: 360px; }
.net .cell { border-radius: 4px; border: 1px solid rgba(0, 0, 0, .18); }
.net .cell.center::after { color: rgba(0, 0, 0, .35); font-family: var(--font-mono); }
.input-panel .row button { font-size: var(--fs-sm); }
.cam-intro { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); margin-bottom: var(--sp-3); }
.cam-intro p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.cam-ico { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.scan-btn { width: 100%; margin: 0; min-height: var(--tap); }

.methods { gap: var(--sp-2); margin-bottom: var(--sp-3); }
.method {
  position: relative; border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-3); background: var(--surface); transition: border-color .15s, background .15s;
}
.method input { position: absolute; opacity: 0; pointer-events: none; }
.method:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.method:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
/* iPhone iOS < 15.4 không hiểu :has → khung được chọn không sáng lên (nút tròn bị ẩn) → hiện ✓ + chữ màu nhấn ở cách đang chọn */
@supports not selector(:has(a)) { .method input:checked + span b { color: var(--accent); } .method input:checked + span b::after { content: ' ✓'; } }
.method b { display: flex; align-items: center; gap: 6px; }
.method small { font-size: var(--fs-xs); margin-top: 2px; line-height: 1.35; }
#btnSolve { width: 100%; }
details summary { color: var(--text-2); }
.move-pad button { border-radius: var(--r-sm); font-family: var(--font-mono); }

/* Thư viện */
.library h2 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xl); }
.tabs button small { color: var(--muted); font-weight: var(--fw-medium); margin-left: 4px; }
.tabs button.active small { color: var(--text-2); }
.lib-search { max-width: none; margin: var(--sp-3) 0 var(--sp-4); }
.case-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.case-card { gap: 4px; padding: var(--sp-3) var(--sp-2); }
.case-card:hover { border-color: var(--border-strong); }
.case-card svg { width: 84px; height: 84px; }
.case-name { font-size: var(--fs-sm); }
.case-name small { color: var(--muted); font-weight: var(--fw-medium); }
.case-alg { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; color: var(--muted); }
.case-card.locked svg { filter: none; opacity: .38; }
.case-card.locked .case-alg { color: var(--gold-text); font-family: var(--font-sans); font-weight: var(--fw-bold); }
.lock-badge { top: 8px; right: 8px; padding: 3px 7px; }
.group-title { color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-bold); text-transform: none; }

/* ---------- Bấm giờ ---------- */
.session-bar { display: flex; gap: var(--sp-2); }
.session-bar select { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); font-weight: var(--fw-semibold); }
.session-bar .icon-btn { width: var(--tap); height: var(--tap); border-radius: var(--r-md); border: 1px solid var(--border); }
.t-side { padding: 0; background: none; border: 0; box-shadow: none; gap: var(--sp-3); }
.scramble-bar { padding: var(--sp-4); }
.scr-text { font-size: clamp(1rem, 2.4vw, 1.3rem); font-weight: 600; word-spacing: .3em; letter-spacing: .02em; }
.scr-actions { display: grid; grid-template-columns: 44px 1fr 1fr 1.4fr; gap: 6px; }
.scr-actions button { min-height: var(--tap-sm); font-size: var(--fs-sm); line-height: 1.15; padding: 0 8px; }
@media (min-width: 601px) { .scr-actions { display: flex; justify-content: center; } .scr-actions button { padding: 0 16px; } }

.timer-area { gap: var(--sp-2); }
.t-display { line-height: 1; color: var(--text); }
.timer-area[data-state="holding"] .t-display, .timer-area[data-state="armInspect"] .t-display { color: var(--t-hold); }
.timer-area[data-state="ready"] .t-display { color: var(--t-ready); }
.timer-area[data-state="inspect"] .t-display { color: var(--t-inspect); }
.t-display.warn { color: var(--t-hold) !important; }
.t-pb {
  order: 0; animation: pop .5s ease; color: var(--success); background: var(--success-soft);
  font-size: var(--fs-sm); font-weight: var(--fw-bold); padding: 4px 12px; border-radius: var(--r-pill);
}
.t-quick { gap: var(--sp-5); font-family: var(--font-mono); font-size: var(--fs-sm); }
.t-quick span { color: var(--muted); }
.t-quick b { color: var(--text); font-weight: 700; margin-left: 4px; }
.t-last { gap: 2px; padding: 4px; border-radius: var(--r-md); background: var(--surface-2); margin-top: var(--sp-2); }
.t-last button { min-height: 36px; border: 0; background: transparent; padding: 0 14px; font-size: var(--fs-sm); color: var(--text-2); border-radius: 10px; }
.t-last button.active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); font-weight: var(--fw-bold); }
.t-last button.del { color: var(--danger); }
.t-last svg { width: 16px; height: 16px; }
.t-hint { font-size: var(--fs-sm); max-width: 340px; }

.t-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); border: 0; }
.st-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; box-shadow: var(--sh-1); }
.st-label { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.st-val { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.st-best { font-family: var(--font-mono); font-size: 11px; color: var(--gold-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-card .link { cursor: pointer; }
.st-card .link:hover { color: var(--accent); }
.t-summary div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.t-list-panel { padding: 0; overflow: hidden; }
.t-list-head { padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); color: var(--muted); border-bottom: 1px solid var(--border); }
.t-list-head b { color: var(--text); }
.t-list { border: 0; border-radius: 0; max-height: 440px; }
.t-list th { background: var(--surface); font-size: 11px; text-transform: none; padding: 10px 14px; }
.t-list td { padding: 11px 14px; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-2); }
.t-list td:nth-child(2) { color: var(--text); font-weight: 700; }
.t-list td.best { color: var(--success); }
.t-list tr[data-i]:hover { background: var(--surface-2); }
.t-more { background: var(--surface); color: var(--accent); font-weight: var(--fw-bold); min-height: var(--tap); }
.t-chart-panel .tabs { flex: 0 0 auto; }
.chart-head .tabs button { flex: 0 0 auto; padding: 0 14px; }
.legend { font-size: var(--fs-xs); }
.chart-tip { background: var(--surface); border-color: var(--border); box-shadow: var(--sh-2); border-radius: var(--r-sm); }
.vip-mini-lock b { font-size: var(--fs-md); }
.t-toast { background: var(--text); color: var(--bg); border-radius: var(--r-md); box-shadow: var(--sh-3); }

/* ---------- Luyện tập ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.page-head h1 { margin: 0; font-size: var(--fs-2xl); }
.vip-days { background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold-line); border-radius: var(--r-pill); padding: 4px 12px; font-size: var(--fs-xs); font-weight: var(--fw-bold); white-space: nowrap; }
#trTabs { margin-bottom: var(--sp-4); }
#trTabs button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.tr-grid { gap: var(--sp-3); align-items: stretch; }
.tr-case { padding: var(--sp-4); gap: 6px; }
.tr-name { font-size: var(--fs-lg); }
.tr-name small { color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); margin-left: 4px; }
.tr-svg svg { width: 150px; height: 150px; }
.tr-setup span { font-size: 11px; font-weight: var(--fw-bold); letter-spacing: .1em; }
.tr-setup b { font-size: 1.2rem; font-weight: 700; }
.tr-case .hint { margin: 2px 0 0; text-align: center; }
.tr-area { background: var(--surface); min-height: 220px; padding: var(--sp-5); }
.tr-area .t-display { font-size: clamp(3.6rem, 16vw, 6rem); }
.tr-last { font-size: var(--fs-sm); color: var(--muted); }
.tr-last b { color: var(--text); font-family: var(--font-mono); }
.tr-of { font-size: var(--fs-xs); }
.tr-alg { font-family: var(--font-mono); font-size: var(--fs-xs); margin-top: 4px; }
.tr-opts { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-5); }
.tr-opts .switch { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 var(--sp-4); min-height: var(--tap); }
.tr-opts #trSkip { min-height: var(--tap); padding: 0 var(--sp-5); }
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); font-weight: var(--fw-semibold); font-size: var(--fs-sm); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-track { position: relative; width: 40px; height: 24px; border-radius: var(--r-pill); background: var(--surface-3); transition: background .15s; flex-shrink: 0; }
.sw-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform .15s; }
.switch input:checked + .sw-track { background: var(--accent); }
.switch input:checked + .sw-track::after { transform: translateX(16px); }
.switch input:focus-visible + .sw-track { outline: 3px solid var(--accent); outline-offset: 2px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; margin: 0 0 var(--sp-3); }
.sec-head h3 { margin: 0; font-size: var(--fs-lg); }
.sec-meta { font-size: var(--fs-sm); color: var(--muted); }
.sec-meta button.link { font-size: var(--fs-sm); }
#trCases { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--sp-2); }
#trCases .case-card { padding: var(--sp-2); }
#trCases .case-card svg { width: 64px; height: 64px; }
.tr-card:not(.selected) { opacity: 1; }
.tr-card:not(.selected) svg { opacity: .45; }
.tr-card.selected { background: var(--accent-soft); }
.tr-foot { text-align: center; margin-top: var(--sp-4); }
#trDaily.panel { padding: var(--sp-5); }
.dy-stats div { background: var(--surface-2); border-radius: var(--r-sm); }
.dy-stats b { font-family: var(--font-mono); }
.dy-history td:last-child { font-family: var(--font-mono); }
.vip-lock .vl-icon { font-size: 2.6rem; }

/* ---------- VIP ---------- */
.vip-status { border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); background: var(--surface); }
.vip-status.on { background: var(--gold-soft); border-color: var(--gold-line); }
.vip-status.on b { color: var(--gold-text); }
/* 🎁 Ô nhập mã quà tặng */
.vip-gift { margin: var(--sp-3, 12px) 0 0; padding: 12px 16px; border-radius: var(--r-lg, 14px); background: var(--surface); border: 1px dashed var(--gold-line, rgba(200, 160, 40, .5)); display: flex; flex-direction: column; gap: 8px; }
.vip-gift label { font-weight: 700; }
.vip-gift-row { display: flex; gap: 8px; }
.vip-gift-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-mono, monospace); }
.vip-gift-row button { flex: none; white-space: nowrap; }
.vip-gift-msg { margin: 0; font-size: .92rem; min-height: 0; }
.vip-gift-msg:empty { display: none; }
.vip-gift-msg.ok { color: var(--ok, #1a9a5a); font-weight: 600; }
.vip-gift-msg.bad { color: var(--bad, #d23c3c); }
.vip-hero { background: var(--gold-hero); border: 0; color: #F6EEDB; box-shadow: var(--sh-3); padding: var(--sp-8) var(--sp-5); }
.vip-hero h1 { color: #FFF6DF; font-size: var(--fs-3xl); }
.vip-hero .sub { color: rgba(246, 238, 219, .75); }
.vip-price b { color: #F2C65C; font-size: var(--fs-3xl); font-weight: var(--fw-black); }
.vip-price span { color: rgba(246, 238, 219, .7); }
.vip-features li { background: rgba(255, 255, 255, .06); border: 1px solid rgba(242, 198, 92, .18); border-radius: var(--r-md); }
.vip-features b { color: #FFF6DF; }
.vip-features small { color: rgba(246, 238, 219, .7); }
.vip-compare td:last-child, .vip-compare .vip-col { color: var(--gold-text); }
.order-code code { background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold-line); border-radius: var(--r-sm); }
.vip-bank img { border-radius: var(--r-md); }
.vip-contact a { border-radius: var(--r-md); background: var(--surface-2); }
.vip-activate textarea, #dVipExpire textarea { font-family: var(--font-mono); font-size: var(--fs-sm); background: var(--surface-2); }
.gold-txt { color: var(--gold-text); }

/* ---------- Hộp thoại ---------- */
.modal-head h3 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-lg); }
.modal-head button { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; background: var(--surface-2); font-size: var(--fs-sm); }
.vip-features-small { color: var(--text-2); font-size: var(--fs-sm); }
.vx-renew { background: var(--gold-soft); border-color: var(--gold-line); border-radius: var(--r-md); }
.d-pen button.active, .d-pen button:focus-visible { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.d-time { font-family: var(--font-mono); }
.d-scr, .a-list { background: var(--surface-2); border-radius: var(--r-sm); font-family: var(--font-mono); }
.set-grid label { border-color: var(--border); }
.set-grid select, .set-grid input[type=number] { min-height: 40px; background: var(--surface-2); border-radius: var(--r-sm); }
kbd { background: var(--surface-2); border-color: var(--border-strong); }

/* Chế độ tập trung khi bấm giờ */
body.timing .timer-area { background: var(--bg); }

/* ---------- Điện thoại ---------- */
@media (max-width: 600px) {
  /* backdrop-filter ở thanh trên sẽ "giữ" thanh điều hướng (position: fixed) lại trong nó → bỏ ở mobile */
  .topnav { min-height: 56px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .nav-tabs { -webkit-backdrop-filter: blur(14px); }
  #trTabs button { white-space: normal; line-height: 1.15; font-size: var(--fs-sm); padding: 4px 6px; }
  .nav-tabs { grid-template-columns: repeat(5, 1fr); padding-top: 6px; }
  .nav-tabs a { flex-direction: column; gap: 3px; padding: 4px 2px; border-radius: var(--r-md); background: transparent !important; }
  .nav-tabs a .ni { padding: 3px 18px; border-radius: var(--r-pill); }
  .nav-tabs a .ni svg { width: 22px; height: 22px; }
  .nav-tabs a.active .ni { background: var(--accent-soft); }
  .nav-tabs a.nav-vip.active .ni { background: var(--gold-soft); }
  body { padding-bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); }
  header { text-align: left; padding: 14px 16px 0; }
  header .sub { font-size: var(--fs-sm); margin-top: 2px; }
  .panel { padding: var(--sp-4); border-radius: var(--r-lg); }
  .scene { height: 290px; }
  .player { grid-template-columns: 44px 44px 1fr 44px 44px; }
  .case-grid { grid-template-columns: repeat(2, 1fr); }
  #trCases { grid-template-columns: repeat(3, 1fr); }
  .t-stats { order: 0; }
  .session-bar { order: 0; }
  .scramble-bar { order: 1; }
  .timer-area { order: 2; min-height: 38vh; }
  .t-side { order: 3; }
  .t-bottom { order: 4; }
  .st-val { font-size: 1.05rem; }
  .tr-grid { grid-template-columns: 1fr; }
  .modal { padding: var(--sp-3) var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom)); }
  .modal::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto var(--sp-3); }
  .vip-hero { padding: var(--sp-6) var(--sp-4); }
}

/* Hàng tab thư viện (8 mục): cuộn ngang */
.lib-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.lib-tabs::-webkit-scrollbar { display: none; }
.lib-tabs button { flex: 0 0 auto; padding: 0 14px; white-space: nowrap; }
#libHint { margin: var(--sp-3) 0 0; }

/* ================= Thư viện VIP: chọn khối ================= */
.vip-library { padding: var(--sp-5); }
.puzzle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.puzzle-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 0; padding: var(--sp-4) var(--sp-3); border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border); text-align: center;
}
.puzzle-card:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.puzzle-card svg { width: 92px; height: 92px; margin-bottom: 4px; }
.puzzle-card b { font-size: var(--fs-lg); }
.puzzle-card small { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.puzzle-card .lock-badge { position: absolute; top: 10px; right: 10px; }
.lib-open-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.lib-open-head h2 { margin: 0; font-size: var(--fs-xl); }
.lib-open-head .icon-btn { border: 1px solid var(--border); }

.lib-viewer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4); align-items: center; margin-bottom: var(--sp-5); padding: var(--sp-4); border-radius: var(--r-lg); background: var(--surface-2); }
.lv-scene { height: 320px; }
.lv-title { font-size: var(--fs-lg); }
.lv-title small { color: var(--muted); font-weight: var(--fw-medium); margin-left: 4px; }
.lv-desc { color: var(--text-2); font-size: var(--fs-sm); margin: 4px 0 var(--sp-3); }
.lv-chips { display: grid; grid-template-columns: repeat(auto-fill, 52px); gap: 6px; margin-bottom: var(--sp-2); }
.lv-chips .move-chip { background: var(--surface); }
.lv-chips .move-chip.done { opacity: .4; }
.lv-chips .move-chip.current { background: var(--accent); color: var(--on-accent); }
.lib-viewer .current-move { font-size: var(--fs-sm); }
@media (max-width: 760px) {
  .lib-viewer { grid-template-columns: 1fr; padding: var(--sp-3); }
  .lv-scene { height: 280px; }
}
@media (max-width: 600px) {
  .puzzle-grid { grid-template-columns: repeat(2, 1fr); }
  .puzzle-card svg { width: 76px; height: 76px; }
}

/* Bộ đếm giờ: chọn loại khối, scramble dài của khối lớn */
.session-bar .puzzle-sel { flex: 0 0 auto; width: auto; min-width: 84px; font-weight: var(--fw-bold); background: var(--accent-soft); color: var(--accent-ink); border: 0; }
.scr-text.long { font-size: clamp(0.85rem, 1.6vw, 1rem); word-spacing: .15em; line-height: 1.6; max-height: 9.6em; overflow-y: auto; }

/* Thương hiệu CubeX */
.brand-name { font-weight: var(--fw-black); letter-spacing: -0.03em; font-size: 1.2rem; }
.brand-name .bx {
  color: var(--accent); font-style: italic; font-size: 1.15em; margin-left: -1px;
}

/* Bàn phím ký hiệu (tab Nhập scramble) */
.kp-input { position: relative; margin-bottom: var(--sp-3); }
.kp-input input { width: 100%; font-family: var(--font-mono); font-weight: 700; letter-spacing: .02em; padding-right: 72px; }
.kp-count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-semibold); pointer-events: none; }
.keypad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 6px; }
.keypad button { min-height: 44px; padding: 0; font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-md); border-radius: var(--r-sm); background: var(--surface-2); }
.keypad button:active { background: var(--accent-soft); color: var(--accent-ink); }
#keypadX button { background: var(--surface-3); }
.kp-actions { display: grid; grid-template-columns: 1.4fr 0.7fr 1fr 1.3fr; gap: 6px; margin-top: var(--sp-2); }
.kp-actions button { min-height: 44px; padding: 0 8px; font-size: var(--fs-sm); }
#kpBack { font-size: 1.15rem; }

/* Chế độ tự giải (VIP) */
.play-cta { margin-top: var(--sp-3); }
.play-cta button { width: 100%; min-height: var(--tap); font-weight: var(--fw-bold); }
.play-box { margin-top: var(--sp-4); padding: var(--sp-4); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.play-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }
.play-stats div { background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; }
.play-stats span { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.play-stats b { font-family: var(--font-mono); font-size: 1.15rem; }
.play-msg { font-size: var(--fs-sm); margin: 0 0 var(--sp-3); color: var(--text-2); }
.play-msg.ok { color: var(--success); font-weight: var(--fw-bold); font-size: var(--fs-md); }
.play-box .keypad button { background: var(--surface); }
.play-rot button { background: var(--surface-3) !important; }
.keypad button.hinted { background: var(--accent) !important; color: var(--on-accent); box-shadow: var(--sh-accent); animation: hint-pop .5s ease-out; }
@keyframes hint-pop { 0% { transform: scale(1); } 35% { transform: scale(1.16); } 100% { transform: scale(1); } }
.play-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: var(--sp-2); }
/* ✕ Thoát Tự giải: chữ rõ ràng + nút nổi ở góc trên trái khung khối (chỉ hiện khi đang tự giải) */
.play-exit { color: var(--danger, #d23c36) !important; font-weight: 800; white-space: nowrap; }
.bp-head .play-exit { min-height: 40px; padding: 0 14px; }
.exit-fab { display: none; position: absolute; top: 10px; left: 10px; z-index: 40; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px; border-radius: 99px;
  border: 1px solid transparent;
  border: 1px solid color-mix(in srgb, var(--danger, #d23c36) 45%, transparent); background: var(--surface, #fff); background: color-mix(in srgb, var(--surface, #fff) 88%, transparent); color: var(--danger, #d23c36);
  font: inherit; font-weight: 800; font-size: .92rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.exit-fab:hover { background: var(--danger, #d23c36); color: #fff; }
body.play-mode #scene { position: relative; }
body.play-mode #scene .exit-fab, #bpScene .exit-fab { display: inline-flex; }
.play-actions button { min-height: 44px; padding: 0 6px; font-size: var(--fs-sm); }
.play-keys { margin: var(--sp-3) 0 0; }
@media (pointer: coarse) { .play-keys { display: none; } }

/* Đang tự giải: bố cục gọn, khối 3D luôn ở trong tầm nhìn */
body.play-mode #view-solver > header,
body.play-mode .view-panel > .hint,
body.play-mode .skin-picker { display: none; }
body.play-mode .scene {
  position: sticky; top: 64px; z-index: 6;
  height: 270px; background: var(--surface); border-radius: var(--r-md);
  box-shadow: 0 10px 14px -12px rgba(0, 0, 0, .25);
}
body.play-mode main { margin-top: 10px; }
body.play-mode .play-box { margin-top: var(--sp-2); }
@media (max-width: 600px) {
  body.play-mode .scene { top: 56px; height: 235px; }
  body.play-mode .view-panel { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
  body.play-mode .play-box { padding: var(--sp-3); }
  body.play-mode .play-stats { margin-bottom: var(--sp-2); }
  body.play-mode .play-stats div { padding: 5px 8px; }
  body.play-mode .play-stats b { font-size: 1rem; }
  body.play-mode .play-msg { margin-bottom: var(--sp-2); font-size: var(--fs-xs); }
  body.play-mode .keypad { gap: 5px; margin-bottom: 5px; }
  body.play-mode .keypad button { min-height: 40px; }
  body.play-mode .play-actions button { min-height: 40px; }
}
/* Khi đang tự giải: ẩn khung tô màu/nhập để trang không cuộn khối 3D đi mất */
body.play-mode .input-panel { display: none; }
body.play-mode main { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
/* Laptop / máy tính: Tự giải nằm ngang – khối 3D bên trái (đứng yên), bảng điều khiển bên phải */
@media (min-width: 901px) {
  body.play-mode main { max-width: 1120px; }
  body.play-mode .view-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); column-gap: var(--sp-5, 24px); align-items: start; }
  body.play-mode .view-panel > .scene { grid-column: 1; grid-row: 1; top: 84px; height: min(560px, calc(100vh - 120px)); box-shadow: none; }
  body.play-mode .view-panel > .play-box { grid-column: 2; grid-row: 1; margin-top: 0; }
}

/* Xem từng mặt (chế độ tự giải) */
.view-faces { display: flex; align-items: center; gap: 4px; margin-bottom: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.view-faces::-webkit-scrollbar { display: none; }
.view-faces span { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--muted); white-space: nowrap; margin-right: 2px; }
.view-faces button { flex: 0 0 auto; min-height: 32px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); background: var(--surface); }
.view-faces button.active { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
@media (max-width: 600px) { body.play-mode .view-faces button { min-height: 30px; padding: 0 9px; } }
/* Tự giải khối lớn 4×4 → 7×7 */
body.bigplay-mode #view-solver > header, body.bigplay-mode #view-solver > main { display: none; }
.big-play { max-width: 1120px; width: calc(100% - 32px); margin: 10px auto 24px; }
.bp-grid { display: grid; gap: var(--sp-3, 12px); }
.bp-cubebox { padding: 0; overflow: hidden; }
.bp-scene { position: relative; height: 300px; overflow: hidden; touch-action: none; background: var(--surface); }
.bp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--sp-2); }
.bp-head b { font-size: var(--fs-lg, 1.15rem); }
.bp-pads .keypad { margin-bottom: 6px; }
.bp-box .play-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bp-box .play-actions button { min-height: 42px; white-space: nowrap; font-size: var(--fs-sm); padding: 0 6px; }
.bp-pads .bp-inner { grid-template-columns: repeat(6, 1fr); }
.bp-pads .bp-inner button { background: var(--surface-3); font-size: var(--fs-sm); min-height: 38px; }
@media (max-width: 600px) { .bp-ctrl-row { flex-wrap: wrap; row-gap: 6px; } }
@media (min-width: 901px) {
  .bp-grid { grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); align-items: start; }
  .bp-cubebox { position: sticky; top: 84px; }
  .bp-scene { height: min(560px, calc(100vh - 120px)); }
}
@media (max-width: 900px) { .bp-cubebox { position: sticky; top: 56px; z-index: 6; } .bp-scene { height: 270px; } .big-play { width: calc(100% - 24px); } }
body.bigplay-mode .ai-fab { display: none; }
.tr-bigsize { margin: 0 0 var(--sp-3, 12px); }
/* Hộp hỏi: chọn cỡ khối */
.ctrl-size { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.ctrl-size span { font-weight: var(--fw-bold); color: var(--muted); font-size: var(--fs-sm); margin-right: 2px; }
.ctrl-size button { min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--border); background: var(--surface); font-weight: var(--fw-bold); }
.ctrl-size button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* Chọn cách xoay: vuốt / bấm nút */
.ctrl-dlg { max-width: 460px; }
.ctrl-opts { display: grid; gap: 10px; margin: 6px 0 8px; }
.ctrl-opt { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; text-align: left; padding: 14px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; }
.ctrl-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.ctrl-ico { grid-row: span 2; font-size: 2rem; line-height: 1; align-self: center; }
.ctrl-opt b { font-size: var(--fs-md); }
.ctrl-opt small { color: var(--muted); font-weight: 400; line-height: 1.4; }
body.play-mode.swipe-ctrl #scene .sticker { cursor: grab; }
/* ✋ Giữ ~0,3 giây rồi kéo = xoay góc nhìn (hold-view.js): khung khối sáng viền + hiện 🔄 để biết đang xoay góc nhìn, không phải xoay tầng */
.view-hold { box-shadow: inset 0 0 0 3px var(--accent, #5b3df5), 0 0 24px transparent !important; box-shadow: inset 0 0 0 3px var(--accent, #5b3df5), 0 0 24px color-mix(in srgb, var(--accent, #5b3df5) 40%, transparent) !important; cursor: grabbing !important; }
.view-hold::after { content: '🔄'; position: absolute; top: 10px; right: 10px; z-index: 30; padding: 4px 10px; border-radius: 99px; background: var(--accent, #5b3df5); color: #fff; font-size: 1.05rem; line-height: 1.3; pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); animation: viewHoldIn .18s ease-out; } /* góc trên phải: không che khối, không đè nhãn "👀 Xem đề" ở giữa */
@keyframes viewHoldIn { from { opacity: 0; transform: scale(.6); } }
@media (max-width: 600px) { .ctrl-row { flex-wrap: wrap; row-gap: 6px; } }
body.play-mode.swipe-ctrl #scene { touch-action: none; }
body.play-mode #scene { overflow: hidden; touch-action: none; } /* phóng to khối: không tràn đè lên bảng điều khiển */
/* Trang Giải Rubik trên điện thoại (không phải Tự giải): vuốt lên/xuống trên khối = cuộn trang; vuốt ngang = xoay khối */
@media (pointer: coarse) { body:not(.play-mode) #scene { touch-action: pan-y; } }
body.play-mode.swipe-ctrl #scene .sticker:active { cursor: grabbing; }
/* Xoay theo hướng đang nhìn */
.view-rel { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-bottom: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }
.vr-toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--fw-bold); cursor: pointer; }
.vr-now { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.vr-now .dot { width: 13px; height: 13px; vertical-align: -2px; }

/* Tư thế cầm khối (chế độ tự giải) */
.hold-row { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.hold-row > span { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--muted); white-space: nowrap; }
.hold-seg { display: flex; gap: 3px; padding: 3px; border-radius: var(--r-md); background: var(--surface-3); flex: 1; }
.hold-seg button { flex: 1; min-height: 34px; border: 0; background: transparent; font-size: var(--fs-sm); display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 0 8px; }
.hold-seg button.active { background: var(--surface); box-shadow: var(--sh-1); font-weight: var(--fw-bold); }
.dot { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid rgba(0,0,0,.25); display: inline-block; }
.dot.w { background: var(--cube-w); }
.dot.y { background: var(--cube-y); }

/* ================= Thanh liên hệ đầu trang ================= */
.contact-bar {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--gold-hero); color: #F6EEDB;
  border-bottom: 1px solid rgba(242, 198, 92, .25);
}
/* vệt sáng trang trí */
.contact-bar::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120px 60px at 12% 0%, rgba(242, 198, 92, .28), transparent 70%),
    radial-gradient(160px 70px at 88% 100%, rgba(140, 124, 255, .22), transparent 70%);
}
.contact-bar > * { position: relative; }
.cb-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cb-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-grad); color: var(--gold-ink);
  font-weight: var(--fw-black); font-size: 0.85rem; letter-spacing: .02em;
  box-shadow: 0 0 0 2px rgba(255, 246, 223, .25), var(--sh-gold);
}
.cb-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cb-text b { font-size: 0.95rem; color: #FFF6DF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-text small { font-size: 11px; color: rgba(246, 238, 219, .7); white-space: nowrap; }
.cb-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  text-decoration: none; font-weight: var(--fw-bold); font-size: 0.88rem; white-space: nowrap;
  transition: transform .1s, filter .15s;
}
.cb-btn:active { transform: scale(.96); }
.cb-btn:hover { filter: brightness(1.08); }
.cb-btn svg { width: 16px; height: 16px; fill: currentColor; }
.cb-phone { background: var(--gold-grad); color: var(--gold-ink); box-shadow: var(--sh-gold); font-family: var(--font-mono); letter-spacing: .01em; }
.cb-zalo { background: #0068FF; color: #fff; }
.zalo-z { width: 18px; height: 18px; border-radius: 5px; background: #fff; color: #0068FF; font-weight: 900; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
/* Khi đang bấm giờ / tự giải: ẩn để không chiếm chỗ */
body.timing .contact-bar, body.play-mode .contact-bar { display: none; }
@media (max-width: 600px) {
  .contact-bar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; gap: var(--sp-2); }
  .cb-avatar { width: 32px; height: 32px; font-size: 0.78rem; }
  .cb-text b { font-size: 0.88rem; }
  .cb-btn { min-height: 34px; padding: 0 10px; font-size: 0.82rem; }
  /* thanh trên đã có khoảng an toàn ở thanh liên hệ */
  .contact-bar:not([hidden]) + .topnav { padding-top: 8px; }
}
@media (max-width: 600px) {
  .cb-zalo { width: 34px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .cb-text b { overflow: visible; }
  .cb-phone { padding: 0 10px 0 9px; gap: 5px; }
}
@media (max-width: 380px) { .cb-avatar { display: none; } .cb-text b { font-size: 0.86rem; } }
@media (max-width: 340px) { .cb-text small { display: none; } .cb-phone { font-size: 0.74rem; padding: 0 8px; } .cb-phone svg { display: none; } }

/* Tên chủ web trong phần liên hệ trang VIP */
.vc-name { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: var(--r-md); background: var(--gold-soft); color: var(--gold-text); font-weight: var(--fw-bold); border: 1px solid var(--gold-line); }

/* Đăng nhập tài khoản VIP */
.act-tabs { margin-bottom: var(--sp-4); }
.login-form { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 460px; }
.lf-field { display: flex; flex-direction: column; gap: 6px; }
.lf-field > span { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); }
.lf-field input { width: 100%; font-family: var(--font-mono); font-weight: 600; letter-spacing: .02em; }
.lf-pass { position: relative; display: block; }
.lf-pass input { padding-right: 72px; }
.lf-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); background: var(--surface); }
.login-form .big { margin-top: 4px; }

/* Trạng thái thanh toán tự động */
.pay-status { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.pay-status b { display: block; }
.pay-status small { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.pay-status.wait { border-color: var(--accent); background: var(--accent-soft); }
.pay-status.under { border-color: var(--warning); }
.pay-status.under b { color: var(--warning); }
.pay-status.done { border-color: var(--success); background: var(--success-soft); }
.pay-status.done b { color: var(--success); }
.pay-spin { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; border: 3px solid var(--accent); border-right-color: transparent; animation: payspin .8s linear infinite; }
@keyframes payspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-spin { animation-duration: 3s; } }

/* ================= Tài khoản Gmail ================= */
.acc-btn { position: relative; }
.acc-btn.logged svg { display: none; }
.acc-initial { display: none; }
.acc-btn.logged { background: var(--accent); border-color: transparent; }
.acc-btn.logged .acc-initial { display: inline; color: var(--on-accent); font-weight: var(--fw-black); font-size: 1rem; }
.acc-modal { width: min(440px, calc(100% - 24px)); }
#accTabs { margin-bottom: var(--sp-4); }
.ar-row { display: flex; gap: 6px; }
.ar-row input { flex: 1; min-width: 0; }
.ar-row button { flex-shrink: 0; min-height: var(--tap); padding: 0 14px; white-space: nowrap; }
#arStep2 { display: flex; flex-direction: column; gap: var(--sp-3); }
#arStep2[hidden] { display: none; }
.ar-code { font-family: var(--font-mono) !important; font-size: 1.5rem !important; letter-spacing: .5em; text-align: center; font-weight: 800; }
.ar-note { margin: 0; }
.af-link { margin: 0; text-align: center; }.acc-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); margin-bottom: var(--sp-2); }
.acc-card b { display: block; word-break: break-all; }
.acc-card small { color: var(--muted); }
.acc-card small.is-vip { color: var(--gold-text); font-weight: var(--fw-bold); }
.acc-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); font-weight: var(--fw-black); font-size: 1.3rem; }
#apVipBtn { background: var(--gold-grad); color: var(--gold-ink); border: 0; font-weight: var(--fw-bold); }
.gmail-pane p { color: var(--text-2); margin: 0 0 var(--sp-3); }
.gmail-pane .hint { margin-top: var(--sp-2); }
.act-tabs button { font-size: var(--fs-sm); white-space: nowrap; }
@media (max-width: 600px) { .act-tabs button { font-size: 12px; padding: 0 6px; } }

/* Ô email / mật khẩu: cùng kiểu với ô nhập khác trong bộ thiết kế */
input[type=email], input[type=password] {
  min-height: var(--tap); padding: 0 var(--sp-4);
  font: var(--fw-medium) 16px var(--font-sans);
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid transparent; border-radius: var(--r-md);
}
input[type=email]:focus, input[type=password]:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.lf-field input[type=email], .lf-field input[type=password] { width: 100%; font-family: var(--font-mono); font-weight: 600; }
.ar-row input { width: auto; }

/* Cảnh báo ghi đúng nội dung chuyển khoản */
.pay-warn {
  display: flex; flex-direction: column; gap: 4px;
  margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); border: 1.5px solid var(--danger);
  background: var(--danger-soft); color: var(--text); font-size: var(--fs-sm); line-height: 1.5;
}
.pay-warn > b { color: var(--danger); font-size: var(--fs-md); }
.pay-warn-strong { font-weight: var(--fw-bold); color: var(--danger); }

/* Huy hiệu thanh liên hệ: logo khối Rubik thay cho chữ cái tên */
.cb-avatar { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; padding: 7px; background: var(--cube-body); border-radius: 10px; align-items: stretch; justify-content: stretch; }
.cb-avatar i { border-radius: 3px; }
.cb-avatar i:nth-child(1) { background: var(--cube-r); }
.cb-avatar i:nth-child(2) { background: var(--cube-y); }
.cb-avatar i:nth-child(3) { background: var(--cube-b); }
.cb-avatar i:nth-child(4) { background: var(--cube-g); }

/* ================= Nút "Đăng ký VIP" thu gọn ================= */
.vip-register { padding: 0; overflow: hidden; border-color: var(--gold-line); }
.vip-reg-toggle {
  width: 100%; min-height: 72px; padding: var(--sp-4) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-3); text-align: left;
  border: 0; border-radius: 0; background: var(--gold-grad); color: var(--gold-ink); box-shadow: none;
}
.vip-reg-toggle:hover:not(:disabled) { background: var(--gold-grad); filter: brightness(1.04); }
.vip-reg-toggle:active:not(:disabled) { transform: none; filter: brightness(.97); }
.vrt-ico { font-size: 1.8rem; line-height: 1; }
.vrt-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.vrt-text b { font-size: var(--fs-xl); font-weight: var(--fw-black); }
.vrt-text small { font-size: var(--fs-sm); font-weight: var(--fw-semibold); opacity: .8; }
.vrt-chev { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.vip-register.open .vrt-chev { transform: rotate(180deg); }
.vip-reg-body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-5); animation: regopen .2s ease; }
@keyframes regopen { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.vip-reg-account { padding-bottom: var(--sp-5); border-bottom: 1px solid var(--border); }
.vip-reg-account .gmail-pane p { margin-top: 0; }
.vip-buy h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.vip-buy .vip-steps { margin: 0; }
@media (max-width: 600px) {
  .vip-reg-toggle { padding: var(--sp-3) var(--sp-4); min-height: 64px; }
  .vrt-text b { font-size: var(--fs-lg); }
  .vip-reg-body { padding: var(--sp-4); }
}

/* ================= Trợ lý AI ================= */
.ai-fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 45;
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 14px;
  border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
  font-weight: var(--fw-bold); box-shadow: var(--sh-accent), var(--sh-2);
}
.ai-fab:hover:not(:disabled) { background: var(--accent-hover); }
.ai-fab svg, .ai-av svg { width: 22px; height: 22px; fill: currentColor; }
.ai-panel {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 46;
  width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-3);
}
.ai-panel[hidden] { display: none; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ai-av { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); }
.ai-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-title small { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-head .icon-btn { width: 36px; height: 36px; min-width: 36px; min-height: 0; border: 1px solid var(--border); }
.ai-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ai-msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: var(--fs-sm); line-height: 1.55; word-wrap: break-word; }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.ai-msg li { margin: 2px 0; }
.ai-msg code { font-family: var(--font-mono); font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.ai-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: aidot 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aidot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.ai-suggest[hidden] { display: none; }
/* Chỉ dùng câu hỏi có sẵn: khu nút nằm dưới, cuộn được khi nhiều câu */
#aiSuggest { max-height: 46%; overflow-y: auto; padding-top: 10px; border-top: 1px solid var(--border); overscroll-behavior: contain; }
#aiSuggest .ai-sg-title { flex: 1 1 100%; margin: 0 0 2px; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--muted); }
#aiSuggest button { text-align: left; min-height: 36px; padding: 6px 12px; line-height: 1.3; }
#aiSuggest button.ai-topic { flex: 1 1 calc(50% - 6px); min-height: 48px; font-size: var(--fs-sm); font-weight: var(--fw-bold); justify-content: center; text-align: center; border-radius: var(--r-md); }
#aiSuggest button.ai-back { background: transparent; color: var(--accent-ink); border: 1px dashed var(--accent); }
.ai-note { padding-top: 6px; }
.ai-suggest button { min-height: 32px; padding: 0 12px; font-size: var(--fs-xs); border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); border: 0; }
.ai-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.ai-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 11px 14px !important; border-radius: var(--r-md); line-height: 1.4; font-family: var(--font-sans); }
.ai-form button { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.ai-form button svg { width: 20px; height: 20px; fill: currentColor; }
.ai-note { margin: 0; padding: 0 14px 10px; font-size: 11px; color: var(--muted); text-align: center; }
/* Không che khi đang bấm giờ / tự giải */
body.timing .ai-fab, body.play-mode .ai-fab, body.timing .ai-panel { display: none; }
@media (max-width: 760px) { body.tr-solving .ai-fab { display: none; } } /* Luyện tập trên điện thoại: không che nút xoay */
@media (max-width: 600px) {
  .ai-fab { bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); right: 14px; min-height: 48px; padding: 0 14px; }
  .ai-form textarea { font-size: 16px; } /* iPhone: chữ < 16px thì tự phóng to trang khi chạm */
  .ai-panel { left: 8px; right: 8px; width: auto; top: max(8px, env(safe-area-inset-top)); bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); height: auto; border-radius: var(--r-lg); }
}

/* ===== Thanh toán bằng ví điện tử (trang VIP) ===== */
.pay-wallets { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.pay-wallets > b { font-size: .95rem; color: var(--text); }
.pay-wallets small { color: var(--muted); line-height: 1.5; }
.pw-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pw { padding: 5px 11px; border-radius: 99px; font-weight: 700; font-size: .85rem; color: #fff; }
.pw.momo { background: #A50064; } .pw.zalo { background: #0068FF; } .pw.shopee { background: #EE4D2D; } .pw.viettel { background: #E3001B; }

/* ===== Luyện tập: khối 3D + câu hỏi "đã thuộc công thức chưa?" ===== */
.tr-scene { height: 250px; cursor: grab; touch-action: none; }
.dy-scene { height: 230px; cursor: grab; touch-action: none; }
.tr-drag { text-align: center; margin: 0; }
.tr-ask { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent);
  text-align: center; animation: trAskIn .35s ease; }
.tr-ask > b { font-size: 1.02rem; color: var(--text); }
.tr-ask small { color: var(--muted); line-height: 1.45; }
.tr-ask-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tr-ask-btns button { flex: 1; min-width: 120px; padding: 11px 14px; font-weight: 700; }
@keyframes trAskIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tr-algbox { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.tr-alg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.tr-algbox code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 1.12rem; font-weight: 700; color: var(--text); word-spacing: 4px; line-height: 1.5; }
.tr-algbox #trDemo { align-self: flex-start; }
.tr-known { text-align: center; font-size: .92rem; color: var(--muted); padding: 8px; border-radius: 12px; background: var(--surface-2); }
@media (max-width: 640px) { .tr-scene { height: 220px; } .dy-scene { height: 210px; } }
.tr-case .tr-scene, .tr-case .tr-ask, .tr-case .tr-algbox, .tr-case .tr-known, .dy-scene { width: 100%; box-sizing: border-box; }
.tr-case .tr-scene, .dy-scene { max-width: 300px; height: 275px; margin: 0 auto; }
@media (max-width: 640px) { .tr-case .tr-scene, .dy-scene { max-width: 270px; height: 250px; } }
/* Luyện tập: thu nhỏ còn 80% trên máy tính cho gọn, dễ nhìn hết (điện thoại giữ nguyên để nút đủ to) */
@media (min-width: 761px) { #view-trainer { zoom: .8; } }
/* Luyện tập: giải trên khối 3D */
.tr-modeseg { display: flex; gap: 3px; padding: 3px; border-radius: var(--r-md); background: var(--surface-3); width: 100%; box-sizing: border-box; }
.tr-modeseg button { flex: 1; min-height: 36px; border: 0; background: transparent; border-radius: 10px; font-size: var(--fs-sm); padding: 0 8px; }
.tr-modeseg button.active { background: var(--surface); box-shadow: var(--sh-1); font-weight: var(--fw-bold); }
.tr-solve { width: 100%; box-sizing: border-box; }
.tr-pad-alg { display: none; }
@media (max-width: 760px) { .tr-pad-alg:not([hidden]) { display: block; margin-top: 6px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-family: var(--font-mono); font-weight: 700; word-spacing: 4px; text-align: center; } }
.tr-mini { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: var(--fs-sm); color: var(--muted); }
.tr-mini b { font-family: var(--font-mono); font-size: 1.25rem; color: var(--text); }
.tr-mini.solved b { color: var(--ok, #17a05d); }
.tr-pad { margin-top: 4px; }
.tr-pad button { min-height: 40px; }
.tr-pad-x button { background: var(--surface-3); font-size: var(--fs-sm); min-height: 36px; }
.tr-pad.off button { opacity: .45; pointer-events: none; }
.tr-solve-actions { display: flex; gap: 6px; }
.tr-solve-actions button { flex: 1; min-height: 38px; }
.tr-keys { font-size: var(--fs-xs); }
.tr-area.solved .t-display { color: var(--ok, #17a05d); }
/* Điện thoại: khối 3D dính ở đầu màn hình khi kéo xuống bấm nút xoay */
@media (max-width: 760px) {
  body.tr-solving .tr-case .tr-scene { position: sticky; top: 60px; z-index: 6; background: var(--surface); border-radius: 0 0 18px 18px; box-shadow: 0 10px 16px -12px rgba(0,0,0,.3); }
}
.dy-preview { width: 100%; }

/* ===== Thanh ưu đãi (bật bằng quan-ly-vip\uu-dai.bat) ===== */
.promo-bar { position: relative; display: flex; align-items: stretch; margin: 10px auto 0; max-width: 1120px; width: calc(100% - 32px);
  border-radius: 14px; overflow: hidden; background: linear-gradient(100deg, #FF5A1F 0%, #F2378D 55%, #8B3DF5 100%); color: #fff;
  box-shadow: 0 8px 22px rgba(242, 55, 141, .28); animation: promoIn .5s ease both; }
.promo-bar[hidden] { display: none; }
@keyframes promoIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.promo-bar a { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #fff; text-decoration: none; min-width: 0; }
.promo-bar .pb-fire { font-size: 1.35rem; animation: promoFire 1.4s ease-in-out infinite; }
@keyframes promoFire { 50% { transform: scale(1.18) rotate(-6deg); } }
.promo-bar .pb-text { flex: 1; font-size: .95rem; line-height: 1.35; }
.promo-bar .pb-text s { opacity: .75; font-size: .85em; }
.promo-bar .pb-go { flex: none; padding: 7px 12px; border-radius: 99px; background: #fff; color: #C2185B; font-weight: 800; font-size: .85rem; white-space: nowrap; }
.promo-x { flex: none; width: 38px; border: 0; background: rgba(0,0,0,.12); color: #fff; font-size: .95rem; cursor: pointer; }
.promo-x:hover { background: rgba(0,0,0,.22); }
.old-price { opacity: .55; font-size: .62em; font-weight: 600; margin-right: 6px; }
body.promo-on .vip-reg-toggle .vrt-text small { color: #8a1c4f; font-weight: 700; }
[data-theme="dark"] body.promo-on .vip-reg-toggle .vrt-text small, body.promo-on[data-theme="dark"] .vip-reg-toggle .vrt-text small { color: #ffd1e3; }
body.timing .promo-bar, body.play-mode .promo-bar { display: none; }
@media (max-width: 640px) {
  .promo-bar { width: calc(100% - 24px); margin-top: 8px; }
  .promo-bar a { padding: 9px 10px; gap: 8px; }
  .promo-bar .pb-text { font-size: .86rem; }
  .promo-bar .pb-go { padding: 6px 9px; font-size: .78rem; }
}

/* ================= 🎮 Thử thách hôm nay (daily.js) ================= */
.dy2-hero { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dy2-hero h2 { margin: 0; }
.dy2-level { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); background: linear-gradient(135deg, #6d4dff, #b14dff); color: #fff; min-width: 240px; box-shadow: 0 6px 18px rgba(109, 77, 255, .3); }
.lv-num { display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1; opacity: .9; }
.lv-num b { font-size: 26px; line-height: 1.05; }
.lv-info { flex: 1; min-width: 0; }
.lv-info b { font-size: 14px; }
.lv-bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .3); overflow: hidden; margin: 4px 0 2px; }
.lv-bar i { display: block; height: 100%; background: #ffe066; border-radius: 4px; transition: width .6s; }
.lv-info small { font-size: 11px; opacity: .9; }
.dy2-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.dy2-stats div { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.dy2-stats span { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dy2-stats b { font-size: 1.1rem; font-family: var(--font-mono); }
.dy2-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.dy2-week .wk { text-align: center; padding: 6px 2px; border-radius: var(--r-sm); background: var(--surface-2); border: 2px solid transparent; display: flex; flex-direction: column; gap: 1px; }
.dy2-week .wk small { color: var(--muted); font-size: 11px; font-weight: 700; }
.dy2-week .wk span { font-size: 18px; line-height: 1.2; }
.dy2-week .wk i { font-style: normal; font-size: 10px; color: var(--muted); min-height: 12px; }
.dy2-week .wk.on { background: rgba(255, 140, 0, .12); }
.dy2-week .wk.today { border-color: var(--accent); }
.dy2-week .wk.fut { opacity: .45; }
.dy2-missions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.dy2-m { display: flex !important; align-items: center; gap: 10px; text-align: left; padding: 12px !important; min-height: 70px; border-radius: var(--r-md) !important; border: 2px solid var(--border) !important; background: var(--surface) !important; color: var(--text) !important; transition: transform .15s, border-color .15s; }
.dy2-m:hover { transform: translateY(-2px); }
.dy2-m.active { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
.dy2-m.done { background: linear-gradient(135deg, rgba(61, 220, 132, .14), transparent) !important; }
.dy2-m .m-ic { font-size: 28px; }
.dy2-m .m-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dy2-m .m-t small { color: var(--muted); font-weight: 500; font-size: .8rem; }
.dy2-m .m-st { font-size: 18px; }
.dy2-stage { background: var(--surface-2); border-radius: var(--r-lg); padding: 14px; margin-bottom: 12px; animation: dyIn .25s ease-out; }
@keyframes dyIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dy2-intro { margin: 0 0 10px; line-height: 1.5; }
.dy-practice { position: absolute; top: 10px; left: 0; right: 0; text-align: center; font-size: .8rem; color: var(--muted); }
#dyArea { position: relative; }
.dy-lbl { display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; color: rgba(0, 0, 0, .62); text-shadow: 0 1px 0 rgba(255, 255, 255, .5); font-family: var(--font-mono); }
.dy2-pz { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dy2-pz-bar { display: flex; justify-content: space-between; font-weight: 700; margin-top: 6px; padding: 0 6px; }
.dy2-pz-bar span:last-child { color: #f5a400; letter-spacing: 2px; font-size: 18px; }
.dy2-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.dy2-pad button { min-height: 44px; padding: 0; font-family: var(--font-mono); font-weight: 700; font-size: 16px; }
.dy2-pad button.hint { background: #ffe066 !important; color: #222 !important; animation: dyPulse .6s 3; }
@keyframes dyPulse { 50% { transform: scale(1.12); } }
.dy2-pz-ctrl { margin-top: 10px; flex-wrap: wrap; }
.dy2-qz-top { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-weight: 800; font-size: 20px; margin-bottom: 8px; }
.qz-bar { flex: 1; height: 10px; border-radius: 5px; background: var(--surface-3, rgba(0, 0, 0, .1)); overflow: hidden; }
.qz-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3ddc84, #ffd60a); }
.dy2-qz.hurry .qz-bar i { background: #ff4d6d; }
.dy2-qz.hurry #qzTime { color: #ff4d6d; animation: dyPulse .5s infinite; }
#qzPts { min-width: 56px; text-align: right; color: var(--accent); }
.dy2-qz-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
.dy2-qz-cube { position: relative; }
.qz-combo { position: absolute; top: 6px; right: 6px; font-weight: 900; font-size: 24px; color: #ff7b00; text-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.qz-combo.pop { animation: dyPop .35s ease-out; }
@keyframes dyPop { 0% { transform: scale(.4); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qz-opts button { min-height: 64px; font-family: var(--font-mono); font-size: 26px; font-weight: 800; position: relative; border-radius: var(--r-md); }
.qz-opts button small { position: absolute; top: 4px; left: 8px; font-size: 11px; opacity: .5; font-family: var(--font-sans); }
.qz-opts button.right { background: #3ddc84 !important; color: #fff !important; }
.qz-opts button.wrong { background: #ff4d6d !important; color: #fff !important; }
.qz-intro h3 { margin: 0 0 4px; font-size: 26px; }
.dy2-qz.shake { animation: dyShake .35s; }
@keyframes dyShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.dy2-share { text-align: center; margin: 4px 0 14px; }
.dy2-badges { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.dy2-badges .bd { text-align: center; padding: 10px 6px; border-radius: var(--r-md); background: var(--surface-2); filter: grayscale(1); opacity: .45; display: flex; flex-direction: column; gap: 2px; }
.dy2-badges .bd.got { filter: none; opacity: 1; background: linear-gradient(160deg, rgba(255, 214, 10, .22), var(--surface-2)); box-shadow: inset 0 0 0 1px rgba(255, 180, 0, .5); }
.dy2-badges .bd span { font-size: 26px; }
.dy2-badges .bd b { font-size: 12px; }
.dy2-badges .bd small { font-size: 10px; color: var(--muted); line-height: 1.3; }
#trDaily .dy-history td:not(:first-child) { text-align: center; }
.dy-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.dy-confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: dyFall linear forwards; }
@keyframes dyFall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: .9; } }
.dy-toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.dy-toast { background: #1b1640; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); animation: dyToast .3s ease-out; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.dy-toast.out { opacity: 0; transform: translateY(-8px); transition: .4s; }
@keyframes dyToast { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
@media (max-width: 760px) {
  .dy2-missions { gap: 6px; }
  .dy2-m { flex-direction: column; gap: 2px; text-align: center; padding: 8px 4px !important; min-height: 0; }
  .dy2-m .m-ic { font-size: 24px; }
  .dy2-m .m-t b { font-size: 13px; line-height: 1.2; }
  .dy2-m .m-t small { font-size: 11px; }
  .dy2-m .m-st { display: none; }
  .dy2-stats { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .dy2-stats div { padding: 6px; align-items: center; text-align: center; }
  .dy2-stats span { font-size: 10px; white-space: normal; line-height: 1.2; }
  .dy2-stats b { font-size: .95rem; }
  .dy2-week { gap: 4px; }
  .dy2-pz, .dy2-qz-main { grid-template-columns: 1fr; }
  .dy2-badges { grid-template-columns: repeat(3, 1fr); }
  .dy2-level { min-width: 0; width: 100%; }
  .qz-opts button { min-height: 56px; font-size: 22px; }
  .dy2-stage { padding: 10px; }
}
@media (max-width: 380px) { .dy2-pad button { font-size: 14px; min-height: 40px; } .dy2-week .wk span { font-size: 15px; } }
body.dy-playing .ai-fab { display: none; } /* đang chơi Ký hiệu chớp nhoáng: không che nút */

/* ---------- 🎁 Dùng thử VIP 15 phút (vip.js – 25/11): thẻ trong hộp "Tính năng VIP" + trang VIP, thanh đếm giờ đầu trang ---------- */
.vip-try { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.vip-try[hidden] { display: none; }
.vip-try-page { margin: 0 0 16px; }
.vip-try .vt-rows { display: flex; flex-direction: column; gap: 8px; }
.vip-try .vt-row { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 10px 12px; border-radius: var(--r-md, 12px);
  background: var(--gold-soft, #fff6d9); border: 1px solid var(--gold-line, #f0d27a); }
.vip-try .vt-row b { color: var(--gold-text, #7a5300); }
.vip-try .vt-row span, .vip-try .vt-row small { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.vip-try .vt-row.on { background: var(--success-soft, #e3f7e8); border-color: var(--success, #1b8a3a); }
.vip-try .vt-row.on b { color: var(--success, #1b8a3a); }
.vip-try .vt-row.used { opacity: .85; }
.vip-try .vt-go { width: 100%; min-height: 44px; font-weight: 800; white-space: normal; }
.vip-try .vt-t { font-family: var(--font-mono, ui-monospace, monospace); font-size: 1.05em; }
.vip-try .vt-msg { margin: 0; min-height: 0; font-size: .9rem; }
.vip-try .vt-msg:empty { display: none; }
.vip-try .vt-msg.ok { color: var(--success, #1b8a3a); font-weight: 700; }
.vip-try .vt-msg.bad { color: var(--danger, #c0262d); font-weight: 600; }
.try-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 10px auto 0; max-width: 1120px; width: calc(100% - 32px); box-sizing: border-box;
  padding: 8px 12px; border-radius: 14px; background: linear-gradient(100deg, #12a150 0%, #0f8a7e 100%); color: #fff; box-shadow: 0 6px 18px rgba(15, 138, 126, .25); font-size: .92rem; }
.try-bar[hidden] { display: none; }
.try-bar.ended { background: linear-gradient(100deg, #6b7280 0%, #4b5563 100%); box-shadow: none; }
.try-bar .tbr-i { flex: 1 1 auto; min-width: 0; }
.try-bar .tbr-i + .tbr-i { flex-basis: 100%; }
.try-bar .vt-t { font-family: var(--font-mono, ui-monospace, monospace); }
.try-bar .tbr-go { flex: none; padding: 6px 12px; border-radius: 99px; background: #fff; color: #0f6b5f; font-weight: 800; text-decoration: none; white-space: nowrap; }
.try-bar .tbr-x { flex: none; min-height: 32px; min-width: 32px; padding: 0 8px; border-radius: 99px; border: 0; background: rgba(255, 255, 255, .18); color: #fff; }
body.timing .try-bar, body.play-mode .try-bar, body.bigplay-mode .try-bar, body.duel-playing .try-bar, body.dy-playing .try-bar, body.tr-solving .try-bar { display: none; }

/* ⚠️ Máy chủ quá tải (overload.js) – dòng báo nhỏ giữa đáy màn hình, tự ẩn sau 9 giây */
.overload-toast { position: fixed; inset: auto; margin: 0; border: 0; overflow: visible; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 2147483000;
  width: max-content; max-width: calc(100% - 32px); box-sizing: border-box; padding: 10px 14px; border-radius: 14px; background: #2b2b33; color: #fff;
  font-size: .92rem; line-height: 1.4; box-shadow: 0 10px 28px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.overload-toast.on { opacity: 1; transform: translate(-50%, 0); }
.overload-toast.top { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); }
body.timing .overload-toast, body.play-mode .overload-toast, body.bigplay-mode .overload-toast, body.duel-playing .overload-toast, body.dy-playing .overload-toast, body.tr-solving .overload-toast { display: none; } /* đang bấm giờ / đang giải: không làm phiền */
.vip-page .pay-late { display: block; margin-top: 6px; color: var(--danger, #c0262d); font-weight: 600; }