/* Phượt Thủ Đại Chiến – toàn bộ CSS. Hiệu ứng chỉ dùng transform/opacity để giữ FPS. */
:root {
  --bg: #1b1033; --panel: rgba(30, 18, 58, .82); --panel2: rgba(255, 255, 255, .08);
  --ink: #fff7e6; --mute: #c9b8e8; --accent: #ffd32a; --pink: #ff4d8d; --green: #2ed573; --blue: #1e90ff; --red: #ff4757;
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --font: 'Baloo 2', 'Nunito', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
#view { position: fixed; inset: 0; z-index: 0; }
#view canvas { display: block; width: 100%; height: 100%; }
#labels { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; font-weight: 800; }
.hidden { display: none !important; }
input, button { font-family: inherit; }
input { user-select: text; -webkit-user-select: text; }
b { font-weight: 800; }

/* ---- màn hình ---- */
.screen { position: fixed; inset: 0; z-index: 10; }
.screen.nopointer { pointer-events: none; z-index: 12; }
.screen.nopointer .pointer { pointer-events: auto; }
#screen-lobby, #screen-room, #screen-results { background: linear-gradient(180deg, rgba(27, 16, 51, .55), rgba(27, 16, 51, .86)); }
.scroll { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: calc(12px + var(--sat)) calc(14px + var(--sar)) calc(20px + var(--sab)) calc(14px + var(--sal)); max-width: 1040px; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 2px solid rgba(255, 255, 255, .14); border-radius: 18px; padding: 14px 16px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 6px 0 rgba(0, 0, 0, .25); }
.panel h2 { margin: 0 0 8px; font-size: 22px; color: var(--accent); }
.panel h3 { margin: 10px 0 4px; font-size: 16px; color: var(--pink); }
.lbl { display: block; margin: 8px 0 4px; font-size: 13px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .5px; }
.hint { font-size: 14px; color: var(--mute); margin: 6px 0; }
.badge { display: inline-block; background: var(--pink); color: #fff; border-radius: 999px; padding: 0 9px; font-size: 14px; vertical-align: middle; }

/* ---- logo ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; margin-bottom: 4px; }
.hublink { color: var(--mute); font-size: 13px; font-weight: 700; text-decoration: none; opacity: .85; white-space: nowrap; }
.hublink:hover { opacity: 1; color: var(--accent); }
.nx-badge { display: flex; justify-content: flex-end; min-width: 0; max-width: 60%; font-size: 13px; }
.nx-badge .v { color: #7bed9f; font-weight: 800; margin-left: 3px; }
.vtick { color: #7bed9f; font-weight: 800; margin-left: 3px; }
.logo { text-align: center; margin: 6px 0 14px; }
.logo-ico { font-size: 40px; animation: bob 1.6s ease-in-out infinite; }
.logo h1 { margin: 0; font-size: clamp(26px, 6vw, 48px); line-height: 1.05; font-weight: 800; color: #fff; text-shadow: 0 4px 0 #ff4d8d, 0 8px 0 rgba(0, 0, 0, .35); letter-spacing: 1px; }
.logo h1 span { color: var(--accent); }
.logo .tag { margin: 8px 0 0; color: var(--mute); font-size: 15px; }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }

/* ---- nút & input ---- */
.btn { cursor: pointer; border: 0; border-radius: 14px; padding: 10px 16px; font-size: 17px; font-weight: 800; color: #2a1650; background: #fff3c4; box-shadow: 0 4px 0 #c9a93a; transition: transform .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c9a93a; }
.btn:disabled, .btn.disabled { opacity: .45; filter: grayscale(.6); cursor: not-allowed; }
.btn.primary { background: var(--accent); box-shadow: 0 4px 0 #b8940c; }
.btn.danger { background: #ff7b86; box-shadow: 0 4px 0 #b3303c; color: #3b0710; }
.btn.ghost { background: transparent; color: var(--mute); box-shadow: none; border: 2px solid rgba(255, 255, 255, .2); margin-top: 10px; }
.btn.ready-on { background: var(--green); box-shadow: 0 4px 0 #1a8f4a; }
.btn.small { padding: 6px 12px; font-size: 15px; }
.btn.big { width: 100%; padding: 12px 16px; font-size: 20px; margin-top: 8px; }
input[type=text], input:not([type]) { width: 100%; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .22); color: #fff; border-radius: 12px; padding: 9px 12px; font-size: 17px; font-weight: 700; outline: none; touch-action: auto; }
input:focus { border-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; min-width: 0; }
.row.actions { margin-top: 8px; }
.row.actions .btn { flex: 1; }
.code-in { text-transform: uppercase; letter-spacing: 4px; text-align: center; }
.join-row { margin: 8px 0; }
.conn { margin-top: 8px; font-size: 13px; color: var(--mute); text-align: center; }
.conn.bad { color: #ff9aa2; }
.conn.ok { color: #7bed9f; }

/* ---- màu / xe ---- */
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); cursor: pointer; transition: transform .12s; }
.sw.sel { border-color: #fff; transform: scale(1.18); box-shadow: 0 0 0 3px var(--pink); }
.bikes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bk { cursor: pointer; padding: 8px 10px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .15); background: var(--panel2); }
.bk b { display: block; font-size: 16px; }
.bk span { font-size: 13px; color: var(--mute); line-height: 1.15; display: block; }
.bk.sel { border-color: var(--accent); background: rgba(255, 211, 42, .18); }

/* ---- danh sách phòng ---- */
.rooms-list { max-height: 240px; overflow-y: auto; touch-action: pan-y; display: flex; flex-direction: column; gap: 6px; }
.rm { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel2); }
.rm .rm-main { flex: 1; min-width: 0; }
.rm .rm-n { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm .rm-s { font-size: 12px; color: var(--mute); }
.rm .rm-id { font-family: monospace; font-weight: 800; color: var(--accent); letter-spacing: 2px; }
.empty { color: var(--mute); text-align: center; padding: 14px 6px; font-size: 15px; }

/* ---- phím tắt ---- */
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 14px; }
kbd { display: inline-block; min-width: 22px; text-align: center; padding: 0 6px; margin-right: 3px; border-radius: 6px; background: #fff3c4; color: #2a1650; font-weight: 800; font-size: 13px; box-shadow: 0 2px 0 #c9a93a; }

/* ---- segmented ---- */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 70px; cursor: pointer; border: 2px solid rgba(255, 255, 255, .2); background: var(--panel2); color: var(--ink); border-radius: 10px; padding: 7px 8px; font-weight: 800; font-size: 15px; }
.seg button.sel { background: var(--accent); color: #2a1650; border-color: #fff; }
.seg.dis button { pointer-events: none; opacity: .6; }
.setrow { margin-bottom: 6px; }

/* ---- phòng chờ ---- */
.room-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.room-code { font-size: clamp(44px, 12vw, 80px); line-height: 1; font-weight: 800; letter-spacing: 10px; color: var(--accent); text-shadow: 0 4px 0 #b8940c; font-family: 'Baloo 2', monospace; }
.room-info { text-align: right; flex: 1; min-width: 180px; }
.room-name { font-size: 24px; font-weight: 800; }
.room-route { color: var(--pink); font-weight: 800; }
.room-opts { color: var(--mute); font-size: 14px; }
.players { display: flex; flex-direction: column; gap: 6px; }
.pl { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: var(--panel2); }
.pl.me { outline: 2px solid var(--accent); }
.pl .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; flex: none; }
.pl .nm { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .bk-n { font-size: 12px; color: var(--mute); }
.pl .rd { font-size: 13px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.pl .rd.on { background: var(--green); color: #07301a; }
.pl .xu { font-size: 14px; color: var(--accent); font-weight: 800; }
.reason { min-height: 20px; margin-top: 6px; text-align: center; color: #ffb3ba; font-size: 14px; font-weight: 700; }
.setup { margin-top: 10px; padding-top: 6px; border-top: 2px dashed rgba(255, 255, 255, .18); }
.chatpanel { display: flex; flex-direction: column; }
.chatlog { flex: 1; min-height: 180px; max-height: 360px; overflow-y: auto; touch-action: pan-y; margin-bottom: 8px; padding: 6px; background: rgba(0, 0, 0, .25); border-radius: 12px; font-size: 15px; }
.chatlog div { padding: 2px 0; word-break: break-word; }
.chatlog .sys { color: var(--mute); font-style: italic; }

/* ---- HUD ---- */
.hud-tl { position: absolute; left: calc(10px + var(--sal)); top: calc(10px + var(--sat)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.chip { background: var(--panel); border-radius: 12px; padding: 2px 12px; font-size: 20px; border: 2px solid rgba(255, 255, 255, .15); }
.chip .k { font-size: 12px; color: var(--mute); margin-right: 4px; }
.chip b { font-size: 26px; color: var(--accent); }
.chip small { font-size: 16px; color: var(--mute); }
.netinfo { position: absolute; right: calc(8px + var(--sar)); top: calc(4px + var(--sat)); font-size: 11px; color: rgba(255, 255, 255, .6); text-shadow: 0 1px 2px #000; }
.wanted { position: absolute; left: calc(10px + var(--sal)); top: calc(150px + var(--sat)); font-size: 26px; color: #ffd32a; text-shadow: 0 2px 0 #7a3a00, 0 0 10px rgba(255, 70, 70, .6); letter-spacing: 1px; transition: opacity .2s; opacity: .45; max-width: 60vw; }
.wanted.on { opacity: 1; }
.wanted.shake { animation: shake .25s linear infinite; }
.wanted .dim { opacity: .25; }
@keyframes shake { 0% { transform: translate(0, 0) } 25% { transform: translate(2px, -2px) } 50% { transform: translate(-2px, 1px) } 75% { transform: translate(1px, 2px) } 100% { transform: translate(0, 0) } }

.hud-bot { position: absolute; left: calc(10px + var(--sal)); bottom: calc(10px + var(--sab)); display: flex; align-items: flex-end; gap: 10px; }
.gauge { position: relative; width: 120px; height: 120px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(135deg); }
.g-bg, .g-arc { fill: rgba(20, 10, 40, .65); stroke-width: 11; stroke-linecap: round; }
.g-bg { stroke: rgba(255, 255, 255, .18); stroke-dasharray: 75 100; }
.g-arc { fill: none; stroke: var(--accent); stroke-dasharray: 0 100; transition: stroke .2s; }
.g-bg { fill: rgba(20, 10, 40, .6); }
.g-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.g-num b { font-size: 38px; text-shadow: 0 2px 0 #000; }
.g-num small { font-size: 12px; color: var(--mute); }
.bars { display: flex; flex-direction: column; gap: 6px; width: min(38vw, 220px); padding-bottom: 6px; }
.bar { position: relative; height: 22px; border-radius: 11px; background: rgba(0, 0, 0, .55); border: 2px solid rgba(255, 255, 255, .25); overflow: hidden; }
.bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; transform: scaleX(1); background: linear-gradient(90deg, #2ed573, #7bed9f); }
.hpbar.low i { background: linear-gradient(90deg, #ff4757, #ff7b86); }
.hpbar.mid i { background: linear-gradient(90deg, #ffa502, #ffd32a); }
.bar em { position: absolute; left: 8px; top: 0; font-style: normal; font-size: 12px; line-height: 18px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.bar span { position: absolute; right: 8px; top: 0; font-size: 13px; line-height: 18px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.nitrobar { height: 14px; opacity: .35; }
.nitrobar.on { opacity: 1; }
.nitrobar i { background: linear-gradient(90deg, #ff4d00, #ffd32a); transform: scaleX(0); }
.nitrobar em { line-height: 10px; font-size: 10px; }

.weapon { position: absolute; right: calc(70px + var(--sar)); bottom: calc(14px + var(--sab)); display: flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid rgba(255, 255, 255, .2); border-radius: 16px; padding: 4px 14px; }
.weapon .we { font-size: 38px; }
.weapon .wu { font-size: 22px; font-weight: 800; color: var(--accent); }
.weapon .wn { font-size: 12px; color: var(--mute); max-width: 90px; line-height: 1.05; }
.weapon.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.6) } 60% { transform: scale(1.2) } 100% { transform: scale(1) } }

.status { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); background: rgba(0, 0, 0, .7); border: 3px solid var(--accent); border-radius: 16px; padding: 6px 20px; font-size: 22px; font-weight: 800; text-align: center; white-space: nowrap; animation: blink 1s ease-in-out infinite; }
.status.busted { border-color: var(--red); color: #ff9aa2; }
@keyframes blink { 50% { opacity: .65 } }

/* dải tiến độ */
.progress { position: absolute; right: calc(14px + var(--sar)); top: calc(34px + var(--sat)); bottom: calc(150px + var(--sab)); width: 22px; }
.ptrack { position: relative; height: 100%; width: 8px; margin: 0 auto; border-radius: 4px; background: rgba(255, 255, 255, .28); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); }
.pfin { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 18px; }
.pd { position: absolute; left: 50%; width: 12px; height: 12px; margin: 0 0 -6px -6px; border-radius: 50%; border: 2px solid #fff; transition: bottom .5s linear; }
.pd.me { width: 20px; height: 20px; margin: 0 0 -10px -10px; border-width: 3px; z-index: 3; box-shadow: 0 0 8px #fff; }
.pd.cop { width: auto; height: auto; border: 0; background: none; font-size: 14px; line-height: 1; margin: 0 0 -7px -8px; }
.pd.bot { opacity: .75; }

.emotes { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(8px + var(--sab)); display: none; gap: 5px; }
.emotes.show { display: flex; }
.emotes button { pointer-events: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; font-size: 20px; background: var(--panel); cursor: pointer; padding: 0; opacity: .8; }
.emotes button:active { transform: scale(.85); }
.has-touch .emotes button { width: 30px; height: 30px; font-size: 16px; }
.has-touch .emotes { gap: 3px; }

.ingame-chat { position: absolute; left: calc(10px + var(--sal)); bottom: calc(150px + var(--sab)); width: min(50vw, 380px); display: flex; flex-direction: column; gap: 2px; font-size: 14px; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.ingame-chat div { animation: fadechat 9s linear forwards; word-break: break-word; }
@keyframes fadechat { 0%, 80% { opacity: 1 } 100% { opacity: 0 } }
.chat-box { position: absolute; left: calc(10px + var(--sal)); bottom: calc(112px + var(--sab)); width: min(60vw, 420px); pointer-events: auto; }

.evbar { position: absolute; top: calc(8px + var(--sat)); left: 50%; transform: translateX(-50%) translateY(-120%); opacity: 0; transition: transform .3s, opacity .3s; background: linear-gradient(90deg, #ff4d8d, #a55eea); border-radius: 16px; padding: 6px 22px 10px; font-size: 20px; font-weight: 800; text-align: center; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); max-width: 70vw; overflow: hidden; }
.evbar.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.evbar #evbar-ico { margin-right: 8px; font-size: 24px; }
.evbar i { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: #fff; transform-origin: left; }
.evbar i.run { animation: evfill linear forwards; }
@keyframes evfill { from { transform: scaleX(1) } to { transform: scaleX(0) } }

.commentary { position: absolute; left: 0; right: 0; bottom: calc(160px + var(--sab)); display: flex; justify-content: center; pointer-events: none; }
.commentary span { background: rgba(0, 0, 0, .72); border-left: 6px solid var(--accent); border-radius: 12px; padding: 6px 18px; font-size: 20px; font-weight: 700; max-width: min(80vw, 760px); opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; text-align: center; }
.commentary span.show { opacity: 1; transform: translateY(0); }
.commentary span::before { content: '🎙️ '; }

.bigtext { position: absolute; left: 0; right: 0; top: 28%; text-align: center; pointer-events: none; }
#bigtext-main { font-size: clamp(48px, 14vw, 140px); line-height: 1; font-weight: 800; color: #fff; text-shadow: 0 6px 0 #ff4d8d, 0 12px 0 rgba(0, 0, 0, .4); opacity: 0; }
#bigtext-main.show { animation: bigpop 1s ease-out forwards; }
#bigtext-sub { margin-top: 6px; font-size: clamp(18px, 4vw, 30px); font-weight: 800; color: var(--accent); text-shadow: 0 2px 0 #000; opacity: 0; }
#bigtext-sub.show { opacity: 1; }
@keyframes bigpop { 0% { opacity: 0; transform: scale(2.2) } 20% { opacity: 1; transform: scale(1) } 80% { opacity: 1; transform: scale(1) } 100% { opacity: 0; transform: scale(.9) } }

.menu-btn { position: absolute; left: 50%; top: calc(8px + var(--sat)); transform: translateX(-50%); opacity: .7; }
.evbar.show ~ .menu-btn { display: none; }

.toasts { position: fixed; top: calc(76px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: 90vw; }
.toast { background: rgba(20, 10, 40, .92); border: 2px solid var(--blue); border-radius: 12px; padding: 6px 16px; font-size: 17px; font-weight: 700; animation: toast 3.2s ease-out forwards; max-width: 100%; text-align: center; }
.toast.warn { border-color: var(--red); }
.toast.good { border-color: var(--green); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-12px) } 8% { opacity: 1; transform: translateY(0) } 85% { opacity: 1 } 100% { opacity: 0 } }

/* ---- hiệu ứng toàn màn ---- */
.fxwrap { position: fixed; inset: 0; z-index: 11; pointer-events: none; }
.fx { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; will-change: opacity; }
.fx.on { opacity: 1; }
.fx-hit { background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 30, 30, .6) 100%); transition-duration: .08s; }
.fx-speed { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, .0) 0 6deg, rgba(255, 255, 255, .13) 6deg 7deg); -webkit-mask-image: radial-gradient(ellipse at center, transparent 35%, #000 85%); mask-image: radial-gradient(ellipse at center, transparent 35%, #000 85%); }
.fx-speed.on { animation: speedpulse .35s linear infinite; }
@keyframes speedpulse { 0%, 100% { opacity: .7 } 50% { opacity: 1 } }
.fx-smell { background: rgba(110, 200, 40, .45); }
.fly { position: absolute; font-size: 34px; opacity: 0; }
.fx-smell.on .fly { animation: fly 2.4s linear infinite; opacity: 1; }
.fly.f1 { left: 20%; top: 30%; } .fly.f2 { left: 70%; top: 40%; animation-delay: -.6s !important; } .fly.f3 { left: 45%; top: 60%; animation-delay: -1.2s !important; } .fly.f4 { left: 80%; top: 20%; animation-delay: -1.8s !important; }
@keyframes fly { 0% { transform: translate(0, 0) rotate(0) } 25% { transform: translate(60px, -40px) rotate(40deg) } 50% { transform: translate(-30px, 50px) rotate(-30deg) } 75% { transform: translate(40px, 30px) rotate(20deg) } 100% { transform: translate(0, 0) rotate(0) } }
.fx-sleep { background: rgba(5, 5, 25, .82); }
.zzz { position: absolute; font-size: 60px; font-weight: 800; color: #9ec5ff; opacity: 0; left: 50%; top: 50%; }
.fx-sleep.on .zzz { animation: zzz 2s ease-out infinite; }
.zzz.z2 { animation-delay: -.7s !important; font-size: 44px; } .zzz.z3 { animation-delay: -1.4s !important; font-size: 80px; }
@keyframes zzz { 0% { opacity: 0; transform: translate(-60px, 40px) scale(.6) } 30% { opacity: 1 } 100% { opacity: 0; transform: translate(60px, -140px) scale(1.2) } }
.fx-busted .siren-l, .fx-busted .siren-r { position: absolute; top: 0; bottom: 0; width: 50%; opacity: 0; }
.fx-busted .siren-l { left: 0; background: radial-gradient(ellipse at left, rgba(255, 0, 40, .7), transparent 70%); }
.fx-busted .siren-r { right: 0; background: radial-gradient(ellipse at right, rgba(0, 80, 255, .7), transparent 70%); }
.fx-busted.on .siren-l { animation: sirenA .6s steps(1) infinite; }
.fx-busted.on .siren-r { animation: sirenB .6s steps(1) infinite; }
@keyframes sirenA { 0% { opacity: 1 } 50% { opacity: 0 } }
@keyframes sirenB { 0% { opacity: 0 } 50% { opacity: 1 } }
.fx-safe { box-shadow: inset 0 0 60px 10px rgba(120, 255, 255, .6); }
.fx-safe.on { animation: safeblink .3s linear infinite; }
@keyframes safeblink { 50% { opacity: .35 } }
.fx-wanted { background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 40, 40, .35) 100%); }
.fx-wanted.on { animation: wantedp .8s ease-in-out infinite; }
@keyframes wantedp { 50% { opacity: .4 } }

/* ---- kết quả ---- */
.results { text-align: center; }
.rtitle { margin: 0 0 8px; font-size: clamp(26px, 6vw, 42px); color: var(--accent); text-shadow: 0 3px 0 #b8940c; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 10px 0 16px; min-height: 210px; }
.pod { width: 30%; max-width: 170px; border-radius: 14px 14px 0 0; padding: 8px 4px; animation: rise .7s ease-out backwards; }
.pod .pe { font-size: 40px; }
.pod .pn { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .pt { font-size: 13px; color: #2a1650; }
.pod.p1 { height: 190px; background: linear-gradient(#ffe066, #f7b500); color: #3a2400; order: 2; animation-delay: .5s; }
.pod.p2 { height: 158px; background: linear-gradient(#e9eef5, #aab4c4); color: #1e2633; order: 1; animation-delay: .25s; }
.pod.p3 { height: 134px; background: linear-gradient(#e6a56c, #b06a2c); color: #2e1700; order: 3; }
.pod.me { outline: 3px solid var(--pink); }
@keyframes rise { from { transform: translateY(60px); opacity: 0 } to { transform: none; opacity: 1 } }
.tablewrap { overflow-x: auto; touch-action: pan-x pan-y; }
.rtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.rtable th { color: var(--mute); font-size: 12px; text-transform: uppercase; padding: 4px 6px; text-align: center; }
.rtable td { padding: 6px; text-align: center; border-top: 1px solid rgba(255, 255, 255, .1); white-space: nowrap; }
.rtable td.nm { text-align: left; font-weight: 800; }
.rtable tr.me td { background: rgba(255, 211, 42, .15); }
.rtable .neg { color: #ff9aa2; }
.rtable .pos { color: #7bed9f; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 4, 20, .65); display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-box { width: min(440px, 100%); max-height: 92vh; overflow-y: auto; touch-action: pan-y; }
#menu { z-index: 52; } #modal-settings { z-index: 54; } #modal-create { z-index: 51; }

/* ---- cảm ứng ---- */
.touch { position: absolute; inset: 0; pointer-events: none; }
.joy { position: absolute; left: calc(24px + var(--sal)); bottom: calc(24px + var(--sab)); width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .14); border: 3px solid rgba(255, 255, 255, .35); pointer-events: auto; touch-action: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255, 211, 42, .8); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); will-change: transform; }
.tbtns { position: absolute; right: calc(14px + var(--sar)); bottom: calc(16px + var(--sab)); width: 190px; height: 170px; }
.tb { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .5); color: #fff; font-weight: 800; font-size: 15px; line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; }
.tb small { font-size: 18px; }
.tb.down { transform: scale(.9); filter: brightness(1.4); }
.tb-atk { width: 84px; height: 84px; right: 0; bottom: 0; background: rgba(255, 71, 87, .75); font-size: 18px; }
.tb-kick { width: 70px; height: 70px; right: 92px; bottom: 6px; background: rgba(255, 165, 2, .75); }
.tb-use { width: 62px; height: 62px; right: 10px; bottom: 96px; background: rgba(46, 213, 115, .75); }
.tb-horn { width: 56px; height: 56px; right: 82px; bottom: 90px; background: rgba(30, 144, 255, .75); font-size: 13px; }
.has-touch .hud-bot { bottom: calc(170px + var(--sab)); }
.has-touch .joy { bottom: calc(14px + var(--sab)); }
.has-touch .weapon { bottom: calc(190px + var(--sab)); right: calc(14px + var(--sar)); }
.has-touch .progress { bottom: calc(260px + var(--sab)); }
.has-touch .commentary { bottom: calc(50px + var(--sab)); }
.has-touch .ingame-chat { bottom: auto; top: 160px; }

/* màn thấp (điện thoại nằm ngang) */
@media (max-height: 460px) {
  .gauge { width: 84px; height: 84px; } .g-num b { font-size: 26px; }
  .chip b { font-size: 20px; } .chip { font-size: 15px; }
  .wanted { top: 110px; font-size: 20px; }
  .has-touch .hud-bot { bottom: calc(10px + var(--sab)); left: calc(180px + var(--sal)); }
  .has-touch .joy { width: 120px; height: 120px; }
  .has-touch .progress { bottom: calc(170px + var(--sab)); }
  .has-touch .weapon { bottom: calc(180px + var(--sab)); }
  .has-touch .commentary { bottom: calc(100px + var(--sab)); }           /* trên thanh máu/nitro */
  .has-touch .commentary span { font-size: 16px; padding: 4px 12px; }
  .has-touch .emotes { bottom: auto; top: 54px; }                          /* dưới nút menu, khỏi đè thanh máu */
  .bigtext { top: 18%; }
}
@media (prefers-reduced-motion: reduce) { .logo-ico, .status, .wanted.shake { animation: none; } }
#screen-results { z-index: 14; }
.pod .pm { font-size: 12px; opacity: .8; }
body[data-screen=results] #screen-results { background: rgba(20, 10, 40, .92); }
.grid2 > * { min-width: 0; } .pl .rd { flex: none; }
