/* ---------- Game "Đêm lái xe" (dem-lai-xe.html, dem-lai-xe.js) ----------
   Khung, màn chọn / kết quả và chế độ toàn màn hình dùng lại .pl của style.css (Mark phiêu lưu); ở đây chỉ có phần riêng. */
.dx-khung { background: #0B1222; }

/* Nút điều khiển: đổi làn bên trái, ba con mắt ở giữa, phanh bên phải. Máy tính cũng hiện vì cần bấm chọn mắt. */
.dx-dk { display: flex; align-items: center; gap: 10px; margin-top: 12px; user-select: none; -webkit-user-select: none; }
.dx-dk button { min-height: 56px; border-radius: 16px; border: 2px solid var(--edge); background: var(--panel); color: var(--ink); font: 800 20px/1 var(--f-display); touch-action: none; -webkit-touch-callout: none; cursor: pointer; }
.dx-dk button.is-an { transform: translateY(2px); filter: brightness(.92); }
.dx-lan { display: flex; gap: 8px; }
.dx-lan button { width: 64px; }
.dx-mat-ds { flex: 1; display: flex; justify-content: center; gap: 8px; }
.dx-mat-ds button { flex: 1; max-width: 132px; font-size: 15px; padding: 0 8px; }
.dx-mat.is-bat { color: #0F172A; }
.dx-mat-lidar.is-bat { background: #38BDF8; border-color: #0284C7; }
.dx-mat-radar.is-bat { background: #FACC15; border-color: #CA8A04; }
.dx-mat-camera.is-bat { background: #F8FAFC; border-color: #0F172A; }
.dx-phanh { width: 96px; background: #FEE2E2 !important; border-color: #DC2626 !important; color: #991B1B !important; font-size: 17px !important; }
@media (max-width: 520px) { .dx-dk { flex-wrap: wrap; } .dx-mat-ds { order: -1; flex-basis: 100%; } .dx-lan { flex: 1; } .dx-lan button { flex: 1; } }

/* Lời gợi ý của Bit nổi trong màn chơi */
.dx-bit { position: absolute; z-index: 5; top: 140px; left: 50%; transform: translateX(-50%); width: min(520px, 76%); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 94%, transparent); color: var(--ink); border: 2px solid #38BDF8; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.dx-bit[hidden] { display: none; }
.dx-bit img { flex: none; width: 44px; height: 44px; }
.dx-bit p { margin: 0; font: 600 15px/1.4 var(--f-body); }
@media (max-width: 700px) { .dx-bit { top: 96px; } .dx-bit p { font-size: 13.5px; } .dx-bit img { width: 34px; height: 34px; } }

/* Toàn màn hình nằm ngang: nút nổi trên game */
.pl.is-toan .dx-lien-ds { display: none; }
.pl.is-toan .dx-dk { position: absolute; z-index: 4; left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); margin: 0; pointer-events: none; flex-wrap: nowrap; align-items: flex-end; }
.pl.is-toan .dx-dk button { pointer-events: auto; min-height: 0; border: 2px solid rgba(255, 255, 255, .7); background: rgba(15, 23, 42, .4); color: #fff; backdrop-filter: blur(2px); }
.pl.is-toan .dx-lan button { width: 66px; height: 66px; border-radius: 50%; font-size: 24px; }
.pl.is-toan .dx-mat-ds { order: 0; flex-basis: auto; align-self: flex-end; gap: 6px; }
.pl.is-toan .dx-mat-ds button { height: 44px; max-width: 104px; border-radius: 22px; font-size: 14px; }
.pl.is-toan .dx-mat.is-bat { color: #0F172A; }
.pl.is-toan .dx-mat-lidar.is-bat { background: #38BDF8; }
.pl.is-toan .dx-mat-radar.is-bat { background: #FACC15; }
.pl.is-toan .dx-mat-camera.is-bat { background: #F8FAFC; }
.pl.is-toan .dx-phanh { width: 86px; height: 86px; border-radius: 50%; background: rgba(220, 38, 38, .75) !important; border-color: #FCA5A5 !important; color: #fff !important; }
.pl.is-toan .dx-bit { top: 74px; }
.pl.is-toan.is-man .dx-dk { display: none; }

/* Màn kết quả: bảng các chặng */
.pl-man > .dx-kq { width: min(780px, 100%); max-height: 100%; overflow: auto; }
.dx-thu { margin: 12px 0 0; font: 500 12.5px/1.3 var(--f-mono); color: var(--muted); text-align: center; }
.dx-chang-ds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; text-align: left; }
@media (max-width: 760px) { .dx-chang-ds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dx-chang { display: grid; gap: 4px; align-content: start; padding: 10px; border-radius: 14px; border: 1.5px solid var(--edge); background: var(--bg2); }
.dx-chang b { font: 700 14.5px/1.25 var(--f-display); }
.dx-chang p, .dx-chang small { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.dx-chang .dx-chang-tot { color: var(--ink); font-size: 13px; }
.dx-mat-chip { display: inline-block; margin: 0 4px 2px 0; padding: 1px 8px; border-radius: 999px; font: 700 12.5px/1.5 var(--f-body); color: #0F172A; }
.dx-mat-chip.dx-mat-lidar { background: #38BDF8; } .dx-mat-chip.dx-mat-radar { background: #FACC15; } .dx-mat-chip.dx-mat-camera { background: #E2E8F0; border: 1px solid #64748B; }
.dx-thanh { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 30%, transparent); overflow: hidden; }
.dx-thanh i { display: block; height: 100%; background: #16A34A; border-radius: 3px; }
.dx-chang-vid { font-size: 12.5px; font-weight: 600; }
/* Biểu tượng trời vẽ bằng CSS */
.dx-chang-ic { position: relative; width: 30px; height: 30px; border-radius: 50%; }
.dx-tt-nang .dx-chang-ic { background: #FACC15; box-shadow: 0 0 0 4px rgba(250, 204, 21, .3); }
.dx-tt-dem .dx-chang-ic { background: transparent; box-shadow: inset -9px -3px 0 0 #6366F1; }
.dx-tt-mua .dx-chang-ic { border-radius: 50% 0 50% 50%; transform: rotate(-45deg) scale(.8); background: #3B82F6; }
.dx-tt-suong .dx-chang-ic { border-radius: 4px; height: 26px; background: repeating-linear-gradient(#94A3B8 0 5px, transparent 5px 10px); }
.dx-ly { margin: 4px 0 8px; padding: 0; list-style: none; display: grid; gap: 4px; }
.dx-ly li { padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, #F43F5E 12%, var(--panel)); border: 1.5px solid #FDA4AF; font-size: 13.5px; text-align: left; }

/* Thẻ dẫn sang phòng thí nghiệm và series */
.dx-lien-ds { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.dx-lien { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--edge); background: var(--panel); color: var(--ink); text-decoration: none; }
.dx-lien:hover { border-color: var(--blue); }
.dx-lien b { font: 700 15px/1.3 var(--f-display); color: var(--blue); }
.dx-lien span { font-size: 13.5px; color: var(--muted); }
/* Kết quả gọn khi chơi toàn màn hình nằm ngang (màn thấp): ảnh Mark bên trái, chữ bên phải, bảng chặng 4 cột */
.pl.is-toan .pl-man > .dx-kq { display: grid; grid-template-columns: 56px 1fr; column-gap: 12px; align-items: center; padding: 10px 14px; text-align: left; }
.pl.is-toan .dx-kq > img { grid-row: 1 / 4; width: 56px; height: 56px; }
.pl.is-toan .dx-kq h3 { margin: 0; font-size: 19px; }
.pl.is-toan .dx-kq .pl-kq-sao { margin: 0; font-size: 20px; }
.pl.is-toan .dx-kq > p { margin: 0; font-size: 13.5px; }
.pl.is-toan .dx-kq > .dx-ly, .pl.is-toan .dx-kq > .dx-chang-ds, .pl.is-toan .dx-kq > .pl-kq-nut, .pl.is-toan .dx-kq > p ~ p { grid-column: 1 / -1; }
.pl.is-toan .dx-chang-ds { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.pl.is-toan .dx-chang { padding: 8px; }
.pl.is-toan .dx-chang-ic { width: 22px; height: 22px; }
.pl.is-toan .dx-chang-vi { display: none; }
.pl.is-toan .dx-kq .pl-kq-nut { margin-top: 8px; justify-content: flex-start; }
.pl.is-toan .dx-chang-vid { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
