/* ⚔️ Đấu Rubik online (duel.js) */
.duel { display: flex; flex-direction: column; gap: 12px; max-width: 1100px; }
.du-head h1 { margin: 4px 0 6px; font-size: 1.6rem; }
.du-head p { margin: 0; color: var(--muted); line-height: 1.55; }
.du-lobby { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.du-field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.du-field input, .du-join input { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); background: var(--surface-2); color: inherit; font: inherit; font-size: 1rem; }
.du-join { display: flex; gap: 8px; }
.du-join input { flex: 1; min-width: 0; font-family: var(--font-mono); letter-spacing: .25em; text-transform: uppercase; font-weight: 800; }
.du-join button { min-width: 110px; }
.du-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .88rem; }
.du-or::before, .du-or::after { content: ''; flex: 1; height: 1px; background: var(--border, rgba(127,127,127,.3)); }
.du-note { margin: 0; min-height: 1.2em; font-weight: 600; }
.du-note.bad { color: #d23c36; }
.du-note:empty { display: none; }

.du-room { display: flex; flex-direction: column; gap: 12px; }
.du-room[hidden], .du-play[hidden], .du-end[hidden], .du-wait[hidden] { display: none !important; }
.du-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.du-code { display: flex; flex-direction: column; margin-right: auto; }
.du-code small { color: var(--muted); font-size: 12px; }
.du-code b { font: 800 1.7rem/1.1 var(--font-mono); letter-spacing: .18em; color: var(--accent); }
.du-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.du-x { align-self: center; font: 900 1.3rem var(--font-mono); color: var(--muted); }
.du-p { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border, rgba(127,127,127,.2)); min-width: 0; }
.du-p.me { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.du-p.away, .du-p.empty { opacity: .7; }
.du-av { grid-row: 1 / 3; font-size: 26px; }
.du-p b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.du-p small { grid-column: 2; color: var(--muted); font-size: 12px; }
.du-p em { grid-row: 1; grid-column: 3; font-style: normal; font-weight: 800; font-family: var(--font-mono); }
.du-ready { grid-column: 1 / 4; margin-top: 6px; font-style: normal; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px; justify-self: start; background: var(--surface-2); color: var(--muted); }
.du-ready.on { background: #22c55e; color: #fff; }
.du-wait { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.du-wait p { margin: 0; }

/* ⚔️ Khung đấu: 2 nửa BẰNG NHAU (trái = mình, phải = đối thủ), 2 khối Rubik cùng cỡ */
.du-play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.du-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.du-mine { border: 2px solid var(--accent); }
.du-shead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; }
.du-sav { font-size: 1.4rem; line-height: 1; }
.du-shead > b { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.du-shead small { color: var(--muted); font-size: 12px; margin-right: auto; }
.du-chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-size: 13px; color: var(--muted); white-space: nowrap; }
.du-chip b { font: 800 1.15rem/1.1 var(--font-mono); color: var(--text, inherit); }
.du-foot { display: flex; flex-direction: column; gap: 8px; }
.du-scene { position: relative; height: 380px; overflow: hidden; touch-action: none; border-radius: 14px; background: var(--surface-2); }
/* 15 giây trò chuyện: chỉ khung chat (rộng cả 2 nửa), chưa hiện 2 khối */
body.duel-chatting .du-side { display: none !important; }
.du-play > .du-chat[data-mode="big"] { grid-column: 1 / -1; }
.du-scene.won { animation: duWin 1.2s ease; }
@keyframes duWin { 30% { box-shadow: 0 0 0 6px #22c55e, 0 0 40px #22c55e; } }
.du-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 5rem var(--font-mono); color: var(--accent); background: rgba(0,0,0,.18); pointer-events: none; z-index: 20; text-shadow: 0 4px 20px rgba(0,0,0,.3); }
.du-count[hidden] { display: none; }
.du-count.pop { animation: duPop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes duPop { from { transform: scale(1.8); opacity: 0; } }
.du-ctrl-row { margin: 0; }
#duPads .keypad { margin-bottom: 6px; }
.du-pad { grid-template-columns: repeat(6, 1fr) !important; }
.du-keys { margin: 0; }
.du-emo { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.du-emo span { position: absolute; left: 50%; bottom: 10%; font-size: 3rem; animation: duEmo 2.2s ease-out forwards; }
@keyframes duEmo { from { transform: translate(-50%, 0) scale(.4); opacity: 0; } 15% { transform: translate(-50%, -20px) scale(1.2); opacity: 1; } to { transform: translate(-50%, -140px) scale(1); opacity: 0; } }
.du-emotes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.du-emotes button { min-height: 40px; font-size: 20px; padding: 0; }
.du-emotes button.sent { animation: duSent .4s ease; }
@keyframes duSent { 50% { transform: scale(1.25); } }

.du-end { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.du-end h2 { margin: 0; font-size: 1.5rem; }
.du-end.win { border: 2px solid #22c55e; }
.du-end.lose { border: 2px solid #d23c36; }
.du-end.sus { border: 2px solid #e0a100; } /* ván bị nghi dùng máy giải – không tính */
.du-sus { margin: 0; font-weight: 600; line-height: 1.4; }
/* ⛔ cảnh cáo / cấm đấu vì dùng máy giải */
.du-strike { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(225, 29, 72, .12); color: #be123c; }
.du-warn { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: rgba(245, 158, 11, .16); border: 1.5px solid rgba(245, 158, 11, .6); font-weight: 700; line-height: 1.45; }
.du-warn[hidden] { display: none; }
.du-res { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.du-res div { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.du-res span { font-family: var(--font-mono); font-size: 13px; }
.du-end code { font-size: 12px; word-break: break-word; }
.du-end-act { display: flex; justify-content: center; }
.du-end-act button { min-width: 200px; }
.du-end-act p { margin: 0; }
body.duel-playing .ai-fab { display: none; }

@media (max-width: 760px) {
  .du-vs { grid-template-columns: 1fr; }
  .du-x { display: none; }
  .du-emotes { grid-template-columns: repeat(8, 1fr); gap: 3px; }
  .du-emotes button { min-height: 32px; font-size: 16px; }
}
/* điện thoại cầm DỌC: 2 nửa xếp trên / dưới, cao bằng nhau (đối thủ ở trên) */
@media (max-width: 760px) and (orientation: portrait) {
  .du-play { grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 8px; } /* 2 hàng cao bằng nhau */
  .du-theirs { order: -1; }
  .du-side { padding: 8px; gap: 6px; }
  .du-scene { height: min(300px, 34vh); }
  .du-keys { display: none; }
  /* nửa đối thủ gọn như nửa mình: chỉ 1 hàng ô nhắn + 😈 + đầu hàng (tin của đối thủ nổi trên khối họ) */
  .du-theirs .du-foot { flex-direction: row; align-items: center; }
  .du-theirs .du-emotes, .du-chat[data-mode="mini"] .du-chat-log, .du-chat[data-mode="mini"] .du-mute { display: none; }
  .du-theirs .du-chat { flex: 1; min-width: 0; }
  #duResign { flex: none; padding: 0 10px; font-size: .82rem; }
  .du-chat[data-mode="mini"] .du-chat-in button[type="submit"] { padding: 0 9px; }
  .du-chat[data-mode="mini"] .du-chat-in button[type="submit"] span { display: none !important; }
  .du-chat[data-mode="mini"] .du-chat-in button[type="submit"]::before { content: '➤'; }
}

/* 👀 15 giây xem đề: nhãn nhỏ trên khối thay cho số to che khối (3 giây cuối mới đếm số to) */
.du-count.insp { inset: 10px auto auto 50%; transform: translateX(-50%); width: auto; height: auto; padding: 6px 14px; border-radius: 99px; font: 800 .95rem/1.2 var(--font-sans, inherit); color: #fff; background: rgba(20, 16, 50, .72); text-shadow: none; white-space: nowrap; }

/* 💬 Trò chuyện + nhãn dán khiêu khích */
.du-chat { display: flex; flex-direction: column; gap: 8px; position: relative; }
.du-chat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.du-chat-timer { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.du-chat-timer:empty { display: none; }
.du-mute { margin-left: auto; font-size: .8rem; min-height: 0 !important; padding: 2px 4px; }
.du-chat-log { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; font-size: .9rem; line-height: 1.35; overscroll-behavior: contain; }
.du-chat-log:empty::before { content: attr(data-empty); color: var(--muted); font-size: .85rem; }
.du-msg { overflow-wrap: anywhere; }
.du-msg b { margin-right: 6px; color: var(--accent); }
.du-msg.me b { color: var(--muted); }
.du-msg.stk span { font-weight: 800; }
.du-msg.sys { color: var(--muted); font-style: italic; font-size: .85em; }
.du-stk { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.du-stk button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 54px; padding: 4px 2px; border-radius: 12px; line-height: 1.1; }
.du-stk button i { font-style: normal; font-size: 1.45rem; }
.du-stk button small { font-size: .62rem; font-weight: 700; color: var(--muted); }
.du-stk button:active { transform: scale(.94); }
.du-chat-in { display: flex; gap: 6px; margin: 0; }
.du-chat-in input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); background: var(--surface-2); color: inherit; font: inherit; }
.du-chat-in button { min-height: 40px; padding: 0 14px; }
.du-stk-btn { display: none; font-size: 1.2rem; padding: 0 10px !important; }
/* trước ván (to, thế chỗ khối của mình) */
.du-chat[data-mode="big"] { min-height: 300px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 2px solid var(--accent); }
.du-chat[data-mode="big"] .du-chat-head b { font-size: 1.05rem; }
.du-chat[data-mode="big"] .du-chat-timer { font-size: 1.05rem; }
.du-chat[data-mode="big"] .du-chat-log { flex: 1; max-height: none; min-height: 80px; }
/* đang đấu (gọn bên cột đối thủ): nhãn dán mở bằng nút 😈 */
.du-chat[data-mode="mini"] { padding: 0; gap: 6px; }
.du-chat[data-mode="mini"] .du-chat-head b, .du-chat[data-mode="mini"] .du-chat-timer { display: none; }
.du-chat[data-mode="mini"] .du-chat-log { max-height: 84px; font-size: .82rem; }
.du-chat[data-mode="mini"] .du-stk-btn { display: inline-flex; align-items: center; }
.du-chat[data-mode="mini"] .du-stk { display: none; position: absolute; right: 0; bottom: calc(100% + 6px); width: min(300px, 86vw); z-index: 30; padding: 8px; border-radius: 14px; background: var(--surface, #fff); box-shadow: 0 12px 32px rgba(0, 0, 0, .25); }
.du-chat[data-mode="mini"].stk-open .du-stk { display: grid; }
.du-chat[data-mode="mini"] .du-chat-in input { min-height: 34px; font-size: .85rem; }
.du-chat[data-mode="mini"] .du-chat-in button { min-height: 34px; padding: 0 10px; font-size: .85rem; }
/* bong bóng tin của đối thủ nổi trên khối của họ */
.du-bub { position: absolute; left: 6px; right: 6px; top: 6px; padding: 6px 10px; border-radius: 12px 12px 12px 3px; background: var(--surface, #fff); color: var(--text, #14161c); font-size: .82rem; font-weight: 600; line-height: 1.3; box-shadow: 0 6px 16px rgba(0, 0, 0, .22); overflow-wrap: anywhere; animation: duBub 4.2s ease forwards; }
.du-bub.stk { font-size: 1rem; font-weight: 800; text-align: center; border-radius: 14px; background: linear-gradient(135deg, #ffd23f, #ff6b6b); color: #2a0f00; animation-duration: 3.2s; }
@keyframes duBub { 0% { transform: translateY(-8px) scale(.85); opacity: 0; } 8% { transform: none; opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }

/* 📱 Lời nhắc xoay ngang: chỉ hiện trên điện thoại đang cầm DỌC lúc vào trận (máy không tự khoá ngang được, VD iPhone) */
.du-rot { display: none; align-items: center; gap: 10px; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft, rgba(91, 61, 245, .12)); color: var(--accent-ink, inherit); font-weight: 700; font-size: .88rem; line-height: 1.35; }
.du-rot .du-rot-i { font-style: normal; font-size: 1.5rem; display: inline-block; flex: none; animation: duRot 2.4s ease-in-out infinite; }
@keyframes duRot { 0%, 30% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 600px) { /* nổi trên màn hình (trang đã cuộn tới khối Rubik) – tự ẩn sau 7 giây */
  body.duel-playing .du-rot { display: flex; position: fixed; left: 12px; right: 12px; top: calc(66px + env(safe-area-inset-top)); z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); background: var(--surface, #fff); border: 2px solid var(--accent, #5b3df5); pointer-events: none; animation: duRotOut .4s 7s forwards; }
}
@keyframes duRotOut { to { opacity: 0; visibility: hidden; } }

/* 📱 Điện thoại cầm NGANG trong trận: ẩn thanh menu / tiêu đề, khối của mình to bên trái, nút điều khiển giữa, khối đối thủ bên phải */
@media (orientation: landscape) and (max-height: 520px) {
  body.duel-playing .topnav, body.duel-playing .contact-bar, body.duel-playing .subnav, body.duel-playing .promo-bar, body.duel-playing .nav-tabs,
  body.duel-playing .du-head, body.duel-playing .du-vs, body.duel-playing .du-wait, body.duel-playing .du-warn { display: none !important; }
  body.duel-playing { padding-bottom: 0 !important; }
  body.duel-playing #view-duel, body.duel-playing .duel { padding-top: 6px !important; padding-bottom: 4px !important; margin-top: 0 !important; margin-bottom: 0 !important; }
  body.duel-playing .duel { gap: 6px; }
  body.duel-playing .du-room { gap: 6px; }
  body.duel-playing .du-bar { padding: 4px 10px; gap: 8px; }
  body.duel-playing .du-code { flex-direction: row; align-items: baseline; gap: 6px; }
  body.duel-playing .du-code b { font-size: 1.05rem; }
  body.duel-playing .du-bar button { min-height: 32px; padding: 4px 10px; font-size: .82rem; }
  /* 2 nửa bằng nhau cạnh nhau: dòng tên → khối (cùng cỡ, cao vừa 1 màn hình) → phần dưới cao bằng nhau */
  body.duel-playing .du-play { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  body.duel-playing .du-side { padding: 6px; gap: 6px; }
  body.duel-playing .du-shead { min-height: 26px; gap: 6px; flex-wrap: nowrap; }
  body.duel-playing .du-sav { font-size: 1.1rem; }
  body.duel-playing .du-shead > b { font-size: .92rem; }
  body.duel-playing .du-chip { padding: 2px 8px; font-size: 11px; }
  body.duel-playing .du-chip b { font-size: .95rem; }
  body.duel-playing .du-scene { height: calc(100vh - 194px); height: calc(100dvh - 194px); min-height: 140px; }
  body.duel-playing .du-foot { height: 70px; overflow-y: auto; gap: 4px; justify-content: flex-start; } /* (center + cuộn: phần trên bị cắt, không cuộn lên được) */
  body.duel-playing .du-skillmsg { top: -4px; padding: 4px 12px; font-size: .78rem; max-width: min(80%, 460px); } /* thông báo skill gọn hơn */
  /* 👑 bảng 3 nước gọn 1 hàng mỏng ở đáy (khung khối thấp – không che khối) */
  body.duel-playing .du-guide { bottom: 4px; padding: 3px 8px; border-radius: 10px; }
  body.duel-playing .du-guide > b, body.duel-playing .du-guide-mv small { display: none; }
  body.duel-playing .du-guide-mv { margin-top: 0; gap: 6px; flex-wrap: nowrap; }
  body.duel-playing .du-guide-mv span { flex-direction: row; gap: 5px; min-width: 0; padding: 2px 7px; }
  body.duel-playing .du-guide-mv i { width: 12px; height: 12px; }
  body.duel-playing .du-guide-mv b { font-size: .95rem; }
  /* ⚡ nút skill gọn 1 dòng cho vừa phần dưới 70px */
  body.duel-playing .du-skill-btn, body.duel-playing .du-skill-auto { flex-direction: row; justify-content: center; gap: 8px; min-height: 30px; padding: 2px 10px; border-radius: 10px; flex: none; }
  body.duel-playing .du-skill-btn b, body.duel-playing .du-skill-auto b { font-size: .84rem; white-space: nowrap; }
  body.duel-playing .du-skill-btn small, body.duel-playing .du-skill-auto small { font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  body.duel-playing .du-ctrl-row { flex-wrap: nowrap; gap: 4px; font-size: .8rem; }
  body.duel-playing .du-ctrl-row > span { display: none; }
  body.duel-playing #duPads .keypad { margin-bottom: 3px; gap: 3px; }
  body.duel-playing #duPads button { min-height: 26px; height: 26px; padding: 0; font-size: .78rem; }
  body.duel-playing .du-ctrl-row .hold-seg button { min-height: 28px; padding: 2px 8px; font-size: .8rem; }
  body.duel-playing .du-keys { display: none; }
  /* nửa đối thủ: ô nhắn + nút 😈 + nút đầu hàng trên 1 hàng (tin của đối thủ nổi trên khối họ) */
  body.duel-playing .du-theirs .du-foot { flex-direction: row; align-items: center; }
  body.duel-playing .du-theirs .du-emotes { display: none; }
  body.duel-playing .du-theirs .du-chat { flex: 1; min-width: 0; }
  body.duel-playing #duResign { flex: none; min-height: 34px; padding: 0 10px; font-size: .8rem; }
  body.duel-playing .du-chat[data-mode="mini"] .du-chat-log, body.duel-playing .du-chat[data-mode="mini"] .du-mute { display: none; }
  body.duel-playing .du-chat[data-mode="mini"] .du-chat-in button[type="submit"] { padding: 0 9px; }
  body.duel-playing .du-chat[data-mode="mini"] .du-chat-in button[type="submit"] span { display: none !important; }
  body.duel-playing .du-chat[data-mode="mini"] .du-chat-in button[type="submit"]::before { content: '➤'; }
  body.duel-playing .du-chat[data-mode="mini"] .du-stk-btn { padding: 0 6px !important; }
  body.duel-playing .du-chat[data-mode="mini"] .du-stk { right: 0; bottom: calc(100% + 4px); width: 300px; }
  /* 💬 15 giây trò chuyện: khung chat rộng cả màn hình */
  body.duel-chatting .du-play > .du-chat { height: calc(100vh - 72px); height: calc(100dvh - 72px); min-height: 200px; padding: 8px; gap: 6px; }
  body.duel-chatting .du-chat .du-stk button { min-height: 44px; }
  body.duel-chatting .du-chat .du-stk button i { font-size: 1.2rem; }
}

/* 📜 Luật Đấu Rubik: khung gập ở sảnh + hộp "đọc & đồng ý" lần đầu vào trận */
.du-rules { margin-top: 12px; border: 1px solid var(--border, #e1e4eb); border-radius: 12px; padding: 0 12px; background: var(--surface, #fff); }
.du-rules summary { cursor: pointer; padding: 10px 0; font-weight: 800; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.du-rules summary::-webkit-details-marker { display: none; }
.du-rules summary::after { content: '▾'; margin-left: auto; opacity: .6; }
.du-rules[open] summary::after { content: '▴'; }
.du-rules summary small { font-weight: 600; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: rgba(31, 157, 85, .14); color: #1f9d55; }
.du-rules summary small.need { background: rgba(229, 57, 53, .12); color: #d32f2f; }
.du-rules-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 7px; }
.du-rules-list li { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: start; font-size: .86rem; line-height: 1.4; }
.du-rules-list li span { font-size: 1.05rem; line-height: 1.3; }
.du-rules-list li p { margin: 0; }
.du-rules-dlg { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 0; border-radius: 18px; padding: 18px 18px 16px;
  background: var(--surface, #fff); color: var(--text, #14161c); box-shadow: 0 24px 60px rgba(15, 12, 40, .35); }
.du-rules-dlg::backdrop { background: rgba(10, 8, 25, .55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.du-rules-dlg h3 { margin: 0 0 4px; font-size: 1.15rem; }
.du-rules-lead { margin: 0 0 12px; color: #d32f2f; font-weight: 700; font-size: .88rem; }
.du-rules-ok { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; font-weight: 700; cursor: pointer; }
.du-rules-ok input { width: 20px; height: 20px; accent-color: var(--accent, #5b3df5); }
.du-rules-btns { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.du-rules-btns .primary:disabled { opacity: .45; cursor: not-allowed; }

/* ⚡ Skill khối Shop (duel.js: renderSkillBar / onSkill / fx) – hiệu ứng là LỚP PHỦ (không filter lên khối 3D) */
.du-play { position: relative; }
.du-skillmsg { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 45; max-width: min(92%, 560px); padding: 8px 16px; border-radius: 99px; text-align: center;
  background: linear-gradient(135deg, #2a0f5c, #5b3df5); color: #fff; font-weight: 800; font-size: .92rem; box-shadow: 0 8px 24px rgba(40, 10, 90, .45); pointer-events: none; }
.du-skillmsg[hidden] { display: none; }
.du-skillmsg.pop { animation: duSkPop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes duSkPop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
.du-skillbar[hidden] { display: none; }
.du-skill-btn, .du-skill-auto { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 48px; padding: 6px 12px; border-radius: 14px; font: inherit; text-align: center; }
.du-skill-btn { cursor: pointer; border: 0; color: #fff; background: linear-gradient(135deg, #ff6a00, #ff2e63); box-shadow: 0 6px 16px rgba(255, 60, 60, .35); }
.du-skill-btn.k-freeze { background: linear-gradient(135deg, #1a0b3a, #7c3aed); box-shadow: 0 6px 16px rgba(124, 58, 237, .45); }
.du-skill-btn:not(:disabled):hover { transform: translateY(-1px); }
.du-skill-btn:disabled { cursor: default; opacity: .5; box-shadow: none; filter: grayscale(.4); }
.du-skill-btn b, .du-skill-auto b { font-size: .95rem; } .du-skill-btn small, .du-skill-auto small { font-size: .74rem; opacity: .9; }
.du-skill-auto { border: 1px dashed var(--border-strong, var(--border)); background: var(--surface-2); color: var(--text, inherit); }
.du-skill-auto.k-shield { border-color: #ff6ec7; } .du-skill-auto.k-insight { border-color: #5ac8fa; }
.du-sk { display: block; margin-top: 3px; font-size: .74rem; font-weight: 700; color: #7c3aed; } .du-sk.off { color: var(--muted); text-decoration: line-through; }
.du-skopt { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 10px auto 0; padding: 10px 12px; max-width: 560px; border-radius: 14px; background: var(--surface-2); font-size: .88rem; text-align: center; }
.du-skopt-t { font-weight: 800; font-size: .82rem; color: var(--muted); }
.du-modeseg { width: 100%; }
.du-modeseg button { flex: 1; white-space: nowrap; font-size: .86rem; }
/* 🎮 hộp chọn chế độ khi tạo phòng + nhãn chế độ trên thanh phòng */
.du-mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.du-mode-card { display: flex; flex-direction: column; align-items: center; gap: 4px; height: auto; min-height: 0; padding: 14px 10px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text, inherit); font: inherit; white-space: normal; cursor: pointer; text-align: center; transition: transform .15s, border-color .15s; }
.du-mode-card:hover { transform: translateY(-2px); }
.du-mode-card.k-pure:hover { border-color: #2f86ec; } .du-mode-card.k-skill:hover { border-color: #7c3aed; }
.du-mode-card.k-skill { background: linear-gradient(180deg, var(--surface), var(--surface)); background: linear-gradient(180deg, color-mix(in srgb, #7c3aed 10%, var(--surface)), var(--surface)); }
.du-mode-i { font-size: 2rem; line-height: 1.1; }
.du-mode-card b { font-size: 1rem; } .du-mode-card small { color: var(--muted); line-height: 1.4; font-size: .8rem; }
@media (max-width: 480px) { .du-mode-pick { grid-template-columns: 1fr; } }
.du-mode { padding: 4px 12px; border-radius: 99px; font-weight: 800; font-size: .82rem; white-space: nowrap; }
.du-mode.k-pure { background: rgba(47, 134, 236, 0.14); background: color-mix(in srgb, #2f86ec 14%, transparent); color: #1f6fd1; }
.du-mode.k-skill { background: rgba(124, 58, 237, 0.14); background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.du-skopt small { display: block; color: var(--muted); }
/* ☄️ Mưa sao băng: rung + mờ (backdrop-filter trên lớp phủ, khối 3D không bị dẹt) */
.du-scene.du-fx-meteor { animation: duShake .22s linear 9; }
.du-scene.du-fx-meteor::before { content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); background: radial-gradient(circle at 50% 60%, rgba(255, 140, 0, .12), rgba(60, 20, 0, .25)); }
.du-scene.du-fx-meteor::after { content: '☄️ ☄️ ☄️'; position: absolute; top: -20%; left: 0; right: 0; z-index: 31; pointer-events: none; text-align: center; font-size: 2.2rem; letter-spacing: 1.5em; animation: duMeteor .7s linear infinite; }
@keyframes duShake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-5px, 3px) rotate(-.6deg); } 50% { transform: translate(4px, -3px); } 75% { transform: translate(-3px, -2px) rotate(.5deg); } }
@keyframes duMeteor { from { transform: translate(30%, 0); opacity: 1; } to { transform: translate(-30%, 520%); opacity: .2; } }
/* 🕳️ Hút thời gian: đóng băng */
.du-scene.du-fx-freeze::before { content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, rgba(10, 0, 30, .05) 30%, rgba(80, 40, 200, .45)), repeating-conic-gradient(from 0deg, rgba(167, 139, 250, .18) 0 10deg, transparent 10deg 20deg); box-shadow: inset 0 0 0 3px #a78bfa, inset 0 0 40px rgba(124, 58, 237, .8); animation: duWarp 2s linear; }
.du-scene.du-fx-freeze::after { content: '🕳️ ⏸'; position: absolute; top: 12px; right: 12px; z-index: 31; padding: 4px 10px; border-radius: 99px; background: #4c1d95; color: #fff; font-size: 1rem; pointer-events: none; }
@keyframes duWarp { from { opacity: 0; } 10% { opacity: 1; } 85% { opacity: 1; } to { opacity: 0; } }
.du-scene.du-fx-nope { animation: duShake .25s linear 1; }
/* 🌈 lá chắn chặn · 💎 soi thấu */
.du-scene.du-fx-shield::before { content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 4px #ff6ec7, inset 0 0 30px rgba(255, 110, 199, .7); animation: duWarp 1.2s linear; }
.du-scene.du-fx-shield::after { content: '🌈🛡'; position: absolute; top: 12px; right: 12px; z-index: 31; font-size: 1.6rem; pointer-events: none; }
.du-scene.du-fx-insight::before { content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 3px #5ac8fa, inset 0 0 30px rgba(90, 200, 250, .7); animation: duWarp 1.5s linear; }
@media (prefers-reduced-motion: reduce) { .du-scene.du-fx-meteor, .du-scene.du-fx-meteor::after, .du-scene.du-fx-nope { animation: none; } }
.du-mode-dlg .du-rules-lead { color: var(--muted); font-weight: 600; } /* hộp chọn chế độ: chữ giải thích không phải cảnh báo */
/* 👑 💎 🔥 Skill khối VIP */
.du-guide { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 32; width: max-content; max-width: calc(100% - 16px); padding: 8px 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(59, 15, 92, .94), rgba(120, 80, 10, .94)); color: #ffe9a8; box-shadow: 0 0 0 2px #e8b931, 0 8px 22px rgba(0, 0, 0, .35); pointer-events: none; text-align: center; animation: duSkPop2 .35s cubic-bezier(.3, 1.6, .5, 1); }
.du-guide[hidden] { display: none; }
@keyframes duSkPop2 { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
.du-guide > b { font-size: .82rem; }
.du-guide-mv { display: flex; gap: 8px; justify-content: center; margin-top: 4px; flex-wrap: wrap; }
.du-guide-mv span { display: flex; flex-direction: column; align-items: center; padding: 3px 8px; border-radius: 10px; background: rgba(255, 255, 255, .12); min-width: 58px; }
.du-guide-mv i { width: 16px; height: 16px; border-radius: 4px; box-shadow: 0 0 0 1.5px #fff; }
.du-guide-mv b { font: 900 1.15rem/1.2 var(--font-mono, monospace); color: #fff; }
.du-guide-mv small { font-size: .66rem; opacity: .9; white-space: nowrap; }
/* 💎 Lóa mắt: ô màu thành xám (đổi nền ô – KHÔNG filter lên khối 3D) + lớp phủ chói sáng */
.du-scene.du-fx-blind .sticker { background: #9aa0a6 !important; box-shadow: none !important; }
.du-scene.du-fx-blind .sticker::after { display: none !important; }
.du-scene.du-fx-blind::before { content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none; border-radius: inherit; background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .55), rgba(200, 230, 255, .12) 60%); box-shadow: inset 0 0 0 3px #bfe9ff; animation: duWarp 3s linear; }
.du-scene.du-fx-blind::after { content: '💎✨'; position: absolute; top: 12px; right: 12px; z-index: 31; font-size: 1.5rem; pointer-events: none; }
/* 🔥 Tái sinh ngược: lửa phượng hoàng cuộn ngược */
.du-scene.du-fx-rewind::before { content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none; border-radius: inherit; background: conic-gradient(from 0deg, rgba(255, 120, 40, .4), rgba(232, 49, 126, .15), rgba(255, 200, 60, .4), rgba(255, 120, 40, .4)); box-shadow: inset 0 0 0 3px #ff7a3c, inset 0 0 40px rgba(255, 94, 58, .7); animation: duWarp 1.5s linear; }
.du-scene.du-fx-rewind::after { content: '🔥⏪'; position: absolute; top: 12px; right: 12px; z-index: 31; font-size: 1.5rem; pointer-events: none; }
.du-skill-btn.k-guide { background: linear-gradient(135deg, #3b0f5c, #b8860b); color: #ffe9a8; }
.du-skill-btn.k-blind { background: linear-gradient(135deg, #6b7c93, #bfe9ff); color: #10233a; }
.du-skill-btn.k-rewind { background: linear-gradient(135deg, #ff5e3a, #e8317e); }

/* 💻 Nhắc laptop: GIỮ Shift + kéo chuột = xoay nhìn khối – chỉ hiện trên máy có chuột (điện thoại / máy tính bảng không thấy) */
.du-pchint { display: none; }
@media (hover: hover) and (pointer: fine) {
  .du-pchint { display: block; }
  .du-foot .du-pchint { margin: 0 0 6px; padding: 6px 10px; border-radius: 10px; background: rgba(91, 61, 245, 0.12); background: color-mix(in srgb, #5b3df5 12%, transparent); font-size: .84rem; line-height: 1.4; text-align: center; }
  .du-foot .du-pchint b { color: var(--accent, #5b3df5); }
}
/* 💻 cùng dòng nhắc ở Tự giải 3×3 / khối lớn (index.html .pc-shift) */
@media (hover: hover) and (pointer: fine) {
  .pc-shift { margin: 6px 0; padding: 6px 10px; border-radius: 10px; background: rgba(91, 61, 245, 0.12); background: color-mix(in srgb, #5b3df5 12%, transparent); font-size: .84rem; line-height: 1.4; text-align: center; }
  .pc-shift b { color: var(--accent, #5b3df5); }
}

/* 🎁 nút Tự giải: nhãn 'Miễn phí · còn x/3' (app.js fpBadge) */
.vip-badge.free { background: #16a34a !important; color: #fff !important; }
.fp-note { margin: 6px 0; padding: 6px 10px; border-radius: 10px; background: rgba(22, 163, 74, 0.14); background: color-mix(in srgb, #16a34a 14%, transparent); font-weight: 700; font-size: .86rem; text-align: center; }

/* 🎉 nút skill khối sự kiện */
.du-skill-btn.ev { background: linear-gradient(135deg, #ff006e, #ff8c1a 55%, #ffbe0b); color: #fff; box-shadow: 0 6px 18px rgba(255, 0, 110, .4); }

/* ---------- 🛡️ Điểm uy tín + chống treo máy (duel.js – 25/11) ---------- */
.du-p .du-rep { margin-left: 6px; font-family: var(--font-sans, inherit); } /* thẻ người chơi: cạnh 🏆 số ván thắng (cùng ô, không đổi bố cục thẻ) */
.du-rep { font-style: normal; font-size: .8rem; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: #e3f7e8; color: #13753a; white-space: nowrap; }
.du-rep.low { background: #fff1d6; color: #8a5300; }
.du-rep.bad { background: #ffe1e1; color: #a40000; }
.du-rephint b.low { color: #8a5300; } .du-rephint b.bad { color: #c0262d; }
.du-afk { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 6; width: max-content; max-width: calc(100% - 20px); box-sizing: border-box;
  padding: 8px 14px; border-radius: 14px; background: #c0262d; color: #fff; font-weight: 800; font-size: .92rem; line-height: 1.35; text-align: center;
  box-shadow: 0 8px 22px rgba(192, 38, 45, .35); animation: duAfkPulse 1s ease-in-out infinite alternate; pointer-events: none; }
.du-afk[hidden] { display: none; }
@keyframes duAfkPulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .du-afk { animation: none; } }
.du-repline { margin: 6px 0; font-weight: 700; }
.du-repline.bad { color: #c0262d; } .du-repline.ok { color: #13753a; }
/* ---------- 🤖 Đua với bot Rubik (botrace.js) – dùng chung khung Đấu online ---------- */
.bt-head .hr-tag { font-size: .7rem; vertical-align: middle; }
.bt-lobby h2 { margin: 0 0 10px; font-size: 1.1rem; }
.bt-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.bt-lv { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: auto; padding: 14px 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: inherit; text-align: center; white-space: normal; }
.bt-lv i { font-style: normal; font-size: 2rem; line-height: 1; }
.bt-lv b { font-size: 1.05rem; }
.bt-lv small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.bt-lv em { font-style: normal; font-size: .76rem; font-weight: 700; color: var(--accent, #5b3df5); }
.bt-lv.on { border-color: var(--accent, #5b3df5); box-shadow: 0 0 0 2px var(--accent, #5b3df5); }
.bt-sehint a { font-weight: 800; }
.bt-msg { margin: 8px 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 700; line-height: 1.45; }
.bt-msg.bad { background: var(--surface); background: color-mix(in srgb, #f59e0b 18%, var(--surface)); }
.bt-stage { min-height: 1.3em; font-size: .9rem; font-weight: 700; }
.bt-bar { height: 8px; border-radius: 99px; background: rgba(127, 127, 127, .2); overflow: hidden; }
.bt-bar i { display: block; width: 0; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #60a5fa, #7c3aed); transition: width .3s; }
@media (max-width: 560px) {
  .bt-levels { grid-template-columns: 1fr; }
  .bt-lv { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; text-align: left; padding: 10px 12px; }
  .bt-lv i { grid-row: 1 / span 3; }
}
@media (max-width: 760px) and (orientation: portrait) { .bt-play { grid-auto-rows: auto; } .bt-bot .du-scene { height: min(190px, 24vh); } }

/* ---------- 🎲 Tự động ghép trận (duel.js – 26/11) ---------- */
.du-mm-btn { width: 100%; }
.du-lobby #duCreate { width: 100%; }
.du-mm { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 2px solid var(--accent, #5b3df5); background: var(--surface); background: color-mix(in srgb, var(--accent, #5b3df5) 8%, var(--surface)); }
.du-mm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.du-mm-row b { font-size: 1.05rem; margin-right: auto; }
.du-mm-spin { display: inline-block; font-size: 1.5rem; animation: duMMspin 1.6s ease-in-out infinite; }
@keyframes duMMspin { 0%, 100% { transform: rotate(-12deg) scale(1); } 50% { transform: rotate(12deg) scale(1.15); } }
.du-mm .hint { margin: 0; }
.du-mm-bot { padding: 10px 12px; border-radius: 12px; background: var(--surface); background: color-mix(in srgb, #f59e0b 16%, var(--surface)); }
.du-mm-bot p { margin: 0 0 8px; font-weight: 700; }
.du-mm > .link { align-self: flex-start; }
@media (prefers-reduced-motion: reduce) { .du-mm-spin { animation: none; } }

/* 👥 PHÒNG NHIỀU NGƯỜI (1/12/2026 – duel.js): thẻ chỗ ngồi · chọn số người · bảng tiến độ đối thủ · huy chương trên khối · bảng xếp hạng */
.du-vs.multi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.du-vs.multi .du-x { display: none; }
/* thẻ hẹp: 🏆 + 🛡️ xuống dòng riêng dưới tên (không chiếm chỗ làm tên bị cắt "B…") */
.du-vs.multi .du-p { grid-template-columns: auto minmax(0, 1fr); }
.du-vs.multi .du-av { grid-row: 1 / 4; }
.du-vs.multi .du-p em { grid-row: auto; grid-column: 2; font-size: 12px; }
.du-vs.multi .du-p .du-sk, .du-vs.multi .du-ready { grid-column: 1 / -1; }
body.duel-playing .du-vs.multi { display: none; } /* đang đấu: bảng tiến độ thay cho các thẻ */
.du-size-pick { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 2px; }
.du-size-pick > span { font-weight: 800; font-size: .85rem; color: var(--muted); }
.du-size-pick .hold-seg button, .du-sizeseg button { flex: 1; min-height: 40px; white-space: nowrap; }
.du-sizeseg { width: 100%; }
.du-board { display: flex; flex-direction: column; gap: 4px; }
.du-board[hidden] { display: none; }
.du-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(50px, 32%) auto; align-items: center; gap: 8px; width: 100%; height: auto; min-height: 34px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border, rgba(127, 127, 127, .25)); background: var(--surface-2); color: var(--text, inherit); font: inherit; font-weight: 400; text-align: left; cursor: pointer; }
.du-row.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.du-row.out { opacity: .55; }
.du-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.du-row small { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.du-row-i { font-size: 1.1rem; text-align: center; }
.du-row-bar { height: 8px; border-radius: 99px; background: rgba(127, 127, 127, .22); overflow: hidden; }
.du-row-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s; }
.du-row.done .du-row-bar i { background: #22c55e; }
.du-play.multi .du-opscene { height: 240px; }
.du-place { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 90%; padding: 12px 20px; border-radius: 16px; background: rgba(20, 16, 50, .78); color: #fff; text-align: center; pointer-events: none; }
.du-place[hidden] { display: none; }
.du-place b { font-size: 1.3rem; }
.du-place small { font-size: .85rem; opacity: .9; }
.du-rank { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 520px; text-align: left; }
.du-rank li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
.du-rank li.me { box-shadow: inset 0 0 0 2px var(--accent); }
.du-rank b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.du-rank small { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-align: right; }
.du-rk-n { font-size: 1.2rem; font-weight: 900; text-align: center; }
.du-end.multi .du-end-act { flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) { .du-vs.multi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .du-vs.multi { grid-template-columns: 1fr; } .du-vs.multi .du-p { padding: 6px 10px; } .du-rank li { padding: 6px 10px; gap: 8px; } }
/* điện thoại cầm dọc: khối đối thủ nhỏ lại, bảng tiến độ gọn */
@media (max-width: 760px) and (orientation: portrait) {
  .du-play.multi { grid-auto-rows: auto; }
  .du-play.multi .du-opscene { height: min(150px, 18vh); }
  .du-row { min-height: 30px; padding: 3px 8px; gap: 6px; grid-template-columns: 22px minmax(0, 1fr) 26% auto; }
}
/* điện thoại xoay ngang: bên phải chỉ còn bảng tiến độ (khối của mình to nhất có thể) */
@media (orientation: landscape) and (max-height: 520px) {
  body.duel-playing .du-play.multi .du-opscene { display: none; }
  body.duel-playing .du-play.multi .du-board { flex: 1; min-height: 0; overflow-y: auto; }
  body.duel-playing .du-row { min-height: 28px; padding: 2px 8px; }
}
