:root {
  --pink: #ff7a1a;
  --cyan: #00e5ff;
  --yellow: #ffd600;
  --bg: #0b0c1a;
  --panel: rgba(12, 14, 34, 0.78);
  --text: #f4f6ff;
  --muted: #9aa3c7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: "Rubik", "Assistant", "Segoe UI", "Arial Hebrew", system-ui, Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- menu ---------- */
#menu, #end { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, rgba(255,122,26,.25), transparent 50%), radial-gradient(circle at 70% 80%, rgba(0,229,255,.2), transparent 50%), rgba(5,6,16,.82); z-index: 20; }
.menu-card { width: min(440px, 100%); background: var(--panel); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 24px; backdrop-filter: blur(8px); box-shadow: 0 0 40px rgba(255,122,26,.25); max-height: 100%; overflow: auto; }
h1 { margin: 0; font-size: 44px; letter-spacing: 3px; direction: ltr; text-align: center; font-weight: 900; text-shadow: 0 0 18px var(--pink); }
h1 span { color: var(--cyan); text-shadow: 0 0 18px var(--cyan); }
.tag { text-align: center; color: var(--muted); margin: 6px 0 18px; }
label { display: block; margin: 12px 0; color: var(--muted); font-size: 14px; }
label input:not([type=range]) { display: block; width: 100%; margin-top: 6px; padding: 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font-size: 18px; }
label select { display: block; width: 100%; margin-top: 6px; padding: 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font-size: 16px; }
label input[type=range] { display: block; width: 100%; margin-top: 6px; accent-color: var(--pink); }
#play { width: 100%; margin-top: 8px; padding: 16px; font-size: 26px; font-weight: 900; border: 0; border-radius: 14px; color: #fff;
  background: linear-gradient(90deg, var(--pink), #ff6d00); box-shadow: 0 0 24px rgba(255,122,26,.6); transition: transform .1s; }
#play:hover { transform: scale(1.03); }
#play:disabled { opacity: .6; }
#gsi { display: flex; justify-content: center; min-height: 0; margin: 6px 0; }
#account, #online-count { text-align: center; color: var(--cyan); font-size: 13px; margin: 4px 0; min-height: 1em; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row input { flex: 1; min-width: 0; padding: 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font-size: 18px; text-transform: uppercase; letter-spacing: 3px; direction: ltr; text-align: center; }
button.secondary { flex: 1; padding: 12px; border-radius: 12px; border: 1px solid var(--cyan); background: rgba(0,229,255,.12); color: var(--text); font-weight: 700; font-size: 16px; }
button.secondary:disabled { opacity: .5; }
#invite { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 30; background: var(--panel); border: 1px solid var(--yellow); border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px); flex-wrap: wrap; }
#invite button { border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 700; }
#invite .yes { background: var(--yellow); color: #000; }
#invite .no { background: rgba(255,255,255,.12); color: var(--text); }
#menu-status { min-height: 1.2em; color: var(--yellow); text-align: center; }
details { margin-top: 10px; color: var(--muted); font-size: 14px; }
details ul { padding-inline-start: 18px; line-height: 1.8; }
code { direction: rtl; unicode-bidi: plaintext; background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; }
.safe { font-size: 12px; color: var(--muted); border-top: 1px solid rgba(255,255,255,.1); padding-top: 10px; }
#profile { text-align: center; color: var(--cyan); font-weight: 700; }

/* ---------- start screen ---------- */
#menu { place-items: start center; overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 44px 44px,
    radial-gradient(1200px 600px at 15% -10%, rgba(255,122,26,.28), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(0,229,255,.22), transparent 60%),
    #070814; }
.menu-shell { width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; margin: auto; padding-block: 8px 16px; }
.topnav { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-radius: 16px; background: rgba(10,12,30,.7); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: baseline; gap: 8px; direction: ltr; }
.topnav h1 { font-size: 30px; letter-spacing: 2px; text-align: start; }
.ver { color: var(--muted); font-size: 12px; }
.nav-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); color: var(--text); font-size: 14px; font-weight: 700; }
.chip:empty { display: none; }
.chip-btn:hover { border-color: var(--yellow); }
.chip select { margin: 0; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; width: auto; display: inline; }
.chip select option { background: #111428; }
#profile { color: var(--cyan); }

.panel { background: rgba(12,14,34,.78); border: 1px solid rgba(255,255,255,.1); border-radius: 20px; padding: 16px; backdrop-filter: blur(10px); min-width: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.panel h2.sub { margin: 14px 0 8px; font-size: 13px; letter-spacing: 1.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.preview-wrap { position: relative; border-radius: 16px; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, rgba(0,229,255,.2), transparent 55%), linear-gradient(180deg, #1c2550, #0b0e22 75%); }
#char-preview { display: block; width: 100%; height: auto; aspect-ratio: 480 / 500; max-height: 56vh; object-fit: contain; cursor: grab; touch-action: none; }
.arrow { direction: ltr; unicode-bidi: isolate; position: absolute; top: 45%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(10,12,30,.6); color: #fff; font-size: 26px; line-height: 1; backdrop-filter: blur(6px); }
.arrow:hover { border-color: var(--cyan); }
#char-prev { right: 12px; }
#char-next { left: 12px; }
.char-caption { position: absolute; inset-inline: 0; bottom: 0; padding: 40px 18px 14px; background: linear-gradient(transparent, rgba(5,6,16,.92)); pointer-events: none; }
.kind { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: rgba(255,122,26,.2); color: #ffb066; border: 1px solid rgba(255,122,26,.5); }
.kind.civ.m { background: rgba(41,182,246,.15); color: #9fdcff; border-color: rgba(41,182,246,.55); }
.kind.civ.f { background: rgba(255,170,90,.15); color: #ffd2a1; border-color: rgba(255,170,90,.55); }
.kind.mil.m { background: rgba(40,53,147,.35); color: #b7c0ff; border-color: rgba(92,107,192,.7); }
.kind.mil.f { background: rgba(123,31,162,.3); color: #e1b5f5; border-color: rgba(171,71,188,.7); }
.char-name { margin-top: 6px; font-size: 28px; font-weight: 900; }
.char-role { color: var(--muted); font-size: 14px; min-height: 1.3em; }
.char-loading { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 12px; background: rgba(5,6,16,.75); border: 1px solid rgba(0,229,255,.4); color: var(--text); font-weight: 700; text-align: center; max-width: 80%; }
.char-loading .err { display: block; margin-top: 6px; font-size: 11px; font-weight: 400; color: var(--muted); direction: ltr; word-break: break-word; }
.drag-hint { position: absolute; top: 10px; inset-inline-start: 12px; font-size: 12px; color: var(--muted); background: rgba(0,0,0,.35); padding: 3px 8px; border-radius: 999px; }
.char-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.char-card { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: var(--text); border-radius: 12px; padding: 8px 4px; font-size: 12px; font-weight: 700; min-width: 0; transition: border-color .15s, transform .1s; }
.char-card:hover { border-color: rgba(255,255,255,.35); transform: translateY(-1px); }
.char-card .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #fff; }
.char-card.civ.m .av { background: linear-gradient(135deg, #29b6f6, #1e63e9); }   /* civilian man: blue */
.char-card.civ.f .av { background: linear-gradient(135deg, #ffb066, #ff9f43); }   /* civilian woman: pink */
.char-card.mil.m .av { background: linear-gradient(135deg, #283593, #0d1757); }   /* soldier man: dark blue */
.char-card.mil.f .av { background: linear-gradient(135deg, #7b1fa2, #3f0d63); }   /* soldier woman: purple */
.char-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.char-card[aria-checked="true"] { border-color: var(--pink); background: rgba(255,122,26,.16); box-shadow: 0 0 16px rgba(255,122,26,.35); }
.arrow:focus-visible, .char-card:focus-visible, .server:focus-visible, .tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.play-panel { display: flex; flex-direction: column; }
.name-field { margin-top: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 6px 0 12px; border-radius: 14px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.08); }
.tab { border: 0; border-radius: 10px; padding: 10px 6px; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; }
.tab[aria-selected="true"] { background: linear-gradient(90deg, rgba(255,122,26,.35), rgba(0,229,255,.25)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.tab-page { min-height: 150px; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.field-row { display: flex; gap: 8px; margin-top: 8px; }
.field-row select { flex: 1; min-width: 0; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font: inherit; font-size: 15px; }
.field-row select option { background: #111428; }
.code-input { flex: 1; min-width: 0; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font-size: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: 6px; direction: ltr; text-align: center; }
button.primary { flex: 1.2; padding: 12px; border-radius: 12px; border: 0; color: #fff; font-weight: 900; font-size: 16px; background: linear-gradient(90deg, var(--pink), #ff6d00); box-shadow: 0 0 18px rgba(255,122,26,.45); }
button.primary:disabled { opacity: .55; }
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.12); }
.server-head { display: flex; justify-content: space-between; align-items: baseline; }
.server-head h2.sub { margin-top: 0; }
button.link { background: none; border: 0; color: var(--cyan); font-size: 13px; padding: 4px; }
.servers { display: flex; flex-direction: column; gap: 8px; }
.server { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; text-align: start; border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3); color: var(--text); border-radius: 12px; padding: 10px 12px; }
.server[aria-checked="true"] { border-color: var(--cyan); background: rgba(0,229,255,.12); }
.server .dot { width: 10px; height: 10px; border-radius: 50%; background: #666; }
.server .dot.ok { background: #00e676; box-shadow: 0 0 8px #00e676; }
.server .dot.slow { background: var(--yellow); }
.server .dot.down { background: #ff1744; }
.server b { display: block; font-size: 15px; }
.server small { color: var(--muted); font-size: 12px; }
.server .meta { text-align: end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; }
.server .meta strong { display: block; color: var(--text); font-size: 14px; }
.play-panel #play { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: 18px; height: 18px; accent-color: var(--pink); }
@media (max-width: 900px) {
  .menu-shell { grid-template-columns: minmax(0, 1fr); }
  #char-preview { max-height: 40vh; }
  .topnav h1 { font-size: 24px; }
}
@media (max-width: 520px) {
  .topnav { gap: 8px; padding: 8px 12px; }
  .nav-side { gap: 6px; }
  .chip { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 420px) {
  .char-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .char-card { font-size: 10px; padding: 6px 2px; }
  .char-card .av { width: 28px; height: 28px; font-size: 13px; }
}
/* phones in landscape: preview and play side by side, compact */
@media (max-height: 500px) and (orientation: landscape) {
  .menu-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  #char-preview { max-height: 46vh; }
  .char-caption { padding: 20px 12px 8px; }
  .char-name { font-size: 20px; }
  .topnav { padding: 6px 12px; }
  .topnav h1 { font-size: 20px; }
}

body.free-mouse canvas#game { cursor: crosshair; }
/* credit: creator and studio, bottom corner of the start screen and on the pause screen */
.credit { grid-column: 1 / -1; justify-self: end; font-size: 12px; color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.1); background: rgba(10,12,30,.6); unicode-bidi: plaintext; }
.credit b { color: var(--text); font-weight: 700; }
.credit:hover, .credit:focus-visible { color: var(--text); border-color: var(--cyan); }
.pause-credit { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); pointer-events: auto; }
/* voice chat + room code HUD */
#voice-hud { position: absolute; top: calc(70px + env(safe-area-inset-top, 0px)); inset-inline-start: 16px; padding: 6px 12px; border-radius: 999px; background: rgba(10,12,30,.7); border: 1px solid rgba(255,255,255,.15); font-size: 13px; }
#voice-hud.talking { border-color: #00e676; box-shadow: 0 0 14px rgba(0,230,118,.5); }
#voice-hud.talking .mic { filter: drop-shadow(0 0 4px #00e676); }
#room-code { position: absolute; top: calc(66px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 6px 12px; border-radius: 12px; background: rgba(10,12,30,.75); border: 1px solid var(--yellow); font-size: 13px; color: var(--yellow); direction: ltr; pointer-events: auto; cursor: pointer; }
#t-voice.on { background: rgba(0,230,118,.45); }

/* shop */
.shop-btn { flex: 0 0 auto; padding: 8px 14px; font-size: 14px; }
#shop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(5,6,16,.78); overflow-y: auto; }
.shop-card-wrap { width: min(640px, 100%); background: var(--panel); border: 1px solid rgba(255,214,0,.4); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.shop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.shop-head h2 { margin: 0; }
#shop-balance { color: var(--yellow); font-weight: 900; font-size: 18px; }
.shop-note { margin: 0; color: var(--muted); font-size: 13px; }
#shop-items h3 { margin: 12px 0 8px; font-size: 15px; color: var(--muted); }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shop-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.12); text-align: center; min-width: 0; }
.shop-card.on { border-color: var(--yellow); }
.shop-card .swatch { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }
.shop-card .swatch.glow { box-shadow: 0 0 14px currentColor; }
.shop-card small { color: var(--yellow); min-height: 1.2em; font-size: 12px; }
.shop-card button { width: 100%; border: 0; border-radius: 8px; padding: 8px 4px; font-weight: 700; background: linear-gradient(90deg, var(--pink), #ff6d00); color: #fff; font-size: 13px; }
.shop-card button:disabled { opacity: .45; }
#shop-status { color: var(--yellow); margin: 0; min-height: 1.2em; text-align: center; }
@media (max-width: 520px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* team lobby */
#lobby { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; background: rgba(5,6,16,.72); }
.lobby-card { width: min(640px, 100%); background: var(--panel); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
#lobby-title { margin: 0; text-align: center; font-size: 22px; }
.lobby-teams { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.team { border-radius: 14px; padding: 12px; background: rgba(0,0,0,.3); }
.team-a { border: 1px solid #40c4ff; }
.team-b { border: 1px solid #ff1744; }
.team h3 { margin: 0 0 8px; font-size: 15px; }
.team-a h3 { color: #40c4ff; }
.team-b h3 { color: #ff8a3d; }
.team ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.team li { padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.06); display: flex; gap: 8px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.team li.me { outline: 1px solid var(--yellow); }
.team li.open { color: var(--muted); font-style: italic; }
.team li .ok { color: #00e676; font-weight: 900; }
.team li .wait { color: var(--muted); }
#lobby-status { text-align: center; color: var(--yellow); margin: 0; min-height: 1.3em; }
#lobby-ready { flex: 1; padding: 12px; border: 0; border-radius: 12px; font-weight: 900; font-size: 17px; color: #fff; background: linear-gradient(90deg, var(--pink), #ff6d00); }
#lobby-ready.on { background: #00c853; }
#lobby-invite { text-align: center; color: var(--cyan); font-size: 14px; margin: 0; }
#lobby-leave { align-self: center; }
#mode { flex: 1; min-width: 0; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font-size: 15px; }
#team-score { font-size: 26px; font-weight: 900; direction: ltr; margin-bottom: 4px; background: var(--panel); border-radius: 10px; padding: 2px 16px; }
#team-score .ta { color: #40c4ff; }
#team-score .tb { color: #ff8a3d; }
#team-score .vs { margin: 0 8px; color: var(--muted); }
@media (max-width: 520px) { .lobby-teams { grid-template-columns: minmax(0, 1fr); } }

/* admin panel */
#admin-btn { position: fixed; z-index: 7; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 10px; border: 1px solid var(--yellow); background: var(--panel); color: var(--yellow); font-weight: 700; }
#admin-panel { position: fixed; z-index: 25; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 32px)); max-height: 80vh; display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--yellow); border-radius: 16px; padding: 16px; backdrop-filter: blur(8px); }
.admin-head { display: flex; justify-content: space-between; align-items: center; }
.admin-head h2 { margin: 0; font-size: 18px; color: var(--yellow); }
.admin-head button { background: none; border: 0; color: var(--text); font-size: 20px; }
#admin-search, #admin-confirm input { padding: 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.35); color: var(--text); font-size: 15px; }
#admin-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.admin-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.3); flex-wrap: wrap; }
.admin-row div { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-row button { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: var(--text); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
#admin-confirm { position: fixed; z-index: 26; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); background: var(--panel); border: 1px solid #ff1744; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
#admin-confirm .yes { flex: 1; padding: 10px; border: 0; border-radius: 10px; background: #ff1744; color: #fff; font-weight: 700; }

/* language pickers */
.head-side { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lang-pick, .pause-lang { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.lang-pick select, .pause-lang select { display: inline-block; width: auto; margin: 0; padding: 6px 8px; font-size: 14px; }
.pause-lang { margin-top: 12px; pointer-events: auto; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#crosshair, #hitmarker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; transition: transform .08s; }
#crosshair i:nth-child(1), #crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; }
#crosshair i:nth-child(1) { top: calc(-8px - var(--gap, 5px)); }
#crosshair i:nth-child(2) { top: var(--gap, 5px); }
#crosshair i:nth-child(3), #crosshair i:nth-child(4) { height: 2px; width: 8px; top: -1px; }
#crosshair i:nth-child(3) { left: calc(-8px - var(--gap, 5px)); }
#crosshair i:nth-child(4) { left: var(--gap, 5px); }
#hitmarker { opacity: 0; transition: opacity .15s; }
#hitmarker.on { opacity: 1; transition: none; }
#hitmarker i { position: absolute; width: 10px; height: 2px; background: #fff; box-shadow: 0 0 3px #000; }
#hitmarker.head i { background: var(--yellow); }
#hitmarker.kill i { background: #ff1744; width: 16px; }
#hitmarker i:nth-child(1) { transform: translate(5px, 5px) rotate(45deg); }
#hitmarker i:nth-child(2) { transform: translate(-15px, 5px) rotate(-45deg); }
#hitmarker i:nth-child(3) { transform: translate(5px, -7px) rotate(-45deg); }
#hitmarker i:nth-child(4) { transform: translate(-15px, -7px) rotate(45deg); }
#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0, transparent 34vmin, #000 34.3vmin); }
#scope::before, #scope::after { content: ""; position: absolute; background: rgba(0,0,0,.8); }
#scope::before { left: 50%; top: 0; bottom: 0; width: 1px; }
#scope::after { top: 50%; left: 0; right: 0; height: 1px; }
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle, transparent 45%, rgba(255,0,40,.65)); transition: opacity .4s; }
#damage-dir { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px; opacity: 0; transition: opacity .6s; }
#damage-dir::before { content: ""; position: absolute; left: 50%; top: 0; margin-left: -22px; border: 22px solid transparent; border-bottom: 26px solid rgba(255,30,60,.9); border-top: 0; filter: drop-shadow(0 0 6px red); }
#dmg-numbers { position: absolute; inset: 0; }
.dmg { position: absolute; font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 0 4px #000, 0 2px 0 #000; transform: translate(-50%, -50%); direction: ltr; }
.dmg.head { color: var(--yellow); font-size: 26px; }
.dmg.kill { color: #ff1744; font-size: 28px; }

#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; }
#timer { font-size: 28px; font-weight: 900; background: var(--panel); padding: 4px 18px; border-radius: 10px; direction: ltr; }
#leader { font-size: 13px; color: var(--muted); margin-top: 4px; background: var(--panel); border-radius: 8px; padding: 2px 10px; }
#killfeed { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.kf { background: var(--panel); padding: 4px 10px; border-radius: 6px; font-size: 14px; animation: slidein .2s; }
.kf.me { border: 1px solid var(--yellow); }
.kf .w { color: var(--muted); margin: 0 6px; font-size: 12px; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } }
#announce { position: absolute; top: 22%; width: 100%; text-align: center; font-size: 52px; font-weight: 900; direction: ltr; letter-spacing: 3px;
  color: var(--yellow); text-shadow: 0 0 20px var(--pink), 0 4px 0 #000; opacity: 0; }
#announce.show { animation: pop 1.6s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: scale(2.2); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
#center-msg { position: absolute; top: 62%; width: 100%; text-align: center; font-size: 20px; font-weight: 700; text-shadow: 0 2px 4px #000; }

#health { position: absolute; bottom: 20px; right: 20px; display: flex; align-items: center; gap: 10px; direction: ltr; }
#hp-bar { width: 220px; height: 16px; background: rgba(0,0,0,.5); border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.2); }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #00e676, #76ff03); transition: width .15s; }
#hp-fill.low { background: linear-gradient(90deg, #ff1744, #ff9100); }
/* armor: a blue layer above the health bar */
#health { flex-wrap: wrap; justify-content: flex-end; }
#armor { order: -1; flex-basis: 100%; height: 8px; background: rgba(0,0,0,.5); border-radius: 4px; overflow: hidden; border: 1px solid rgba(77,157,255,.5); }
#armor-fill { height: 100%; width: 0; background: linear-gradient(90deg, #2f80ff, #6ec6ff); transition: width .15s; }
#buffs { position: absolute; bottom: 64px; right: 20px; display: flex; gap: 6px; direction: ltr; }
.buff { padding: 3px 9px; border-radius: 999px; font-size: 13px; font-weight: 800; background: rgba(10,12,30,.7); border: 1px solid rgba(255,255,255,.2); font-variant-numeric: tabular-nums; }
.buff.speed { color: #ffd400; border-color: #ffd400; } .buff.power { color: #c36bff; border-color: #c36bff; } .buff.rpg { color: #ff8a3d; border-color: #ff8a3d; }
#pickup-toast { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font-size: 22px; font-weight: 900; text-shadow: 0 2px 10px rgba(0,0,0,.7); pointer-events: none; animation: toastIn .25s ease-out; white-space: nowrap; }
@keyframes toastIn { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
#weapon-slots button { font: inherit; font-size: 11px; color: var(--muted); background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 2px 6px; pointer-events: auto; cursor: pointer; }
#weapon-slots button.on { color: #000; background: var(--cyan); border-color: var(--cyan); }
#weapon-slots button.special { border-color: #ff8a3d; color: #ff8a3d; }
#weapon-slots button.special.on { background: #ff8a3d; color: #000; }
#switch-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
body.touch #switch-hint { display: none; }
body.touch #buffs { bottom: auto; top: 96px; right: 14px; }
#hp-text { font-size: 28px; font-weight: 900; min-width: 50px; }
#ammo { position: absolute; bottom: 20px; left: 20px; text-align: left; direction: ltr; }
#weapon-name { font-size: 14px; color: var(--muted); direction: rtl; text-align: left; }
#mag { font-size: 40px; font-weight: 900; }
#mag.empty { color: #ff1744; }
#weapon-slots { display: flex; gap: 4px; margin-top: 4px; }
#weapon-slots span { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--panel); color: var(--muted); }
#weapon-slots span.on { color: #000; background: var(--cyan); }
#streak { position: absolute; bottom: 56px; right: 20px; color: var(--yellow); font-weight: 900; text-shadow: 0 0 8px var(--pink); }

#chat { position: absolute; bottom: 140px; right: 20px; width: min(380px, 60vw); pointer-events: auto; }
#chat-log { max-height: 190px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 14px; }
#chat-log div { padding: 2px 8px; margin-top: 2px; background: rgba(0,0,0,.4); border-radius: 6px; transition: opacity 1s; unicode-bidi: plaintext; text-align: right; word-wrap: break-word; }
#chat-log div.faded { opacity: 0; }
#chat.open #chat-log div.faded { opacity: 1; }
#chat-log .sys { color: var(--yellow); }
#chat-log .quick { font-style: italic; }
#chat-log b { margin-inline-end: 4px; }
#chat-input { width: 100%; margin-top: 6px; padding: 10px; border-radius: 8px; border: 1px solid var(--cyan); background: rgba(0,0,0,.7); color: #fff; font-size: 15px; }
#quick-menu { background: var(--panel); border-radius: 10px; padding: 8px; margin-top: 6px; }
#quick-menu div { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
#quick-menu div:hover { background: rgba(255,255,255,.1); }
#quick-menu kbd { background: var(--cyan); color: #000; border-radius: 4px; padding: 0 6px; margin-inline-end: 6px; font-weight: 700; }

#scoreboard { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--panel); border-radius: 14px; padding: 16px 22px; min-width: min(460px, 92vw); }
#scoreboard h2 { margin: 0 0 10px; text-align: center; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; text-align: right; }
th { color: var(--muted); font-size: 13px; font-weight: 400; border-bottom: 1px solid rgba(255,255,255,.15); }
tr.me td { color: var(--yellow); font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; }

#death, #pause { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-shadow: 0 2px 6px #000; }
#death { background: rgba(80,0,20,.35); }
#pause { background: rgba(0,0,0,.45); pointer-events: auto; cursor: pointer; }
.big { font-size: 44px; font-weight: 900; }
.keys { color: var(--muted); max-width: 640px; text-align: center; padding: 0 16px; }

#end h2 { text-align: center; font-size: 30px; margin: 0 0 12px; color: var(--yellow); }
#xp-box { margin-top: 14px; }
.xpbar { height: 12px; background: rgba(0,0,0,.5); border-radius: 6px; overflow: hidden; margin: 6px 0; }
#xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--pink)); transition: width 1.5s ease-out; }
#next-goal { color: var(--cyan); font-size: 14px; }
#end-next { text-align: center; color: var(--muted); }

/* ---------- touch ---------- */
body:not(.touch) .touch-only { display: none; }
#stick { opacity: .55; }
#stick.active { opacity: 1; }
#touch { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#stick { position: absolute; left: 30px; bottom: 30px; width: 150px; height: 150px; transition: opacity .15s; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.2); pointer-events: auto; }
#stick-knob { position: absolute; left: 47px; top: 47px; width: 56px; height: 56px; border-radius: 50%; background: rgba(0,229,255,.5); }
.tbtn { position: absolute; width: 56px; height: 56px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); background: rgba(12,14,34,.55); color: #fff; font-size: 22px; pointer-events: auto; }
.tbtn { display: flex; align-items: center; justify-content: center; padding: 0; }
.tbtn .ticon { width: 62%; height: 62%; pointer-events: none; display: block; }
.tbtn.big .ticon { width: 58%; height: 58%; }
.tbtn.big { width: 84px; height: 84px; font-size: 34px; background: rgba(255,122,26,.45); }
#t-fire { right: 40px; bottom: 60px; }
#t-ads { right: 140px; bottom: 40px; }
#t-jump { right: 140px; bottom: 110px; }
#t-reload { right: 40px; bottom: 160px; }
#t-swap { right: 100px; bottom: 200px; }
#t-crouch { right: 210px; bottom: 70px; width: 50px; height: 50px; font-size: 20px; }
#t-prone { right: 210px; bottom: 130px; width: 50px; height: 50px; font-size: 22px; }
#t-crouch.on, #t-prone.on { background: rgba(0,229,255,.4); border-color: var(--cyan); }
#t-chat { left: 14px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
#t-quick { left: 64px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
#t-score { left: 114px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
#t-voice { left: 164px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
/* Phone layout: status top-right, social top-left, thumbs own the bottom corners */
body.touch #health { bottom: auto; top: 12px; right: 14px; }
body.touch #hp-bar { width: 120px; }
body.touch #hp-text { font-size: 22px; }
body.touch #ammo { bottom: auto; top: 48px; left: auto; right: 14px; text-align: right; }
body.touch #weapon-name { text-align: right; }
body.touch #mag { font-size: 30px; }
body.touch #weapon-slots { display: none; }
body.touch #streak { bottom: auto; top: 110px; right: 14px; }
body.touch #killfeed { top: 64px; left: 14px; }
body.touch .kf { font-size: 12px; padding: 2px 8px; }
body.touch #chat { bottom: auto; top: 150px; left: 14px; right: auto; width: min(320px, 40vw); }
body.touch #chat-log { max-height: 96px; font-size: 12px; }
body.touch #timer { font-size: 18px; padding: 2px 12px; }
body.touch #leader { font-size: 11px; }
body.touch #center-msg { top: 30%; font-size: 16px; }
@media (max-height: 380px) { body.touch #chat { display: none; } body.touch #chat.open { display: block; } }
/* Phone held upright: stack the status pieces so nothing overlaps */
@media (orientation: portrait) {
  body.touch #topbar { top: 64px; }
  body.touch #health { top: 12px; right: 14px; }
  body.touch #hp-bar { width: 90px; }
  body.touch #ammo { top: 120px; }
  body.touch #killfeed { top: 130px; }
  body.touch #chat { top: 190px; width: 60vw; }
  body.touch #streak { top: 46px; }
}

@media (max-width: 700px) {
  h1 { font-size: 34px; }
  #announce { font-size: 32px; }
  #timer { font-size: 20px; }
}

#armor{position:relative;height:18px}

#scoreboard-toggle{position:absolute;top:16px;right:18px;z-index:12;padding:6px 13px;border:1px solid #8ba9b855;border-radius:8px;background:#101b25d9;color:white;font-size:23px;cursor:pointer}
.brand h1{letter-spacing:-1px}.brand h1 span{color:#ffb34d}#owner-settings{padding:12px;border-top:1px solid #7895a455}#owner-settings input,#owner-settings select{max-width:100%}#room-list{margin-top:12px;max-height:240px;overflow:auto}#room-list .field-row{align-items:center;justify-content:space-between;padding:8px;border-bottom:1px solid #7895a433}

body.game-active canvas#game{cursor:none!important}.pause-actions{display:flex;flex-direction:column;gap:12px;max-width:460px;margin:auto}.pause-actions button,.pause-actions a{padding:12px 20px;border-radius:10px;border:1px solid #6dbde0;background:#132c3f;color:white;font:600 17px Arial;cursor:pointer}.pause-actions p{font-size:14px;line-height:1.6;max-width:420px}body.game-active #pause.hidden{pointer-events:none}

/* HUD fixes: menu button clickable, pause + camera buttons, driving hides combat buttons */
#scoreboard-toggle{pointer-events:auto}
#t-pause { left: 214px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
#t-view { left: 264px; top: 12px; width: 44px; height: 44px; font-size: 18px; }
body.in-car #t-fire, body.in-car #t-ads, body.in-car #t-jump, body.in-car #t-reload, body.in-car #t-swap, body.in-car #t-crouch, body.in-car #t-prone, body.in-car #t-view { display: none; }

/* ---------- in-game update prompt ---------- */
#update-banner{position:fixed;z-index:40;inset:auto 12px 12px 12px;max-width:420px;margin-inline:auto;left:0;right:0;padding:14px 16px;border-radius:14px;border:1px solid var(--cyan);background:rgba(10,12,30,.92);backdrop-filter:blur(10px);box-shadow:0 12px 40px rgba(0,0,0,.45);display:flex;flex-direction:column;gap:10px}
#update-banner.hidden{display:none}
#update-banner h3{margin:0;font-size:17px;color:var(--cyan)}
#update-banner p{margin:0;font-size:14px;line-height:1.45;opacity:.92}
#update-banner .ub-actions{display:flex;gap:8px;flex-wrap:wrap}
#update-banner .ub-actions button{flex:1;min-width:120px;padding:10px 12px;border-radius:10px;border:1px solid rgba(255,255,255,.25);background:#132c3f;color:#fff;font:600 14px Rubik,Arial;cursor:pointer}
#update-banner .ub-actions button.primary{border-color:var(--cyan);background:rgba(0,229,255,.22)}
#update-banner .ub-ver{font-size:12px;opacity:.65}

.brand .sg-brand{margin-inline-start:auto;align-self:center;display:inline-flex;opacity:.92}.brand .sg-brand img{height:30px;width:auto;display:block;filter:drop-shadow(0 0 6px #00e5ff33) drop-shadow(0 1px 3px #0008)}.brand .sg-brand:hover{opacity:1}

/* ---------- Brawl-style touch HUD (0.16.7) ---------- */
#stick { left: 26px; bottom: 26px; width: 150px; height: 150px; opacity: .7; background: radial-gradient(circle, rgba(40,120,255,.28), rgba(10,20,60,.35)); border: 4px solid rgba(255,255,255,.55); box-shadow: 0 4px 0 rgba(0,0,0,.35); }
#stick-knob { background: radial-gradient(circle at 35% 30%, #7fd4ff, #1f6fe0); border: 3px solid #fff; box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.tbtn { border: 3px solid #fff; background: radial-gradient(circle at 35% 30%, rgba(90,110,160,.9), rgba(25,30,60,.85)); box-shadow: 0 4px 0 rgba(0,0,0,.45); }
.tbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.45); }
.tbtn.big, #t-fire { width: 96px; height: 96px; right: 28px; bottom: 36px; background: radial-gradient(circle at 35% 30%, #ff8a5c, #d0281e); border: 4px solid #fff; }
#t-ads { width: 64px; height: 64px; right: 144px; bottom: 52px; background: radial-gradient(circle at 35% 30%, #ffe45c, #e8a400); }
#t-jump { width: 56px; height: 56px; right: 119px; bottom: 127px; background: radial-gradient(circle at 35% 30%, #7dff8a, #1faa3a); }
#t-reload { width: 52px; height: 52px; right: 50px; bottom: 158px; }
#t-swap { width: 52px; height: 52px; right: 50px; bottom: 222px; background: radial-gradient(circle at 35% 30%, #c49bff, #6a2bd8); }
#t-crouch { width: 48px; height: 48px; right: 124px; bottom: 196px; }
#t-prone { width: 48px; height: 48px; right: 124px; bottom: 252px; }
#t-chat, #t-quick, #t-score, #t-voice, #t-pause, #t-view { top: 10px; width: 40px; height: 40px; font-size: 17px; border-width: 2px; }
#t-chat { left: 12px; } #t-quick { left: 56px; } #t-score { left: 100px; } #t-voice { left: 144px; } #t-pause { left: 188px; } #t-view { left: 232px; }
@media (orientation: portrait), (max-width: 430px) {
  #stick { left: 14px; bottom: 22px; width: 130px; height: 130px; }
  #stick-knob { left: 37px; top: 37px; }
  #t-pause { left: 12px; top: 56px; } #t-view { left: 56px; top: 56px; }
  body.touch #killfeed { top: 104px; }
}

/* ---------- 0.16.8 garage + car summon button ---------- */
#garage{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;background:#000a}
#garage.hidden{display:none}
#garage .shop-card-wrap{max-width:560px;width:92vw;max-height:88vh;overflow:auto;padding:18px;border-radius:16px;background:#101b25f2;border:1px solid #6dbde0;color:#fff}
#garage .shop-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px}
#garage .shop-card{display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px;border-radius:12px;background:#132c3f;border:2px solid transparent}
#garage .shop-card.on{border-color:#ffb34d}
#garage .garage-car{width:64px;height:64px}
#garage button{padding:8px 12px;border-radius:10px;border:1px solid #6dbde0;background:#1d4766;color:#fff;font:600 14px Rubik,Arial;cursor:pointer}
#garage button:disabled{opacity:.55}
#t-car{position:fixed;z-index:15;left:40px;bottom:196px;width:60px;height:60px;border-radius:50%;padding:6px;background:radial-gradient(circle at 35% 30%,#ffd27a,#e07b00);pointer-events:auto}
#t-car .ticon{width:100%;height:100%}
#t-car[hidden]{display:none}
body:not(.touch) #t-car{left:auto;right:24px;bottom:24px;width:54px;height:54px}
body:not(.touch) #t-car::after{content:'H';position:absolute;right:-4px;bottom:-4px;font:700 12px Arial;background:#000a;border-radius:6px;padding:1px 4px;color:#fff}
@media (orientation: portrait), (max-width: 430px){#t-car{left:30px;bottom:166px;width:54px;height:54px}}

/* ---------- 0.16.9 Rivals (Roblox)-style touch HUD ----------
   Flat dark-glass circles, thin white rim, white icons, short captions.
   Right thumb: JUMP in the corner, FIRE above-left of it, AIM beside FIRE, SLIDE/PRONE stacked over JUMP,
   RELOAD/SWAP above FIRE. Weapon hotbar bottom-centre. Menu ≡ top-left, status top-right. */
body.touch .tbtn, body.touch #t-car { border: 2px solid rgba(255,255,255,.85); background: rgba(10,12,20,.48); box-shadow: 0 2px 6px rgba(0,0,0,.35); backdrop-filter: blur(2px); }
body.touch .tbtn:active, body.touch .tbtn.on { background: rgba(255,255,255,.28); transform: scale(.94); }
body.touch .tbtn[data-cap]::after { content: attr(data-cap); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 1px; font: 700 10px/1.1 Rubik, Arial, sans-serif; color: #fff; letter-spacing: .3px; white-space: nowrap; text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; }
body.touch #t-jump { right: 22px; bottom: 26px; width: 74px; height: 74px; background: rgba(10,12,20,.48); }
body.touch #t-fire, body.touch .tbtn.big { right: 112px; bottom: 74px; width: 90px; height: 90px; border: 3px solid #fff; background: rgba(214,40,40,.55); }
body.touch #t-ads { right: 216px; bottom: 34px; width: 58px; height: 58px; background: rgba(10,12,20,.48); }
body.touch #t-crouch { right: 30px; bottom: 120px; width: 56px; height: 56px; }
body.touch #t-prone { right: 34px; bottom: 192px; width: 48px; height: 48px; }
body.touch #t-reload { right: 128px; bottom: 182px; width: 52px; height: 52px; }
body.touch #t-swap { right: 196px; bottom: 182px; width: 50px; height: 50px; background: rgba(10,12,20,.48); }
body.touch.no-gun #t-ads, body.touch.no-gun #t-reload { display: none; }
/* top-left: menu ≡ first (Roblox), then social; pause folded into ≡ */
body.touch #scoreboard-toggle { left: 12px; right: auto; top: 10px; width: 40px; height: 40px; padding: 0; font-size: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); background: rgba(10,12,20,.55); z-index: 12; }
body.touch #t-pause { display: none; }
body.touch #t-chat { left: 58px; } body.touch #t-quick { left: 102px; } body.touch #t-score { left: 146px; } body.touch #t-voice { left: 190px; } body.touch #t-view { left: 234px; top: 10px; }
/* weapon hotbar, bottom centre (Rivals 1-2-3-4) */
body.touch #weapon-slots { display: flex; position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); gap: 6px; margin: 0; z-index: 7; }
body.touch #weapon-slots button { min-width: 54px; height: 40px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(10,12,20,.5); border: 2px solid rgba(255,255,255,.55); border-radius: 8px; }
body.touch #weapon-slots button.on { background: rgba(255,255,255,.88); color: #111; border-color: #fff; }
/* thumbstick: plain ring + knob so it no longer reads as a scope */
body.touch #stick { background: rgba(10,12,20,.28); border: 2px solid rgba(255,255,255,.6); box-shadow: none; }
body.touch #stick-knob { background: rgba(255,255,255,.75); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
body.touch #t-car { left: 26px; bottom: 196px; width: 56px; height: 56px; }
body.in-car #weapon-slots { display: none !important; }
@media (orientation: portrait), (max-width: 430px) {
  body.touch #t-jump { right: 14px; bottom: 20px; width: 62px; height: 62px; }
  body.touch #t-fire, body.touch .tbtn.big { right: 90px; bottom: 60px; width: 76px; height: 76px; }
  body.touch #t-ads { right: 178px; bottom: 22px; width: 50px; height: 50px; }
  body.touch #t-crouch { right: 18px; bottom: 104px; width: 50px; height: 50px; }
  body.touch #t-prone { right: 20px; bottom: 170px; width: 44px; height: 44px; }
  body.touch #t-reload { right: 102px; bottom: 156px; width: 46px; height: 46px; }
  body.touch #t-swap { right: 160px; bottom: 156px; width: 44px; height: 44px; }
  body.touch #weapon-slots { bottom: auto; top: 58px; }
  body.touch #t-view { left: 12px; top: 56px; }
  body.touch #t-car { left: 20px; bottom: 166px; width: 50px; height: 50px; }
}
/* hotbar lives between the stick and the AIM button, never under a thumb button */
body.touch #weapon-slots { left: 196px; right: 290px; transform: none; justify-content: center; flex-wrap: nowrap; overflow: hidden; }
body.touch #weapon-slots button { flex: 0 1 58px; min-width: 0; height: 38px; padding: 1px 3px; font-size: 10px; line-height: 1.1; overflow: hidden; }
@media (orientation: portrait), (max-width: 430px) { body.touch #weapon-slots { left: 60px; right: 60px; } }
@media (orientation: portrait) { body.touch #weapon-slots { top: auto; bottom: 236px; left: 12px; right: 12px; } }

/* 0.16.11 big ENTER/EXIT vehicle button (touch + mouse) */
#t-enter{position:fixed;z-index:26;right:calc(150px + env(safe-area-inset-right,0px));bottom:calc(210px + env(safe-area-inset-bottom,0px));width:84px;height:84px;border-radius:50%;border:3px solid #fff;background:radial-gradient(circle at 35% 30%,#6ff3a0,#119a4c);color:#fff;font:900 15px Rubik,Arial;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;box-shadow:0 0 18px #2bff8a99;pointer-events:auto;touch-action:none;animation:enterPulse 1.1s ease-in-out infinite}
#t-enter[hidden]{display:none}
#t-enter img{width:34px;height:34px;pointer-events:none}
#t-enter span{pointer-events:none;text-shadow:0 1px 2px #000a}
body:not(.touch) #t-enter{right:auto;left:50%;transform:translateX(-50%);bottom:calc(34% + 56px)}
@keyframes enterPulse{50%{box-shadow:0 0 30px #2bff8aee}}

/* ===== 0.16.14 Rivalz combat polish ===== */
#t-dash { right: 210px; bottom: 190px; width: 52px; height: 52px; }
body.touch #t-dash { right: 196px; bottom: 112px; width: 54px; height: 54px; border-color: #5ef2ff; }
@media (orientation: portrait), (max-width: 430px) { body.touch #t-dash { right: 160px; bottom: 100px; width: 46px; height: 46px; } }
#t-dash::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(0,0,0,.6) calc(var(--cd, 0) * 360deg), transparent 0); }
body.in-car #t-dash { display: none; }
#reload-ring { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; opacity: 0; transition: opacity .15s; pointer-events: none;
  background: conic-gradient(#ffd24d calc(var(--p, 0) * 360deg), rgba(255,255,255,.18) 0);
  -webkit-mask: radial-gradient(circle, transparent 18px, #000 19px); mask: radial-gradient(circle, transparent 18px, #000 19px); }
#reload-ring.on { opacity: 1; }
.dmg-arc { position: absolute; left: 50%; top: 50%; width: 240px; height: 240px; margin: -120px; border-radius: 50%; pointer-events: none;
  border: 7px solid transparent; border-top-color: rgba(255,40,60,.9); filter: drop-shadow(0 0 6px red); animation: dmgArc 1s ease-out forwards; }
@keyframes dmgArc { 0% { opacity: 1; } 100% { opacity: 0; } }
.dmg { animation: dmgPop .18s ease-out; } .dmg.head::after { content: " ✦"; }
@keyframes dmgPop { from { filter: brightness(2); } }
#daily-panel { position: absolute; left: 12px; top: 120px; min-width: 190px; padding: 8px 10px; border-radius: 10px; background: rgba(10,12,24,.55); color: #fff; font: 600 12px Rubik, Arial, sans-serif; pointer-events: none; border-left: 3px solid #ffd24d; }
#daily-panel b { display: block; font-size: 11px; letter-spacing: 1px; color: #ffd24d; margin-bottom: 4px; }
#daily-panel .task { display: flex; align-items: center; gap: 6px; margin: 3px 0; opacity: .9; }
#daily-panel .task i { width: 14px; height: 14px; border: 2px solid #fff8; border-radius: 3px; font-style: normal; font-size: 11px; line-height: 12px; text-align: center; }
#daily-panel .task.done i { background: #2ee59d; border-color: #2ee59d; color: #062; }
#daily-panel .task.done span { text-decoration: line-through; opacity: .7; }
#daily-panel em { margin-inline-start: auto; color: #ffd24d; font-style: normal; }
#dash-fx { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(90deg, transparent 0 40px, rgba(94,242,255,.18) 40px 42px, transparent 42px 90px, rgba(255,61,139,.14) 90px 91px);
  -webkit-mask: radial-gradient(ellipse at center, transparent 35%, #000 75%); mask: radial-gradient(ellipse at center, transparent 35%, #000 75%); }
body.dashing #dash-fx { animation: dashFx .32s steps(4) forwards; }
body.dashing #game { animation: glitch .32s steps(3); }
@keyframes dashFx { 0% { opacity: 1; transform: translateX(-12px); } 50% { opacity: .8; transform: translateX(10px); } 100% { opacity: 0; transform: none; } }
@keyframes glitch { 0% { filter: hue-rotate(40deg) saturate(1.6); transform: translateX(3px); } 50% { filter: hue-rotate(-30deg); transform: translateX(-3px); } 100% { filter: none; transform: none; } }
#match-point { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); padding: 4px 14px; border-radius: 6px; background: rgba(255,40,60,.85); color: #fff; font: 900 14px Rubik, Arial, sans-serif; letter-spacing: 2px; display: none; pointer-events: none; }
body.match-point #match-point { display: block; animation: mpPulse 1s infinite; }
@keyframes mpPulse { 50% { opacity: .55; } }
body.dead-gray #game { filter: grayscale(1) brightness(.85); transition: filter .4s; }
#damage-dir { display: none; }

/* 0.16.23 in-match minimap: top-right (free on desktop); on touch below health/ammo/buffs, clear of fire/drive buttons */
#minimap { position: fixed; z-index: 6; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); width: 150px; height: 150px; border-radius: 10px; overflow: hidden; pointer-events: none; box-shadow: 0 0 6px rgba(0,0,0,.6); }
#minimap canvas { width: 100%; height: 100%; display: block; }
#minimap-toggle { position: fixed; z-index: 7; top: calc(164px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(10,12,30,.7); color: #fff; font-size: 14px; pointer-events: auto; }
#minimap-toggle.off { top: calc(10px + env(safe-area-inset-top, 0px)); opacity: .7; }
body.touch #minimap { top: calc(140px + env(safe-area-inset-top, 0px)); right: 14px; width: 130px; height: 130px; }
body.touch #minimap-toggle { top: calc(274px + env(safe-area-inset-top, 0px)); right: 14px; width: 34px; height: 34px; }
body.touch #minimap-toggle.off { top: calc(140px + env(safe-area-inset-top, 0px)); }
@media (max-height: 430px) { body.touch #minimap { top: calc(150px + env(safe-area-inset-top, 0px)); width: 110px; height: 110px; } body.touch #minimap-toggle { top: calc(264px + env(safe-area-inset-top, 0px)); } }

/* 0.16.25 car HP */
#car-hp{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;align-items:center;gap:6px;pointer-events:none;z-index:20;font:bold 14px Arial}
#car-hp.hidden{display:none}
#car-hp-bar{width:150px;height:10px;background:rgba(0,0,0,.55);border:1px solid rgba(255,255,255,.4);border-radius:6px;overflow:hidden}
#car-hp-fill{height:100%;width:100%;transition:width .2s}

/* ===== 0.16.27 touch declutter: secondary buttons smaller & hugging the right edge,
   utility row = compact top-left cluster, lower-left only stick + car ===== */
body.touch #t-crouch { right: 14px; bottom: 112px; width: 48px; height: 48px; }
body.touch #t-prone { right: 16px; bottom: 172px; width: 42px; height: 42px; }
body.touch #t-reload { right: 118px; bottom: 172px; width: 44px; height: 44px; }
body.touch #t-swap { right: 172px; bottom: 172px; width: 42px; height: 42px; }
body.touch #t-dash { right: 210px; bottom: 112px; width: 44px; height: 44px; }
body.touch #t-chat, body.touch #t-quick, body.touch #t-score, body.touch #t-voice, body.touch #t-view { top: 10px; bottom: auto; width: 40px; height: 40px; font-size: 16px; }
body.touch #t-chat { left: 56px; } body.touch #t-quick { left: 100px; } body.touch #t-score { left: 144px; } body.touch #t-voice { left: 188px; } body.touch #t-view { left: 232px; }
@media (orientation: portrait), (max-width: 430px) {
  body.touch #t-crouch { right: 10px; bottom: 92px; width: 42px; height: 42px; }
  body.touch #t-prone { right: 12px; bottom: 144px; width: 38px; height: 38px; }
  body.touch #t-reload { right: 96px; bottom: 146px; width: 40px; height: 40px; }
  body.touch #t-swap { right: 144px; bottom: 146px; width: 38px; height: 38px; }
  body.touch #t-dash { right: 172px; bottom: 92px; width: 40px; height: 40px; }
  body.touch #t-chat, body.touch #t-quick, body.touch #t-score, body.touch #t-voice, body.touch #t-view { top: 56px; width: 38px; height: 38px; }
  body.touch #t-chat { left: 12px; } body.touch #t-quick { left: 54px; } body.touch #t-score { left: 96px; } body.touch #t-voice { left: 138px; } body.touch #t-view { left: 180px; }
}
/* portrait hotbar sits mid-screen above both thumb clusters */
@media (orientation: portrait) { body.touch #weapon-slots { bottom: 280px; left: 70px; right: 70px; } }
/* 0.16.27 minimap takes long-press for map pings */
#minimap:not([hidden]) { pointer-events: auto; touch-action: none; }
/* ===== 0.16.30: minimap moved off the right action cluster. Touch: small square at the very top,
   left of the HP bar (between timer and HP), so it never sits over fire/jump/prone/crouch/dash/slide/swap. ===== */
body.touch #minimap { top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(250px + env(safe-area-inset-right, 0px)); width: 96px; height: 96px; }
body.touch #minimap-toggle { top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(352px + env(safe-area-inset-right, 0px)); width: 30px; height: 30px; }
body.touch #minimap-toggle.off { top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(250px + env(safe-area-inset-right, 0px)); }
@media (max-height: 430px) { body.touch #minimap { top: calc(8px + env(safe-area-inset-top, 0px)); width: 84px; height: 84px; } body.touch #minimap-toggle { top: calc(8px + env(safe-area-inset-top, 0px)); } }
@media (orientation: portrait), (max-width: 430px) {
  body.touch #minimap { top: calc(100px + env(safe-area-inset-top, 0px)); right: 10px; width: 90px; height: 90px; }
  body.touch #minimap-toggle, body.touch #minimap-toggle.off { top: calc(100px + env(safe-area-inset-top, 0px)); right: 106px; }
}
/* 0.16.30 dedicated ground-slide button, left of dash */
#t-slide { right: 262px; bottom: 112px; width: 48px; height: 48px; }
body.touch #t-slide { right: 262px; bottom: 112px; width: 44px; height: 44px; border-color: #ffb02e; }
@media (orientation: portrait), (max-width: 430px) { body.touch #t-slide { right: 218px; bottom: 92px; width: 40px; height: 40px; } }
body.in-car #t-slide { display: none; }
body:not(.touch) #t-slide { display: none; }
/* 0.16.31: no Dash on touch — the Fortnite-style slide button takes the dash slot */
body.touch #t-dash { display: none !important; }
body.touch #t-slide { right: 210px; bottom: 112px; width: 50px; height: 50px; border-color: #ffb02e; }
@media (orientation: portrait), (max-width: 430px) { body.touch #t-slide { right: 172px; bottom: 92px; width: 44px; height: 44px; } }
