* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1224;
  color: #f1f5f9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  overscroll-behavior: none;
}

button, input, select, textarea {
  font-family: inherit;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button {
  touch-action: manipulation;
}

.hidden { display: none !important; }

.account-bar {
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.auth-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-row input {
  flex: 1;
  min-width: 110px;
  padding: 6px 10px !important;
  font-size: 13px !important;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
}

.auth-logged {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.rank-ico {
  width: 25px;
  height: 15px;
  image-rendering: pixelated;
  vertical-align: middle;
}

.acc-pill {
  background: #1e293b;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}

.acc-pill.gp { color: #38bdf8; }
.acc-pill.gold { color: #fbbf24; }

.gender-wrap { width: 88px; }

.room-list-box {
  margin-top: 8px;
  background: #090f20;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px;
}

.room-list-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 92px;
  overflow-y: auto;
  font-size: 11px;
  color: #94a3b8;
}

.room-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #131f3a;
  padding: 5px 8px;
  border-radius: 6px;
  color: #e2e8f0;
}

.av-sel-name {
  font-size: 11px;
  font-weight: 800;
  color: #fde047;
  text-align: center;
  min-height: 16px;
}

.btn-buy-av {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #fef08a;
  background: linear-gradient(180deg, #f59e0b, #b45309);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.btn-equip-av {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #86efac;
  background: linear-gradient(180deg, #22c55e, #15803d);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.av-item.previewing {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.55);
}

.av-price {
  font-size: 9px;
  font-weight: 800;
  color: #fbbf24;
  margin-top: 2px;
}

.av-price.owned { color: #4ade80; }

/* SCREEN 0: AUTHENTIC GUNBOUND LAUNCHER / LOGIN SCREEN (frame.png + login.png) */
.gb-login-stage {
  position: fixed;
  inset: 0;
  background-color: #0b1c47;
  background-image:
    url('/assets/ui/login_gbretro_bg.webp'),
    linear-gradient(180deg, #0b2460 0%, #091533 100%);
  background-position: center center, center center;
  background-size: contain, cover;
  background-repeat: no-repeat, no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 60;
}

.gb-launcher-frame {
  position: relative;
  width: min(94vw, 384px, calc(94dvh * 384 / 442));
  aspect-ratio: 384 / 442;
  max-height: 94dvh;
  background: url('/assets/ui/frame.png') center center / 100% 100% no-repeat;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
}

.gb-launcher-banner {
  position: absolute;
  left: 3.2%;
  top: 6.5%;
  width: 93.6%;
  height: 71.5%;
  background:
    linear-gradient(180deg, rgba(14, 34, 78, 0.58) 0%, rgba(10, 22, 52, 0.82) 100%),
    url('/assets/maps/metro_bg.jpg') center center / cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(6px, 2dvh, 16px);
  gap: clamp(4px, 1.5dvh, 8px);
}

.gb-launcher-title {
  font-size: clamp(16px, 5.2dvh, 28px);
  font-weight: 900;
  letter-spacing: 2px;
  color: #fde047;
  text-shadow: 0 3px 0 #78350f, 0 0 14px rgba(250, 204, 21, 0.5);
}

.gb-launcher-title span {
  color: #93c5fd;
  text-shadow: 0 3px 0 #1e3a8a;
}

.gb-launcher-sub {
  font-size: 12px;
  color: #e0f2fe;
  font-weight: 700;
}

.gb-launcher-info {
  margin-top: 8px;
  background: rgba(10, 18, 40, 0.72);
  border: 1px solid rgba(147, 197, 253, 0.4);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: #bfdbfe;
  font-weight: 600;
}

.gb-launcher-gender {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 700;
}

.gb-login-err {
  margin-top: 6px;
  background: rgba(153, 27, 27, 0.9);
  border: 1px solid #fca5a5;
  color: #fef2f2;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

/* Middle strip: authentic login.png (369x50) */
.gb-login-inputs-strip {
  position: absolute;
  left: 2.0%;
  top: 80.1%;
  width: 96.0%;
  height: 11.3%;
  background: url('/assets/ui/login.png') center center / 100% 100% no-repeat;
}

.gb-id-input, .gb-pw-input {
  position: absolute !important;
  left: 31.8% !important;
  width: 36.2% !important;
  height: 36% !important;
  padding: 0 4px !important;
  font-size: clamp(10px, 2.7dvh, 13px) !important;
  font-weight: 700;
  background: transparent !important;
  border: none !important;
  color: #0f172a !important;
  outline: none !important;
}

.gb-id-input { top: 10% !important; }
.gb-pw-input { top: 55% !important; }

/* Bottom strip: authentic register.png (87x78 -> 3 states of 26px) & start_game.png (107x78 -> 3 states of 26px) */
.gb-launcher-footer {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 1.6%;
  height: 6.2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.gb-bmp-btn {
  border: none;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-size: 100% 300%;
  background-position: 0 0;
  height: 100%;
  image-rendering: pixelated;
}

.gb-bmp-btn:hover { background-position: 0 50%; }
.gb-bmp-btn:active { background-position: 0 100%; }

.gb-btn-reg {
  width: 24%;
  max-width: 87px;
  background-image: url('/assets/ui/register.png');
}

.gb-btn-startgame {
  width: 29.5%;
  max-width: 107px;
  background-image: url('/assets/ui/start_game.png');
}

.gb-guest-btn {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.gb-guest-btn:hover { background: #475569; }

/* SCREEN 1: HOME / GAME LIST (gamelist_back.png 800x600) */
.gb-home-stage {
  position: relative;
  width: min(100vw, calc(100dvh * 4 / 3));
  max-height: 100dvh;
  aspect-ratio: 800 / 600;
  background: url('/assets/ui/gamelist_back.png') center center / 100% 100% no-repeat;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.gb-home-topbar {
  position: absolute;
  left: 16%;
  right: 1.5%;
  top: 0.8%;
  height: 7%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.gb-home-actions {
  display: flex;
  gap: 4px;
}

.gb-act-gold {
  background: linear-gradient(180deg, #f59e0b, #b45309) !important;
  border-color: #fde047 !important;
}

.gb-act-red {
  background: linear-gradient(180deg, #ef4444, #991b1b) !important;
  border-color: #fca5a5 !important;
}

.gb-act-green {
  background: linear-gradient(180deg, #10b981, #047857) !important;
  border-color: #6ee7b7 !important;
}

/* DEDICATED REGISTER / NEW ID PAGE */
.gb-register-card {
  width: min(94vw, 440px);
  max-height: 94dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1d3c78 0%, #0f1f42 100%);
  border: 3px solid #93c5fd;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
}

.gb-reg-head {
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(147, 197, 253, 0.35);
}

.gb-reg-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #fde047;
  text-shadow: 0 2px 0 #78350f;
}

.gb-reg-sub {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #93c5fd;
  margin-top: 2px;
}

.gb-reg-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gb-reg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gb-reg-row label {
  font-size: 11px;
  font-weight: 800;
  color: #bfdbfe;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.gb-reg-row input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1.5px solid #475569;
  background: #090f20;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.gb-reg-row input:focus { border-color: #60a5fa; }

.gb-reg-gender-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.gb-reg-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  margin-top: 4px;
}

/* TOP UP MODAL */
.topup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.topup-pkg {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #334155;
  border-radius: 9px;
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color 0.12s, transform 0.1s;
}

.topup-pkg strong {
  font-size: 14px;
  font-weight: 900;
  color: #fde047;
}

.topup-pkg span {
  font-size: 11px;
  font-weight: 700;
  color: #93c5fd;
}

.topup-pkg.active, .topup-pkg:hover {
  border-color: #fbbf24;
  background: rgba(180, 83, 9, 0.35);
}

.topup-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(9, 15, 32, 0.8);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.topup-custom-row label {
  font-size: 12px;
  font-weight: 800;
  color: #bfdbfe;
  white-space: nowrap;
}

.topup-custom-row input {
  flex: 1;
  min-width: 110px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #60a5fa;
  background: #0f172a;
  color: #fde047;
  font-weight: 900;
  font-size: 14px;
  outline: none;
}

.topup-total {
  font-size: 13px;
  font-weight: 900;
  color: #4ade80;
  white-space: nowrap;
}

.topup-status {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #38bdf8;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: #e0f2fe;
  line-height: 1.4;
}

.topup-status.err {
  border-color: #f87171;
  background: rgba(127, 29, 29, 0.75);
  color: #fecaca;
}

.topup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.topup-badge {
  font-size: 11px;
  font-weight: 700;
  color: #93c5fd;
}

.gb-home-auth {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 54%;
}

.gb-gamelist-area {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 8.5%;
  height: 39.5%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gb-gamelist-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gb-roomlist-title {
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 900;
  letter-spacing: 1px;
  color: #fde047;
  text-shadow: 0 1px 2px #000;
}

.gb-gamelist-bar input {
  padding: 3px 6px !important;
  font-size: clamp(9px, 1.1vw, 12px) !important;
  background: rgba(9, 15, 32, 0.85) !important;
  border: 1px solid #60a5fa !important;
  border-radius: 4px;
}

.gb-join-inline {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.gb-join-inline input {
  width: 64px;
  text-transform: uppercase;
  text-align: center;
  font-weight: 800;
}

.gb-home-room-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  overflow-y: auto;
  align-content: start;
}

.gb-room-card {
  background: linear-gradient(180deg, rgba(24, 48, 96, 0.92), rgba(12, 26, 56, 0.94));
  border: 2px solid #93c5fd;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.gb-room-card:hover {
  border-color: #fde047;
  transform: translateY(-1px);
}

.gb-room-card-title {
  font-size: clamp(10px, 1.3vw, 13px);
  font-weight: 900;
  color: #fde047;
}

.gb-room-card-sub {
  font-size: clamp(8px, 1vw, 11px);
  color: #bfdbfe;
}

.gb-empty-rooms {
  grid-column: 1 / -1;
  background: rgba(15, 23, 42, 0.72);
  border: 1px dashed #60a5fa;
  border-radius: 8px;
  padding: 18px 12px;
  text-align: center;
  font-size: clamp(10px, 1.3vw, 13px);
  color: #e2e8f0;
}

/* HOME CHATTING BOX (exact match to gamelist_back.png CHATTING box) */
.gb-home-chat {
  position: absolute;
  left: 2.0%;
  top: 56.8%;
  width: 61.8%;
  height: 27.6%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 6px;
}

.gb-chat-log {
  flex: 1;
  overflow-y: auto;
  font-size: clamp(9px, 1.15vw, 12px);
  line-height: 1.35;
  color: #f1f5f9;
  padding-right: 4px;
}

.gb-chat-sys { color: #fde047; font-weight: 700; }
.gb-chat-line b { color: #93c5fd; }

.gb-chat-input-row {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  padding-left: 22px;
}

.gb-chat-input-row input {
  flex: 1;
  padding: 3px 6px !important;
  font-size: clamp(9px, 1.1vw, 12px) !important;
  background: rgba(9, 15, 32, 0.8) !important;
  border: 1px solid #60a5fa !important;
  border-radius: 4px;
}

/* HOME CHANNEL ONLINE PLAYERS BOX (exact match to gamelist_back.png CHANNEL box) */
.gb-home-online {
  position: absolute;
  left: 67.2%;
  top: 56.8%;
  width: 30.8%;
  height: 27.6%;
  padding: 5px 6px;
  overflow-y: auto;
}

.gb-online-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gb-online-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(9, 15, 32, 0.65);
  border: 1px solid rgba(147, 197, 253, 0.25);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: clamp(8px, 1.05vw, 11px);
  color: #e2e8f0;
}

/* AUTHENTIC 800x600 GUNBOUND PC WAITING ROOM */
.gb-lobby-screen {
  position: fixed;
  inset: 0;
  background: #060d1f;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  overflow: hidden;
}

.gb-ready-stage {
  position: relative;
  width: min(100vw, calc(100dvh * 4 / 3));
  max-height: 100dvh;
  aspect-ratio: 800 / 600;
  background: url('/assets/ui/ready_back.png') center center / 100% 100% no-repeat;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

/* 8 PLAYER CHEVRON SLOTS */
.gb-slot {
  position: absolute;
  width: 24.5%;
  height: 13.5%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  color: #fff;
  font-size: clamp(9px, 1.3vw, 12px);
  overflow: visible;
}

.slot-l0 { left: 2.5%; top: 3.8%; }
.slot-l1 { left: 7.5%; top: 20.8%; }
.slot-l2 { left: 2.5%; top: 37.8%; }
.slot-l3 { left: 7.5%; top: 54.8%; }
.slot-r0 { right: 2.5%; top: 3.8%; flex-direction: row-reverse; text-align: right; }
.slot-r1 { right: 7.5%; top: 20.8%; flex-direction: row-reverse; text-align: right; }
.slot-r2 { right: 2.5%; top: 37.8%; flex-direction: row-reverse; text-align: right; }
.slot-r3 { right: 7.5%; top: 54.8%; flex-direction: row-reverse; text-align: right; }

.gb-slot-canvas {
  height: 92%;
  width: auto;
  max-width: 76px;
  aspect-ratio: 76 / 66;
  image-rendering: pixelated;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
}

.gb-slot-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.gb-slot-name {
  font-weight: 800;
  color: #fef08a;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gb-slot-sub {
  font-size: clamp(8px, 1vw, 10px);
  color: #bfdbfe;
  font-weight: 700;
}

.gb-slot-empty {
  width: 100%;
  text-align: center;
  font-size: clamp(8px, 1vw, 10px);
  color: rgba(255, 255, 255, 0.35);
  font-weight: 700;
  letter-spacing: 1px;
}

/* CENTER MAP BOX (exact match to ready_back.png center panel) */
.gb-center-box {
  position: absolute;
  left: 36.2%;
  top: 3.8%;
  width: 27.6%;
  height: 30.2%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 6px 6px;
}

.gb-center-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(8px, 1.1vw, 11px);
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 1px 2px #000;
}

.gb-chip {
  border: 1px solid #93c5fd;
  background: #1e3a8a;
  color: #e0f2fe;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: clamp(8px, 1vw, 10px);
  font-weight: 800;
  cursor: pointer;
}

.gb-chip.on {
  border-color: #4ade80;
  background: #14532d;
  color: #bbf7d0;
}

.gb-map-frame {
  position: relative;
  width: 100%;
  height: 41%;
  border: 2px solid #1e293b;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  margin-top: 16%;
}

.gb-map-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gb-map-caption {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(0, 0, 0, 0.68);
  padding: 2px 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(7px, 1.05vw, 11px);
  font-weight: 800;
  color: #fff;
}

.gb-map-caption small {
  font-size: clamp(6px, 0.85vw, 9px);
  color: #93c5fd;
}

.gb-center-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.gb-act-btn {
  border: 1px solid #93c5fd;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #fff;
  border-radius: 4px;
  padding: 3px 2px;
  font-size: clamp(8px, 1.05vw, 11px);
  font-weight: 800;
  cursor: pointer;
  text-shadow: 0 1px 1px #000;
}

.gb-act-btn:hover { filter: brightness(1.15); }

/* BOTTOM-LEFT CHAT LOG & INPUT (aligned pixel-accurately inside ready_back.png boxes) */
.gb-bl-log-box {
  position: absolute;
  left: 1.8%;
  top: 73.6%;
  width: 49.8%;
  height: 8.6%;
  padding: 2px 6px;
  display: flex;
  flex-direction: column;
}

.gb-bl-input-box {
  position: absolute;
  left: 4.8%;
  top: 83.2%;
  width: 46.8%;
  height: 3.3%;
  display: flex;
  align-items: center;
  gap: 4px;
}

.gb-bl-input-box input {
  flex: 1;
  height: 100%;
  padding: 0 6px !important;
  font-size: clamp(8px, 1.05vw, 11px) !important;
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  outline: none;
}

.gb-bl-input-box .gb-mini-gold {
  height: 100%;
  padding: 0 8px;
  font-size: clamp(8px, 0.95vw, 10px);
}

/* BOTTOM-RIGHT: 3 BAR FILLS EXACTLY INSIDE ready_back.png PAINTED STAT TROUGHS */
.gb-br-bar1, .gb-br-bar2, .gb-br-bar3 {
  position: absolute;
  height: 1.00%;
  border-radius: 1px;
  overflow: hidden;
  pointer-events: none;
}

.gb-br-bar1 { left: 61.75%; top: 76.00%; width: 13.50%; }
.gb-br-bar2 { left: 60.50%; top: 79.33%; width: 13.50%; }
.gb-br-bar3 { left: 59.38%; top: 82.67%; width: 13.38%; }

.gb-br-bar1 i, .gb-br-bar2 i, .gb-br-bar3 i {
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #38bdf8, #facc15);
  transition: width 0.2s;
}

.gb-br-right-panel {
  position: absolute;
  left: 76.2%;
  top: 74.6%;
  width: 22.0%;
  height: 11.6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 4px;
}

.gb-br-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* OLD BOTTOM-LEFT BOX */
.gb-bl-box {
  position: absolute;
  left: 1.6%;
  top: 73.6%;
  width: 50.0%;
  height: 18.2%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 6px;
}

.gb-auth-inline {
  display: flex;
  gap: 4px;
  align-items: center;
}

.gb-auth-inline input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px !important;
  font-size: clamp(9px, 1.1vw, 12px) !important;
  background: rgba(9, 15, 32, 0.85) !important;
  border: 1px solid #60a5fa !important;
  color: #fff !important;
  border-radius: 4px;
}

.gb-mini-gold {
  background: linear-gradient(180deg, #facc15, #ca8a04);
  color: #1e1b4b;
  border: 1px solid #fef08a;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: clamp(8px, 1.05vw, 11px);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.gb-auth-logged {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: clamp(9px, 1.1vw, 12px);
}

.gb-bl-bottom {
  display: flex;
  gap: 5px;
  align-items: center;
}

.gb-bl-bottom input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px !important;
  font-size: clamp(9px, 1.1vw, 12px) !important;
  background: rgba(9, 15, 32, 0.85) !important;
  border: 1px solid #60a5fa !important;
  border-radius: 4px;
}

.gb-db-badge {
  font-size: clamp(8px, 0.95vw, 10px);
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #475569;
  color: #93c5fd;
  font-weight: 700;
}

.gb-inline-err {
  font-size: 10px;
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.85);
  padding: 2px 6px;
  border-radius: 4px;
}

/* BOTTOM-RIGHT BOX (exact match to ready_back.png bottom-right stats panel) */
.gb-br-box {
  position: absolute;
  left: 53.8%;
  top: 73.6%;
  width: 44.4%;
  height: 18.2%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
}

.gb-br-avatar canvas {
  width: clamp(46px, 8vw, 72px);
  height: clamp(46px, 8vw, 72px);
  background: rgba(9, 15, 32, 0.7);
  border: 1px solid #60a5fa;
  border-radius: 6px;
  image-rendering: pixelated;
}

.gb-br-stats {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gb-br-mob {
  font-size: clamp(10px, 1.3vw, 13px);
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 1px 2px #000;
}

.gb-stat-bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(7px, 0.95vw, 10px);
  font-weight: 800;
  color: #bfdbfe;
}

.gb-stat-bar-row span { width: 26px; }

.gb-sbar {
  flex: 1;
  height: 7px;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 3px;
  overflow: hidden;
}

.gb-sbar i {
  display: block;
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, #38bdf8, #facc15);
}

.gb-br-sub {
  font-size: clamp(7px, 0.9vw, 9px);
  color: #4ade80;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gb-br-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gb-start-img-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.1s, filter 0.1s;
}

.gb-start-img-btn:hover { transform: scale(1.06); filter: brightness(1.15); }
.gb-start-img-btn:active { transform: scale(0.95); }

.gb-start-img-btn img {
  width: clamp(32px, 5.5dvh, 62px);
  height: auto;
  image-rendering: pixelated;
}

.gb-start-img-btn span {
  font-size: clamp(8px, 1vw, 10px);
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 1px 2px #000;
  margin-top: -2px;
}

.gb-footer-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.6%;
  text-align: center;
  font-size: clamp(7px, 0.95vw, 10px);
  font-weight: 700;
  color: #1e3a8a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

/* POPUP MODALS OVER WAITING ROOM */
.gb-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 24, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 70;
}

.gb-modal-card {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1d3c78, #0f1f42);
  border: 3px solid #93c5fd;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.gb-modal-wide { max-width: 760px; }

.gb-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(147, 197, 253, 0.35);
  font-weight: 900;
  font-size: 14px;
  color: #fde047;
}

.gb-modal-close {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-weight: 900;
  cursor: pointer;
}

/* LEADERBOARD MODAL */
.lb-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.lb-tab {
  flex: 1;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.lb-tab.active {
  border-color: #fbbf24;
  background: linear-gradient(180deg, #b45309, #78350f);
  color: #fef08a;
}

.lb-head-row, .lb-row {
  display: grid;
  grid-template-columns: 44px 1.8fr 0.9fr 1.1fr;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
}

.lb-head-row {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #93c5fd;
  border-bottom: 1px solid rgba(147, 197, 253, 0.3);
  margin-bottom: 4px;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lb-row {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 7px;
  font-size: 12px;
  color: #e2e8f0;
}

.lb-row.lb-top1 { border-color: #facc15; background: rgba(113, 63, 18, 0.42); }
.lb-row.lb-top2 { border-color: #cbd5e1; background: rgba(51, 65, 85, 0.45); }
.lb-row.lb-top3 { border-color: #fb923c; background: rgba(124, 45, 18, 0.35); }
.lb-row.lb-me {
  box-shadow: inset 0 0 0 1.5px #38bdf8;
  background: rgba(14, 116, 144, 0.35);
}

.lb-rank { font-weight: 900; text-align: center; color: #fde047; }
.lb-player {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.lb-player strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.lb-player small {
  font-size: 10px;
  color: #93c5fd;
  white-space: nowrap;
}
.lb-gp { font-weight: 800; color: #38bdf8; }
.lb-wl { font-size: 11px; color: #cbd5e1; }
.lb-wl small { color: #4ade80; font-weight: 700; }
.lb-gold { font-weight: 800; color: #fbbf24; text-align: right; }
.lb-empty {
  text-align: center;
  padding: 20px;
  color: #94a3b8;
  font-size: 12px;
}

/* F8 Skip Turn orb visible & clickable */
.gb-skip-btn {
  position: absolute;
  left: 37.8%;
  top: 17%;
  width: 4.6%;
  height: 45%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #fde047;
  font-size: clamp(7px, 1.1vw, 10px);
  font-weight: 900;
  cursor: pointer;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gb-skip-btn:hover {
  background: rgba(250, 204, 21, 0.35);
  border-color: #fef08a;
}

/* CLASSIC GUNBOUND PC LOBBY THEME */
.lobby-overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 42, 92, 0.72) 0%, rgba(8, 18, 42, 0.88) 100%),
    url('/assets/ui/ready_back.png') center center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  z-index: 50;
}

.gb-window {
  width: 100%;
  max-width: 980px;
  max-height: 95vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(42, 74, 132, 0.94) 0%, rgba(21, 38, 76, 0.96) 100%);
  border: 3px solid #93c5fd;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 18px 50px rgba(0, 0, 0, 0.75);
  border-radius: 12px;
  padding: 12px 14px;
}

.gb-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  border: 2px solid #bfdbfe;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.gb-title-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.gb-logo {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #fde047;
  text-shadow: 0 2px 0 #78350f, 0 0 8px rgba(250, 204, 21, 0.45);
}

.gb-logo span { color: #e0f2fe; text-shadow: 0 2px 0 #1e3a8a; }

.gb-badge {
  font-size: 11px;
  color: #bfdbfe;
  font-weight: 600;
}

.gb-btn-sm {
  background: linear-gradient(180deg, #facc15, #ca8a04);
  color: #1e1b4b;
  border: 1px solid #fef08a;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
}

.gb-panel {
  background: linear-gradient(180deg, rgba(24, 44, 86, 0.92), rgba(14, 26, 54, 0.95)) !important;
  border: 2px solid #60a5fa !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.avatar-shop-pane {
  background:
    linear-gradient(180deg, rgba(14, 26, 54, 0.78), rgba(10, 18, 40, 0.88)),
    url('/assets/ui/avatar_back.png') center center / cover no-repeat;
  border-radius: 8px;
  padding: 6px;
}

.gb-podium {
  background: linear-gradient(180deg, #2b4c8c, #182e5c) !important;
  border: 2px solid #fbbf24 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.gb-start-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #facc15 0%, #ea580c 100%);
  border: 2px solid #fef08a;
  color: #fff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.7);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45);
}

/* CLASSIC GUNBOUND TOP WIND ORB */
.gb-wind-orb {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3b82f6 0%, #1e3a8a 65%, #0f172a 100%);
  border: 3px solid #fef08a;
  box-shadow: 0 0 0 2px #1d4ed8, 0 6px 18px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gb-wind-orb .wind-arrow {
  font-size: 22px;
  line-height: 1;
  color: #fde047;
  text-shadow: 0 1px 3px #000;
}

.gb-wind-orb .wind-val {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px #000;
  margin-top: -2px;
}

.gb-weather-pill {
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid #93c5fd;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
}

.gb-turn-box {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.92), rgba(15, 23, 42, 0.92));
  border: 2px solid #93c5fd;
}

/* AUTHENTIC CLASSIC GUNBOUND PC BOTTOM HUD (play_back.png 800x84) */
.gb-hud-dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 880px);
  z-index: 15;
  pointer-events: auto;
}

.gb-hud-bar {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 84;
  background: url('/assets/ui/play_back.png') center bottom / 100% 100% no-repeat;
  filter: drop-shadow(0 -4px 14px rgba(0, 0, 0, 0.65));
}

/* Shot 1 / 2 / SS buttons on the left cream deck */
.gb-hud-shots {
  position: absolute;
  left: 2%;
  top: 16%;
  width: 20%;
  height: 56%;
  display: flex;
  gap: 4%;
  align-items: center;
}

.gb-hud-shots .shot-btn {
  flex: 1;
  height: 100%;
  border-radius: 6px;
  border: 2px solid #334155;
  background: linear-gradient(180deg, #fef9c3, #d4c48a);
  color: #1e293b;
  font-weight: 900;
  font-size: clamp(10px, 1.8vw, 15px);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #475569;
  cursor: pointer;
}

.gb-hud-shots .shot-btn.active {
  background: linear-gradient(180deg, #f97316, #b91c1c);
  border-color: #fde047;
  color: #fff;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

/* Angle display centered inside play_back.png circular angle dial (x=242/800=30.25%) */
.gb-hud-angle {
  position: absolute;
  left: 25.4%;
  top: 32%;
  width: 9.8%;
  height: 54%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gb-hud-angle strong {
  font-size: clamp(11px, 2.1vw, 20px);
  font-weight: 900;
  color: #fef08a;
  text-shadow: 0 2px 3px #000;
}

/* F8 Skip Turn orb (x=304..338) */
.gb-skip-btn {
  position: absolute;
  left: 37.8%;
  top: 20%;
  width: 4.5%;
  height: 44%;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
}

.gb-skip-btn:hover {
  background: rgba(250, 204, 21, 0.25);
}

/* 6 Battle Item slots inside the exact F1..F6 boxes (x=360..570, y=5..38) */
.gb-item-tray {
  position: absolute;
  left: 44.8%;
  top: 6%;
  width: 26.8%;
  height: 42%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
}

.gb-item-tray .item-slot {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.25);
  padding: 1px;
}

.gb-item-tray .item-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gb-item-tray .item-key { display: none; }

/* Right top area: SLICE/DRAG + FIRE (x=588..794, y=6..38) */
.gb-hud-right-ctrl {
  position: absolute;
  left: 73.5%;
  top: 7%;
  width: 25.5%;
  height: 40%;
  display: flex;
  gap: 4px;
  align-items: center;
}

.gb-hud-right-ctrl .btn-barmode {
  height: 100%;
  flex: 0.8;
  padding: 0 4px;
  font-size: clamp(8px, 1.3vw, 11px);
  border-radius: 5px;
}

.gb-hud-right-ctrl .btn-fire {
  height: 100%;
  flex: 1.2;
  padding: 0 6px;
  font-size: clamp(10px, 1.5vw, 13px);
  border-radius: 5px;
}

/* Power Bar inside authentic 4-segment tray (x=388..792, y=47..70) */
.gb-hud-bar .gb-power-track {
  position: absolute !important;
  left: 48.5%;
  top: 56%;
  width: 50.4%;
  height: 27% !important;
  border-radius: 2px;
  background: rgba(15, 10, 6, 0.55) !important;
  border: none !important;
  overflow: hidden;
  z-index: 4;
}

/* Move Fuel Bar underneath (x=388..792, y=73..81) */
.gb-hud-bar .gb-fuel-track {
  position: absolute !important;
  left: 48.5%;
  top: 86%;
  width: 50.4%;
  height: 10% !important;
  background: rgba(15, 23, 42, 0.5) !important;
  overflow: hidden;
  z-index: 4;
}

.gb-fuel-track .fuel-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fde047);
}

/* MOBILE LANDSCAPE & COMPACT SCREEN POLISH */
@media (pointer: coarse), (max-width: 920px) {
  .touch-controls {
    display: block;
    bottom: calc(min(100vw, 880px) * 0.105 + 8px);
    left: max(10px, env(safe-area-inset-left));
  }
  .touch-dpad { gap: 3px; }
  .t-mid { gap: 32px; }
  .t-btn {
    width: 38px;
    height: 38px;
    font-size: 14px;
    background: rgba(15, 23, 42, 0.52);
    border-width: 1.5px;
  }
}

/* MOBILE PORTRAIT ROTATE OVERLAY (strictly enforces landscape on mobile) */
.gb-rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 13, 31, 0.98);
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

@media (pointer: coarse) and (orientation: portrait), (max-width: 600px) and (orientation: portrait) {
  .gb-rotate-overlay { display: flex; }
}

.gb-rotate-card {
  max-width: 320px;
  background: linear-gradient(180deg, #1d3c78, #0f1f42);
  border: 2px solid #93c5fd;
  border-radius: 14px;
  padding: 22px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.85);
}

.gb-rotate-icon {
  font-size: 42px;
  margin-bottom: 10px;
  animation: gbRotateWiggle 1.6s ease-in-out infinite;
}

@keyframes gbRotateWiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}

.gb-rotate-card h3 {
  font-size: 18px;
  color: #fde047;
  margin-bottom: 8px;
}

.gb-rotate-card p {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 14px;
}

.gb-rotate-skip {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid #60a5fa;
  color: #bfdbfe;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* iOS SAFARI ANTI-AUTO-ZOOM: any input < 16px forces Safari to zoom the whole page in!
   Keep computed font-size: 16px on touch devices and visually scale compact inputs. */
@media (pointer: coarse) {
  input, textarea, select {
    font-size: 16px !important;
  }
  .gb-id-input, .gb-pw-input {
    font-size: 16px !important;
    width: 52% !important;
    height: 52% !important;
    transform: scale(0.7);
    transform-origin: left top;
  }
  .gb-id-input { top: 8% !important; }
  .gb-pw-input { top: 53% !important; }

  .gb-gamelist-bar input,
  .gb-chat-input-row input,
  .gb-bl-input-box input,
  .av-search {
    font-size: 16px !important;
    line-height: 1.1;
  }
}

@media (max-height: 520px) {
  /* IN-GAME MOBILE LANDSCAPE */
  .top-hud {
    top: 4px;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
  }
  .hud-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
    border-radius: 7px;
  }
  .gb-wind-orb {
    width: 48px;
    height: 48px;
    border-width: 2px;
  }
  .gb-wind-orb .wind-arrow { font-size: 15px; }
  .gb-wind-orb .wind-val { font-size: 13px; }
  .gb-weather-pill { font-size: 9px; padding: 1px 7px; }
  .gb-turn-box { padding: 3px 8px; }
  .turn-banner { font-size: 10px; }
  .turn-timer { font-size: 14px; }
  .gb-hud-dock {
    width: 100vw;
    max-width: 100vw;
    bottom: 0;
    left: 0;
    transform: none;
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.78), #070d1c);
    padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
    display: flex;
    justify-content: center;
  }
  .gb-hud-dock .gb-hud-bar {
    width: min(100%, 660px);
  }
  .touch-controls {
    bottom: calc(min(100vw - 16px, 660px) * 0.105 + env(safe-area-inset-bottom) + 6px);
    left: max(8px, env(safe-area-inset-left));
    opacity: 0.68;
    transition: opacity 0.15s;
  }
  .touch-controls:active { opacity: 1; }
  .touch-dpad { gap: 2px; }
  .t-mid { gap: 26px; }
  .t-btn {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  /* LOGIN SCREEN MOBILE LANDSCAPE */
  .gb-login-stage { padding: 6px; }
  .gb-launcher-gender { margin-top: 2px; font-size: 10px; gap: 5px; }
  .gb-launcher-gender .gb-chip { padding: 2px 6px; font-size: 10px; }
  .gb-login-err { font-size: 9px; padding: 2px 6px; margin-top: 2px; }

  /* =========================================================
     HOME / GAME LIST — FULL-WIDESCREEN MOBILE LANDSCAPE UI
     ========================================================= */
  .gb-home-stage {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 0.75fr) minmax(0, 1.35fr);
    grid-template-areas:
      "top top"
      "rooms online"
      "rooms chat";
    gap: 6px;
    padding: 6px max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background:
      linear-gradient(180deg, rgba(11, 25, 58, 0.88) 0%, rgba(7, 16, 38, 0.94) 100%),
      url('/assets/ui/gamelist_back.png') center center / cover no-repeat;
    box-shadow: none;
  }

  .gb-home-topbar {
    position: static;
    grid-area: top;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: linear-gradient(180deg, #1d4ed8 0%, #172e6e 100%);
    border: 1.5px solid #93c5fd;
    border-radius: 8px;
    padding: 4px 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  .gb-home-actions {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
  }
  .gb-home-actions .gb-act-btn {
    padding: 4px 3px;
    font-size: 9.5px;
    border-radius: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }
  .gb-home-auth {
    max-width: none;
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid rgba(147, 197, 253, 0.25);
    padding-top: 3px;
  }
  .gb-auth-logged {
    width: 100%;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: nowrap;
    font-size: 10px;
    white-space: nowrap;
  }
  .gb-auth-logged strong {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .gb-auth-logged .rank-ico { width: 18px; height: 11px; }
  .gb-auth-logged .acc-pill { padding: 1px 6px; font-size: 9.5px; }
  #accRankName { display: inline-block; }
  .gb-auth-logged .btn-mini { padding: 2px 8px; font-size: 9.5px; font-weight: 800; margin-left: auto; }

  .gb-gamelist-area {
    position: static;
    grid-area: rooms;
    height: auto;
    min-height: 0;
    background: rgba(13, 27, 60, 0.82);
    border: 1.5px solid #60a5fa;
    border-radius: 8px;
    padding: 6px;
    gap: 6px;
  }
  .gb-gamelist-bar {
    gap: 5px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .gb-gamelist-bar input {
    padding: 2px 7px !important;
    max-width: 120px !important;
    height: 28px;
    border-radius: 6px;
  }
  .gb-gamelist-bar .gb-chip { padding: 4px 7px; font-size: 10px; white-space: nowrap; }
  .gb-db-badge { font-size: 9.5px; padding: 3px 6px; white-space: nowrap; }
  .gb-join-inline { gap: 4px; align-items: center; }
  .gb-join-inline input { width: 68px !important; height: 28px; }
  .gb-mini-gold { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
  .gb-home-room-grid {
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .gb-room-card { padding: 7px 10px; border-width: 1.5px; border-radius: 7px; }
  .gb-room-card-title { font-size: 12px; }
  .gb-room-card-sub { font-size: 10px; }
  .gb-empty-rooms { padding: 14px 10px; font-size: 11px; line-height: 1.45; }

  .gb-home-online {
    position: static;
    grid-area: online;
    width: auto;
    height: auto;
    min-height: 0;
    background: rgba(13, 27, 60, 0.82);
    border: 1.5px solid #60a5fa;
    border-radius: 8px;
    padding: 5px 6px;
    -webkit-overflow-scrolling: touch;
  }
  .gb-online-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .gb-online-row {
    padding: 3px 7px;
    font-size: 10px;
    gap: 6px;
    border-radius: 6px;
  }

  .gb-home-chat {
    position: static;
    grid-area: chat;
    width: auto;
    height: auto;
    min-height: 0;
    background: rgba(13, 27, 60, 0.82);
    border: 1.5px solid #60a5fa;
    border-radius: 8px;
    padding: 5px 6px;
    gap: 4px;
  }
  .gb-chat-log {
    font-size: 10.5px;
    line-height: 1.35;
    -webkit-overflow-scrolling: touch;
  }
  .gb-chat-input-row {
    padding-left: 0;
    margin-top: 0;
    gap: 4px;
    align-items: center;
  }
  .gb-chat-input-row input {
    padding: 2px 8px !important;
    height: 28px;
    border-radius: 6px;
  }

  /* =========================================================
     WAITING ROOM (LOBBY) — FULL-WIDESCREEN MOBILE LANDSCAPE UI
     ========================================================= */
  .gb-ready-stage {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-rows: repeat(4, minmax(0, 1fr)) 32px;
    gap: 5px;
    padding: 6px max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background:
      linear-gradient(180deg, rgba(11, 25, 58, 0.86) 0%, rgba(7, 16, 38, 0.94) 100%),
      url('/assets/ui/ready_back.png') center center / cover no-repeat;
    box-shadow: none;
  }

  .gb-slot {
    position: static;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 3px 7px;
    gap: 6px;
    font-size: 11px;
    background: linear-gradient(180deg, rgba(24, 52, 108, 0.88), rgba(14, 30, 68, 0.92));
    border: 1.5px solid #60a5fa;
    border-radius: 7px;
    overflow: hidden;
  }
  .slot-l0 { grid-column: 1; grid-row: 1; border-left: 3px solid #38bdf8; }
  .slot-l1 { grid-column: 1; grid-row: 2; border-left: 3px solid #38bdf8; }
  .slot-l2 { grid-column: 1; grid-row: 3; border-left: 3px solid #38bdf8; }
  .slot-l3 { grid-column: 1; grid-row: 4; border-left: 3px solid #38bdf8; }
  .slot-r0 { grid-column: 3; grid-row: 1; border-right: 3px solid #f87171; }
  .slot-r1 { grid-column: 3; grid-row: 2; border-right: 3px solid #f87171; }
  .slot-r2 { grid-column: 3; grid-row: 3; border-right: 3px solid #f87171; }
  .slot-r3 { grid-column: 3; grid-row: 4; border-right: 3px solid #f87171; }
  .gb-slot-canvas { height: 96%; max-height: 52px; width: auto; }
  .gb-slot-name { font-size: 11px; }
  .gb-slot-sub { font-size: 9px; }
  .gb-slot-empty { font-size: 10px; }

  .gb-center-box {
    position: static;
    grid-column: 2;
    grid-row: 1 / 3;
    width: auto;
    height: auto;
    min-height: 0;
    background: rgba(13, 27, 60, 0.88);
    border: 1.5px solid #93c5fd;
    border-radius: 8px;
    padding: 5px 7px;
    gap: 4px;
  }
  .gb-center-top { font-size: 11px; }
  .gb-center-top .gb-chip { padding: 2px 7px; font-size: 9.5px; }
  .gb-map-frame { flex: 1; height: auto; min-height: 46px; margin-top: 0; border-radius: 6px; }
  .gb-map-caption { padding: 3px 6px; font-size: 11px; }
  .gb-map-caption small { font-size: 9px; }
  .gb-center-actions {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 3px;
  }
  .gb-center-actions .gb-act-btn {
    padding: 4px 3px;
    font-size: 9.5px;
    white-space: nowrap;
    border-radius: 5px;
  }

  /* Hide desktop painted-trough stat bars on mobile (stats shown cleanly in center panel) */
  .gb-br-bar1, .gb-br-bar2, .gb-br-bar3 { display: none; }

  .gb-br-right-panel {
    position: static;
    grid-column: 2;
    grid-row: 3;
    width: auto;
    height: auto;
    min-height: 0;
    background: linear-gradient(180deg, rgba(24, 52, 108, 0.9), rgba(14, 30, 68, 0.95));
    border: 1.5px solid #fbbf24;
    border-radius: 8px;
    padding: 4px 10px;
  }
  .gb-br-mob { font-size: 13px; }
  .gb-br-sub { font-size: 10px; }
  .gb-start-img-btn {
    flex-direction: row;
    gap: 6px;
    background: linear-gradient(180deg, #facc15, #ea580c);
    border: 1.5px solid #fef08a;
    border-radius: 7px;
    padding: 4px 12px;
    box-shadow: 0 2px 10px rgba(234, 88, 12, 0.55);
  }
  .gb-start-img-btn img { width: 26px; }
  .gb-start-img-btn span { font-size: 12px; color: #fff; margin-top: 0; letter-spacing: 0.5px; }

  .gb-bl-log-box {
    position: static;
    grid-column: 2;
    grid-row: 4;
    width: auto;
    height: auto;
    min-height: 0;
    background: rgba(9, 18, 42, 0.85);
    border: 1.5px solid #475569;
    border-radius: 7px;
    padding: 3px 7px;
  }

  .gb-bl-input-box {
    position: static;
    grid-column: 1 / 4;
    grid-row: 5;
    width: auto;
    height: 30px;
    background: rgba(9, 18, 42, 0.9);
    border: 1.5px solid #60a5fa;
    border-radius: 7px;
    padding: 2px 4px;
    gap: 5px;
  }
  .gb-bl-input-box input {
    height: 24px;
    padding: 0 6px !important;
  }
  .gb-bl-input-box .gb-mini-gold {
    height: 24px;
    padding: 0 12px;
    font-size: 11px;
  }

  /* MODALS (MOBILE / MAP / AVATAR SHOP / BUDDY) IN MOBILE LANDSCAPE */
  .gb-modal { padding: 6px; }
  .gb-modal-card {
    max-height: 94dvh;
    padding: 8px 10px;
    border-width: 2px;
  }
  .gb-modal-head {
    margin-bottom: 6px;
    padding-bottom: 4px;
    font-size: 12px;
  }
  .gb-modal-close { width: 24px; height: 24px; font-size: 12px; }
  .mobile-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    max-height: 54dvh;
  }
  .mobile-opt { padding: 4px 2px; border-radius: 7px; }
  .mobile-opt img { width: 34px; height: 30px; margin-bottom: 2px; }
  .mobile-opt span { font-size: 9px; }
  .mobile-stats-box { margin-top: 5px; padding: 5px 8px; font-size: 10px; }
  .map-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    max-height: 70dvh;
  }
  .map-opt img { height: 42px; }
  .map-opt span { font-size: 9px; padding: 2px; }
  .avatar-studio {
    grid-template-columns: 128px 1fr;
    gap: 8px;
  }
  .avatar-preview-col { padding: 5px; gap: 3px; }
  #avatarPreviewCanvas { width: 78px; height: 78px; }
  .av-sel-name { font-size: 9.5px; min-height: 12px; }
  .btn-buy-av, .btn-equip-av, .btn-mini-blue { padding: 4px; font-size: 9.5px; }
  .av-stats-list { font-size: 9px; gap: 2px; }
  .av-cat { padding: 3px; font-size: 10px; }
  .av-search { padding: 2px 6px !important; margin-bottom: 4px; height: 24px; }
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-height: 48dvh;
  }
  .avatar-set-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-height: 58dvh !important;
    gap: 5px !important;
  }
  .av-set-hint { font-size: 9.5px; padding: 3px 6px; margin-bottom: 4px; }
  .av-set-card { padding: 4px 6px !important; gap: 5px; }
  .av-set-thumbs img { width: 24px !important; height: 24px !important; }
  .av-set-card .av-name { font-size: 9.5px; }
  .av-set-card .av-mini-stat { font-size: 8px; }
  .av-set-card .av-price { font-size: 8.5px; }
  .av-item { padding: 3px 2px; }
  .av-item img { width: 32px; height: 32px; margin-bottom: 2px; }
  .av-item .av-name { font-size: 9px; }
  .av-item .av-mini-stat, .av-price { font-size: 8px; }
  .lb-tabs { gap: 4px; margin-bottom: 5px; }
  .lb-tab { padding: 4px 6px; font-size: 10px; }
  .lb-head-row, .lb-row {
    grid-template-columns: 34px 1.7fr 0.85fr 1fr;
    gap: 4px;
    padding: 3px 6px;
    font-size: 10px;
  }
  .lb-player small { display: none; }
  .lb-list { max-height: 54dvh; }

  /* REGISTER PAGE MOBILE LANDSCAPE (2-column compact form) */
  .gb-register-card {
    width: min(92vw, 560px);
    padding: 10px 14px;
  }
  .gb-reg-head { margin-bottom: 6px; padding-bottom: 4px; }
  .gb-reg-title { font-size: 15px; }
  .gb-reg-sub { font-size: 9px; }
  .gb-reg-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }
  .gb-reg-row label { font-size: 9.5px; }
  .gb-reg-row input { padding: 4px 8px; height: 30px; }
  .gb-reg-gender-row { align-self: end; height: 30px; }
  #regError, .gb-reg-actions { grid-column: 1 / -1; }
  .gb-reg-actions .btn { padding: 6px 10px; font-size: 12px; }

  /* TOP UP MODAL MOBILE LANDSCAPE */
  .topup-grid { gap: 5px; margin-bottom: 6px; }
  .topup-pkg { padding: 5px 4px; }
  .topup-pkg strong { font-size: 11.5px; }
  .topup-pkg span { font-size: 9.5px; }
  .topup-custom-row { padding: 5px 8px; margin-bottom: 6px; }
  .topup-custom-row input { height: 28px; padding: 2px 8px; }
  .topup-total { font-size: 11px; }
  .topup-status { padding: 5px 8px; margin-bottom: 6px; font-size: 10px; }
  .topup-badge { font-size: 9.5px; }

  /* IN-GAME CHAT BAR & RESULT CARD MOBILE LANDSCAPE */
  .chat-bar { bottom: calc(min(96vw, 720px) * 0.105 + 8px); width: min(88vw, 380px); padding: 4px; gap: 4px; }
  .chat-emote-btn { font-size: 14px; padding: 2px 0; }
  .chat-bar input { height: 28px; padding: 2px 8px; }
  .win-card { width: min(86vw, 320px); min-height: 190px; padding: 14px 18px; }
  .win-card h2 { font-size: 22px; }
  .win-card p { font-size: 12px; margin: 6px 0 12px; }
}

/* OLD LOBBY OVERRIDE END */

.lobby-card {
  width: 100%;
  max-width: 980px;
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(15, 24, 46, 0.95);
  border: 2px solid #3b82f6;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.lobby-header {
  text-align: center;
  margin-bottom: 16px;
}

.lobby-header h1 {
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: 2px;
  color: #fbbf24;
  text-shadow: 0 3px 0 #78350f;
}

.lobby-header h1 span {
  color: #60a5fa;
  text-shadow: 0 3px 0 #1e3a8a;
}

.subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
}

@media (max-width: 780px) {
  .lobby-grid { grid-template-columns: 1fr; }
}

.top-profile-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.name-wrap { flex: 1; }
.avatar-toggle-wrap { width: 112px; }

.btn-toggle {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #94a3b8;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.btn-toggle.on {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.lobby-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.l-tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.l-tab.active {
  border-color: #38bdf8;
  background: #1e3a5f;
  color: #fff;
}

.mobile-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 520px) {
  .mobile-grid { grid-template-columns: repeat(4, 1fr); }
}

.mobile-stats-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #1e293b;
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 278px;
  overflow-y: auto;
  padding-right: 4px;
}

/* AVATAR STUDIO */
.avatar-studio {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .avatar-studio { grid-template-columns: 1fr; }
}

.avatar-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #090f20;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 8px;
}

#avatarPreviewCanvas {
  background: radial-gradient(circle, #1e3a6e 0%, #0b1224 75%);
  border-radius: 10px;
  border: 1px solid #334155;
  image-rendering: pixelated;
}

.btn-mini-blue {
  width: 100%;
  padding: 5px;
  border-radius: 6px;
  border: 1px solid #3b82f6;
  background: #1e3a8a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.av-stats-list {
  width: 100%;
  font-size: 11px;
  color: #cbd5e1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.av-stat-pill {
  background: #131f3a;
  padding: 2px 5px;
  border-radius: 4px;
  text-align: center;
}

.av-stat-pill b { color: #fbbf24; }

.av-cat-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.av-cat {
  flex: 1;
  padding: 5px 4px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.av-cat.active {
  border-color: #fbbf24;
  background: #422006;
  color: #fde68a;
}

.av-search {
  margin-bottom: 6px;
  padding: 6px 8px !important;
  font-size: 12px !important;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 196px;
  overflow-y: auto;
  padding-right: 4px;
}

.av-set-hint {
  font-size: 11px;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 6px;
}

.avatar-set-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  max-height: 290px !important;
  gap: 7px !important;
}

.av-set-card {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left !important;
  padding: 6px 8px !important;
}

.av-set-thumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: rgba(9, 15, 32, 0.8);
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 3px;
}

.av-set-thumbs img {
  width: 30px !important;
  height: 30px !important;
  margin: 0 !important;
}

.av-set-info {
  min-width: 0;
  flex: 1;
}

.av-set-card .av-name { font-size: 11px; color: #fef08a; }
.av-set-card .av-mini-stat { font-size: 9.5px; color: #93c5fd; }
.av-set-card .av-price { font-size: 10px; margin-top: 3px; }

/* POWER USER & CUSTOM SLOT BACKGROUNDS */
.av-cat-ex {
  border-color: #facc15 !important;
  color: #fde047 !important;
}

.pu-banner-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.55), rgba(30, 58, 138, 0.78));
  border: 2px solid #facc15;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.25);
}

.pu-banner-info h4 {
  font-size: 13px;
  font-weight: 900;
  color: #fde047;
  margin-bottom: 3px;
}

.pu-banner-info p {
  font-size: 10.5px;
  color: #e0f2fe;
  line-height: 1.35;
}

.pu-buy-btn {
  padding: 7px 12px;
  border-radius: 7px;
  border: 1.5px solid #fef08a;
  background: linear-gradient(180deg, #facc15, #ca8a04);
  color: #1e1b4b;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.pu-badge {
  display: inline-block;
  background: linear-gradient(180deg, #facc15, #d97706);
  color: #1e1b4b;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 3px;
  vertical-align: middle;
}

.gb-chat-pu { color: #fde047; }
.gb-room-card.power-room {
  border-color: #facc15 !important;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.35);
}

.bg-preview-swatch {
  width: 58px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
}

/* 8 Custom Slot Background Themes (works identically on PC & Mobile Landscape!) */
.slot-bg-bg_01 {
  background: linear-gradient(135deg, rgba(161, 98, 7, 0.88), rgba(113, 63, 18, 0.92), rgba(234, 179, 8, 0.72)) !important;
  border-color: #fde047 !important;
  box-shadow: inset 0 0 14px rgba(250, 204, 21, 0.45);
  border-radius: 8px;
}
.slot-bg-bg_02 {
  background: linear-gradient(135deg, rgba(14, 34, 78, 0.75), rgba(3, 105, 161, 0.72)), url('/assets/maps/metro_bg.jpg') center/cover !important;
  border-color: #38bdf8 !important;
  box-shadow: inset 0 0 14px rgba(56, 189, 248, 0.45);
  border-radius: 8px;
}
.slot-bg-bg_03 {
  background: linear-gradient(135deg, rgba(12, 74, 110, 0.65), rgba(30, 58, 138, 0.72)), url('/assets/maps/babo_bg.jpg') center/cover !important;
  border-color: #7dd3fc !important;
  border-radius: 8px;
}
.slot-bg-bg_04 {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.72), rgba(14, 165, 233, 0.75), rgba(224, 242, 254, 0.35)) !important;
  border-color: #67e8f9 !important;
  box-shadow: inset 0 0 14px rgba(103, 232, 249, 0.45);
  border-radius: 8px;
}
.slot-bg-bg_05 {
  background: linear-gradient(135deg, rgba(124, 45, 18, 0.72), rgba(180, 83, 9, 0.68)), url('/assets/maps/brick_bg.jpg') center/cover !important;
  border-color: #fb923c !important;
  border-radius: 8px;
}
.slot-bg-bg_06 {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.9), rgba(220, 38, 38, 0.78), rgba(234, 88, 12, 0.75)) !important;
  border-color: #f87171 !important;
  box-shadow: inset 0 0 14px rgba(248, 113, 113, 0.5);
  border-radius: 8px;
}
.slot-bg-bg_07 {
  background: linear-gradient(135deg, rgba(46, 16, 101, 0.92), rgba(109, 40, 217, 0.8), rgba(236, 72, 153, 0.55)) !important;
  border-color: #c084fc !important;
  box-shadow: inset 0 0 14px rgba(192, 132, 252, 0.5);
  border-radius: 8px;
}
.slot-bg-bg_08 {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.9), rgba(16, 185, 129, 0.72), rgba(52, 211, 153, 0.45)) !important;
  border-color: #34d399 !important;
  box-shadow: inset 0 0 14px rgba(52, 211, 153, 0.45);
  border-radius: 8px;
}

.av-item {
  background: #131f3a;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 5px 4px;
  text-align: center;
  cursor: pointer;
}

.av-item.active {
  border-color: #fbbf24;
  background: #1e315c;
}

.av-item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto 3px;
}

.av-item .av-name {
  font-size: 10px;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.av-item .av-mini-stat {
  font-size: 9px;
  color: #93c5fd;
  margin-top: 2px;
}

.loadout-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 10px;
}

#miniAvatarCanvas {
  background: radial-gradient(circle, #1e3a6e 0%, #0b1224 75%);
  border-radius: 8px;
  border: 1px solid #475569;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.sum-title { font-size: 15px; font-weight: 800; color: #fbbf24; }
.sum-sub { font-size: 11px; color: #93c5fd; margin-top: 2px; }
.sum-stats { font-size: 11px; color: #4ade80; margin-top: 4px; font-weight: 700; }

.panel {
  background: rgba(10, 16, 32, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 12px;
  padding: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #93c5fd;
  margin-bottom: 6px;
  font-weight: 700;
}

input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  outline: none;
}

input[type="text"]:focus {
  border-color: #60a5fa;
}

/* mobile-grid & map-grid defined above */

.mobile-opt {
  background: #131f3a;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}

.mobile-opt:hover { transform: translateY(-2px); }
.mobile-opt.active {
  border-color: #fbbf24;
  background: #1e315c;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.mobile-opt img {
  width: 46px;
  height: 42px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto 4px;
}

.mobile-opt span {
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
}

/* map-grid defined above */

.map-opt {
  background: #131f3a;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
}

.map-opt.active {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.map-opt img {
  width: 100%;
  height: 52px;
  object-fit: cover;
  display: block;
}

.map-opt span {
  display: block;
  font-size: 11px;
  padding: 4px;
  font-weight: 600;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  transition: filter 0.12s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }
.btn:hover { filter: brightness(1.1); }
.btn-lg { width: 100%; padding: 12px; font-size: 15px; }
.btn-primary { background: linear-gradient(180deg, #3b82f6, #1d4ed8); }
.btn-gold { background: linear-gradient(180deg, #f59e0b, #b45309); width: 100%; }
.btn-secondary { background: #334155; }

.divider {
  text-align: center;
  margin: 12px 0;
  position: relative;
}

.divider span {
  font-size: 10px;
  color: #64748b;
  letter-spacing: 1px;
  font-weight: 700;
}

.mp-controls { display: flex; flex-direction: column; gap: 8px; }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: 3px; text-align: center; font-weight: 700; }

.room-box {
  margin-top: 10px;
  background: #0f1b35;
  border: 1px solid #38bdf8;
  border-radius: 10px;
  padding: 10px;
}

.room-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.room-top strong { color: #fbbf24; font-size: 16px; letter-spacing: 2px; }

.btn-mini {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.room-players {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.room-player-row {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 8px;
  border-radius: 6px;
}

.room-wait {
  margin-top: 8px;
  font-size: 12px;
  color: #93c5fd;
  text-align: center;
}

.error-msg {
  margin-top: 8px;
  padding: 8px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  border-radius: 8px;
  font-size: 12px;
  color: #fca5a5;
}

.controls-hint {
  margin-top: 12px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
}

.controls-hint code {
  background: #1e293b;
  padding: 1px 4px;
  border-radius: 4px;
  color: #e2e8f0;
}

/* GAME STAGE */
.game-wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #060a14;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* TOP HUD */
.top-hud {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

.hud-left {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.hud-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}

.wind-box {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #38bdf8;
  border-radius: 14px;
  padding: 4px 14px;
  text-align: center;
  min-width: 96px;
}

.wind-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #93c5fd;
  font-weight: 800;
}

.wind-compass {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wind-arrow {
  font-size: 20px;
  color: #fbbf24;
  transition: transform 0.3s;
}

.wind-val {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.turn-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 12px;
  padding: 6px 12px;
  text-align: right;
}

.turn-banner {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
}

.turn-timer {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

/* BOTTOM HUD */
.bottom-hud {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(96vw, 760px);
  background: rgba(12, 20, 40, 0.9);
  border: 2px solid #3b82f6;
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.hud-shots {
  display: flex;
  gap: 5px;
}

.shot-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 2px solid #475569;
  background: #1e293b;
  color: #cbd5e1;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.shot-btn.active {
  border-color: #fbbf24;
  background: #b45309;
  color: #fff;
}

.shot-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hud-angle {
  min-width: 58px;
  text-align: center;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 4px 6px;
}

.angle-lbl {
  display: block;
  font-size: 9px;
  color: #94a3b8;
  font-weight: 700;
}

#angleDisplay {
  font-size: 16px;
  color: #38bdf8;
}

.power-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.power-bar-bg {
  position: relative;
  height: 22px;
  background: #090e1a;
  border: 1px solid #475569;
  border-radius: 6px;
  overflow: hidden;
}

.power-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
}

.power-last-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.power-ticks {
  position: absolute;
  inset: 0;
  display: flex;
}

.power-ticks span {
  flex: 1;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.power-ticks span:last-child { border-right: none; }

.fuel-bar-bg {
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}

.fuel-fill {
  height: 100%;
  width: 100%;
  background: #f59e0b;
}

.btn-fire {
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 2px solid #fca5a5;
  background: linear-gradient(180deg, #ef4444, #991b1b);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  touch-action: none;
}

.btn-fire:active {
  transform: scale(0.95);
  filter: brightness(1.2);
}

/* MOBILE TOUCH DPAD */
.touch-controls {
  position: fixed;
  bottom: 84px;
  left: 14px;
  z-index: 12;
  display: none;
  touch-action: none;
}

@media (pointer: coarse), (max-width: 900px) {
  .touch-controls { display: block; }
  .bottom-hud { padding: 6px 8px; gap: 6px; }
  .shot-btn { width: 32px; height: 32px; font-size: 11px; }
  .btn-fire { padding: 0 12px; height: 38px; font-size: 12px; }
}

.touch-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.t-mid {
  display: flex;
  gap: 44px;
}

.t-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(147, 197, 253, 0.55);
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  touch-action: none;
}

.t-btn:active {
  background: rgba(59, 130, 246, 0.8);
}

.hud-center-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.sudden-badge {
  background: linear-gradient(90deg, #b91c1c, #dc2626, #b91c1c);
  border: 1px solid #fca5a5;
  color: #fef08a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.75);
  animation: pulseSudden 0.9s infinite alternate;
}

@keyframes pulseSudden {
  from { transform: scale(1); filter: brightness(1); }
  to { transform: scale(1.06); filter: brightness(1.25); }
}

.wind-weather-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.weather-box {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #a855f7;
  border-radius: 14px;
  padding: 4px 12px;
  text-align: center;
  min-width: 108px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.weather-val {
  font-size: 13px;
  font-weight: 800;
  color: #fde68a;
  margin-top: 2px;
}

.item-bar {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(10, 18, 36, 0.86);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  padding: 5px 8px;
  z-index: 11;
}

.item-slot {
  position: relative;
  width: 44px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid #334155;
  background: #0f172a;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.1s;
}

.item-slot:hover:not(:disabled) { transform: translateY(-2px); border-color: #60a5fa; }
.item-slot.armed {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.75);
  background: #422006;
}
.item-slot:disabled { opacity: 0.28; cursor: not-allowed; filter: grayscale(1); }
.item-slot img { width: 36px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.item-slot .item-key {
  position: absolute;
  top: -5px;
  left: -4px;
  font-size: 9px;
  font-weight: 800;
  background: #1e293b;
  color: #93c5fd;
  padding: 0 3px;
  border-radius: 3px;
}

.btn-barmode {
  height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #38bdf8;
  background: #0f172a;
  color: #38bdf8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.btn-barmode.drag {
  border-color: #fbbf24;
  color: #fbbf24;
  background: #422006;
}

.power-bar-bg.drag-mode {
  cursor: ew-resize;
  border-color: #fbbf24;
}

@media (max-width: 600px) {
  .item-slot { width: 38px; height: 34px; }
  .item-slot img { width: 30px; height: 26px; }
  .item-bar { bottom: 68px; gap: 4px; padding: 4px 6px; }
  .weather-box { min-width: 82px; padding: 4px 8px; }
  .weather-val { font-size: 11px; }
}

.chat-bar {
  position: fixed;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 440px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid #38bdf8;
  border-radius: 10px;
  padding: 6px;
  z-index: 25;
}

.chat-emotes {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.chat-emote-btn {
  flex: 1;
  background: rgba(30, 58, 138, 0.65);
  border: 1px solid rgba(147, 197, 253, 0.45);
  border-radius: 6px;
  padding: 3px 0;
  font-size: 16px;
  cursor: pointer;
}

.chat-emote-btn:active { transform: scale(0.92); background: #1d4ed8; }

.chat-input-line {
  display: flex;
  gap: 6px;
}

.chat-bar input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
}

/* WIN MODAL (authentic g_result_back.png classic GunBound card) */
.win-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 24, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 40;
}

.win-card {
  width: min(90vw, 370px);
  min-height: 260px;
  background:
    linear-gradient(180deg, rgba(10, 22, 52, 0.68) 0%, rgba(8, 16, 40, 0.86) 100%),
    url('/assets/ui/result_back.png') center center / 100% 100% no-repeat;
  border: 2.5px solid #fbbf24;
  border-radius: 14px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.win-card h2 {
  font-size: 30px;
  color: #fbbf24;
  margin-bottom: 8px;
}

.win-card p {
  color: #cbd5e1;
  margin-bottom: 20px;
}

.win-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* GUILD / CLAN, GIFT & ROOM CONTROLS */
.guild-tag {
  color: #38bdf8;
  font-weight: 900;
  margin-right: 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.gb-slot-kick {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #fca5a5;
  background: rgba(185, 28, 28, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.gb-slot-kick:hover { background: #ef4444; transform: scale(1.1); }

.guild-my-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(14, 116, 144, 0.25);
  border: 1px solid #38bdf8;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.guild-create-box {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.guild-create-box input {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
}

.guild-msg {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  background: rgba(30, 58, 138, 0.55);
  border: 1px solid #60a5fa;
  color: #e0f2fe;
}
.guild-msg.err {
  background: rgba(153, 27, 27, 0.65);
  border-color: #f87171;
  color: #fee2e2;
}
.guild-msg.ok {
  background: rgba(21, 128, 61, 0.55);
  border-color: #4ade80;
  color: #dcfce7;
}

.guild-head-row,
.guild-row {
  grid-template-columns: 34px 1fr 64px 82px 68px !important;
}

.gift-item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 270px;
  overflow-y: auto;
  padding: 2px;
  margin-bottom: 10px;
}

.gift-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  color: #f1f5f9;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.gift-item:hover { border-color: #60a5fa; }
.gift-item.selected {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}
.gift-item.pu-item {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.35), rgba(30, 41, 59, 0.9));
}
.gift-item strong { font-size: 12px; color: #f8fafc; }
.gift-item small { font-size: 10px; color: #94a3b8; }
.gift-item .gift-price { font-size: 11px; font-weight: 800; color: #fbbf24; margin-top: 2px; }

.gift-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #1e293b;
  padding-top: 8px;
}

.room-set-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.room-set-form label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  margin-top: 4px;
}
.room-set-form input {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
}

@media (max-height: 520px) {
  .gift-item-list { max-height: 145px; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); }
  .guild-create-box { flex-wrap: wrap; }
  .guild-my-box { padding: 5px 8px; font-size: 11px; }
}

@media (pointer: coarse) {
  .guild-create-box input,
  .room-set-form input {
    font-size: 16px !important;
  }
}

/* ============================================================================
   PRO HOMESCREEN UI/UX (GLASS + METALLIC ESPORTS LOBBY, ZERO EMOJIS)
   ============================================================================ */
.gb-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.gb-lobby-screen {
  background:
    linear-gradient(180deg, rgba(6, 18, 46, 0.22) 0%, rgba(8, 20, 48, 0.32) 100%),
    url('/assets/ui/home_wallpaper.jpg?v=2') center center / cover no-repeat !important;
}

.gb-home-stage {
  position: relative;
  width: min(1240px, 97vw);
  height: min(760px, 95dvh);
  aspect-ratio: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(8, 22, 52, 0.34) 0%, rgba(10, 24, 56, 0.44) 100%),
    url('/assets/ui/home_wallpaper.jpg?v=2') center center / cover no-repeat;
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.gb-home-topbar {
  position: static;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(10, 22, 48, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.gb-home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.gb-brand-logo {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.8px;
  color: #f8fafc;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}
.gb-brand-logo span {
  color: #fbbf24;
}

.gb-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #4ade80;
  background: rgba(20, 83, 45, 0.45);
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.gb-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.gb-home-auth {
  max-width: none;
  margin-left: auto;
}

.gb-auth-logged {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  font-size: 13px;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-logout:hover {
  background: rgba(185, 28, 28, 0.65);
  border-color: #f87171;
}
.btn-logout .gb-ico { width: 13px; height: 13px; }

.gb-home-actions {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.gb-home-actions .gb-act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-shadow: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s, filter 0.15s;
  white-space: nowrap;
}
.gb-home-actions .gb-act-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.24);
  color: #fff;
}
.gb-home-actions .gb-act-btn.gb-act-primary {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: rgba(147, 197, 253, 0.55);
  color: #fff;
}
.gb-home-actions .gb-act-btn.gb-act-gold {
  background: linear-gradient(180deg, #d97706, #b45309) !important;
  border-color: rgba(253, 224, 71, 0.55) !important;
  color: #fff !important;
}
.gb-home-actions .gb-act-btn.gb-act-green {
  background: linear-gradient(180deg, #059669, #047857) !important;
  border-color: rgba(110, 231, 183, 0.5) !important;
  color: #fff !important;
}

.gb-home-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 2.25fr) minmax(240px, 1fr);
  gap: 10px;
}

.gb-home-main-col {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 10px;
}

.gb-gamelist-area,
.gb-home-chat,
.gb-home-online {
  position: static;
  width: auto;
  height: auto;
  min-height: 0;
  background: rgba(10, 22, 48, 0.66);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gb-panel-title,
.gb-panel-subhead {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #93c5fd;
  text-transform: uppercase;
}

.gb-panel-subhead {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.gb-count-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 800;
}

.gb-gamelist-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.gb-roomlist-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.1px;
  color: #e2e8f0;
  text-shadow: none;
}

.gb-join-inline input {
  width: 92px;
  padding: 5px 8px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  background: rgba(15, 23, 42, 0.9) !important;
  color: #f8fafc !important;
}

.gb-room-card {
  background: linear-gradient(160deg, rgba(22, 34, 62, 0.92), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  padding: 10px 12px;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.gb-room-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.18);
  transform: translateY(-1px);
}
.gb-room-card.power-room {
  border-color: rgba(251, 191, 36, 0.65);
  background: linear-gradient(160deg, rgba(56, 38, 16, 0.55), rgba(15, 23, 42, 0.96));
}
.gb-room-card-title {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
}
.gb-room-card-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.gb-empty-rooms {
  background: rgba(15, 23, 42, 0.55);
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 24px 16px;
  color: #94a3b8;
  font-size: 12.5px;
}

.gb-chat-input-row {
  padding-left: 0;
  gap: 6px;
}
.gb-chat-input-row input {
  padding: 7px 10px !important;
  font-size: 12px !important;
  border-radius: 7px !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  background: rgba(15, 23, 42, 0.9) !important;
  color: #f8fafc !important;
}

.gb-online-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.gb-online-row {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}

/* LEADERBOARD MODE TABS (PLAYERS / GUILDS) */
.lb-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
  background: rgba(9, 15, 32, 0.85);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid #1e293b;
}
.lb-mode-tab {
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lb-mode-tab.active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: rgba(147, 197, 253, 0.55);
  color: #fff;
}

.lb-guild-head-row,
.lb-guild-row {
  grid-template-columns: 42px 1fr 84px 96px !important;
}

/* MOBILE LANDSCAPE OVERRIDES FOR PRO HOMESCREEN (COMPACT & CENTERED) */
@media (max-height: 520px) {
  .gb-home-stage {
    width: min(740px, 92vw);
    height: min(375px, 92dvh);
    max-width: 740px;
    max-height: 92dvh;
    margin: auto;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.34);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    padding: 7px 9px;
    gap: 6px;
  }
  .gb-home-topbar {
    padding: 5px 9px;
    border-radius: 9px;
    gap: 8px;
  }
  .gb-brand-logo { font-size: 13px; letter-spacing: 1px; }
  .gb-live-pill { display: none; }
  .gb-auth-logged { font-size: 10px; gap: 5px; }
  .btn-logout { padding: 3px 6px; font-size: 9.5px; }
  .btn-logout span { display: none; }

  .gb-home-actions {
    gap: 4px;
  }
  .gb-home-actions .gb-act-btn {
    padding: 5px 4px;
    font-size: 9.5px;
    gap: 4px;
    border-radius: 7px;
  }
  .gb-home-actions .gb-ico { width: 12px; height: 12px; }

  .gb-home-body {
    grid-template-columns: minmax(0, 1.95fr) minmax(160px, 1fr);
    gap: 6px;
  }
  .gb-home-main-col {
    grid-template-rows: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 6px;
  }
  .gb-gamelist-area,
  .gb-home-chat,
  .gb-home-online {
    padding: 6px 8px;
    border-radius: 9px;
    gap: 4px;
  }
  .gb-panel-subhead,
  .gb-gamelist-bar {
    padding-bottom: 3px;
    font-size: 9.5px;
  }
  .gb-room-card { padding: 5px 8px; border-radius: 7px; }
  .gb-room-card-title { font-size: 11px; }
  .gb-room-card-sub { font-size: 9.5px; }
  .gb-empty-rooms { padding: 10px 8px; font-size: 10.5px; }
  .gb-online-list { flex-direction: column; flex-wrap: nowrap; gap: 3px; }
  .gb-online-row { padding: 3px 6px; font-size: 10px; border-radius: 6px; }
}

/* WAITING ROOM SVG BUTTONS, GUILD MANAGEMENT & ROOM INVITE TOAST */
.gb-center-actions .gb-act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.gb-center-actions .gb-ico {
  width: 13px;
  height: 13px;
}

.guild-search-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.guild-search-row input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
}

.gb-app-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.guild-sec-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #93c5fd;
  margin-bottom: 5px;
}

.guild-sublist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 145px;
  overflow-y: auto;
  padding-right: 2px;
}

.guild-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #1e293b;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
}

.guild-member-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guild-leader-pill {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fde047;
  font-size: 9.5px;
  font-weight: 800;
}

.gb-invite-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 120;
  width: min(340px, 92vw);
  background: rgba(10, 22, 48, 0.96);
  backdrop-filter: blur(12px);
  border: 1.5px solid #38bdf8;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gb-invite-head {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.1px;
  color: #38bdf8;
}

.gb-invite-text {
  font-size: 13px;
  color: #f1f5f9;
  line-height: 1.4;
}

.gb-invite-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (pointer: coarse) {
  .guild-search-row input {
    font-size: 16px !important;
  }
}


/* ============================================================================
   REDESIGN v2 — HOME & WAITING ROOM (PC + MOBILE LANDSCAPE)
   Warm dark neutrals, one amber accent, team colors only where meaningful.
   No gradients, no glow, no glass. Clear hierarchy, large hit targets.
   ============================================================================ */
:root {
  --ui-bg: #0f1216;
  --ui-panel: #171b21;
  --ui-raised: #1f242c;
  --ui-hover: #272d37;
  --ui-line: #2a3039;
  --ui-line-2: #39414d;
  --ui-text: #ebe6dc;
  --ui-text-2: #a9afb8;
  --ui-text-3: #707782;
  --ui-accent: #eea53b;
  --ui-accent-hover: #f6b558;
  --ui-accent-ink: #1d1407;
  --ui-team-a: #5d9cd3;
  --ui-team-b: #dd6b59;
  --ui-ok: #6bbd7b;
  --ui-danger: #d65a4d;
  --ui-gold: #e7c060;
  --ui-gp: #8db6dc;
  --ui-radius: 8px;
  --ui-font: 'Segoe UI', Roboto, 'Helvetica Neue', system-ui, sans-serif;
}

.gb-lobby-screen {
  background: var(--ui-bg) !important;
  font-family: var(--ui-font);
}

.ui-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Shared form controls inside new screens */
.hs input[type="text"],
.rs input[type="text"] {
  height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid var(--ui-line-2);
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 500 13px var(--ui-font);
  outline: none;
  transition: border-color 0.15s;
  user-select: text;
  -webkit-user-select: text;
}
.hs input[type="text"]:focus,
.rs input[type="text"]:focus { border-color: var(--ui-accent); }
.hs input::placeholder,
.rs input::placeholder { color: var(--ui-text-3); }

.hs-btn,
.rs-btn {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  border: 1px solid var(--ui-line-2);
  background: var(--ui-raised);
  color: var(--ui-text);
  font: 600 13px var(--ui-font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.hs-btn:hover,
.rs-btn:hover { background: var(--ui-hover); border-color: #4a5361; }
.hs-btn:active,
.rs-btn:active { transform: translateY(1px); }

.hs-panel {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.hs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui-line);
  min-height: 52px;
}
.hs-panel-head h2 {
  margin: 0;
  font: 700 14px var(--ui-font);
  color: var(--ui-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hs-count {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--ui-raised);
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text-2);
  font: 600 11px var(--ui-font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------- HOME ---------------------------------- */
.hs {
  width: min(1360px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px 20px 20px;
  color: var(--ui-text);
  font-family: var(--ui-font);
}

.hs-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
}

.hs-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.hs-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  font: 800 15px var(--ui-font);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hs-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.hs-brand-text strong {
  font: 700 17px var(--ui-font);
  color: var(--ui-text);
}
.hs-brand-text small {
  font: 500 12px var(--ui-font);
  color: var(--ui-text-3);
}

.hs-account {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  padding: 6px 6px 6px 12px;
  min-width: 0;
}
.hs-account .rank-ico {
  width: 26px;
  height: 16px;
  margin-right: 6px;
}
.hs-acc-id {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  padding-right: 14px;
  margin-right: 4px;
  border-right: 1px solid var(--ui-line);
  min-width: 0;
}
.hs-acc-id strong {
  font: 700 14px var(--ui-font);
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.hs-acc-id #accRankName {
  font: 500 11px var(--ui-font);
  color: var(--ui-text-3);
}
.hs-acc-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  padding: 0 12px;
  border-right: 1px solid var(--ui-line);
}
.hs-acc-stat small {
  font: 600 10px var(--ui-font);
  color: var(--ui-text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.hs-acc-stat span {
  font: 700 13px var(--ui-font);
  color: var(--ui-gp);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hs-acc-stat.is-gold span { color: var(--ui-gold); }
.hs-icon-btn {
  width: 36px;
  height: 36px;
  margin-left: 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hs-icon-btn:hover { background: var(--ui-raised); color: var(--ui-danger); }

.hs-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 14px;
  min-height: 0;
}

/* Left navigation */
.hs-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.hs-cta {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: var(--ui-radius);
  border: 1px solid transparent;
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  font: 700 14px var(--ui-font);
  cursor: pointer;
  transition: background 0.15s;
}
.hs-cta:hover { background: var(--ui-accent-hover); }
.hs-cta:active { transform: translateY(1px); }
.hs-cta-alt {
  background: var(--ui-raised);
  border-color: var(--ui-line-2);
  color: var(--ui-text);
}
.hs-cta-alt:hover { background: var(--ui-hover); }
.hs-nav-label {
  margin: 14px 4px 2px;
  font: 600 11px var(--ui-font);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ui-text-3);
}
.hs-nav-item {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-text-2);
  font: 600 13.5px var(--ui-font);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hs-nav-item:hover {
  background: var(--ui-panel);
  border-color: var(--ui-line);
  color: var(--ui-text);
}
.hs-nav-item .ui-ico { color: var(--ui-text-3); }
.hs-nav-item:hover .ui-ico { color: var(--ui-accent); }

/* Center column */
.hs-main {
  display: grid;
  grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.hs-join {
  display: flex;
  gap: 6px;
}
.hs-join input[type="text"] {
  width: 120px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}
.hs-join input::placeholder {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

.hs-room-cols,
.hs-room {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr) 76px 92px;
  align-items: center;
  gap: 12px;
}
.hs-room-cols {
  padding: 8px 14px;
  font: 600 11px var(--ui-font);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ui-text-3);
  border-bottom: 1px solid var(--ui-line);
}

.hs-room-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hs-room {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
  color: var(--ui-text);
  font-family: var(--ui-font);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.hs-room:hover { background: var(--ui-raised); }
.hs-room.is-locked { cursor: default; }
.hs-room.is-locked:hover { background: transparent; }

.hs-room-id {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.hs-code {
  flex-shrink: 0;
  width: 54px;
  height: 30px;
  border-radius: 5px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text);
  font: 700 12px ui-monospace, 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hs-room-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.hs-room-text strong {
  font: 600 13.5px var(--ui-font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hs-room-text small {
  font: 500 11.5px var(--ui-font);
  color: var(--ui-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hs-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  font: 700 9.5px var(--ui-font);
  letter-spacing: 0.5px;
  vertical-align: 1px;
}
.hs-tag.is-private { background: #3a2f22; color: #e8b46a; }
.hs-tag.is-power { background: #3b3320; color: var(--ui-gold); }

.hs-room-map {
  font: 500 12.5px var(--ui-font);
  color: var(--ui-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hs-room-count {
  font: 600 13px var(--ui-font);
  color: var(--ui-text-2);
  font-variant-numeric: tabular-nums;
}
.hs-room-act {
  display: flex;
  justify-content: flex-end;
}
.hs-status {
  height: 28px;
  min-width: 72px;
  padding: 0 12px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 12px var(--ui-font);
}
.hs-status.is-open {
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
}
.hs-status.is-playing {
  background: transparent;
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text-3);
}
.hs-status.is-full {
  background: transparent;
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text-3);
}

.hs-empty {
  padding: 34px 20px;
  text-align: center;
  font: 500 13px var(--ui-font);
  color: var(--ui-text-3);
  line-height: 1.5;
}

/* Chat */
.hs-chat-log,
.rs-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px;
  font: 400 13px/1.5 var(--ui-font);
  color: var(--ui-text);
  -webkit-overflow-scrolling: touch;
  user-select: text;
  -webkit-user-select: text;
}
.hs-chat-log .gb-chat-sys,
.rs-chat-log .gb-chat-sys {
  color: var(--ui-text-3);
  font-weight: 500;
  font-style: italic;
}
.hs-chat-log .gb-chat-line,
.rs-chat-log .gb-chat-line { padding: 1px 0; }
.hs-chat-log .gb-chat-line b,
.rs-chat-log .gb-chat-line b { color: var(--ui-gp); font-weight: 600; }
.hs-chat-log .gb-chat-pu b,
.rs-chat-log .gb-chat-pu b { color: var(--ui-gold); }
.hs-chat-log .rank-ico,
.rs-chat-log .rank-ico { width: 20px; height: 12px; vertical-align: -1px; }

.hs-chat-input,
.rs-chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--ui-line);
}
.hs-chat-input input,
.rs-chat-input input { flex: 1; min-width: 0; }

/* Online list */
.hs-online-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  -webkit-overflow-scrolling: touch;
}
.hs-online-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
}
.hs-online-row:hover { background: var(--ui-raised); }
.hs-online-row .rank-ico { width: 22px; height: 13px; flex-shrink: 0; }
.hs-on-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.hs-on-text strong {
  font: 600 13px var(--ui-font);
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hs-on-text small {
  font: 500 11px var(--ui-font);
  color: var(--ui-text-3);
}
.hs-on-text small.in-room { color: var(--ui-ok); }
.hs-on-join {
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid var(--ui-line-2);
  background: transparent;
  color: var(--ui-text);
  font: 600 11.5px var(--ui-font);
  cursor: pointer;
}
.hs-on-join:hover { border-color: var(--ui-accent); color: var(--ui-accent); }
.hs-online-empty {
  padding: 20px 10px;
  text-align: center;
  font: 500 12px var(--ui-font);
  color: var(--ui-text-3);
}

/* Names: guild tag + PU badge, restyled calm */
.hs .guild-tag,
.rs .guild-tag {
  color: var(--ui-team-a);
  text-shadow: none;
  font-weight: 700;
}
.hs .pu-badge,
.rs .pu-badge {
  background: #3b3320;
  color: var(--ui-gold);
  border: none;
  box-shadow: none;
  text-shadow: none;
}

/* Global toast */
.ui-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 130;
  max-width: min(520px, 92vw);
  padding: 11px 16px;
  border-radius: var(--ui-radius);
  background: var(--ui-raised);
  border: 1px solid var(--ui-line-2);
  border-left: 3px solid var(--ui-accent);
  color: var(--ui-text);
  font: 600 13px var(--ui-font);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ------------------------------ WAITING ROOM ------------------------------ */
.rs {
  width: min(1320px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 20px 20px;
  color: var(--ui-text);
  font-family: var(--ui-font);
}

.rs-top {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
}
.rs-back {
  height: 38px;
  padding: 0 14px 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  border: 1px solid var(--ui-line-2);
  background: var(--ui-panel);
  color: var(--ui-text-2);
  font: 600 13px var(--ui-font);
  cursor: pointer;
}
.rs-back:hover { color: var(--ui-text); background: var(--ui-raised); }
.rs-title {
  flex: 1;
  min-width: 0;
}
.rs-title span {
  display: block;
  font: 700 17px var(--ui-font);
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rs-toggle {
  height: 34px;
  padding: 0 12px 0 32px;
  position: relative;
  border-radius: 6px;
  border: 1px solid var(--ui-line-2);
  background: var(--ui-panel);
  color: var(--ui-text-2);
  font: 600 12.5px var(--ui-font);
  cursor: pointer;
}
.rs-toggle::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 3px;
  border: 1.5px solid var(--ui-line-2);
  background: transparent;
}
.rs-toggle.on { color: var(--ui-text); }
.rs-toggle.on::before {
  background: var(--ui-ok);
  border-color: var(--ui-ok);
}

.rs-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1.1fr) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.rs-team {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.rs-team-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  font: 700 12px var(--ui-font);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ui-text-2);
}
.rs-team-head i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--ui-team-a);
}
.team-b .rs-team-head { justify-content: flex-end; flex-direction: row-reverse; }
.team-b .rs-team-head i { background: var(--ui-team-b); }

.rs-slot {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  max-height: 104px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-left: 3px solid var(--ui-team-a);
  overflow: hidden;
}
.team-b .rs-slot {
  flex-direction: row-reverse;
  padding: 6px 6px 6px 12px;
  border-left-width: 1px;
  border-right: 3px solid var(--ui-team-b);
  text-align: right;
}
.rs-slot.is-empty {
  background: transparent;
  border: 1px dashed var(--ui-line-2);
  justify-content: center;
}
.team-b .rs-slot.is-empty { border-right: 1px dashed var(--ui-line-2); }
.rs-slot.is-me { background: var(--ui-raised); }
.rs-slot.is-me::after {
  content: 'YOU';
  position: absolute;
  top: 6px;
  right: 8px;
  font: 700 9.5px var(--ui-font);
  letter-spacing: 0.6px;
  color: var(--ui-accent);
}
.team-b .rs-slot.is-me::after { right: auto; left: 8px; }

.rs-slot-empty {
  font: 500 12.5px var(--ui-font);
  color: var(--ui-text-3);
}
.rs-slot-canvas {
  height: 100%;
  max-height: 88px;
  width: auto;
  aspect-ratio: 84 / 72;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--ui-bg);
  image-rendering: pixelated;
}
.rs-slot-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.rs-slot-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font: 700 14px var(--ui-font);
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-b .rs-slot-name { justify-content: flex-end; }
.rs-slot-name .rank-ico { width: 22px; height: 13px; flex-shrink: 0; }
.rs-slot-name .nm {
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-slot-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 500 12px var(--ui-font);
  color: var(--ui-text-3);
}
.team-b .rs-slot-sub { justify-content: flex-end; }
.rs-host {
  padding: 1px 5px;
  border-radius: 3px;
  background: #3b3320;
  color: var(--ui-gold);
  font: 700 9.5px var(--ui-font);
  letter-spacing: 0.5px;
}
.rs-kick {
  position: absolute;
  bottom: 6px;
  right: 8px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--ui-line-2);
  background: var(--ui-bg);
  color: var(--ui-text-3);
  font: 600 10.5px var(--ui-font);
  cursor: pointer;
}
.team-b .rs-kick { right: auto; left: 8px; }
.rs-kick:hover { border-color: var(--ui-danger); color: var(--ui-danger); }

/* Center: map + loadout */
.rs-center {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding-top: 30px;
}
.rs-map {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--ui-radius);
  overflow: hidden;
  border: 1px solid var(--ui-line);
  background: var(--ui-panel);
  cursor: pointer;
}
.rs-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.rs-map:hover img { transform: scale(1.03); }
.rs-map-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(12, 14, 18, 0.82);
  border-top: 1px solid var(--ui-line);
}
.rs-map-cap > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rs-map-cap strong {
  font: 700 15px var(--ui-font);
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-map-change {
  flex-shrink: 0;
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text-2);
  font: 600 11.5px var(--ui-font);
  display: inline-flex;
  align-items: center;
}
.rs-map:hover .rs-map-change { border-color: var(--ui-accent); color: var(--ui-accent); }
.rs-label {
  font: 600 10.5px var(--ui-font);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ui-text-3);
}

.rs-loadout {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rs-loadout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rs-loadout-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rs-loadout-id strong {
  font: 700 15px var(--ui-font);
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-loadout-btns {
  display: flex;
  gap: 6px;
}
.rs-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rs-bar {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 10px;
}
.rs-bar span {
  font: 600 11.5px var(--ui-font);
  color: var(--ui-text-2);
}
.rs-track {
  height: 6px;
  border-radius: 3px;
  background: var(--ui-bg);
  overflow: hidden;
}
.rs-track i {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 3px;
  background: var(--ui-accent);
  transition: width 0.25s ease;
}
.rs-sub {
  font: 500 11.5px var(--ui-font);
  color: var(--ui-text-3);
}

/* Bottom: chat + start */
.rs-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  height: 150px;
}
.rs-chat {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rs-start {
  display: flex;
}
.rs-start-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--ui-radius);
  border: none;
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  cursor: pointer;
  transition: background 0.15s;
}
.rs-start-btn:hover { background: var(--ui-accent-hover); }
.rs-start-btn:active { transform: translateY(1px); }
.rs-start-btn span {
  font: 800 20px var(--ui-font);
  letter-spacing: 0.5px;
}
.rs-start-btn small {
  font: 600 12px var(--ui-font);
  opacity: 0.7;
}

/* --------------------- MODALS THEMED TO MATCH (LOBBY ONLY) --------------------- */
#lobby .gb-modal { background: rgba(8, 10, 13, 0.72); }
#lobby .gb-modal-card {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line-2);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  color: var(--ui-text);
  font-family: var(--ui-font);
}
#lobby .gb-modal-head {
  color: var(--ui-text);
  font: 700 15px var(--ui-font);
  border-bottom: 1px solid var(--ui-line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
#lobby .gb-modal-close {
  background: transparent;
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text-2);
  border-radius: 6px;
  font-weight: 600;
}
#lobby .gb-modal-close:hover { color: var(--ui-text); border-color: var(--ui-danger); }
#lobby .acc-pill { background: var(--ui-raised); color: var(--ui-text-2); border: 1px solid var(--ui-line); }
#lobby .acc-pill.gold { color: var(--ui-gold); }
#lobby .acc-pill.gp { color: var(--ui-gp); }
#lobby .btn { border-radius: 6px; font-family: var(--ui-font); font-weight: 600; }
#lobby .btn-gold { background: var(--ui-accent); color: var(--ui-accent-ink); }
#lobby .btn-gold:hover { background: var(--ui-accent-hover); filter: none; }
#lobby .btn-gold:disabled { opacity: 0.45; cursor: not-allowed; }
#lobby .btn-primary { background: var(--ui-raised); border: 1px solid var(--ui-line-2); }
#lobby .btn-secondary { background: var(--ui-raised); border: 1px solid var(--ui-line-2); color: var(--ui-text); }
#lobby .gb-mini-gold {
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  border: none;
  border-radius: 5px;
  font-weight: 700;
  text-shadow: none;
  box-shadow: none;
}
#lobby .btn-mini-blue {
  background: var(--ui-raised);
  color: var(--ui-text);
  border: 1px solid var(--ui-line-2);
  border-radius: 5px;
}
#lobby .btn-mini {
  background: transparent;
  color: var(--ui-text-2);
  border: 1px solid var(--ui-line-2);
  border-radius: 5px;
}
#lobby .btn-mini:hover { color: var(--ui-danger); border-color: var(--ui-danger); }
#lobby .gb-modal input[type="text"],
#lobby .gb-modal input[type="password"],
#lobby .gb-modal input[type="number"] {
  background: var(--ui-bg);
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text);
  border-radius: 6px;
}
#lobby .lb-head-row { color: var(--ui-text-3); border-bottom-color: var(--ui-line); }
#lobby .lb-row { background: var(--ui-raised); border: 1px solid var(--ui-line); }
#lobby .lb-row.lb-top1 { border-color: #6b5a2c; background: #262218; }
#lobby .lb-row.lb-top2 { border-color: #4a515c; }
#lobby .lb-row.lb-top3 { border-color: #5c4430; }
#lobby .lb-row.lb-me { box-shadow: inset 3px 0 0 var(--ui-accent); background: var(--ui-hover); }
#lobby .lb-rank { color: var(--ui-text-2); }
#lobby .lb-gp { color: var(--ui-gp); }
#lobby .lb-player small { color: var(--ui-text-3); }
#lobby .lb-mode-tabs { background: var(--ui-bg); border-color: var(--ui-line); }
#lobby .lb-mode-tab { color: var(--ui-text-3); }
#lobby .lb-mode-tab.active { background: var(--ui-raised); border-color: var(--ui-line-2); color: var(--ui-text); }
#lobby .room-list-row { background: var(--ui-raised); border: 1px solid var(--ui-line); color: var(--ui-text); }
#lobby .guild-msg { background: var(--ui-raised); border-color: var(--ui-line-2); color: var(--ui-text); }
#lobby .guild-msg.ok { border-color: var(--ui-ok); background: #1c2a20; color: #cfe8d4; }
#lobby .guild-msg.err { border-color: var(--ui-danger); background: #2c1c1a; color: #f0cdc8; }
#lobby .guild-my-box { background: var(--ui-raised); border-color: var(--ui-line-2); }
#lobby .guild-member-row { background: var(--ui-raised); border-color: var(--ui-line); }
#lobby .guild-sec-label { color: var(--ui-text-3); }
#lobby .guild-tag { color: var(--ui-team-a); text-shadow: none; }

.gb-invite-toast {
  background: var(--ui-raised) !important;
  backdrop-filter: none !important;
  border: 1px solid var(--ui-line-2) !important;
  border-left: 3px solid var(--ui-accent) !important;
  font-family: var(--ui-font);
}
.gb-invite-head { color: var(--ui-accent) !important; }

/* ------------------------ MOBILE LANDSCAPE (COMPACT) ------------------------ */
@media (max-height: 520px) {
  .hs,
  .rs {
    width: min(940px, 100%);
    padding: 8px 12px 10px;
    gap: 8px;
  }

.hs input[type="text"],
.rs input[type="text"] { height: 30px; font-size: 12.5px; padding: 0 9px; }
  .hs-btn,
  .rs-btn { height: 30px; padding: 0 10px; font-size: 12px; gap: 5px; }
  .ui-ico { width: 14px; height: 14px; }

  /* Home header */
  .hs-top { height: 38px; gap: 10px; }
  .hs-logo { width: 30px; height: 30px; font-size: 12px; border-radius: 6px; }
  .hs-brand-text strong { font-size: 14px; }
  .hs-brand-text small { display: none; }
  .hs-account { padding: 3px 3px 3px 8px; }
  .hs-account .rank-ico { width: 20px; height: 12px; margin-right: 4px; }
  .hs-acc-id { padding-right: 8px; }
  .hs-acc-id strong { font-size: 12.5px; max-width: 120px; }
  .hs-acc-id #accRankName { display: none; }
  .hs-acc-stat { padding: 0 8px; }
  .hs-acc-stat small { font-size: 9px; }
  .hs-acc-stat span { font-size: 12px; }
  .hs-icon-btn { width: 30px; height: 30px; margin-left: 2px; }

  .hs-body {
    grid-template-columns: 148px minmax(0, 1fr) 168px;
    gap: 8px;
  }
  .hs-nav { gap: 4px; overflow-y: auto; }
  .hs-cta { height: 36px; padding: 0 10px; gap: 7px; font-size: 12.5px; flex-shrink: 0; }
  .hs-nav-label { margin: 6px 4px 0; font-size: 9.5px; }
  .hs-nav-item { height: 32px; padding: 0 9px; gap: 8px; font-size: 12px; flex-shrink: 0; }

  .hs-main {
    grid-template-rows: minmax(0, 1fr) 118px;
    gap: 8px;
  }
  .hs-panel-head { min-height: 38px; padding: 5px 10px; }
  .hs-panel-head h2 { font-size: 12.5px; }
  .hs-count { height: 17px; min-width: 18px; font-size: 10px; padding: 0 5px; }
  .hs-join input[type="text"] { width: 92px; }

  .hs-room-cols { display: none; }
  .hs-room,
  .hs-room-cols { grid-template-columns: minmax(0, 1fr) 46px 62px; gap: 8px; }
  .hs-room { padding: 7px 10px; }
  .hs-room-map { display: none; }
  .hs-code { width: 46px; height: 26px; font-size: 11px; }
  .hs-room-text strong { font-size: 12.5px; }
  .hs-room-text small { font-size: 10.5px; }
  .hs-room-count { font-size: 12px; }
  .hs-status { height: 26px; min-width: 58px; padding: 0 8px; font-size: 11px; }
  .hs-empty { padding: 16px 12px; font-size: 12px; }

  .hs-chat-log,
  .rs-chat-log { padding: 5px 10px; font-size: 12px; line-height: 1.4; }
  .hs-chat .hs-panel-head { display: none; }
  .hs-chat-input,
  .rs-chat-input { padding: 5px 8px; gap: 6px; }

  .hs-online-list { padding: 4px; }
  .hs-online-row { padding: 5px 6px; gap: 6px; }
  .hs-on-text strong { font-size: 12px; }
  .hs-on-text small { font-size: 10px; }
  .hs-on-join { height: 24px; padding: 0 8px; font-size: 10.5px; }

  /* Waiting room */
  .rs-top { height: 34px; gap: 8px; }
  .rs-back { height: 30px; padding: 0 10px 0 6px; font-size: 12px; }
  .rs-title span { font-size: 13.5px; }
  .rs-top-actions { gap: 5px; }
  .rs-top-actions .rs-btn span { display: none; }
  .rs-top-actions .rs-btn { width: 32px; padding: 0; }
  .rs-toggle { height: 30px; padding: 0 9px 0 26px; font-size: 11.5px; }
  .rs-toggle::before { left: 9px; width: 10px; height: 10px; margin-top: -5px; }

  .rs-body {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 1.05fr) minmax(0, 1fr);
    gap: 8px;
  }
  .rs-team { gap: 4px; }
  .rs-team-head { height: 14px; font-size: 9.5px; gap: 6px; }
  .rs-team-head i { width: 8px; height: 8px; }
  .rs-slot { padding: 3px 8px 3px 3px; gap: 7px; border-radius: 6px; }
  .team-b .rs-slot { padding: 3px 3px 3px 8px; }
  .rs-slot-canvas { max-height: 48px; border-radius: 4px; }
  .rs-slot-name { font-size: 12px; gap: 4px; }
  .rs-slot-name .rank-ico { width: 18px; height: 11px; }
  .rs-slot-sub { font-size: 10.5px; gap: 4px; }
  .rs-slot-empty { font-size: 11px; }
  .rs-slot.is-me::after { top: 3px; right: 5px; font-size: 8.5px; }
  .team-b .rs-slot.is-me::after { left: 5px; }
  .rs-kick { bottom: 3px; right: 5px; height: 18px; padding: 0 6px; font-size: 9.5px; }
  .team-b .rs-kick { left: 5px; }

  .rs-center { gap: 6px; padding-top: 18px; }
  .rs-map-cap { padding: 5px 8px; }
  .rs-map-cap strong { font-size: 12.5px; }
  .rs-label { font-size: 9px; }
  .rs-map-change { height: 22px; padding: 0 8px; font-size: 10.5px; }
  .rs-loadout { padding: 7px 9px; gap: 6px; }
  .rs-loadout-id strong { font-size: 12.5px; }
  .rs-loadout-btns .rs-btn { height: 26px; padding: 0 8px; font-size: 11px; }
  .rs-bars { gap: 4px; }
  .rs-bar { grid-template-columns: 54px 1fr; gap: 6px; }
  .rs-bar span { font-size: 10px; }
  .rs-track { height: 5px; }
  .rs-sub { display: none; }

  .rs-bottom {
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 8px;
    height: 84px;
  }
  .rs-start-btn span { font-size: 15px; }
  .rs-start-btn small { font-size: 10.5px; }

  #lobby .gb-modal-card { padding: 10px 12px; }
  #lobby .gb-modal-head { padding-bottom: 6px; margin-bottom: 8px; font-size: 13px; }

  .ui-toast { bottom: 10px; padding: 8px 12px; font-size: 12px; }
}

/* Narrow desktop windows */
@media (min-height: 521px) and (max-width: 1080px) {
  .hs-body { grid-template-columns: 190px minmax(0, 1fr) 220px; }
  .hs-room,
  .hs-room-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 64px 84px; }
  .rs-top-actions .rs-btn span { display: none; }
  .rs-top-actions .rs-btn { width: 36px; padding: 0; }
}

/* FULL-SCREEN WALLPAPERS FOR HOME (GB-RETRO) & LOBBY/WAITING ROOM (CASTLE) */
.hs,
.rs {
  position: relative;
  z-index: 1;
}

.hs::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(12, 15, 20, 0.56) 0%, rgba(12, 15, 20, 0.72) 100%),
    url('/assets/ui/home_gbretro_bg.webp') center center / cover no-repeat;
}

.rs::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(12, 15, 20, 0.50) 0%, rgba(12, 15, 20, 0.68) 100%),
    url('/assets/ui/lobby_castle_bg.webp') center center / cover no-repeat;
}

.hs-panel,
.hs-account,
.rs-slot,
.rs-loadout,
.rs-chat,
.rs-back,
.rs-toggle {
  background: rgba(21, 25, 32, 0.84);
}

.hs-nav-item {
  background: rgba(21, 25, 32, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

.hs-nav-item:hover {
  background: rgba(31, 36, 44, 0.9);
}

.rs-slot.is-empty {
  background: rgba(15, 18, 22, 0.45);
}

.rs-slot.is-me {
  background: rgba(31, 36, 44, 0.9);
}

/* UNIFIED TYPOGRAPHY & TOP UP MODAL THEME */
#lobby .topup-pkg {
  background: var(--ui-raised);
  border: 1px solid var(--ui-line-2);
  border-radius: 8px;
  padding: 10px 8px;
  gap: 3px;
}
#lobby .topup-pkg strong {
  font: 700 13.5px var(--ui-font);
  color: var(--ui-gold);
}
#lobby .topup-pkg span {
  font: 500 11.5px var(--ui-font);
  color: var(--ui-text-2);
}
#lobby .topup-pkg.active,
#lobby .topup-pkg:hover {
  border-color: var(--ui-accent);
  background: #2b2419;
}
#lobby .topup-custom-row {
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  padding: 8px 12px;
}
#lobby .topup-custom-row label {
  font: 600 12px var(--ui-font);
  color: var(--ui-text-2);
}
#lobby .topup-custom-row input {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text);
  font: 700 13px var(--ui-font);
  padding: 6px 10px;
}
#lobby .topup-custom-row input:focus {
  border-color: var(--ui-accent);
}
#lobby .topup-total {
  font: 700 12.5px var(--ui-font);
  color: var(--ui-ok);
}
#lobby .topup-badge {
  font: 500 11.5px var(--ui-font);
  color: var(--ui-text-3);
}
#lobby .guild-sec-label {
  font: 700 11px var(--ui-font);
  letter-spacing: 0.7px;
  color: var(--ui-text-3);
}

@media (max-height: 520px) {
  .hs input[type="text"],
  .rs input[type="text"],
  #lobby .gb-modal input[type="text"],
  #lobby .gb-modal input[type="password"],
  #lobby .gb-modal input[type="number"] {
    font-size: 12.5px !important;
  }
  .hs-join input[type="text"] {
    width: 98px;
    font-size: 12px !important;
    letter-spacing: 0.4px;
  }
  .hs-chat-log,
  .rs-chat-log {
    font-size: 11.5px !important;
    line-height: 1.4 !important;
  }
  #lobby .topup-pkg {
    padding: 7px 6px;
  }
  #lobby .topup-pkg strong {
    font-size: 12.5px;
  }
  #lobby .topup-pkg span {
    font-size: 10.5px;
  }
  #lobby .topup-custom-row {
    padding: 6px 10px;
  }
  #lobby .topup-custom-row input {
    font-size: 12.5px !important;
    padding: 4px 8px;
  }
}

/* ADMIN BADGE & DISTINCT FONT COLOR */
.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  margin-right: 4px;
  border-radius: 3px;
  background: #5c1919;
  border: 1px solid #d65a4d;
  color: #ffb3ad;
  font: 800 9.5px var(--ui-font);
  letter-spacing: 0.5px;
  vertical-align: 1px;
}
.admin-name {
  color: #ff6b6b !important;
  font-weight: 800 !important;
}
.gb-chat-admin b {
  color: #ff6b6b !important;
}
.gb-chat-admin {
  color: #ffd5d2 !important;
}

/* AVATAR & VIP SHOP — UNIFIED THEME & CONSISTENT FONT WEIGHT (NO 900 BLACK JUMP) */
#lobby .gb-modal * {
  font-family: var(--ui-font);
}
#lobby .avatar-preview-col {
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
}
#lobby #avatarPreviewCanvas {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line-2);
  border-radius: 8px;
}
#lobby .av-sel-name {
  font: 700 12.5px var(--ui-font);
  color: var(--ui-gold);
}
#lobby .av-stat-pill {
  background: var(--ui-raised);
  border: 1px solid var(--ui-line);
  color: var(--ui-text-2);
  font: 600 11px var(--ui-font);
}
#lobby .av-stat-pill b {
  color: var(--ui-gold);
  font-weight: 700;
}
#lobby .av-cat {
  background: var(--ui-bg);
  border: 1px solid var(--ui-line-2);
  color: var(--ui-text-2);
  font: 600 12px var(--ui-font);
  border-radius: 6px;
}
#lobby .av-cat.active,
#lobby .av-cat:hover {
  background: var(--ui-raised);
  border-color: var(--ui-accent);
  color: var(--ui-text);
}
#lobby .av-cat.av-cat-ex.active {
  background: #2b2419;
  border-color: var(--ui-accent);
  color: var(--ui-gold);
}
#lobby .av-set-hint {
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
  color: var(--ui-text-2);
  font: 500 12px var(--ui-font);
  border-radius: 6px;
}
#lobby .av-item {
  background: var(--ui-raised);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
}
#lobby .av-item:hover {
  border-color: var(--ui-line-2);
  background: var(--ui-hover);
}
#lobby .av-item.previewing,
#lobby .av-item.active {
  border-color: var(--ui-accent);
  box-shadow: none;
}
#lobby .av-name {
  font: 600 11.5px var(--ui-font);
  color: var(--ui-text);
}
#lobby .av-price {
  font: 700 11px var(--ui-font);
  color: var(--ui-gold);
}
#lobby .av-price.owned {
  color: var(--ui-ok);
}
#lobby .pu-banner-card {
  background: #231e16;
  border: 1px solid #6b5328;
  border-radius: 8px;
  box-shadow: none;
}
#lobby .pu-banner-info h4 {
  font: 700 14px var(--ui-font);
  color: var(--ui-gold);
  letter-spacing: 0.3px;
}
#lobby .pu-banner-info p {
  font: 400 12px/1.45 var(--ui-font);
  color: var(--ui-text-2);
}
#lobby .pu-buy-btn {
  background: var(--ui-accent);
  border: none;
  color: var(--ui-accent-ink);
  font: 700 12.5px var(--ui-font);
  border-radius: 6px;
  box-shadow: none;
  text-shadow: none;
}
#lobby .pu-buy-btn:hover {
  background: var(--ui-accent-hover);
}
#lobby .btn-buy-av {
  background: var(--ui-accent);
  border: none;
  color: var(--ui-accent-ink);
  font: 700 12px var(--ui-font);
  border-radius: 6px;
}
#lobby .btn-equip-av {
  background: var(--ui-ok);
  border: none;
  color: #0e1d12;
  font: 700 12px var(--ui-font);
  border-radius: 6px;
}
