* {
  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;
  touch-action: manipulation;
  overscroll-behavior: none;
}

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:
    radial-gradient(circle at center, rgba(10, 20, 46, 0.14) 0%, rgba(6, 12, 28, 0.52) 100%),
    url('/assets/ui/login_wallpaper.jpg') center center / cover 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: min(96vw, 720px);
    bottom: env(safe-area-inset-bottom);
  }
  .touch-controls {
    bottom: calc(min(96vw, 720px) * 0.105 + 6px);
  }

  /* 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(6, minmax(0, 1fr));
    gap: 4px;
    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(4, 1fr);
    gap: 4px;
  }
  .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;
  }
  .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; }
}

/* 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-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: 126px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 420px);
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid #38bdf8;
  border-radius: 10px;
  padding: 6px;
  z-index: 25;
}

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

/* WIN MODAL */
.win-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.win-card {
  background: #0f172a;
  border: 2px solid #fbbf24;
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.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;
}
