:root {
  --bg: #0e0f16;
  --panel: #191b26;
  --panel-2: #212433;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f5fa;
  --muted: #9aa0b5;
  --yellow: #f5cd30;
  --yellow-dark: #d8ae16;
  --red: #e0453c;
  --green: #43b95a;
  --blue: #2f7de1;
  --purple: #8e5cd9;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  overscroll-behavior: none;
}

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

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: 0; color: inherit; }

/* ---------------- Boot ---------------- */
.boot {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 35%, #232638 0%, #0c0d13 70%);
}
.boot-logo {
  font-size: clamp(22px, 4vw, 40px); font-weight: 900; letter-spacing: 2px; text-transform: uppercase;
}
.boot-logo span { color: var(--yellow); }
.boot-bar { width: min(320px, 60vw); height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; background: var(--yellow); border-radius: 99px; animation: boot 1.1s infinite ease-in-out; }
@keyframes boot { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.boot p { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------------- Menu ---------------- */
.screen { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; overflow: auto; }
#menu {
  background:
    radial-gradient(1100px 620px at 78% 8%, rgba(245, 205, 48, 0.16), transparent 65%),
    radial-gradient(900px 600px at 10% 100%, rgba(80, 120, 230, 0.2), transparent 60%),
    linear-gradient(160deg, rgba(20, 22, 36, 0.9) 0%, rgba(9, 10, 16, 0.94) 70%);
  backdrop-filter: blur(3px);
}

.menu-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px clamp(16px, 3vw, 40px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px; background: var(--yellow);
  display: grid; place-items: center; box-shadow: 0 8px 20px rgba(245, 205, 48, .25);
}
.brand-mark span { width: 22px; height: 22px; border-radius: 50%; border: 6px solid #1a1c28; }
.brand h1 { font-size: clamp(18px, 2.2vw, 26px); margin: 0; letter-spacing: .5px; font-weight: 800; }
.brand h1 em { color: var(--yellow); font-style: normal; text-transform: uppercase; letter-spacing: 1px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .4px; }

.menu-top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.pill b { font-variant-numeric: tabular-nums; }
.coin-icon {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  background: radial-gradient(circle at 35% 30%, #ffe98b, #e8b30d 65%, #a87d05);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}

.btn {
  border-radius: 10px; font-weight: 700; font-size: 14px; padding: 11px 18px;
  background: var(--panel-2); border: 1px solid var(--line); transition: transform .08s, background .15s;
}
.btn:hover { background: #2b2f42; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,.07); }
.btn.play {
  width: 100%; margin-top: 16px; padding: 17px; font-size: 19px; letter-spacing: 1.5px;
  background: linear-gradient(180deg, #ffe15a, #f0be13); color: #241d00;
  border-radius: 12px; border: 0; box-shadow: 0 10px 26px rgba(245, 205, 48, .28);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn.play:hover { filter: brightness(1.06); }
.btn.play[disabled] { filter: grayscale(.7) brightness(.8); cursor: progress; }
.play-icon { font-size: 15px; }
.loading-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(36, 29, 0, .35);
  border-top-color: #241d00; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.menu-main {
  flex: 1; display: grid; grid-template-columns: minmax(320px, 420px) minmax(320px, 430px);
  gap: clamp(16px, 3vw, 34px); justify-content: center; align-content: start;
  padding: clamp(10px, 2vw, 24px) clamp(16px, 3vw, 40px) 20px;
}

.join-card, .character-card {
  background: linear-gradient(180deg, rgba(28, 31, 45, .96), rgba(20, 22, 32, .96));
  border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow);
}
.card-tag { font-size: 11px; letter-spacing: 2px; color: var(--muted); font-weight: 700; margin-bottom: 12px; }

.server-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.server { display: flex; flex-direction: column; gap: 3px; }
.server b { font-size: 16px; }
.server span { color: var(--muted); font-size: 12px; }
.server-ping { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--green); text-transform: uppercase; letter-spacing: 1px; }
.server-ping i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.field { position: relative; }
.field input {
  width: 100%; padding: 15px 16px; border-radius: 11px; border: 2px solid rgba(255,255,255,.12);
  background: #0f1119; color: var(--text); font-size: 17px; font-weight: 600; outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--yellow); }
.field input::placeholder { color: #5b6076; font-weight: 500; }
.field-hint { display: block; margin-top: 6px; font-size: 11px; color: #6d7288; }
.join-error {
  margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: rgba(224, 69, 60, .14);
  border: 1px solid rgba(224, 69, 60, .45); color: #ff9c94; font-size: 13px; font-weight: 600;
}
.join-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 12px 0 0; }
.lobby-strip {
  margin-top: 14px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 12px;
}
.lobby-strip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* Avatar stage */
.avatar-stage {
  display: flex; align-items: center; gap: 18px; padding: 10px 4px 16px;
  border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.avatar-preview { width: 132px; height: 158px; flex: none; position: relative; }
.avatar-preview svg { width: 100%; height: 100%; filter: drop-shadow(0 14px 18px rgba(0,0,0,.45)); }
.avatar-stage-info { min-width: 0; }
.preview-name { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-char { font-size: 12px; color: var(--muted); margin-top: 4px; }
.preview-char b { color: var(--yellow); }

.custom-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.custom-label { width: 92px; flex: none; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding-top: 6px; font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid rgba(255,255,255,.18);
  transition: transform .1s, border-color .1s; padding: 0;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(245,205,48,.22); }

.hat-picker, .character-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
  background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--text);
}
.chip:hover { background: rgba(255,255,255,.12); }
.chip.active { background: var(--yellow); color: #241d00; border-color: var(--yellow); }
.chip .lock { opacity: .7; font-size: 10px; }

.menu-foot {
  padding: 14px clamp(16px, 3vw, 40px) calc(16px + var(--safe-b));
  border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; background: rgba(10, 11, 17, .5);
}
.maps-strip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.maps-strip b { font-size: 11px; letter-spacing: 2px; color: var(--muted); }
.map-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.map-chip { font-size: 11px; padding: 5px 9px; border-radius: 6px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: #cfd3e2; }
.foot-note { font-size: 11px; color: #6d7288; }

/* ---------------- HUD ---------------- */
.hud { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.hud > * { pointer-events: auto; }

.hud-topleft { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hud-player {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px 7px 7px; border-radius: 12px;
  background: rgba(15, 17, 26, .78); border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.hud-avatar { width: 34px; height: 34px; border-radius: 8px; background: var(--panel-2); overflow: hidden; }
.hud-avatar svg { width: 100%; height: 100%; }
.hud-name { font-size: 13px; font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-role { font-size: 10px; letter-spacing: 1.4px; font-weight: 800; color: var(--blue); }
.hud-role.seeker { color: var(--red); }
.hud-role.spectator, .hud-role.caught { color: var(--muted); }
.hud-coins {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(15, 17, 26, .78); border: 1px solid var(--line);
}
.hud-btn {
  width: 34px; height: 34px; border-radius: 9px; background: rgba(15, 17, 26, .78);
  border: 1px solid var(--line); font-size: 14px; display: grid; place-items: center;
}
.hud-btn:hover { background: rgba(40, 44, 62, .95); }

.hud-topcenter { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); text-align: center; width: min(320px, 60vw); }
.map-name { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #cfd3e2; text-shadow: 0 2px 6px #000; }
.round-clock {
  font-size: clamp(30px, 5vw, 46px); font-weight: 900; line-height: 1.05; letter-spacing: 1px;
  text-shadow: 0 4px 18px rgba(0,0,0,.85); font-variant-numeric: tabular-nums;
}
.round-clock.warn { color: #ff6b5e; }
.round-status { font-size: 11.5px; color: #e2e5f0; letter-spacing: .6px; text-shadow: 0 2px 6px #000; }

.hud-topright { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; max-width: 210px; }
.alive-box {
  background: rgba(255,255,255,.94); color: #17181f; border-radius: 9px; padding: 7px 12px;
  display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.alive-box b { font-size: 17px; }
.player-list {
  width: 100%; max-height: min(46vh, 340px); overflow-y: auto; display: flex; flex-direction: column; gap: 3px;
  scrollbar-width: thin;
}
.player-row {
  display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 7px;
  background: rgba(15, 17, 26, .72); border: 1px solid rgba(255,255,255,.07); font-size: 11.5px;
  cursor: pointer;
}
.player-row .p-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.player-row.seeker .p-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.player-row.dead { opacity: .45; }
.player-row.dead .p-name { text-decoration: line-through; }
.player-row.spectator .p-dot { background: var(--muted); }
.player-row.me { border-color: rgba(245,205,48,.55); }
.p-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.p-caught { font-size: 9px; color: #ff8a80; letter-spacing: .5px; }

.hud-left { position: absolute; left: 14px; bottom: calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; }
.ability.hidden { display: none; }
.ability {
  position: relative; width: 74px; height: 74px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #2a2f42, #1b1e2b); border: 2px solid rgba(255,255,255,.14);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 8px 22px rgba(0,0,0,.4);
}
.ability:disabled { opacity: .55; }
.ability-icon { font-size: 22px; line-height: 1; }
.ability-name { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; font-weight: 800; color: #d9ddec; }
.ability-key {
  position: absolute; top: 3px; left: 5px; font-size: 9px; color: #9aa0b5; border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px; padding: 0 3px; line-height: 1.3;
}
.ability-cd {
  position: absolute; inset: 0; background: rgba(10, 12, 18, .78); transform-origin: bottom;
  transform: scaleY(0); pointer-events: none;
}
.ability .cd-text { position: absolute; font-size: 18px; font-weight: 900; color: #fff; display: none; }
.ability.cooling .cd-text { display: block; }

.hud-bottomleft { position: absolute; left: 14px; bottom: calc(18px + var(--safe-b)); }
.distance-box {
  background: rgba(255,255,255,.93); color: #17181f; border-radius: 9px; padding: 8px 12px;
  min-width: 132px; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.distance-box b { font-size: 22px; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.distance-box span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .7px; color: #4a4e60; font-weight: 700; }
.distance-box.spectating b { font-size: 13px; }

.banner {
  position: absolute; top: 21%; left: 50%; transform: translateX(-50%); text-align: center;
  padding: 14px 30px; border-radius: 14px; background: rgba(10, 12, 18, .72);
  border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(5px); animation: bannerIn .32s ease-out;
  pointer-events: none;
}
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -10px) scale(.96); } }
.banner-title { font-size: clamp(22px, 4vw, 34px); font-weight: 900; letter-spacing: 2px; }
.banner-title.you-it { color: #ff6b5e; text-shadow: 0 0 24px rgba(224,69,60,.6); }
.banner-title.hide { color: var(--yellow); }
.banner-sub { font-size: 12px; color: #cfd3e2; margin-top: 4px; letter-spacing: .5px; }

.spectate-bar {
  position: absolute; bottom: calc(22px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: 99px;
  background: rgba(15, 17, 26, .86); border: 1px solid var(--line); font-size: 12px; font-weight: 700;
  letter-spacing: 1px; backdrop-filter: blur(6px);
}
.spectate-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
.spectate-hint { color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }

/* Touch controls */
.touch-ui { position: absolute; inset: 0; pointer-events: none; }
.joystick { position: absolute; left: 22px; bottom: calc(22px + var(--safe-b)); width: 130px; height: 130px; pointer-events: auto; touch-action: none; }
.joystick-base {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 2px solid rgba(255,255,255,.2);
}
.joystick-knob {
  position: absolute; width: 54px; height: 54px; left: 50%; top: 50%; margin: -27px 0 0 -27px;
  border-radius: 50%; background: rgba(255,255,255,.32); border: 2px solid rgba(255,255,255,.55);
  transition: transform .05s;
}
.camera-stick {
  left: auto; right: 22px; bottom: calc(196px + var(--safe-b)); width: 118px; height: 118px; opacity: .82;
}
.camera-stick .joystick-base {
  background: radial-gradient(circle, rgba(120,200,255,.12), rgba(255,255,255,.02));
  border-color: rgba(160,215,255,.3);
}
.camera-stick .joystick-knob { background: rgba(190,230,255,.3); border-color: rgba(200,235,255,.6); }
.touch-buttons { position: absolute; right: 20px; bottom: calc(26px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: auto; }
.touch-btn {
  width: 82px; height: 82px; border-radius: 50%; font-size: 12px; font-weight: 800; letter-spacing: 1px;
  background: rgba(30, 34, 48, .82); border: 2px solid rgba(255,255,255,.22); color: #fff;
  backdrop-filter: blur(4px); touch-action: none;
}
.touch-btn.taunt { width: 62px; height: 62px; font-size: 10px; opacity: .85; }
.touch-btn:active { background: rgba(245, 205, 48, .35); }

.desktop-hint {
  position: absolute; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  font-size: 11px; color: rgba(255,255,255,.55); background: rgba(10, 12, 18, .5);
  padding: 5px 12px; border-radius: 99px; white-space: nowrap; pointer-events: none;
}
.desktop-hint b { color: #fff; }
.crosshair {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: rgba(255,255,255,.8); box-shadow: 0 0 0 3px rgba(0,0,0,.25);
}

/* Toasts */
.toasts { position: absolute; bottom: calc(150px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  padding: 7px 14px; border-radius: 8px; background: rgba(15, 17, 26, .9); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; animation: toastIn .18s ease-out; max-width: 80vw; text-align: center;
}
.toast.good { border-color: rgba(67, 185, 90, .6); color: #a8f0b6; }
.toast.bad { border-color: rgba(224, 69, 60, .6); color: #ffb0a9; }
.toast.gold { border-color: rgba(245, 205, 48, .6); color: #ffe58a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------------- Modals ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 7, 12, .74); backdrop-filter: blur(4px); padding: 16px;
}
.modal-card {
  background: linear-gradient(180deg, #1d2030, #14161f); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: 88vh;
  overflow: auto; padding: 20px;
}
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 20px; flex: 1; letter-spacing: .5px; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.08); font-size: 14px; }
.modal-close:hover { background: rgba(255,255,255,.16); }

/* Round end */
.roundend-card { width: min(620px, 100%); padding: 0; overflow: hidden; }
.roundend-head {
  padding: 26px 20px 6px; text-align: center; font-size: clamp(26px, 5vw, 38px); font-weight: 900;
  letter-spacing: 2px; text-transform: uppercase;
}
.roundend-head.hiders { color: var(--yellow); text-shadow: 0 0 30px rgba(245,205,48,.35); }
.roundend-head.seeker { color: #ff6b5e; text-shadow: 0 0 30px rgba(224,69,60,.35); }
.roundend-map { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.roundend-rewards {
  display: flex; justify-content: center; gap: 10px; margin: 18px 20px; flex-wrap: wrap;
}
.reward {
  background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px;
}
.reward b { font-size: 16px; color: var(--yellow); }
.roundend-list { padding: 0 20px 6px; display: flex; flex-direction: column; gap: 5px; max-height: 34vh; overflow: auto; }
.res-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 8px;
  background: rgba(255,255,255,.04); font-size: 12.5px; border: 1px solid rgba(255,255,255,.05);
}
.res-row .res-rank { width: 20px; color: var(--muted); font-weight: 800; font-size: 11px; }
.res-row .res-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .res-tag { font-size: 9px; letter-spacing: 1px; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.1); }
.res-row .res-tag.seeker { background: rgba(224,69,60,.24); color: #ffb0a9; }
.res-row .res-tag.caught { background: rgba(255,255,255,.08); color: #a9aec1; }
.res-row .res-tag.alive { background: rgba(67,185,90,.22); color: #a8f0b6; }
.res-row .res-coins { color: var(--yellow); font-weight: 800; font-size: 12px; }
.roundend-next { text-align: center; padding: 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* Shop */
.shop-card { width: min(760px, 100%); }
.shop-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { flex: 1; padding: 9px; border-radius: 9px; background: rgba(255,255,255,.05); font-size: 12.5px; font-weight: 700; border: 1px solid transparent; }
.tab.active { background: var(--yellow); color: #241d00; }
.shop-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.shop-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(255,255,255,.04);
  display: flex; flex-direction: column; gap: 8px;
}
.shop-item.owned { border-color: rgba(67,185,90,.45); }
.shop-item.equipped { border-color: var(--yellow); box-shadow: 0 0 0 1px rgba(245,205,48,.4) inset; }
.shop-item-top { display: flex; align-items: center; gap: 9px; }
.shop-swatch { width: 34px; height: 34px; border-radius: 9px; flex: none; background: var(--panel-2); overflow: hidden; }
.shop-swatch svg { width: 100%; height: 100%; }
.shop-item b { font-size: 13px; }
.shop-item small { color: var(--muted); font-size: 10.5px; display: block; }
.shop-item p { margin: 0; font-size: 11px; color: #b9bfd2; line-height: 1.4; flex: 1; }
.shop-buy {
  padding: 8px; border-radius: 8px; background: var(--yellow); color: #241d00; font-weight: 800; font-size: 12px;
}
.shop-buy.owned { background: rgba(255,255,255,.1); color: var(--text); }
.shop-buy.equipped { background: rgba(67,185,90,.22); color: #a8f0b6; }
.shop-buy[disabled] { background: rgba(255,255,255,.07); color: #7d8298; }
.shop-tip { font-size: 11px; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }

/* Help */
.help-body { font-size: 13px; line-height: 1.6; color: #d3d7e4; }
.help-body h3 { margin: 16px 0 6px; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--yellow); }
.help-body p { margin: 0 0 8px; }
.help-body ul { margin: 0; padding-left: 18px; }
.help-body li { margin-bottom: 4px; }
.small-card { width: min(380px, 100%); text-align: center; }
.small-card h2 { margin: 4px 0 8px; }
.small-card p { color: var(--muted); font-size: 13px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .menu-main { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin: 0 auto; width: 100%; }
  .menu-foot { justify-content: center; }
  .avatar-stage { padding-bottom: 12px; }
}
@media (max-width: 640px) {
  .menu-top { padding: 12px 14px; }
  .menu-top-right { width: 100%; justify-content: space-between; }
  .brand h1 { font-size: 17px; }
  .brand p { font-size: 10.5px; }
  .brand-mark { width: 38px; height: 38px; }
  .menu-main { padding: 10px 12px 18px; gap: 12px; }
  .join-card, .character-card { padding: 16px; border-radius: 15px; }
  .avatar-preview { width: 104px; height: 128px; }
  .preview-name { font-size: 17px; }
  .custom-label { width: 74px; font-size: 9.5px; }
  .swatch { width: 20px; height: 20px; }
  .map-strip { display: none; }
  .player-list { max-height: 30vh; }
  .hud-topleft { top: 8px; left: 8px; max-width: 150px; gap: 5px; }
  .hud-player { padding: 4px 7px; gap: 6px; }
  .hud-avatar { width: 26px; height: 26px; }
  .hud-name { display: none; }
  .hud-role { font-size: 8.5px; letter-spacing: 1px; }
  .hud-coins { padding: 5px 8px; font-size: 11px; }
  .hud-btn { width: 26px; height: 26px; font-size: 12px; }
  .hud-topcenter { top: 6px; width: 96px; }
  .map-name { font-size: 7.5px; letter-spacing: .8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .round-clock { font-size: 24px; }
  .round-status { font-size: 8.5px; }
  .hud-topright { top: 8px; right: 8px; max-width: 112px; gap: 5px; }
  .alive-box { padding: 5px 8px; font-size: 8.5px; gap: 6px; }
  .alive-box b { font-size: 14px; }
  .player-row { padding: 4px 6px; font-size: 10px; }
  .desktop-hint { display: none; }
  .ability { width: 62px; height: 62px; border-radius: 12px; }
  .ability-key { display: none; }
  .hud-left { bottom: calc(158px + var(--safe-b)); }
  .banner { top: 26%; padding: 10px 20px; }
  .roundend-rewards { margin: 14px 12px; }
  .roundend-list { max-height: 30vh; }
  .spectate-hint { display: none; }
  .toasts { bottom: calc(118px + var(--safe-b)); }
}
/* Short viewports (phones in landscape): the HUD would otherwise sit under the
   touch controls — the ability button and distance readout both overlapped the
   move stick. Only applies while the touch layer is actually on screen. */
@media (max-height: 560px) {
  body:has(#touch-ui:not(.hidden)) .hud-left {
    left: 18px;
    bottom: calc(22px + 130px + 12px + var(--safe-b));
  }
  body:has(#touch-ui:not(.hidden)) .hud-bottomleft {
    left: calc(22px + 130px + 16px);
    bottom: calc(20px + var(--safe-b));
  }
}

@media (max-width: 420px) {
  .hud-topright { max-width: 150px; }
  .ability { width: 56px; height: 56px; }
  .joystick { width: 112px; height: 112px; }
  .camera-stick { width: 102px; height: 102px; bottom: calc(180px + var(--safe-b)); }
  .touch-btn { width: 70px; height: 70px; }
  .touch-btn.taunt { width: 54px; height: 54px; }
}
@media (pointer: fine) and (min-width: 900px) {
  .touch-ui { display: none !important; }
}
