/* Shooting Kerala — UI
   Palette: paddy green, laterite red, kasavu gold on cream (like a mundu border). */
:root {
  --green-dk: #1f3d2b;
  --green: #2f6b3f;
  --cream: #fbf3df;
  --cream-2: #f3e6c4;
  --ink: #2b1d12;
  --ink-2: #6b5643;
  --laterite: #b4472e;
  --gold: #c9962b;
  --gold-lt: #e6bf5a;
  --danger: #d6362b;
  --font: "Baloo Chettan 2", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--green-dk); }
body { font-family: var(--font); color: var(--ink); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold-lt); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* kasavu border: cream cloth with a gold stripe set in from the edge */
.kasavu {
  background: var(--cream);
  border-radius: 14px;
  box-shadow: inset 0 0 0 6px var(--cream), inset 0 0 0 10px var(--gold), inset 0 0 0 12px var(--cream), inset 0 0 0 13px var(--gold-lt), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.kasavu-thin { background: rgba(251, 243, 223, 0.93); border-radius: 10px; box-shadow: inset 0 -4px 0 var(--gold), 0 8px 24px rgba(0, 0, 0, 0.3); }

/* ---------- Home ---------- */
.screen {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; touch-action: pan-y;
  display: grid; place-items: center; padding: 24px 16px;
  background:
    linear-gradient(180deg, rgba(20, 40, 28, 0.55), rgba(20, 40, 28, 0.85)),
    repeating-linear-gradient(100deg, #3f7d45 0 18px, #4a8c4f 18px 36px);
}
.home-card { width: min(520px, 100%); padding: 34px 32px 26px; }
.logo { text-align: center; margin-bottom: 18px; }
.logo-ml { display: block; color: var(--laterite); font-weight: 700; font-size: 1.1rem; line-height: 1; }
.logo h1 { font-size: 2.9rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: var(--green-dk); }
.tag { color: var(--ink-2); margin-top: 6px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 700; font-size: 0.95rem; }
.field input, .field select, .join-row input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--cream-2); background: #fff; outline: none; font-weight: 600;
}
.field input:focus, .field select:focus, .join-row input:focus { border-color: var(--gold); }
.wallet { text-align: right; color: var(--ink-2); font-size: 0.95rem; margin: -2px 0 10px; }
.wallet b { color: var(--gold); font-size: 1.1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 10px; border: 0;
  background: var(--green); color: #fff; font-weight: 700; transition: transform 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { filter: grayscale(0.6); opacity: 0.7; cursor: wait; }
.btn-main { width: 100%; padding: 14px; font-size: 1.25rem; background: var(--laterite); box-shadow: 0 4px 0 #7d2e1d; margin-bottom: 14px; }
.btn-main:active { box-shadow: 0 2px 0 #7d2e1d; transform: translateY(2px); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.box { padding: 12px; border-radius: 12px; background: var(--cream-2); display: grid; gap: 8px; align-content: start; }
.box h3 { font-size: 1rem; }
.box .btn { width: 100%; }
.check { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--ink-2); }
.join-row { display: flex; gap: 6px; }
.join-row input { text-transform: uppercase; letter-spacing: 0.1em; min-width: 0; }
.err { color: var(--danger); font-weight: 700; min-height: 1.4em; margin-top: 8px; text-align: center; }
.soon { font-size: 0.9rem; color: var(--ink-2); text-align: center; margin: 4px 0 8px; }
.how { margin-top: 6px; font-size: 0.92rem; }
.how summary { cursor: pointer; font-weight: 700; color: var(--green); }
.how ul { margin: 8px 0 0 18px; display: grid; gap: 4px; color: var(--ink-2); }
.how b { color: var(--ink); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud button { pointer-events: auto; }
.top-left { position: absolute; top: 12px; left: 12px; display: grid; gap: 8px; justify-items: start; max-width: 46vw; }
.hud-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.45); color: #fff; font-weight: 800; }
.feed { display: grid; gap: 4px; }
.feed-item { background: rgba(20, 20, 20, 0.6); color: #fff; padding: 3px 10px; border-radius: 8px; font-size: 0.88rem; animation: slideIn 0.25s ease both; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.feed-item .dist { opacity: 0.7; font-size: 0.8em; }
.feed-item.me { background: rgba(180, 71, 46, 0.85); }
.feed-item.info { background: rgba(31, 61, 43, 0.75); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

.top-center { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; display: grid; justify-items: center; gap: 2px; }
.room-pill { background: rgba(0, 0, 0, 0.5); color: #fff; padding: 3px 6px 3px 12px; border-radius: 99px; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.room-pill b { color: var(--gold-lt); letter-spacing: 0.08em; }
.mini { border: 0; border-radius: 99px; padding: 1px 10px; background: var(--gold); color: var(--ink); font-weight: 700; font-size: 0.8rem; }
.timer { font-size: 2rem; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); line-height: 1; font-variant-numeric: tabular-nums; }
.timer.hurry { color: #ffcf4a; animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.board { position: absolute; top: 12px; right: 12px; width: 280px; padding: 8px 10px 10px; }
.board-head { font-weight: 800; color: var(--laterite); font-size: 0.95rem; margin-bottom: 2px; }
.board ol { list-style: none; display: grid; gap: 1px; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; align-items: center; padding: 2px 6px; border-radius: 6px; font-size: 0.92rem; transition: background 0.3s; }
.board li .place { font-weight: 800; color: var(--ink-2); }
.board li .who { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.1; }
.board li .who small { display: block; color: var(--ink-2); font-size: 0.75rem; }
.board li .k { font-weight: 800; font-variant-numeric: tabular-nums; }
.board li.first { background: rgba(201, 150, 43, 0.22); }
.board li.first .place { color: var(--gold); }
.board li.me { background: rgba(180, 71, 46, 0.16); }
.board li.sep { height: 1px; background: var(--cream-2); padding: 0; margin: 3px 0; }
.board li.moved { animation: moved 0.6s ease; }
@keyframes moved { 0% { background: rgba(201, 150, 43, 0.6); } }
.board.hurry { animation: flashBoard 0.8s infinite; }
@keyframes flashBoard { 50% { box-shadow: inset 0 -4px 0 var(--gold), 0 0 0 3px #ffcf4a, 0 8px 24px rgba(0, 0, 0, 0.3); } }

.announce { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); font-size: 1.6rem; font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); white-space: nowrap; opacity: 0; transition: opacity 0.3s; text-align: center; }
.announce.show { opacity: 1; animation: pop 0.4s ease; }
.announce small { display: block; font-size: 1rem; color: var(--gold-lt); }
@keyframes pop { from { transform: translateX(-50%) scale(0.7); } to { transform: translateX(-50%) scale(1); } }

.bottom-left { position: absolute; left: 14px; bottom: 14px; width: 260px; display: grid; gap: 6px; }
.hp-wrap { display: flex; align-items: center; gap: 8px; }
#hpTxt { white-space: nowrap; }
body.mode-adventure:not(.touch) .adv-hud { bottom: 104px; }
.hp-bar { flex: 1; height: 16px; border-radius: 99px; background: rgba(0, 0, 0, 0.5); overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.5); }
#hpFill { height: 100%; width: 100%; background: linear-gradient(90deg, #3fbf5f, #8de06a); transition: width 0.2s; }
#hpFill.low { background: linear-gradient(90deg, #d6362b, #ff7a4a); }
#hpTxt { color: #fff; font-weight: 800; font-size: 1.2rem; width: 38px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.ammo-row { display: flex; gap: 12px; align-items: center; color: #fff; font-weight: 700; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
#ammoTxt { font-variant-numeric: tabular-nums; }
#ammoTxt.reload { color: #ffcf4a; }
.coins b { color: var(--gold-lt); }

#minimap { position: absolute; right: 12px; bottom: 12px; width: 180px; height: 120px; border-radius: 8px; border: 2px solid rgba(251, 243, 223, 0.8); background: #355f37; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; }
#death { background: radial-gradient(circle, rgba(60, 0, 0, 0.15), rgba(60, 0, 0, 0.55)); pointer-events: none; }
.death-card { text-align: center; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5); }
.death-card p { font-size: 1.3rem; font-weight: 700; }
.death-card .count { font-size: 7rem; font-weight: 800; line-height: 1; color: var(--gold-lt); }
#scoreboard, #results { background: rgba(10, 20, 14, 0.6); }

.panel { width: min(640px, 100%); max-height: 92vh; overflow-y: auto; padding: 22px 22px 18px; touch-action: pan-y; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; align-items: center; }
.tab { border: 0; padding: 6px 14px; border-radius: 99px; background: var(--cream-2); font-weight: 700; }
.tab.active { background: var(--green); color: #fff; }
.close { margin-left: auto; border: 0; background: none; font-size: 1.2rem; font-weight: 800; color: var(--ink-2); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { text-align: left; color: var(--ink-2); font-weight: 700; font-size: 0.85rem; padding: 4px 6px; border-bottom: 2px solid var(--cream-2); }
td { padding: 5px 6px; border-bottom: 1px solid var(--cream-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: rgba(180, 71, 46, 0.12); }
tr.first td { background: rgba(201, 150, 43, 0.18); }
td .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
td small { color: var(--ink-2); }

.results-panel { width: min(760px, 100%); text-align: center; }
.results-panel h2 { font-size: 2rem; line-height: 1.1; color: var(--green-dk); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 16px 0 10px; }
.pod { width: 150px; display: grid; justify-items: center; }
.pod .avatar { width: 46px; height: 46px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 3px 0 rgba(0,0,0,0.2); margin-bottom: 4px; display: grid; place-items: center; font-size: 1.3rem; }
.pod .nm { font-weight: 800; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .ds { font-size: 0.8rem; color: var(--ink-2); }
.pod .block { width: 100%; margin-top: 6px; border-radius: 8px 8px 0 0; display: grid; place-items: start center; padding-top: 6px; color: #fff; font-weight: 800; font-size: 1.6rem; }
.pod.p1 .block { height: 110px; background: var(--gold); }
.pod.p2 .block { height: 80px; background: #9aa3a8; }
.pod.p3 .block { height: 60px; background: #b07a4f; }
.pod .kk { font-size: 0.85rem; color: var(--ink-2); }
.res-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; text-align: left; margin-top: 8px; }
.res-grid h3 { font-size: 1rem; margin-bottom: 4px; }
.earned { margin-top: 12px; font-weight: 800; font-size: 1.15rem; color: var(--green); }

#touch { position: absolute; inset: 0; pointer-events: none; }
.stick { position: absolute; bottom: 26px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(255, 255, 255, 0.35); pointer-events: none; }
#stickL { left: 26px; }
#stickR { right: 26px; }
.knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(251, 243, 223, 0.75); }
#stickR .knob { background: rgba(214, 54, 43, 0.75); }
.tbtn { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); background: rgba(0, 0, 0, 0.45); color: #fff; font-weight: 800; font-size: 1.1rem; pointer-events: auto; }
#reloadBtn { right: 176px; bottom: 40px; }
#scoreBtn { right: 176px; bottom: 104px; }

#rotate { position: fixed; bottom: 50%; left: 50%; transform: translateX(-50%); z-index: 30; background: rgba(0, 0, 0, 0.7); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 700; pointer-events: none; }

/* touch layout: move HUD pieces out of the sticks' way */
body.touch .bottom-left { left: 50%; transform: translateX(-50%); bottom: 10px; width: 220px; }
body.touch #minimap { display: none; }
body.touch .top-left { max-width: 34vw; }
body.touch .feed-item { font-size: 0.78rem; }
body.touch .feed-item:nth-child(n+4) { display: none; }
body.touch .announce { top: 76px; font-size: 1.2rem; }
body.touch .board { width: 210px; font-size: 0.85rem; }
body.touch .board li { font-size: 0.82rem; grid-template-columns: 28px 1fr auto; }

@media (max-width: 640px) {
  .home-card { padding: 28px 20px 20px; }
  .logo h1 { font-size: 2.3rem; }
  .split, .res-grid { grid-template-columns: 1fr; }
  .board { width: 200px; }
  .board li .who small { display: none; }
  .pod { width: 100px; }
  .timer { font-size: 1.5rem; }
  .announce { font-size: 1.2rem; }
}
@media (max-height: 460px) {
  .board li:nth-child(n+5):not(.me) { display: none; }
  .board li.sep { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- 3D mode additions ---------- */
.soon a { color: var(--green); font-weight: 700; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,0.9); border-radius: 1px; transition: transform 0.08s; }
.crosshair i:nth-child(1) { width: 2px; height: 9px; left: -1px; top: -16px; }
.crosshair i:nth-child(2) { width: 2px; height: 9px; left: -1px; top: 7px; }
.crosshair i:nth-child(3) { width: 9px; height: 2px; left: -16px; top: -1px; }
.crosshair i:nth-child(4) { width: 9px; height: 2px; left: 7px; top: -1px; }
.crosshair.fire i:nth-child(1) { transform: translateY(-4px); } .crosshair.fire i:nth-child(2) { transform: translateY(4px); }
.crosshair.fire i:nth-child(3) { transform: translateX(-4px); } .crosshair.fire i:nth-child(4) { transform: translateX(4px); }
.crosshair.hit i { background: #ff5a3a; }
#dmgLayer { position: absolute; inset: 0; overflow: hidden; }
.dmg { position: absolute; transform: translate(-50%, -50%); font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.6); animation: dmgUp 0.75s ease-out both; font-size: 1.1rem; white-space: nowrap; }
.dmg.mine { color: #ffd34a; font-size: 1.45rem; }
.dmg.heal { color: #8cf078; }
@keyframes dmgUp { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -40px; } }
.lock-hint { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: rgba(0,0,0,0.6); color: #fff; padding: 8px 16px; border-radius: 10px; font-weight: 700; text-align: center; }
.lock-hint small { display: block; font-weight: 500; opacity: 0.8; }
.tbtn.fire { width: 92px; height: 92px; right: 40px; bottom: 44px; background: rgba(214, 54, 43, 0.7); font-size: 1rem; }
.tbtn.fire.small { width: 60px; height: 60px; right: auto; left: 46px; bottom: 190px; font-size: 1.3rem; }
.tbtn.fire.on { background: rgba(255, 80, 60, 0.95); transform: scale(0.95); }
body.three-d #reloadBtn { right: 150px; bottom: 40px; }
body.three-d #scoreBtn { right: 150px; bottom: 104px; }
.loading { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(20,40,28,0.85); color: #fff; font-size: 1.4rem; font-weight: 800; }
#hurt { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(200, 20, 10, 0.55) 100%); }
#hurt.on { animation: hurt 0.45s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- map picker ---------- */
.maps { display: grid; gap: 8px; }
.map-card { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: center; padding: 6px; border-radius: 12px; border: 2px solid var(--cream-2); background: #fff; cursor: pointer; transition: border-color 0.15s; }
.map-card:hover { border-color: var(--gold-lt); }
.map-card.sel { border-color: var(--green); box-shadow: 0 0 0 2px rgba(47, 107, 63, 0.2); }
.map-thumb { position: relative; height: 74px; border-radius: 8px; background-size: cover; background-position: center; }
.map-card.locked .map-thumb { filter: grayscale(0.75) brightness(0.8); }
.map-thumb .lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; }
.map-thumb .tick { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; }
.map-info { display: grid; gap: 1px; min-width: 0; }
.map-info b { font-size: 1.05rem; line-height: 1.1; }
.map-info span[lang="ml"] { color: var(--laterite); font-weight: 700; font-size: 0.9rem; }
.map-info small { color: var(--ink-2); font-size: 0.8rem; line-height: 1.25; }
.map-buy { justify-self: start; margin-top: 4px; border: 0; border-radius: 99px; padding: 3px 12px; background: var(--gold); color: var(--ink); font-weight: 800; font-size: 0.82rem; }
.map-buy.confirm { background: var(--laterite); color: #fff; }
.map-need { margin-top: 3px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }

/* ---------- full map ---------- */
#fullmap { z-index: 15; background: rgba(10, 20, 14, 0.65); }
.fm-card { padding: 16px 16px 10px; text-align: center; max-width: 100%; }
.fm-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.fm-head b { font-size: 1.4rem; color: var(--green-dk); }
.fm-head span { color: var(--laterite); font-weight: 700; }
.fm-head button { margin-left: auto; border: 0; background: var(--cream-2); border-radius: 99px; padding: 2px 14px; font-weight: 800; }
.fm-wrap { position: relative; margin: 0 auto; width: fit-content; border-radius: 8px; overflow: hidden; border: 3px solid var(--gold); }
.fm-wrap canvas { display: block; }
#fmLive { position: absolute; left: 0; top: 0; }
.fm-card .small { margin-top: 6px; font-size: 0.85rem; }
#minimap { cursor: pointer; pointer-events: auto; }
.hud-map-btn { position: absolute; right: 12px; bottom: 140px; }
body.touch .hud-map-btn { right: auto; left: 12px; top: 56px; bottom: auto; }
body:not(.touch) .hud-map-btn { display: none; }

/* ---------- game modes ---------- */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode-tab { display: grid; justify-items: center; gap: 0; padding: 8px 4px; border-radius: 12px; border: 2px solid var(--cream-2); background: #fff; line-height: 1.1; }
.mode-tab span { font-size: 1.4rem; }
.mode-tab b { font-size: 0.95rem; }
.mode-tab small { color: var(--laterite); font-weight: 700; font-size: 0.78rem; }
.mode-tab.active { border-color: var(--green); background: rgba(47, 107, 63, 0.09); box-shadow: 0 0 0 2px rgba(47, 107, 63, 0.2); }
.mode-help { font-size: 0.85rem; margin-top: 4px; }
.vehs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.veh-card { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 2px solid var(--cream-2); background: #fff; text-align: center; line-height: 1.1; }
.veh-card .em { font-size: 1.8rem; }
.veh-card b { font-size: 0.82rem; }
.veh-card .bars { display: grid; gap: 2px; width: 90%; margin-top: 3px; }
.veh-card .bars i { display: block; height: 4px; border-radius: 9px; background: var(--cream-2); overflow: hidden; }
.veh-card .bars i::after { content: ""; display: block; height: 100%; width: var(--v); background: var(--green); }
.veh-card.sel { border-color: var(--green); box-shadow: 0 0 0 2px rgba(47, 107, 63, 0.2); }
.veh-desc { grid-column: 1 / -1; font-size: 0.85rem; color: var(--ink-2); }
@media (max-width: 640px) { .vehs { grid-template-columns: repeat(3, 1fr); } }

/* HUD per mode */
.race-hud, .speedo, .role-hud, .race-btn { display: none; }
body.mode-race .race-hud { display: grid; position: absolute; left: 14px; top: 56px; gap: 2px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.5); font-weight: 700; }
body.mode-race .top-left { top: 12px; }
body.mode-race .feed { margin-top: 116px; }
.race-pos b { font-size: 3.4rem; line-height: 0.9; font-weight: 800; }
.race-pos sup { font-size: 1.3rem; }
.race-pos span { font-size: 1.2rem; opacity: 0.85; margin-left: 4px; }
.race-lap { font-size: 1.15rem; }
.race-time { font-variant-numeric: tabular-nums; opacity: 0.9; }
body.mode-race .speedo { display: grid; position: absolute; right: 22px; bottom: 150px; justify-items: center; width: 110px; height: 110px; border-radius: 50%; background: rgba(0,0,0,0.45); border: 3px solid rgba(251,243,223,0.8); align-content: center; color: #fff; }
.speedo b { font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.speedo small { opacity: 0.8; }
body.mode-race .bottom-left, body.mode-race .crosshair, body.mode-race #stickL, body.mode-race #fireBtn, body.mode-race #fireBtnL, body.mode-race #reloadBtn, body.mode-race #mapBtn.hud-map-btn { display: none; }
body.mode-race .timer { display: none; }
body.mode-race.touch .race-btn { display: block; }
body.mode-race.touch .speedo { right: 50%; transform: translateX(50%); bottom: 12px; width: 92px; height: 92px; }
#steerL { left: 24px; bottom: 30px; width: 86px; height: 86px; font-size: 1.8rem; }
#steerR { left: 124px; bottom: 30px; width: 86px; height: 86px; font-size: 1.8rem; }
.tbtn.gas { right: 26px; bottom: 30px; width: 96px; height: 96px; background: rgba(47, 160, 80, 0.75); }
.tbtn.brake { right: 134px; bottom: 30px; width: 74px; height: 74px; background: rgba(214, 54, 43, 0.7); font-size: 0.8rem; }
#resetBtn { right: 40px; bottom: 140px; width: 50px; height: 50px; }
.race-btn.on { filter: brightness(1.4); transform: scale(0.95); }
.countdown { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: 9rem; font-weight: 800; color: #fff; text-shadow: 0 6px 0 rgba(0,0,0,0.4); }
.countdown.go { color: #8de06a; }
.wrong-way { position: absolute; left: 50%; top: 28%; transform: translateX(-50%); background: rgba(214, 54, 43, 0.85); color: #fff; padding: 8px 18px; border-radius: 10px; font-weight: 800; font-size: 1.3rem; animation: pulse 0.8s infinite; }
.end-in { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); background: rgba(0,0,0,0.55); color: #ffcf4a; padding: 3px 12px; border-radius: 99px; font-weight: 700; }

body.mode-hide .role-hud { display: grid; position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); text-align: center; background: rgba(0,0,0,0.5); color: #fff; padding: 6px 18px; border-radius: 14px; }
body.mode-hide.touch .role-hud { bottom: auto; top: 76px; }
.role-hud b { font-size: 1.15rem; }
.role-hud small { opacity: 0.85; }
body.mode-hide .bottom-left, body.mode-hide .crosshair, body.mode-hide #reloadBtn, body.mode-hide #fireBtnL { display: none; }
body.mode-hide.hider #fireBtn { display: none; }
#blind { z-index: 9; background: rgba(5, 8, 12, 0.94); color: #fff; text-align: center; }
.blind-card p { font-size: 1.3rem; font-weight: 700; }
.blind-card .count { font-size: 7rem; font-weight: 800; color: var(--gold-lt); line-height: 1; }

.swap-hint { color: rgba(255,255,255,0.8); font-size: 0.85rem; text-shadow: 0 1px 0 rgba(0,0,0,0.6); }
body.touch .swap-hint { display: none; }
#swapBtn { right: 150px; bottom: 168px; font-size: 1.4rem; }
body.mode-race #swapBtn, body.mode-hide #swapBtn { display: none; }

/* ---------- shop ---------- */
.wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 12px; }
.wallet-row .wallet { margin: 0; }
.btn-shop { background: var(--gold); color: var(--ink); box-shadow: 0 3px 0 #8a6a1c; }
#shop { z-index: 30; background: rgba(10, 20, 14, 0.7); }
.shop-card { position: relative; width: min(980px, 100%); max-height: 94vh; display: grid; grid-template-rows: auto 1fr; padding: 20px; overflow: hidden; }
.shop-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.shop-head h2 { font-size: 1.8rem; line-height: 1; color: var(--green-dk); }
.shop-head h2 span { color: var(--laterite); font-size: 1.2rem; }
.shop-wallet { margin-left: auto; font-size: 1.3rem; background: #fff; border: 2px solid var(--gold); border-radius: 99px; padding: 2px 14px; }
.shop-wallet b { color: var(--gold); }
.shop-body { display: grid; grid-template-columns: 300px 1fr; gap: 16px; min-height: 0; }
.shop-preview { display: grid; align-content: start; justify-items: center; gap: 4px; background: radial-gradient(circle at 50% 40%, #fff7e0, var(--cream-2)); border-radius: 14px; padding: 8px; }
#shopCanvas { width: 280px; height: 320px; cursor: grab; touch-action: none; }
.shop-eq { font-size: 0.9rem; text-align: center; }
.shop-side { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.shop-list { overflow-y: auto; display: grid; gap: 8px; padding-right: 4px; align-content: start; touch-action: pan-y; }
.scard { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: #fff; border: 2px solid var(--cream-2); }
.scard.on { border-color: var(--green); }
.scard.locked .sem { filter: grayscale(0.3); }
.sem { font-size: 2.2rem; text-align: center; }
.sinfo { display: grid; gap: 2px; }
.sinfo b { font-size: 1.05rem; line-height: 1.1; }
.sinfo span[lang="ml"] { color: var(--laterite); font-weight: 700; font-size: 0.85rem; }
.sinfo small { color: var(--ink-2); font-size: 0.82rem; }
.sstats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin: 3px 0; }
.sbar { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--ink-2); }
.sbar em { font-style: normal; }
.sbar i { height: 5px; border-radius: 9px; background: var(--cream-2); overflow: hidden; display: block; }
.sbar i::after { content: ""; display: block; height: 100%; width: var(--v); background: var(--laterite); }
.sbtn { justify-self: start; margin-top: 4px; border: 0; border-radius: 99px; padding: 4px 14px; font-weight: 800; font-size: 0.85rem; background: var(--green); color: #fff; }
.sbtn.buy { background: var(--gold); color: var(--ink); }
.sbtn.confirm { background: var(--laterite); color: #fff; }
.sbtn.on, .sbtn:disabled { background: var(--cream-2); color: var(--green); cursor: default; }
.sneed { margin-top: 3px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.shop-flash { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--green); color: #fff; padding: 8px 18px; border-radius: 99px; font-weight: 800; opacity: 0; pointer-events: none; }
.shop-flash.show { animation: flashMsg 2s ease both; }
@keyframes flashMsg { 0% { opacity: 0; transform: translate(-50%, 10px); } 15%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@media (max-width: 760px) {
  .shop-body { grid-template-columns: 1fr; overflow-y: auto; }
  .shop-preview { grid-template-columns: 150px 1fr; align-items: center; }
  #shopCanvas { width: 150px; height: 170px; }
  .shop-card { padding: 14px; }
  .wallet-row { flex-wrap: wrap; }
}

.modes { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .modes { grid-template-columns: repeat(2, 1fr); } }
.adv-hud, .region-banner { display: none; }
body.mode-adventure .adv-hud { display: block; position: absolute; left: 14px; bottom: 92px; color: #fff; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,0.55); background: rgba(0,0,0,0.35); padding: 3px 10px; border-radius: 10px; }
body.mode-adventure.touch .adv-hud { left: 50%; transform: translateX(-50%); bottom: 74px; font-size: 0.85rem; white-space: nowrap; }
body.mode-adventure .region-banner { display: block; position: absolute; left: 50%; top: 120px; transform: translateX(-50%); font-size: 2.4rem; font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.45); opacity: 0; pointer-events: none; }
.region-banner.show { animation: regionIn 3s ease both; }
@keyframes regionIn { 0% { opacity: 0; letter-spacing: 0.3em; } 20%, 70% { opacity: 1; letter-spacing: 0.02em; } 100% { opacity: 0; } }

.team-pick { display: grid; gap: 3px; font-size: 0.85rem; font-weight: 700; color: var(--ink-2); }
.team-pick select { padding: 6px 8px; border-radius: 8px; border: 2px solid var(--cream-2); background: #fff; font-weight: 600; }
body:not(.home-shoot) .team-only { display: none; }
.team-score { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,0.5); color: #fff; padding: 2px 12px; border-radius: 99px; font-weight: 800; }
.team-score .t { color: #8de0a0; } .team-score .m { color: #ffc46b; }
.team-score .mine { text-decoration: underline; text-underline-offset: 3px; }
.team-score b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* adventure: exploring only, no weapons */
body.mode-adventure .crosshair, body.mode-adventure .ammo-row, body.mode-adventure .swap-hint,
body.mode-adventure #fireBtn, body.mode-adventure #fireBtnL, body.mode-adventure #reloadBtn, body.mode-adventure #swapBtn { display: none !important; }
body.mode-adventure .adv-hud { bottom: 18px; }

.coupon { display: grid; grid-template-columns: 1fr auto; gap: 4px 6px; align-items: center; margin-left: auto; }
.coupon input { width: 150px; padding: 5px 10px; border-radius: 99px; border: 2px solid var(--cream-2); background: #fff; font-weight: 700; text-transform: uppercase; }
.coupon .sbtn { margin: 0; }
.coupon small { grid-column: 1 / -1; font-size: 0.78rem; font-weight: 700; color: var(--green); min-height: 1em; }
.shop-wallet { margin-left: 0; }
.sbtn s, .sneed s { opacity: 0.6; }
@media (max-width: 760px) { .shop-head { flex-wrap: wrap; } .coupon { margin-left: 0; } }

/* controls help */
.top-left { grid-auto-flow: row; }
.help-btn { font-size: 1rem; }
#help { z-index: 16; background: rgba(10,20,14,0.6); }
.help-panel { width: min(720px, 100%); }
.help-panel h2 { font-size: 1.5rem; color: var(--green-dk); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-grid h3 { font-size: 1rem; margin-bottom: 6px; color: var(--laterite); }
.help-grid ul { list-style: none; display: grid; gap: 5px; }
.help-grid li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--cream-2); padding-bottom: 3px; font-size: 0.95rem; }
kbd { display: inline-block; min-width: 26px; padding: 1px 7px; border-radius: 6px; background: #fff; border: 1px solid #cdbf9c; border-bottom-width: 3px; font: 700 0.85rem var(--font); text-align: center; color: var(--ink); }
.key-tip { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(0,0,0,0.6); color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 700; pointer-events: none; animation: tipFade 7s ease both; }
@keyframes tipFade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#jumpBtn { right: 150px; bottom: 230px; font-size: 1.3rem; }
#carBtn { right: 30px; bottom: 150px; width: auto; height: 44px; padding: 0 14px; border-radius: 99px; font-size: 0.9rem; }
body.mode-race #jumpBtn { display: none; }
@media (max-width: 640px) { .help-grid { grid-template-columns: 1fr; } }

.car-tip { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); background: rgba(0,0,0,0.65); color: #fff; padding: 6px 16px; border-radius: 99px; font-weight: 700; pointer-events: none; }
body.touch .car-tip { display: none; }
body.mode-adventure.driving .speedo { display: grid; position: absolute; right: 22px; bottom: 150px; justify-items: center; width: 110px; height: 110px; border-radius: 50%; background: rgba(0,0,0,0.45); border: 3px solid rgba(251,243,223,0.8); align-content: center; color: #fff; }
body.mode-adventure.driving.touch .speedo { right: 50%; transform: translateX(50%); bottom: 12px; width: 92px; height: 92px; }
body.mode-adventure.driving.touch .race-btn { display: block; }
body.mode-adventure.driving #stickL, body.mode-adventure.driving #jumpBtn { display: none !important; }
body.mode-adventure.driving.touch #carBtn { right: 30px; bottom: 140px; }
body.mode-adventure.driving.touch #resetBtn { display: none; }
.fm-card { width: fit-content; }
.fm-card .small { max-width: 100%; }

/* =================== LOBBY (home screen) ===================
   Deep paddy-green room, cream game cards with a kasavu-gold edge when picked,
   one panel on the right for the chosen game. */
.lobby {
  position: fixed; inset: 0; z-index: 20; color: #fff;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "games side";
  gap: 14px; padding: 14px 18px 16px;
  background:
    linear-gradient(180deg, transparent 0 7px, #e6bf5a 7px 9px, transparent 9px 13px, #e6bf5a 13px 14px, transparent 14px) top / 100% 14px no-repeat,
    radial-gradient(ellipse at 30% 0%, #23503a 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, #3a1f14 0%, transparent 50%),
    #0f2219;
  overflow: hidden;
}
.lobby.hidden { display: none; }
.lb-panel, .lb-side, .lb-player, .lb-coins, .lb-icon { background: rgba(255,255,255,0.05); border: 1px solid rgba(230, 191, 90, 0.3); }

/* top bar */
.lb-top { grid-area: top; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-top: 6px; }
.lb-player { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 14px; justify-self: start; min-width: 0; }
.lb-avatar { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; background: linear-gradient(135deg, var(--gold-lt), var(--laterite)); flex: none; }
.lb-who { display: grid; gap: 2px; min-width: 0; }
.lb-who input, .lb-who select { background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; color: #fff; padding: 2px 8px; font-weight: 700; width: 170px; outline: none; }
.lb-who input { font-size: 1.05rem; }
.lb-who select { font-size: 0.82rem; color: var(--gold-lt); }
.lb-who select option { color: #111; }
.lb-who input:focus { border-color: var(--gold-lt); }
.lb-loadout { font-size: 0.72rem; color: rgba(255,255,255,0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.lb-logo { text-align: center; line-height: 1; }
.lb-logo span { display: block; color: var(--gold-lt); font-weight: 700; font-size: 0.95rem; }
.lb-logo b { font-size: 2rem; font-weight: 800; letter-spacing: 0.04em; background: linear-gradient(180deg, #fff6d8, var(--gold-lt) 60%, #c98a1b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-right { justify-self: end; display: flex; gap: 8px; align-items: center; }
.lb-coins { padding: 8px 14px; border-radius: 99px; font-size: 1.1rem; white-space: nowrap; }
.lb-coins b { color: var(--gold-lt); font-size: 1.25rem; }
.lb-icon { display: grid; justify-items: center; padding: 5px 12px; border-radius: 14px; color: #fff; font-size: 1.25rem; line-height: 1.1; }
.lb-icon span { font-size: 0.7rem; font-weight: 700; opacity: 0.85; }
.lb-icon:hover { border-color: var(--gold-lt); }
.lb-play { position: relative; min-width: 170px; padding: 7px 26px 6px; border: 0; border-radius: 16px; color: #2a1208; display: grid; justify-items: center; line-height: 1;
  background: linear-gradient(180deg, #ffe7a0, var(--gold-lt) 45%, #d39a2a); box-shadow: 0 5px 0 #8a5a12, 0 0 24px rgba(255, 200, 80, 0.3); }
.lb-play span { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.08em; }
.lb-play small { font-weight: 800; font-size: 0.78rem; opacity: 0.75; margin-top: 2px; white-space: nowrap; }
.lb-play:hover { filter: brightness(1.06); }
.lb-play:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a5a12; }
.lb-play:disabled, .lb-btn:disabled { filter: grayscale(0.5); opacity: 0.7; cursor: wait; }

/* game cards */
.lb-games { grid-area: games; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; min-height: 0; padding: 2px 6px 18px 2px; scrollbar-width: thin; scrollbar-color: rgba(230,191,90,0.45) transparent; }
.lb-cat { font-size: 0.85rem; font-weight: 800; color: var(--gold-lt); margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; }
.lb-cat::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(230,191,90,0.5), transparent); }
.lb-cat + .lb-grid { margin-bottom: 18px; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.g-card { position: relative; display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 14px;
  background: var(--cream); color: var(--ink); border: 2px solid transparent; box-shadow: 0 3px 0 rgba(0,0,0,0.25); transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; min-height: 76px; }
.g-card:hover { transform: translateY(-2px); }
.g-card .g-em { grid-row: 1 / span 3; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; background: var(--acc); }
.g-card b, .g-card small, .g-card .g-pl { justify-self: start; text-align: left; }
.g-card b { font-size: 1rem; line-height: 1.1; }
.g-card small[lang="ml"] { color: var(--laterite); font-weight: 700; font-size: 0.78rem; line-height: 1.2; }
.g-card .g-pl { font-size: 0.72rem; color: var(--ink-2); font-weight: 600; }
.lobby .g-card.active, .lobby .g-card.active:hover { background: #fffaf0; color: var(--ink); border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230,191,90,0.45), 0 3px 0 rgba(0,0,0,0.25); transform: translateY(-2px); }
.g-card.active::after { content: "✓"; position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; box-shadow: 0 0 0 2px #0f2219; border-radius: 50%; background: var(--laterite); color: #fff; font-size: 0.75rem; font-weight: 800; display: grid; place-items: center; }

/* right panel: the chosen game */
.lb-side { grid-area: side; border-radius: 18px; padding: 14px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: flex; flex-direction: column; gap: 9px; min-height: 0; background: rgba(0,0,0,0.25); }
.lb-side-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.lb-side-em { font-size: 2rem; }
.lb-side h2 { font-size: 1.35rem; line-height: 1; color: #fff; }
.lb-side-head small { color: var(--gold-lt); font-weight: 700; }
.lb-side-pl { font-size: 0.72rem; font-weight: 800; color: var(--ink); background: var(--gold-lt); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.lb-side .mode-help { color: rgba(255,255,255,0.82); font-size: 0.86rem; line-height: 1.4; }
.lb-side .field label { color: #fff; }
.lb-side .small { color: rgba(255,255,255,0.8); }
.lb-side .map-card, .lb-side .veh-card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: #fff; }
.lb-side .map-card.sel, .lb-side .veh-card.sel { border-color: var(--gold-lt); box-shadow: 0 0 0 2px rgba(230,191,90,0.35); }
.lb-side .map-info small, .lb-side .veh-desc { color: rgba(255,255,255,0.75); }
.lb-side .map-info span[lang="ml"] { color: var(--gold-lt); }
.lb-side .vehs { grid-template-columns: repeat(3, 1fr); }
.lb-side .veh-card .bars i { background: rgba(255,255,255,0.15); }
.lb-side .veh-card .bars i::after { background: var(--gold-lt); }
.lb-opts { display: grid; gap: 6px; margin-top: auto; }
.lb-opts .check { color: #fff; }
body:not(.home-shoot) .lobby .team-only { display: none; }
.lb-room { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid rgba(230,191,90,0.25); }
.lb-room .lb-create { width: 100%; }
.lb-side .err { color: #ffb4a8; margin: 0; font-weight: 700; }
.lb-side .err:empty { display: none; }
.lb-join { display: flex; gap: 6px; min-width: 0; }
.lb-join input, .lb-join select { background: rgba(0,0,0,0.35); border: 1px solid rgba(230,191,90,0.4); color: #fff; border-radius: 10px; padding: 9px 10px; font-weight: 700; outline: none; }
.lb-join input { flex: 1; min-width: 64px; width: 80px; text-transform: uppercase; letter-spacing: 0.08em; }
.lb-join select { flex: 0 1 auto; min-width: 0; max-width: 130px; }
.lb-join select option { color: #111; }
.lb-btn { border: 1px solid rgba(230,191,90,0.6); background: rgba(20,38,28,0.85); color: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 800; }
.lb-btn:hover { background: rgba(47, 107, 63, 0.9); }
.lb-rotate { display: none; }

/* roomy screens: bigger cards */
@media (min-width: 1100px) and (min-height: 700px) {
  .lb-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .g-card { min-height: 96px; grid-template-columns: 50px 1fr; padding: 12px; column-gap: 9px; }
  .g-card .g-em { width: 50px; height: 50px; font-size: 1.75rem; border-radius: 13px; }
  .g-card b { font-size: 1rem; }
}
/* laptops with short screens, tablets */
@media (max-width: 1000px) {
  .lobby { grid-template-columns: minmax(0, 1fr) 260px; padding: 10px 12px; gap: 10px; }
  .lb-logo b { font-size: 1.5rem; }
  .lb-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
  .lb-side .vehs { grid-template-columns: repeat(3, 1fr); }
  .lb-side .map-card { grid-template-columns: 70px 1fr; }
  .lb-side .map-thumb { height: 48px; }
  .lb-side .map-info small { display: none; }
}
/* phones held sideways */
@media (max-height: 500px) {
  .lobby { padding: 6px 10px 8px; gap: 8px; grid-template-columns: minmax(0, 1fr) 250px; }
  .lobby { background: radial-gradient(ellipse at 30% 0%, #23503a 0%, transparent 55%), #0f2219; }
  .lb-top { padding-top: 0; }
  .lb-who select, .lb-loadout { display: none; }
  .lb-avatar { width: 34px; height: 34px; font-size: 1.15rem; }
  .lb-who input { width: 120px; font-size: 0.95rem; }
  .lb-logo span { display: none; }
  .lb-logo b { font-size: 1.15rem; }
  .lb-icon span { display: none; }
  .lb-icon { padding: 4px 9px; font-size: 1.1rem; }
  .lb-coins { padding: 5px 10px; font-size: 0.95rem; }
  .lb-play { min-width: 120px; padding: 5px 14px 4px; border-radius: 12px; }
  .lb-play span { font-size: 1.25rem; }
  .lb-play small { font-size: 0.64rem; }
  .lb-cat { margin: 2px 0 6px; font-size: 0.75rem; }
  .lb-cat + .lb-grid { margin-bottom: 10px; }
  .lb-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 7px; }
  .g-card { grid-template-columns: 34px 1fr; padding: 7px 8px; min-height: 54px; column-gap: 7px; border-radius: 11px; }
  .g-card .g-em { width: 34px; height: 34px; font-size: 1.2rem; border-radius: 9px; }
  .g-card b { font-size: 0.86rem; }
  .g-card small[lang="ml"] { font-size: 0.66rem; }
  .g-card .g-pl { display: none; }
  .lb-side { padding: 10px; gap: 7px; }
  .lb-side-em { font-size: 1.5rem; }
  .lb-side h2 { font-size: 1.1rem; }
  .lb-side .mode-help { font-size: 0.76rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .lb-join input { min-width: 56px; }
  .lb-join select { max-width: 92px; }
}
@media (orientation: portrait) and (max-width: 700px) {
  .lb-rotate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 5; background: rgba(6,14,10,0.94); font-size: 1.3rem; font-weight: 800; color: var(--gold-lt); text-align: center; padding: 30px; }
}

/* hide & seek: object picker for hiders, crosshair for seekers */
.dg-bar { display: none; }
body.mode-hide.hider .dg-bar { display: flex; position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); gap: 6px; pointer-events: auto; }
.dg { display: grid; justify-items: center; width: 56px; padding: 4px 0 2px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.5); color: #fff; line-height: 1.05; }
.dg span { font-size: 1.5rem; }
.dg small { font-size: 0.7rem; font-weight: 800; opacity: 0.85; }
.dg.on { border-color: var(--gold-lt); background: rgba(180, 71, 46, 0.85); transform: translateY(-3px); }
body.mode-hide.seeker .crosshair { display: block !important; }
body.mode-hide.touch.hider .dg-bar { bottom: 8px; gap: 4px; }
body.mode-hide.touch .dg { width: 46px; padding: 2px 0; }
body.mode-hide.touch .dg span { font-size: 1.2rem; }
body.mode-hide.touch .dg small { font-size: 0.55rem; }
.dmg.taunt { font-size: 2.2rem; animation-duration: 2s; }

/* adventure: jobs, energy, shops */
.job-hud { position: absolute; left: 14px; top: 46%; width: min(340px, 40vw); background: rgba(20, 32, 24, 0.86); color: var(--cream); border: 2px solid var(--gold-lt); border-radius: 14px; padding: 8px 12px; display: grid; gap: 4px; pointer-events: auto; }
.jh-top { display: flex; align-items: center; gap: 8px; }
.jh-top b { font-size: 1.05rem; color: var(--gold-lt); }
.jh-top button { margin-left: auto; border: 1px solid rgba(255,255,255,0.4); background: transparent; color: #fff; border-radius: 99px; padding: 0 10px; font-size: 0.8rem; }
#jhStep { font-weight: 700; }
.jh-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.18); overflow: hidden; }
.jh-bar i { display: block; height: 100%; width: 0; background: var(--gold-lt); transition: width 0.15s linear; }
#jhMeta { opacity: 0.85; }
.tired-tip { position: absolute; left: 50%; bottom: 108px; transform: translateX(-50%); background: rgba(160, 60, 30, 0.88); color: #fff; padding: 6px 16px; border-radius: 99px; font-weight: 700; pointer-events: none; white-space: nowrap; }
body.mode-adventure #hpFill { background: linear-gradient(90deg, #f2a03a, #ffd84a); }
body.mode-adventure #hpFill.low { background: #ff6a4a; }
body.mode-adventure.touch .car-tip { display: none; }
#storeUi { z-index: 25; background: rgba(10, 20, 14, 0.6); }
.store-card { width: min(620px, 100%); max-height: 92vh; overflow-y: auto; padding: 18px 20px; display: grid; gap: 10px; touch-action: pan-y; }
.store-card header { display: flex; align-items: center; gap: 12px; }
.store-card h2 { font-size: 1.7rem; line-height: 1; color: var(--green-dk); }
.store-card h2 span { color: var(--laterite); font-size: 1.1rem; }
.store-card h3 { font-size: 1rem; color: var(--ink-2); }
.st-wallet { margin-left: auto; font-size: 1.2rem; background: #fff; border: 2px solid var(--gold); border-radius: 99px; padding: 0 12px; }
.st-wallet b { color: var(--gold); }
#stClose { border: 0; background: var(--cream-2); width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; }
.st-energy { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-weight: 700; }
.en-bar { height: 12px; border-radius: 99px; background: var(--cream-2); overflow: hidden; }
.en-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2a03a, #ffd84a); transition: width 0.3s; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.food { display: grid; justify-items: center; gap: 1px; padding: 8px 4px; border-radius: 12px; border: 2px solid var(--cream-2); background: #fff; line-height: 1.15; }
.food:hover { border-color: var(--gold); }
.food[data-poor] { opacity: 0.55; }
.fem { font-size: 2rem; }
.food span[lang="ml"] { color: var(--laterite); font-size: 0.78rem; font-weight: 700; }
.food small { color: var(--green); font-weight: 800; }
.food em { font-style: normal; font-weight: 800; color: var(--gold); }
.st-mine { display: flex; flex-wrap: wrap; gap: 6px; }
.mine { background: #fff; border: 2px solid var(--cream-2); border-radius: 99px; padding: 2px 10px; font-size: 0.88rem; }
.mine.on { border-color: var(--green); color: var(--green-dk); font-weight: 700; }
.st-dress { margin-top: 8px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: var(--laterite); color: #fff; font-weight: 800; font-size: 1rem; }
#stMsg { min-height: 1.3em; font-weight: 700; color: var(--green-dk); }
body.touch .job-hud { left: 50%; transform: translateX(-50%); top: 70px; width: min(330px, 50vw); font-size: 0.85rem; }
body.touch .tired-tip { bottom: auto; top: 160px; font-size: 0.85rem; }

/* ---------- Paambum Koniyum ---------- */
body.board-game #hud > :not(.top-left):not(.top-center):not(.announce):not(.sn-ui):not(.on-ui):not(.vl-ui):not(#dmgLayer) { display: none !important; }
body.board-game #mapBtn, body.board-game #timer, body.board-game #teamScore { display: none !important; }
.sn-ui { position: absolute; inset: 0; pointer-events: none; }
.sn-turn-wrap { position: absolute; left: 50%; top: 46px; transform: translateX(-50%); min-width: 260px; text-align: center; background: rgba(43, 29, 18, 0.78); color: var(--cream); border-radius: 14px; padding: 6px 16px 8px; transition: background 0.3s, transform 0.3s; }
.sn-turn-wrap.mine { background: rgba(180, 71, 46, 0.95); transform: translateX(-50%) scale(1.06); }
.sn-turn { font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.sn-turn i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.sn-turn-bar { height: 4px; margin-top: 4px; border-radius: 99px; background: rgba(255,255,255,0.18); overflow: hidden; }
.sn-turn-bar i { display: block; height: 100%; background: var(--gold-lt); transition: width 0.2s linear; }
.sn-side { position: absolute; right: 14px; top: 14px; width: 220px; padding: 10px 12px; pointer-events: auto; }
.sn-side-head { font-weight: 800; color: var(--laterite); display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.sn-side-head small { color: var(--ink-2); font-size: 0.78rem; }
#snPlayers { list-style: none; display: grid; gap: 3px; margin-top: 4px; }
#snPlayers li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 8px; transition: background 0.2s; }
#snPlayers li i { width: 12px; height: 12px; border-radius: 50%; }
#snPlayers li .nm { font-weight: 700; line-height: 1.05; display: grid; }
#snPlayers li .nm small { font-weight: 500; color: var(--ink-2); font-size: 0.72rem; }
#snPlayers li .ps { font-weight: 800; font-size: 1.1rem; color: var(--green-dk); min-width: 30px; text-align: right; }
#snPlayers li.turn { background: rgba(230, 191, 90, 0.45); }
#snPlayers li.me .nm { color: var(--laterite); }
.sn-roll { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 34px; border: 0; border-radius: 99px; font-size: 1.6rem; font-weight: 800; color: #fff; background: #7d7d7d; box-shadow: 0 6px 0 rgba(0,0,0,0.25); opacity: 0.6; transition: transform 0.15s, opacity 0.2s, background 0.2s; }
.sn-roll span { font-size: 2rem; }
.sn-roll.ready { opacity: 1; background: var(--laterite); animation: snPulse 1.1s ease-in-out infinite; }
.sn-roll.ready:active { transform: translateX(-50%) translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.25); }
@keyframes snPulse { 50% { transform: translateX(-50%) scale(1.07); } }
.sn-dice { position: absolute; right: 250px; bottom: 120px; display: grid; justify-items: center; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.45); opacity: 0; }
.sn-dice b { font-size: 5rem; line-height: 1; }
.sn-dice small { font-weight: 800; font-size: 1rem; }
.sn-dice.show { animation: snDice 1.8s ease-out forwards; }
@keyframes snDice { 0% { opacity: 0; transform: scale(0.4); } 15% { opacity: 1; transform: scale(1.15); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.sn-msg { position: absolute; left: 50%; top: 36%; transform: translateX(-50%) translateY(-6px); font-size: 1.5rem; font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.25s, transform 0.25s; white-space: nowrap; }
.sn-msg.show { opacity: 1; transform: translateX(-50%); }
.sn-msg.good { color: #b9f58a; }
.sn-msg.bad { color: #ffb0a0; }
.sn-results { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 20, 14, 0.45); pointer-events: auto; }
.sn-res-card { width: min(460px, 92vw); padding: 18px 20px; display: grid; gap: 10px; text-align: center; }
.sn-res-card h2 { font-size: 1.8rem; color: var(--green-dk); }
#snResList, .sn-res-list { list-style: none; display: grid; gap: 6px; text-align: left; }
#snResList li, .sn-res-list li { display: grid; grid-template-columns: 34px 12px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; background: #fff; border-radius: 10px; padding: 6px 10px; }
#snResList li > span, .sn-res-list li > span { grid-row: span 2; font-size: 1.4rem; text-align: center; }
#snResList li i, .sn-res-list li i { grid-row: span 2; width: 12px; height: 12px; border-radius: 50%; }
#snResList li small, .sn-res-list li small { grid-column: 3; color: var(--ink-2); font-size: 0.78rem; }
#snResList li em, .sn-res-list li em { grid-row: 1 / span 2; grid-column: 4; font-style: normal; font-weight: 800; color: var(--gold); }
#snResList li.me, .sn-res-list li.me { outline: 2px solid var(--laterite); }
#snResMe, .sn-res-me { font-weight: 800; color: var(--laterite); }
body.touch .sn-side { width: 170px; top: 60px; font-size: 0.85rem; }
body.touch .sn-turn-wrap { top: 12px; }
body.touch .sn-dice { right: 200px; bottom: 90px; }
body.touch .sn-roll { bottom: 16px; padding: 10px 28px; font-size: 1.35rem; }

/* ---------- Onam games ---------- */
.on-ui { position: absolute; inset: 0; pointer-events: none; }
.on-head { position: absolute; left: 50%; top: 46px; transform: translateX(-50%); width: min(560px, 70vw); text-align: center; background: rgba(43, 29, 18, 0.8); color: var(--cream); border-radius: 14px; padding: 6px 16px 8px; border: 2px solid var(--gold-lt); }
#onTitle { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
#onTitle small { color: var(--gold-lt); font-size: 0.95rem; }
#onSub { display: block; font-weight: 600; opacity: 0.92; }
.on-bar { height: 4px; margin-top: 5px; border-radius: 99px; background: rgba(255,255,255,0.15); overflow: hidden; }
.on-bar i { display: block; height: 100%; background: var(--gold-lt); transition: width 0.2s linear; }
.on-scores { position: absolute; right: 14px; top: 14px; width: 210px; padding: 8px 10px; list-style: none; display: grid; gap: 3px; }
.on-scores li { display: grid; grid-template-columns: 16px 12px 1fr auto auto auto; gap: 6px; align-items: center; font-size: 0.9rem; }
.on-scores li span { color: var(--ink-2); font-weight: 700; }
.on-scores li i { width: 12px; height: 12px; border-radius: 50%; }
.on-scores li b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-scores li em { color: var(--green); font-weight: 800; font-style: normal; }
.on-scores li small { color: var(--ink-2); }
.on-scores li strong { color: var(--laterite); font-size: 1.05rem; min-width: 22px; text-align: right; }
.on-scores li.me b { color: var(--laterite); }
.on-scores li.out { opacity: 0.45; }
.on-btn { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); pointer-events: auto; min-width: 220px; padding: 14px 36px; border: 0; border-radius: 99px; font-size: 1.7rem; font-weight: 800; color: #fff; background: #7d7d7d; box-shadow: 0 6px 0 rgba(0,0,0,0.25); opacity: 0.6; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.on-btn.ready { opacity: 1; background: var(--laterite); }
.on-btn.alarm { background: #d6362b; animation: snPulse 0.4s ease-in-out infinite; }
.on-btn.bump { animation: onBump 0.12s ease-out; }
@keyframes onBump { 50% { transform: translateX(-50%) scale(0.93); } }
.on-msg { position: absolute; left: 50%; top: 34%; transform: translateX(-50%) translateY(-6px); font-size: 1.7rem; font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.25s, transform 0.25s; white-space: nowrap; }
.on-msg.show { opacity: 1; transform: translateX(-50%); }
.on-msg.good { color: #b9f58a; }
.on-msg.bad { color: #ffb0a0; }
/* blindfold: a dark cloth over the eyes (Uriyadi lets a little light through the bottom) */
.on-blind { position: absolute; inset: 0; background: #0a0705; opacity: 0; transition: opacity 0.5s; }
.on-blind.on { opacity: 0.97; }
.on-blind.peek.on { opacity: 1; background: linear-gradient(180deg, #0a0705 0%, #0a0705 62%, rgba(10,7,5,0.75) 80%, rgba(10,7,5,0.55) 100%); }
.on-cross { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #d6362b; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.4); }
body.touch .on-scores { width: 170px; top: 60px; font-size: 0.8rem; }
body.touch .on-head { top: 8px; }
body.touch .on-btn { bottom: 14px; font-size: 1.4rem; padding: 12px 30px; }

/* carrom has no roll button: you flick on the board */
body.no-roll .sn-roll { display: none; }
body.mode-carrom .sn-turn-wrap { max-width: 70vw; }
body.mode-carrom .sn-turn { font-size: 1.05rem; }

/* ---------- Kachavadam ---------- */
.mn-panel { position: absolute; left: 14px; bottom: 20px; width: min(330px, 42vw); pointer-events: auto; background: rgba(251, 243, 223, 0.96); border: 2px solid var(--gold); border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.mn-offer { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: stretch; }
.mn-sw { border-radius: 4px; }
.mn-offer b { font-size: 1.15rem; color: var(--ink); }
.mn-offer small { display: block; color: var(--ink-2); font-size: 0.8rem; }
.mn-offer small[lang="ml"] { display: inline; color: var(--laterite); font-weight: 700; }
.mn-btns { display: flex; gap: 8px; }
.mn-btns button { flex: 1; border: 0; border-radius: 10px; padding: 10px; font-weight: 800; font-size: 1rem; }
.mn-buy { background: var(--green); color: #fff; }
.mn-buy:disabled { opacity: 0.5; }
.mn-skip { background: var(--cream-2); color: var(--ink); }
.mn-build { display: grid; gap: 5px; max-height: 32vh; overflow-y: auto; touch-action: pan-y; }
.mn-build small { color: var(--ink-2); font-weight: 700; }
.mn-build button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--cream-2); background: #fff; border-radius: 9px; padding: 6px 9px; font-weight: 700; text-align: left; font-size: 0.9rem; }
.mn-build button span { width: 10px; height: 18px; border-radius: 3px; }
.mn-cash { font-size: 0.95rem !important; color: var(--green) !important; }
#snPlayers li.out { opacity: 0.45; }
.mn-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.6); width: min(340px, 80vw); padding: 18px 20px; border-radius: 16px; background: #fbf3df; border: 3px solid var(--gold); text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.45); opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.mn-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.mn-card b { display: block; font-size: 1.3rem; color: var(--laterite); margin-bottom: 6px; }
.mn-card.panchayat b { color: var(--green-dk); }
.mn-card p { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.mn-info { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); background: rgba(43, 29, 18, 0.88); color: var(--cream); border-radius: 12px; padding: 8px 14px; display: grid; gap: 2px; text-align: center; font-size: 0.9rem; opacity: 0; transition: opacity 0.2s; pointer-events: none; max-width: 90vw; }
.mn-info.show { opacity: 1; }
.mn-info small { color: var(--gold-lt); font-weight: 700; }
body.touch .mn-panel { bottom: 10px; width: min(290px, 40vw); padding: 8px; font-size: 0.85rem; }
body.mono-ui .sn-dice { display: none; }
body.mono-ui .sn-roll { left: auto; right: 24px; transform: none; }
body.mono-ui .sn-roll.ready { animation: mnPulse 1.1s ease-in-out infinite; }
@keyframes mnPulse { 50% { transform: scale(1.07); } }

/* ---------- Vallamkali ---------- */
.vl-ui { position: absolute; inset: 0; pointer-events: none; }
.vl-top { position: absolute; left: 50%; top: 46px; transform: translateX(-50%); background: rgba(43, 29, 18, 0.8); color: var(--cream); border-radius: 12px; padding: 6px 16px; font-weight: 800; font-size: 1.1rem; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.vl-top i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.vl-track { position: absolute; right: 14px; top: 14px; width: 240px; padding: 8px 10px; display: grid; gap: 4px; }
.vl-lane { position: relative; height: 22px; border-radius: 6px; background: linear-gradient(90deg, rgba(47,127,208,0.15), rgba(47,127,208,0.3)); border-right: 3px solid var(--gold); }
.vl-lane.me { outline: 2px solid var(--laterite); }
.vl-lane span { position: absolute; top: 1px; transform: translateX(-50%); font-size: 0.9rem; padding: 0 3px; border-radius: 6px; transition: left 0.25s linear; }
.vl-lane small { position: absolute; left: 4px; top: 3px; font-size: 0.66rem; font-weight: 800; color: var(--ink); opacity: 0.75; pointer-events: none; }
.vl-side { position: absolute; left: 14px; bottom: 24px; display: grid; gap: 4px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.5); }
.vl-side small { font-weight: 800; font-size: 0.95rem; }
.vl-crew { display: flex; flex-wrap: wrap; gap: 4px; max-width: 34vw; }
.vl-crew span { background: rgba(0,0,0,0.45); border-radius: 99px; padding: 2px 9px; font-size: 0.8rem; font-weight: 700; }
.vl-crew span.me { background: var(--laterite); }
/* the big round row button with its beat ring */
.vl-btn { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); width: 150px; height: 150px; border-radius: 50%; border: 5px solid #fff; background: radial-gradient(circle at 40% 35%, #e0683f, #b4472e 60%, #7a2a18); color: #fff; font-weight: 800; font-size: 1.25rem; pointer-events: auto; box-shadow: 0 8px 0 rgba(0,0,0,0.3); touch-action: manipulation; -webkit-user-select: none; user-select: none; opacity: 0.7; }
.vl-btn.ready { opacity: 1; }
.vl-btn.beat { box-shadow: 0 0 0 10px rgba(255, 231, 160, 0.55), 0 8px 0 rgba(0,0,0,0.3); }
.vl-btn.bump { animation: vlBump 0.14s ease-out; }
@keyframes vlBump { 50% { transform: translateX(-50%) scale(0.92); } }
.vl-ring { position: absolute; left: 50%; bottom: 101px; width: 150px; height: 150px; border-radius: 50%; border: 5px solid var(--gold-lt); transform: translate(-50%, 50%) scale(2); opacity: 0; pointer-events: none; }
.vl-judge { position: absolute; left: 50%; bottom: 200px; transform: translateX(-50%); font-size: 1.6rem; font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.55); opacity: 0; white-space: nowrap; }
.vl-judge.pop { animation: vlPop 0.6s ease-out forwards; }
.vl-judge.good { color: #b9f58a; } .vl-judge.ok { color: #ffe7a0; } .vl-judge.bad { color: #ffb0a0; }
@keyframes vlPop { 0% { opacity: 0; transform: translateX(-50%) scale(0.6); } 20% { opacity: 1; transform: translateX(-50%) scale(1.15); } 100% { opacity: 0; transform: translateX(-50%) translateY(-24px); } }
.vl-msg { position: absolute; left: 50%; top: 30%; transform: translateX(-50%) translateY(-6px); font-size: 1.7rem; font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.25s, transform 0.25s; white-space: nowrap; }
.vl-msg.show { opacity: 1; transform: translateX(-50%); }
.vl-msg.good { color: #b9f58a; }
body.touch .vl-btn { width: 120px; height: 120px; bottom: 14px; font-size: 1.05rem; }
body.touch .vl-ring { width: 120px; height: 120px; bottom: 74px; }
body.touch .vl-judge { bottom: 150px; }
body.touch .vl-top { top: 8px; font-size: 0.9rem; }
body.touch .vl-track { width: 190px; top: 50px; }

/* ---------- Kuttiyum Kolum ---------- */
.kk-btn { display: none; }
body.kk-batting .kk-btn { display: block; }
.kk-board { position: absolute; right: 14px; top: 14px; width: 230px; padding: 8px 10px; display: grid; gap: 3px; }
.kk-inn { font-size: 0.72rem; font-weight: 800; color: var(--ink); opacity: 0.7; }
.kk-teams { display: flex; justify-content: space-around; font-weight: 800; }
.kk-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 6px; align-items: center; font-size: 0.82rem; padding: 2px 4px; border-radius: 6px; color: var(--ink); }
.kk-row i { width: 12px; height: 12px; border-radius: 50%; }
.kk-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kk-row em { font-style: normal; font-weight: 800; min-width: 28px; text-align: right; }
.kk-row.me { background: rgba(180, 71, 46, 0.14); }
.kk-row.bat { outline: 2px solid var(--gold); }
/* the power meter beside the button: pop when it's high */
.kk-meter { position: absolute; left: calc(50% + 100px); bottom: 30px; width: 22px; height: 140px; border-radius: 11px; border: 3px solid #fff; background: linear-gradient(to top, #c0392b, #f2c12e 55%, #2f9e5b 85%); box-shadow: 0 4px 0 rgba(0,0,0,0.3); opacity: 0; transition: opacity 0.2s; --m: 0; }
.kk-meter.on { opacity: 1; }
.kk-meter i { position: absolute; left: -8px; right: -8px; height: 6px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 2px #2b1d12; bottom: calc(var(--m) * 100% - 3px); }
body.touch .kk-meter { left: calc(50% + 78px); bottom: 14px; height: 116px; }
body.touch .kk-board { width: 180px; top: 50px; font-size: 0.9em; }

/* ---------- Kallanum Policum ---------- */
.pl-ui { display: none; }
body.mode-police .pl-ui { display: grid; position: absolute; left: 50%; top: 92px; transform: translateX(-50%); justify-items: center; gap: 6px; pointer-events: none; }
.pl-top { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.55); color: #fff; border-radius: 14px; padding: 5px 14px; font-weight: 800; white-space: nowrap; }
.pl-role { padding: 2px 10px; border-radius: 99px; font-size: 0.95rem; }
.pl-role.cop { background: #2a4fa8; } .pl-role.thief { background: #b4472e; }
.pl-loot { display: grid; gap: 2px; font-size: 0.85rem; }
.pl-loot i { display: block; width: 130px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.25); overflow: hidden; }
.pl-loot i b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f2c12e, #ffe066); transition: width 0.4s; }
.pl-count { font-size: 0.85rem; opacity: 0.9; }
.pl-state { background: rgba(0,0,0,0.45); color: #fff; font-weight: 700; border-radius: 99px; padding: 3px 14px; text-shadow: 0 1px 0 rgba(0,0,0,0.5); font-size: 0.92rem; }
.pl-ab { display: none; }
body.mode-police:not(.touch):not(.driving) .pl-ab { display: block; position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: rgba(0,0,0,0.5); color: #fff; font-weight: 800; border-radius: 99px; padding: 4px 14px; }
body.mode-police .bottom-left .ammo-row, body.mode-police .crosshair, body.mode-police #reloadBtn, body.mode-police #swapBtn, body.mode-police #fireBtnL, body.mode-police .swap-hint, body.mode-police .hp-wrap { display: none !important; }
body.mode-police #fireBtn { font-size: 0.8rem; width: auto; min-width: 84px; padding: 0 10px; border-radius: 99px; }
body.mode-police #fireBtn.cool { opacity: 0.5; }
body.mode-police.driving .speedo { display: grid; position: absolute; right: 22px; bottom: 150px; justify-items: center; width: 110px; height: 110px; border-radius: 50%; background: rgba(0,0,0,0.45); border: 3px solid rgba(251,243,223,0.8); align-content: center; color: #fff; }
body.mode-police.driving.touch .speedo { right: 50%; transform: translateX(50%); bottom: 12px; width: 92px; height: 92px; }
body.mode-police.driving.touch .race-btn { display: block; }
body.mode-police.driving #stickL, body.mode-police.driving #jumpBtn, body.mode-police.driving #fireBtn { display: none !important; }
body.mode-police.driving.touch #carBtn { right: 30px; bottom: 140px; }
body.mode-police.driving #resetBtn, body.mode-police.riding .race-btn, body.mode-police.riding .speedo { display: none !important; }
body.mode-police.touch .pl-ui { top: 64px; transform: translateX(-50%) scale(0.85); transform-origin: top center; }

/* ---------- nearby chat (Adventure) ---------- */
.chat-ui { display: none; }
body.mode-adventure .chat-ui { display: block; position: absolute; left: 14px; bottom: 150px; width: min(380px, 44vw); pointer-events: none; z-index: 6; }
.chat-log { display: grid; gap: 3px; }
.chat-row { background: rgba(0,0,0,0.5); color: #fff; border-radius: 10px; padding: 3px 10px; font-size: 0.9rem; width: fit-content; max-width: 100%; transition: opacity 1s; overflow-wrap: anywhere; }
.chat-row b { color: #ffe7a0; margin-right: 4px; }
.chat-row.me b { color: #a8f0b4; }
.chat-row.old { opacity: 0; }
.chat-near { margin-top: 6px; background: rgba(43,29,18,0.75); color: var(--cream); border-radius: 99px; padding: 3px 12px; font-size: 0.85rem; font-weight: 700; width: fit-content; }
.chat-box { margin-top: 6px; pointer-events: auto; background: rgba(251,243,223,0.97); border-radius: 14px; padding: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.35); display: grid; gap: 6px; }
.chat-line { display: flex; gap: 6px; }
.chat-line input { flex: 1; min-width: 0; border: 2px solid var(--gold); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 1rem; }
.chat-line button { border: 0; border-radius: 10px; padding: 0 12px; font-weight: 800; background: var(--laterite); color: #fff; }
.chat-line button#chatClose { background: #8a7a62; padding: 0 9px; }
.chat-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-quick button { border: 1.5px solid var(--gold); background: #fff; border-radius: 99px; padding: 2px 9px; font-size: 0.85rem; }
.chat-btn { display: none; }
body.mode-adventure.touch .chat-btn { display: block; position: fixed; right: 14px; top: 120px; width: 50px; height: 50px; border-radius: 50%; border: 3px solid #fff; background: rgba(43,29,18,0.75); font-size: 1.4rem; pointer-events: auto; }
body.mode-adventure.touch .chat-ui { bottom: auto; top: 56px; left: 50%; transform: translateX(-50%); width: min(420px, 70vw); }
body.mode-adventure.touch .chat-log { justify-items: center; }
body.mode-adventure.driving .chat-near { display: none; }
