/* ════════════════════════════════════════════════════════════════════════════
   GAROBIT Sci-Fi Theme — futuristic city / space HUD
   ════════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Orbitron:wght@600;700;900&display=swap');
:root {
  --sf-bg: #060810;
  --sf-bg2: #0a1020;
  --sf-cyan: #00e5ff;
  --sf-blue: #4fc3f7;
  --sf-purple: #7c4dff;
  --sf-magenta: #e040fb;
  --sf-gold: #ffd978;
  --sf-glass: rgba(8, 14, 28, 0.62);
  --sf-glass-border: rgba(0, 229, 255, 0.28);
  --sf-glow-cyan: 0 0 18px rgba(0, 229, 255, 0.35);
  --sf-glow-purple: 0 0 22px rgba(124, 77, 255, 0.4);
}

/* ── Lobby background: sci-fi command corridor ── */
#lobbyPage {
  background: transparent !important;
  background-image: none !important;
  overflow: hidden !important;
}

#lobbyPage::before {
  z-index: 0 !important;
  background-color: var(--sf-bg) !important;
  background-image:
    linear-gradient(180deg, rgba(6, 8, 16, 0.12) 0%, rgba(6, 8, 16, 0.04) 42%, rgba(6, 8, 16, 0.55) 100%),
    url('../assets/images/lobby-backdrop.jpg?v=20260906deblack2') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  transform: translateZ(0);
  backface-visibility: hidden;
}

#loadingScreen {
  background-color: var(--sf-bg) !important;
  background-image:
    linear-gradient(180deg, rgba(6,8,16,0.2) 0%, rgba(0,120,255,0.08) 40%, rgba(6,8,16,0.82) 100%),
    url('../assets/images/scifi-earth-hero.webp?v=20260822mock') !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  align-items: stretch !important;
  overflow: hidden !important;
}

.loading-screen-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-hero-copy {
  text-align: center;
  width: 100%;
  max-width: 420px;
  padding: 0 8px;
}

#loadingScreen .lobby-hero-kicker {
  margin-bottom: 8px;
}

#loadingScreen .lobby-hero-title {
  margin-bottom: 0;
}

#loadingScreen .loader {
  z-index: 2;
  background: linear-gradient(180deg, transparent 0%, rgba(6, 8, 16, 0.72) 35%, rgba(6, 8, 16, 0.92) 100%);
}

#slotPage {
  background-color: var(--sf-bg) !important;
  background-image:
    linear-gradient(180deg, rgba(6,8,16,0.55) 0%, rgba(124,77,255,0.12) 50%, rgba(6,8,16,0.7) 100%),
    url('../assets/images/scifi-city-backdrop.webp?v=20260822scifi') !important;
}

/* ── Brand bar — โลโก้ชิดซ้ายบน · กระเป๋าขวาบน ── */
.lobby-brand-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    0
    env(safe-area-inset-left, 0px);
  pointer-events: none;
}

.lobby-brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  user-select: none;
  margin: 12px 0 0 10px;
  padding: 0;
}

.lobby-brand-hex {
  position: relative;
  /* ใหญ่ขึ้นครึ่งตัวจากขนาดเดิม (~1.5x) */
  width: clamp(72px, 10.8vw, 87px);
  height: clamp(72px, 10.8vw, 87px);
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  color: #e8fbff;
  isolation: isolate;
  overflow: visible;
  flex-shrink: 0;
}

/* ขอบหกเหลี่ยม — ปิดในล็อบบี้ ให้เหลือแค่ไอคอนแอป */
.lobby-brand-hex::before {
  display: none;
}

.lobby-brand-hex::after {
  display: none;
}

.lobby-brand-hex-svg,
.lobby-brand-hex .garobit-g-logo-img,
.lobby-brand-hex .lobby-app-icon {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  user-select: none;
  background: transparent !important;
  filter: none;
}

.lobby-brand-name {
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}

/* ── Hero copy ── */
.lobby-hero-scifi {
  position: relative;
  z-index: 4;
  text-align: center;
  padding: 0 8px 12px;
}

.lobby-hero-scifi:not(.lobby-main-display) {
  margin-top: 0;
}

.lobby-hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--sf-cyan);
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.9;
}

.lobby-hero-title {
  font-size: clamp(20px, 5.2vw, 28px);
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 229, 255, 0.25);
  margin: 0 0 14px;
}

.lobby-hero-title em {
  font-style: normal;
  background: linear-gradient(90deg, var(--sf-cyan), var(--sf-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Stats chips ── */
.lobby-stats-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lobby-stat-chip {
  flex: 1 1 90px;
  max-width: 120px;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(8, 14, 28, 0.82);
  border: 1px solid var(--sf-glass-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.lobby-stat-chip .val {
  display: block;
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 800;
  color: var(--sf-cyan);
  line-height: 1.2;
}

.lobby-stat-chip .lbl {
  display: block;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

/* ── Glass panels ── */
.sf-glass-panel {
  border-radius: 14px;
  background: rgba(8, 14, 28, 0.84);
  border: 1px solid var(--sf-glass-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 28px rgba(0,0,0,0.35);
  overflow: hidden;
}

.lobby-rank-panel {
  text-align: left;
  margin-bottom: 12px;
  padding: 10px 12px 8px;
}

/* คู่แผงอันดับ — ซ้ายคะแนนจริง / ขวาฐานว่าง (เตรียมงานอนาคต) */
.lobby-rank-row-pair {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}

.lobby-rank-row-pair > .lobby-rank-panel {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
  /* กรอบเฉพาะช่องข้อความอันดับ — ไม่ห่อชุดช่องแสดงผลหลักทั้งก้อน */
  border: 1px solid rgba(0, 229, 255, 0.42);
  border-radius: 12px;
  background: rgba(6, 12, 26, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(0, 229, 255, 0.1),
    0 0 14px rgba(0, 229, 255, 0.08);
}

.lobby-rank-row-pair .lobby-rank-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 8px;
  padding: 5px 8px;
  border: 1px solid rgba(0, 229, 255, 0.38);
  border-radius: 8px;
  background: rgba(0, 36, 64, 0.4);
  box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.08);
  box-sizing: border-box;
}

.lobby-rank-row-pair .lobby-rank-panel h3 .lobby-rank-title-flag {
  flex-shrink: 0;
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.lobby-rank-row-pair .lobby-rank-panel h3 .lobby-rank-title-globe {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: #5ef0ff;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.55));
}

.lobby-rank-row-pair .lobby-rank-panel h3 .lobby-rank-title-globe-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lobby-rank-row-pair .lobby-rank-panel h3 .lobby-rank-title-flag:empty,
.lobby-rank-row-pair .lobby-rank-panel h3 .lobby-rank-title-flag[hidden] {
  display: none;
}

.lobby-rank-row-pair .lobby-rank-panel h3 .lobby-rank-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-rank-row-pair .lobby-rank-row {
  font-size: 15px;
  gap: 4px;
  padding: 0;
  min-height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.lobby-rank-row-pair .lobby-rank-row .pts {
  font-size: 14px;
}

.lobby-rank-row-pair .lobby-rank-row .medal {
  width: 20px;
}

/* ล็อกความสูงเหลือเห็น 3 อันดับ — เกินแล้วเลื่อนขึ้นลงแบบลื่น */
.lobby-rank-row-pair .lobby-rank-panel #lobbyRankList,
.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList {
  --lobby-rank-row-slot: 42px;
  height: calc(var(--lobby-rank-row-slot) * 3);
  max-height: calc(var(--lobby-rank-row-slot) * 3);
  min-height: calc(var(--lobby-rank-row-slot) * 3);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scroll-padding-block: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 255, 0.45) rgba(8, 14, 28, 0.35);
}

.lobby-rank-row-pair .lobby-rank-panel #lobbyRankList::-webkit-scrollbar,
.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList::-webkit-scrollbar {
  width: 5px;
}

.lobby-rank-row-pair .lobby-rank-panel #lobbyRankList::-webkit-scrollbar-track,
.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList::-webkit-scrollbar-track {
  background: rgba(8, 14, 28, 0.35);
  border-radius: 999px;
}

.lobby-rank-row-pair .lobby-rank-panel #lobbyRankList::-webkit-scrollbar-thumb,
.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.55), rgba(124, 77, 255, 0.4));
  border-radius: 999px;
}

.lobby-rank-row-pair .lobby-rank-panel #lobbyRankList .lobby-rank-row,
.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList .lobby-rank-row {
  min-height: var(--lobby-rank-row-slot, 38px);
  height: var(--lobby-rank-row-slot, 38px);
  align-items: center;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList .lobby-rank-row .medal {
  width: 24px;
  font-size: 13px;
  flex-shrink: 0;
}

.lobby-rank-row-pair .lobby-rank-panel #lobbyRankList .lobby-rank-empty,
.lobby-rank-row-pair .lobby-rank-panel #lobbyPlayerRankList .lobby-rank-empty {
  min-height: calc(var(--lobby-rank-row-slot, 38px) * 3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-rank-panel-reserve {
  display: flex;
  flex-direction: column;
}

.lobby-rank-panel-reserve .lobby-rank-reserve-body {
  flex: 1 1 auto;
  min-height: 8px;
}

.lobby-player-rank-row .lobby-player-rank-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.lobby-player-rank-row .lobby-player-rank-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lobby-player-rank-row .lobby-player-rank-text .name {
  color: #e8eef8;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lobby-player-rank-row .lobby-player-rank-text .gid {
  color: rgba(180, 210, 235, 0.72);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-rank-panel h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sf-cyan);
  font-weight: 800;
}

.lobby-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: #e8eef8;
}

.lobby-rank-row:last-child { border-bottom: none; }

.lobby-rank-row .medal { width: 22px; text-align: center; flex-shrink: 0; }
.lobby-rank-row .pts { color: var(--sf-gold); font-weight: 700; font-size: 12px; white-space: nowrap; }

.lobby-rank-empty {
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  text-align: center;
  padding: 8px 0;
}

/* ── Feature cards ── */
.lobby-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.lobby-feature-card {
  border-radius: 12px;
  padding: 10px 4px 8px;
  text-align: center;
  background: rgba(8, 14, 28, 0.78);
  border: 1px solid rgba(255,255,255,0.08);
}

.lobby-feature-card .ico { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.lobby-feature-card .txt {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  line-height: 1.2;
}

.lobby-feature-card:nth-child(1) { border-color: rgba(0,229,255,0.35); box-shadow: 0 0 12px rgba(0,229,255,0.12); }
.lobby-feature-card:nth-child(2) { border-color: rgba(124,77,255,0.35); box-shadow: 0 0 12px rgba(124,77,255,0.12); }
.lobby-feature-card:nth-child(3) { border-color: rgba(0,230,118,0.35); box-shadow: 0 0 12px rgba(0,230,118,0.1); }
.lobby-feature-card:nth-child(4) { border-color: rgba(255,215,0,0.35); box-shadow: 0 0 12px rgba(255,215,0,0.1); }

/* ── Tab bar sci-fi dock — ชิดขอบซ้ายขวาล่างกรอบเกม ── */
.lobby-bottom-dock .tab-bar {
  background: rgba(6, 10, 20, 0.94) !important;
  border-top: 1px solid rgba(0, 229, 255, 0.22) !important;
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(0, 229, 255, 0.08) !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.lobby-bottom-dock .svg-button-container {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  background: transparent !important;
  border-top: none !important;
  box-shadow: none !important;
  position: relative !important;
  transform: translateY(-10px);
}

.lobby-bottom-dock .svg-button-container svg.lobby-gold-bar-hit {
  filter: none;
}

.lobby-bar-btn-side {
  transition: opacity 0.2s ease;
}

.lobby-bar-btn-side:active {
  opacity: 0.88;
}

.robit-countdown-slot #lobbyCountdown,
.lv-countdown-box #lobbyCountdown {
  color: rgba(255, 248, 220, 0.95) !important;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 6px rgba(255, 215, 80, 0.35),
    0 0 10px rgba(0, 229, 255, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.85) !important;
}

.lobby-bottom-dock .level-badge#levelBadge,
.lobby-bottom-dock .level-badge#attackLevelBadge {
  bottom: -8px !important;
  text-shadow:
    0 0 8px rgba(255, 215, 0, 0.45),
    0 1px 3px rgba(0, 0, 0, 0.65) !important;
}

.lobby-bottom-dock .level-badge#levelBadge {
  right: 8px !important;
  left: auto !important;
}

.lobby-bottom-dock .level-badge#attackLevelBadge {
  left: 8px !important;
  right: auto !important;
}

.tab-item { color: rgba(255, 255, 255, 0.48) !important; }
.tab-item:hover { color: #7eeaff !important; }
.tab-item.active {
  color: #00e5ff !important;
  background: rgba(0, 229, 255, 0.1) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.28), 0 0 14px rgba(0, 229, 255, 0.12) !important;
}

.tab-item.active .label { color: #00e5ff !important; }

.tab-item-lobby.active {
  background: transparent !important;
  box-shadow: none !important;
}

.tab-item-lobby .label {
  margin-top: 2px;
  font-size: 10px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tab-item-lobby .lv-countdown-box #lobbyCountdown {
  font-size: 11px !important;
  line-height: 1.15;
}

/* ── Sci-fi tab icons (Settings / Social / Store / Bank) ── */
.tab-item .icon.tab-icon-scifi {
  position: relative;
  width: 42px;
  height: 42px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
  color: #7eeaff;
  background:
    radial-gradient(circle at 30% 26%, rgba(124, 77, 255, 0.24) 0%, transparent 50%),
    radial-gradient(circle at 72% 72%, rgba(0, 229, 255, 0.16) 0%, transparent 44%),
    rgba(4, 8, 18, 0.96);
  border: 1.5px solid rgba(0, 229, 255, 0.38);
  box-shadow:
    0 0 14px rgba(0, 229, 255, 0.22),
    0 0 24px rgba(124, 77, 255, 0.1),
    inset 0 0 12px rgba(0, 229, 255, 0.06);
  isolation: isolate;
  overflow: visible;
  filter: none !important;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tab-item .icon.tab-icon-scifi::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 229, 255, 0.55) 60deg,
    rgba(124, 77, 255, 0.4) 130deg,
    transparent 200deg,
    rgba(0, 229, 255, 0.28) 300deg,
    transparent 360deg
  );
  animation: tabIconOrbitRing 5s linear infinite;
  pointer-events: none;
  z-index: 0;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 0.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 0.5px));
}

.tab-item .icon.tab-icon-social::before { animation-duration: 6.2s; animation-direction: reverse; }
.tab-item .icon.tab-icon-store::before { animation-duration: 4.6s; }
.tab-item .icon.tab-icon-bank::before { animation-duration: 5.8s; }

@keyframes tabIconOrbitRing {
  to { transform: rotate(360deg); }
}

.tab-item .icon.tab-icon-scifi .tab-icon-scifi-svg {
  position: relative;
  z-index: 1;
  width: 21px;
  height: 21px;
  display: block;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.55));
}

.tab-item .icon.tab-icon-settings { color: #00e5ff; }
.tab-item .icon.tab-icon-social { color: #b388ff; }
.tab-item .icon.tab-icon-store { color: #ffd978; }
.tab-item .icon.tab-icon-bank { color: #ffe082; }

.tab-item:hover .icon.tab-icon-scifi {
  color: #fff;
  border-color: rgba(0, 229, 255, 0.62);
  box-shadow:
    0 0 18px rgba(0, 229, 255, 0.32),
    0 0 28px rgba(124, 77, 255, 0.16),
    inset 0 0 14px rgba(0, 229, 255, 0.1);
}

.tab-item.active .icon.tab-icon-scifi {
  color: #fff !important;
  border-color: rgba(0, 229, 255, 0.85) !important;
  box-shadow:
    0 0 20px rgba(0, 229, 255, 0.45),
    0 0 32px rgba(124, 77, 255, 0.2),
    inset 0 0 16px rgba(0, 229, 255, 0.14) !important;
  filter: none !important;
}

.tab-item.active .icon.tab-icon-scifi .tab-icon-scifi-svg {
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.75)) drop-shadow(0 0 10px rgba(124, 77, 255, 0.3));
}

.tab-item .icon.tab-icon-settings .tab-icon-scifi-svg {
  width: 22px;
  height: 22px;
}

.tab-item .icon.tab-icon-store .tab-icon-scifi-svg,
.tab-item .icon.tab-icon-bank .tab-icon-scifi-svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 5px rgba(255, 217, 120, 0.55));
}

.tab-item.active .icon.tab-icon-store .tab-icon-scifi-svg,
.tab-item.active .icon.tab-icon-bank .tab-icon-scifi-svg {
  filter: drop-shadow(0 0 7px rgba(255, 224, 130, 0.85)) drop-shadow(0 0 10px rgba(0, 229, 255, 0.25));
}

@media (max-width: 768px) {
  .tab-item .icon.tab-icon-scifi {
    width: 38px;
    height: 38px;
  }
  .tab-item .icon.tab-icon-scifi .tab-icon-scifi-svg {
    width: 19px;
    height: 19px;
  }
  .tab-item .icon.tab-icon-store .tab-icon-scifi-svg,
  .tab-item .icon.tab-icon-bank .tab-icon-scifi-svg {
    width: 20px;
    height: 20px;
  }
}

/* ── Lobby gold bar hit — ไม่ต้อง pulse บนรูปเต็ม ── */
.lobby-bottom-dock .lobby-bar-hit-robit {
  outline: none;
}

@keyframes svgPulseGlowSciFi {
  0%, 100% {
    filter: drop-shadow(0 0 4px rgba(255, 200, 60, 0.42)) drop-shadow(0 0 8px rgba(0, 229, 255, 0.1));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(255, 215, 80, 0.78)) drop-shadow(0 0 16px rgba(0, 229, 255, 0.2));
  }
}

/* ── Back buttons ── */
.back-btn {
  background: transparent !important;
  border: none !important;
  color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  transform: none !important;
  transform-origin: center center !important;
  isolation: isolate;
  overflow: visible;
  filter: drop-shadow(0 14px 8px rgba(0, 0, 0, 0.88)) drop-shadow(0 22px 20px rgba(0, 0, 0, 0.5)) drop-shadow(0 6px 12px rgba(0, 200, 255, 0.42)) !important;
  transition: transform 0.18s cubic-bezier(0.22, 1.28, 0.36, 1), filter 0.18s ease-out !important;
}

.back-btn::after,
.world-back-btn::after,
.social-top-back::after,
.modal-back-btn::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -10px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0.7) 0%, rgba(0, 170, 255, 0.22) 48%, transparent 74%);
  pointer-events: none;
  z-index: -1;
  filter: blur(3px);
}

.back-btn:focus,
.back-btn:focus-visible,
.back-btn:active,
.back-btn:hover {
  outline: none !important;
}

.back-btn:hover {
  filter: brightness(1.08) drop-shadow(0 16px 10px rgba(0, 0, 0, 0.9)) drop-shadow(0 26px 24px rgba(0, 0, 0, 0.55)) drop-shadow(0 8px 14px rgba(0, 200, 255, 0.5)) !important;
}

.back-btn:active,
.back-btn.is-pressed {
  transform: scale(0.86) !important;
  box-shadow: none !important;
  transition: transform 0.08s ease-out, filter 0.08s ease-out !important;
  filter: brightness(0.98) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55)) !important;
}

/* ร้าน + ธนาคาร: ปุ่มย้อนกลับกลางล่าง — ไม่ขยับความสูง */
#storePage .back-btn,
#bankPage .back-btn {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}

#storePage .back-btn:active,
#storePage .back-btn.is-pressed,
#bankPage .back-btn:active,
#bankPage .back-btn.is-pressed {
  transform: translateX(-50%) scale(0.86) !important;
}

.modal-back-btn,
.world-back-btn,
.social-top-back {
  background: transparent !important;
  border: none !important;
  color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center !important;
  transition: transform 0.18s cubic-bezier(0.22, 1.28, 0.36, 1), filter 0.18s ease-out !important;
}

.modal-back-btn img,
.world-back-btn img,
.social-top-back img {
  display: block;
  pointer-events: none;
  user-select: none;
}

.modal-back-btn {
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

.modal-back-btn:focus,
.modal-back-btn:focus-visible,
.modal-back-btn:active {
  outline: none !important;
  box-shadow: none !important;
}

.modal-back-btn:active,
.modal-back-btn.is-pressed,
.world-back-btn:active,
.world-back-btn.is-pressed,
.social-top-back:active,
.social-top-back.is-pressed {
  transform: scale(0.86) !important;
  transition: transform 0.08s ease-out, filter 0.08s ease-out !important;
}

/* ── Full pages (store/bank/social) ── */
#storePage,
#businessPage,
#socialPage {
  background-color: var(--sf-bg) !important;
  background-image:
    linear-gradient(180deg, rgba(6,8,16,0.5) 0%, rgba(124,77,255,0.08) 100%),
    url('../assets/images/scifi-city-backdrop.webp?v=20260822scifi') !important;
  background-size: cover !important;
  background-position: center !important;
}

/* ── Bank page — แผงยอดรวมกลางจอ ── */
#bankPage.bank-page-themed .bank-stage {
  overflow: visible !important;
}

#bankPage.bank-page-themed .bank-stage-bg-picture {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 0 !important;
  pointer-events: none !important;
}

#bankPage.bank-page-themed .bank-stage-bg-picture .bank-stage-bg,
#bankPage.bank-page-themed .bank-stage-bg {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: fill !important;
}

/* มือถือ: ธนาคารเต็มจอเครื่อง — ไม่ใช้สัดส่วนพื้นฐาน */
@media (max-width: 1024px) {
  html.player-stage #bankPage.bank-page-themed,
  #bankPage.bank-page-themed {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
  }

  @supports (height: 100dvh) {
    html.player-stage #bankPage.bank-page-themed,
    #bankPage.bank-page-themed {
      height: 100dvh !important;
      max-height: 100dvh !important;
    }
  }

  #bankPage.bank-page-themed .bank-stage {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    margin: 0 !important;
  }
}

#bankPage.bank-page-themed .bank-balance-panel-hit {
  position: absolute !important;
  left: calc(50% - 3px) !important;
  top: calc(50% - 125px) !important;
  transform: translate(-50%, -50%) !important;
  width: calc(92% - 80px) !important;
  max-width: calc(92% - 80px) !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: pointer !important;
  z-index: 5 !important;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease-out !important;
}

#bankPage.bank-page-themed .bank-balance-panel-hit:focus,
#bankPage.bank-page-themed .bank-balance-panel-hit:focus-visible,
#bankPage.bank-page-themed .bank-balance-panel-hit:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

#bankPage.bank-page-themed .bank-balance-panel-hit:active,
#bankPage.bank-page-themed .bank-balance-panel-hit.is-pressed {
  transform: translate(-50%, -50%) scale(0.96) !important;
}

#bankPage.bank-page-themed .bank-balance-panel-center {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  pointer-events: none !important;
  user-select: none !important;
}

#bankPage.bank-page-themed .bank-balance-total {
  position: absolute !important;
  left: 6% !important;
  right: 38% !important;
  top: calc(50% + 6px) !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  z-index: 2 !important;
  pointer-events: none !important;
  user-select: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Cinzel', 'Times New Roman', serif !important;
  color: #7af6ff !important;
  font-size: clamp(16px, 3.2vw, 28px) !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  font-variant-numeric: tabular-nums !important;
  text-align: center !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-shadow: none !important;
}

/* ── Bank — ฐานทรัพย์สิน 2×2: แบงค์/เหรียน บน, เพชร/ทองแท่ง ล่าง ── */
#bankPage.bank-page-themed .bank-asset-grid {
  position: absolute;
  left: 50%;
  top: calc(46% + 105px);
  transform: translate(-50%, -50%);
  width: calc(92% - 80px);
  max-width: calc(92% - 80px);
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 6px;
  pointer-events: auto;
  background: transparent;
}

#bankPage.bank-page-themed .bank-asset-slot {
  position: relative;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
}

#bankPage.bank-page-themed .bank-asset-slot:focus,
#bankPage.bank-page-themed .bank-asset-slot:focus-visible,
#bankPage.bank-page-themed .bank-asset-slot:active,
#bankPage.bank-page-themed .bank-asset-slot:hover {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

#bankPage.bank-page-themed .bank-asset-slot:active,
#bankPage.bank-page-themed .bank-asset-slot.is-pressed {
  transform: scale(0.96);
}

#bankPage.bank-page-themed .bank-asset-slot img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none !important;
  user-select: none;
  pointer-events: none;
  background: transparent;
}

#bankPage.bank-page-themed .bank-asset-slot .bank-asset-value {
  position: absolute;
  top: calc(48% + 2px);
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  user-select: none;
  font-family: 'Cinzel', 'Times New Roman', serif;
  color: #7af6ff;
  font-size: clamp(14px, 2.6vw, 20px);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: none;
}

#bankPage.bank-page-themed .bank-asset-slot.is-coins .bank-asset-value,
#bankPage.bank-page-themed .bank-asset-slot.is-gold .bank-asset-value {
  left: 6%;
  right: 40%;
}

#bankPage.bank-page-themed .bank-asset-slot.is-cash .bank-asset-value,
#bankPage.bank-page-themed .bank-asset-slot.is-diamond .bank-asset-value {
  left: 40%;
  right: 6%;
}

/* ── Bank — การ์ดโอน / กู้ แยกชั้น: ดำทึบด้านหลัง + ภาพการ์ดด้านบน ── */
#bankPage.bank-page-themed .bank-service-row {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translate(-50%, -35px);
  width: calc(92% - 85px);
  max-width: calc(92% - 85px);
  z-index: 5;
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
}

#bankPage.bank-page-themed .bank-service-hotspot {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: pointer;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 100%;
  transition: transform 0.08s ease-out;
}

#bankPage.bank-page-themed .bank-service-hotspot:focus,
#bankPage.bank-page-themed .bank-service-hotspot:focus-visible,
#bankPage.bank-page-themed .bank-service-hotspot:active,
#bankPage.bank-page-themed .bank-service-hotspot:hover {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* ชั้นดำทึบ — อยู่หลังการ์ดเท่านั้น ไม่รวมกับพิกเซลของภาพ */
#bankPage.bank-page-themed .bank-service-card-fill {
  position: absolute;
  left: 3.5%;
  right: 3.5%;
  top: 5%;
  bottom: 5%;
  z-index: 0;
  background: #000;
  clip-path: polygon(6% 0, 94% 0, 100% 14%, 100% 86%, 94% 100%, 6% 100%, 0 86%, 0 14%);
  pointer-events: none;
}

#bankPage.bank-page-themed .bank-service-card-img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-width: none !important;
  user-select: none;
  pointer-events: none;
  background: transparent;
}

#bankPage.bank-page-themed .bank-service-hotspot.is-transfer {
  transform: translate(-12px, 3px) scale(1.1);
}

#bankPage.bank-page-themed .bank-service-hotspot.is-loan {
  transform: translate(9px, 3px) scale(1.1);
}

#bankPage.bank-page-themed .bank-service-hotspot.is-transfer:active,
#bankPage.bank-page-themed .bank-service-hotspot.is-transfer.is-pressed {
  transform: translate(-12px, 3px) scale(1.056);
}

#bankPage.bank-page-themed .bank-service-hotspot.is-loan:active,
#bankPage.bank-page-themed .bank-service-hotspot.is-loan.is-pressed {
  transform: translate(9px, 3px) scale(1.056);
}

/* ── แจ้งเตือนอยู่ระหว่างการพัฒนา (กดโลกในล็อบบี้) ── */
.dev-notice-overlay {
  background: transparent !important;
  padding: 16px !important;
  z-index: 1200 !important;
  opacity: 1;
  transition: opacity 0.28s ease;
}

.dev-notice-overlay.is-closing {
  opacity: 0 !important;
  pointer-events: none !important;
}

.dev-notice-panel {
  position: relative;
  width: min(92vw, 520px);
  max-width: 520px;
  background: transparent;
  border: none;
  box-shadow: none;
  line-height: 0;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.28s ease;
}

.dev-notice-overlay.is-closing .dev-notice-panel,
.dev-notice-panel.is-closing {
  opacity: 0;
}

.dev-notice-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none !important;
  pointer-events: none;
  user-select: none;
  background: transparent;
}

.dev-notice-close {
  position: absolute;
  top: 7%;
  right: 5.5%;
  width: 11%;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
  transition: transform 0.08s ease-out;
  z-index: 3;
}

.dev-notice-close:focus,
.dev-notice-close:focus-visible,
.dev-notice-close:active {
  outline: none !important;
  box-shadow: none !important;
}

.dev-notice-close:active,
.dev-notice-close.is-pressed {
  transform: scale(0.92);
}

/* นับถอยหลัง — แนวเดียวกับกากบาท (ซ้ายมือ) สไตล์ sci-fi */
.dev-notice-countdown {
  position: absolute;
  top: 7%;
  right: calc(5.5% + 11% + 2%);
  z-index: 3;
  width: 11%;
  aspect-ratio: 1;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: #ff3b5c;
  font-family: 'Orbitron', 'Arial Black', system-ui, sans-serif;
  font-size: clamp(14px, 3.6vw, 22px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 4px rgba(255, 64, 96, 1),
    0 0 12px rgba(255, 20, 70, 0.85),
    0 0 22px rgba(255, 0, 80, 0.45),
    0 0 28px rgba(0, 229, 255, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.9);
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  user-select: none;
  opacity: 1;
  transition: opacity 0.1s ease;
  animation: devNoticeCountdownPulse 1s ease-in-out infinite;
}

.dev-notice-countdown.is-fading {
  opacity: 0 !important;
  animation: none !important;
}

.dev-notice-countdown[hidden] {
  display: none !important;
}

@keyframes devNoticeCountdownPulse {
  0%, 100% {
    color: #ff3b5c;
    filter: brightness(1);
  }
  50% {
    color: #ff6b8a;
    filter: brightness(1.15);
  }
}

/* ── HOME (ปุ่ม HOME ขวาของ ROBIT) — ทางเดินยาน + ปุ่มแจ้งเตือนพัฒนา ── */
#homePage {
  background-color: var(--sf-bg) !important;
  background-image:
    linear-gradient(180deg, rgba(6, 8, 16, 0.22) 0%, rgba(6, 8, 16, 0.08) 36%, rgba(6, 8, 16, 0.5) 78%, rgba(6, 8, 16, 0.82) 100%),
    url('../assets/images/lobby-ship-corridor.jpg?v=20260823ship') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  padding:
    calc(env(safe-area-inset-top, 0px) + 16px)
    20px
    calc(env(safe-area-inset-bottom, 0px) + 28px);
  box-sizing: border-box;
}

#homePage.active {
  display: flex !important;
}

/* ปุ่มแจ้งเตือนพัฒนา — กลางจอสุด */
.home-dev-notice-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: min(92vw, 520px);
  max-width: 520px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  pointer-events: none;
  z-index: 2;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s ease, visibility 0s linear 0s;
}

.home-dev-notice-btn.is-closing {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%);
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
  pointer-events: none !important;
}

.home-dev-notice-btn[hidden] {
  display: none !important;
}

.home-dev-notice-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none !important;
  pointer-events: none;
  user-select: none;
  background: transparent;
}

/* กากบาทขวาบน — กดแล้วกลับหน้าหลัก */
.home-dev-notice-close {
  position: absolute;
  top: 7%;
  right: 5.5%;
  width: 11%;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
  z-index: 3;
  transition: transform 0.08s ease-out;
}

.home-dev-notice-close:focus,
.home-dev-notice-close:focus-visible,
.home-dev-notice-close:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.home-dev-notice-close:active,
.home-dev-notice-close.is-pressed {
  transform: scale(0.92);
}

/* ข้อความ — ตำแหน่งเดิมด้านล่าง */
.home-page-copy {
  text-align: center;
  max-width: 420px;
  margin: 0 auto 18px;
  z-index: 3;
}

.home-page-kicker {
  margin: 0 0 8px;
  color: var(--sf-cyan);
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.home-page-title {
  margin: 0 0 10px;
  color: #f4fbff;
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.home-page-title em {
  font-style: normal;
  color: var(--sf-gold);
}

.home-page-sub {
  margin: 0;
  color: rgba(220, 240, 255, 0.78);
  font-size: clamp(13px, 3.4vw, 15px);
  line-height: 1.45;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

#homePage .back-btn {
  align-self: flex-start;
  z-index: 3;
}

#storePage h2,
#bankPage h2,
#businessPage h2,
#socialPage h2,
#socialPageTitle {
  color: var(--sf-cyan) !important;
  text-shadow: 0 0 12px rgba(0,229,255,0.35);
}

.lobby-brand-bar .lobby-bag-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  pointer-events: auto;
  margin: 12px 10px 0 0;
  /* กรอบใหญ่ขึ้น — ไอคอนคงขนาดเดิม */
  --sf-hex-frame-size: clamp(72px, 11vw, 86px);
  --sf-hex-icon-size: clamp(48px, 7.2vw, 58px);
  --sf-biz-icon-size: clamp(22px, 4.2vw, 28px);
  /* กรอบหกเหลี่ยม — ice / plasma cyan (สไตล์ใหม่) */
  --sf-hex-rim: linear-gradient(
    155deg,
    #c8ffff 0%,
    #5ef8ff 18%,
    #00d4ff 42%,
    #2a7bff 68%,
    #6dffe8 88%,
    #e8ffff 100%
  );
  --sf-hex-core:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(0, 232, 255, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(20, 80, 255, 0.22) 0%, transparent 55%),
    linear-gradient(165deg, #0c1828 0%, #050c16 48%, #081420 100%);
  --sf-hex-glow:
    0 0 8px rgba(0, 232, 255, 0.55),
    0 0 22px rgba(0, 160, 255, 0.32),
    0 0 36px rgba(45, 120, 255, 0.16),
    inset 0 0 14px rgba(0, 232, 255, 0.14);
}

.lobby-brand-bar .bag-btn.bag-btn-scifi {
  position: relative;
  width: var(--sf-hex-frame-size);
  height: var(--sf-hex-frame-size);
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: 0;
  line-height: 0;
  color: #e8fbff;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  overflow: visible;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi::before {
  display: none;
}

/* กรอบหกเหลี่ยมร่วม — ล็อบบี้หิบ / Robit / Business */
.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame,
.scifi-chest-btn .bag-btn-hex-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: var(--sf-hex-core);
  border: none;
  box-shadow: var(--sf-hex-glow);
  overflow: hidden;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame::before,
.scifi-chest-btn .bag-btn-hex-frame::before {
  content: '';
  position: absolute;
  inset: -3px;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: var(--sf-hex-rim);
  z-index: 0;
  pointer-events: none;
  opacity: 0.95;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame::after,
.scifi-chest-btn .bag-btn-hex-frame::after {
  content: '';
  position: absolute;
  inset: 2px;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: var(--sf-hex-core);
  box-shadow: inset 0 0 0 1px rgba(180, 255, 255, 0.22);
  z-index: 0;
  pointer-events: none;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame.scifi-chest-icon-stack {
  overflow: visible;
}

/* หิบล็อบบี้ / หิบตู้ — เอาฐานหกเหลี่ยมออก เหลือแค่ไอคอน */
.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame,
#lobbyChestBtn .bag-btn-hex-frame,
#slotSessionBagBtn .bag-btn-hex-frame,
.scifi-chest-btn .bag-btn-hex-frame {
  clip-path: none !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame::before,
.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-hex-frame::after,
#lobbyChestBtn .bag-btn-hex-frame::before,
#lobbyChestBtn .bag-btn-hex-frame::after,
#slotSessionBagBtn .bag-btn-hex-frame::before,
#slotSessionBagBtn .bag-btn-hex-frame::after,
.scifi-chest-btn .bag-btn-hex-frame::before,
.scifi-chest-btn .bag-btn-hex-frame::after {
  display: none !important;
  content: none !important;
}

.scifi-chest-btn.is-chest-open .bag-btn-hex-frame.scifi-chest-icon-stack,
.lobby-brand-bar .bag-btn.bag-btn-scifi.is-chest-open .bag-btn-hex-frame.scifi-chest-icon-stack {
  overflow: visible;
}

.scifi-chest-icon-stack {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lobbyChestBtn,
#slotSessionBagBtn,
#slotPage .slot-session-bag-btn.slot-chest-btn {
  --sf-hex-frame-size: clamp(86.4px, 13.2vw, 103.2px);
  --sf-hex-icon-size: clamp(57.6px, 8.64vw, 69.6px);
  width: var(--sf-hex-frame-size);
  height: var(--sf-hex-frame-size);
  pointer-events: auto !important;
  z-index: 30;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

#lobbyChestBtn:focus,
#lobbyChestBtn:focus-visible,
#lobbyChestBtn:active,
#slotSessionBagBtn:focus,
#slotSessionBagBtn:focus-visible,
#slotSessionBagBtn:active,
.scifi-chest-btn:focus,
.scifi-chest-btn:focus-visible,
.scifi-chest-btn:active {
  outline: none !important;
  outline-offset: 0 !important;
}

.scifi-chest-3d {
  position: absolute !important;
  inset: 0 !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  transform: none;
  z-index: 3;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.22));
  transition: filter 0.18s ease;
}

.scifi-chest-3d-canvas,
.scifi-chest-3d-video {
  width: 100% !important;
  height: 100% !important;
  display: block;
  pointer-events: none;
  object-fit: contain;
  background: transparent;
}

.scifi-chest-3d-src {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.scifi-chest-btn.is-chest-open .scifi-chest-3d,
.scifi-chest-btn.is-ready.is-chest-open .scifi-chest-3d {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.28)) drop-shadow(0 0 10px rgba(0, 232, 255, 0.42));
}

.scifi-chest-btn:hover .scifi-chest-3d {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.28)) drop-shadow(0 0 7px rgba(0, 232, 255, 0.36));
}

/* Place the slot chest look on the lobby: same city backdrop, viewport-locked crop */
#lobbyChestBtn {
  background: transparent !important;
  background-image: none !important;
}

#lobbyPage #lobbyChestBtn,
#slotPage .slot-session-bag-btn.slot-chest-btn {
  position: relative;
  top: -12px;
  right: auto;
  left: auto;
  bottom: auto;
}

#slotPage .slot-chest-chrome {
  pointer-events: none;
  z-index: 200;
}

#slotPage .slot-chest-chrome .lobby-bag-stack,
#slotPage .slot-chest-chrome #slotSessionBagBtn {
  pointer-events: auto;
}

.lobby-chest-home {
  position: relative;
  width: clamp(86.4px, 13.2vw, 103.2px);
  height: clamp(86.4px, 13.2vw, 103.2px);
  flex-shrink: 0;
}

.lobby-chest-fly-layer {
  position: fixed;
  inset: 0;
  z-index: 980;
  pointer-events: none;
  visibility: hidden;
}

.lobby-chest-fly-layer.is-on {
  visibility: visible;
  pointer-events: auto;
}

.lobby-chest-fly-dim {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0);
  transition: background 0.45s ease;
}

.lobby-chest-fly-layer.is-on .lobby-chest-fly-dim {
  background: rgba(4, 8, 16, 0.58);
}

html.player-stage .lobby-chest-fly-layer {
  left: var(--stage-left) !important;
  top: var(--stage-top) !important;
  width: var(--stage-w) !important;
  height: var(--stage-h) !important;
  right: auto !important;
  bottom: auto !important;
}

#lobbyChestBtn.is-lobby-flying,
#slotSessionBagBtn.is-lobby-flying {
  pointer-events: none !important;
  overflow: visible !important;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi.is-lobby-flying:hover,
#lobbyChestBtn.is-lobby-flying:hover,
#slotSessionBagBtn.is-lobby-flying:hover {
  transform: none !important;
}

#lobbyChestBtn.is-lobby-flying .scifi-chest-3d,
#slotSessionBagBtn.is-lobby-flying .scifi-chest-3d {
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 16px rgba(0, 232, 255, 0.4));
}

.scifi-chest-btn.is-lobby-flying .slot-session-bag-count {
  display: none !important;
}

.inventory-bag-scifi-overlay.is-lobby-chest-reveal {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  align-items: flex-start;
  padding-top: max(6vh, 12px);
  padding-bottom: min(42vh, 300px);
  animation: none !important;
}

.inventory-bag-scifi-overlay.is-lobby-chest-reveal .inventory-bag-scifi-title-chest {
  display: none;
}

.inventory-bag-scifi-title-chest {
  position: relative;
  width: 108px;
  height: 108px;
  flex-shrink: 0;
}
.inventory-chest-3d {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.inventory-chest-3d canvas,
.inventory-chest-3d .scifi-chest-3d-canvas,
.inventory-chest-3d .scifi-chest-3d-video {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  object-fit: contain;
  background: transparent;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi:hover {
  transform: scale(1.04);
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-crate-3d,
.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-crate-fallback {
  position: relative;
  z-index: 2;
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.35)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-crate-3d {
  width: 88%;
  height: 88%;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi .bag-btn-crate-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi.is-ready .bag-btn-crate-fallback {
  display: none;
}

.lobby-brand-bar .bag-btn.bag-btn-scifi.is-star-launch {
  animation: lobbyBagStarLaunch 0.35s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

/* Business — ไอคอนต้นฉบับ ไม่ใช้ฐานหกเหลี่ยม */
.lobby-brand-bar .lobby-biz-under-bag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sf-hex-frame-size);
  height: var(--sf-hex-frame-size);
  margin: clamp(160px, 32vh, 280px) 0 0;
  position: relative;
  top: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  overflow: visible;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.lobby-brand-bar .lobby-biz-under-bag:focus,
.lobby-brand-bar .lobby-biz-under-bag:focus-visible,
.lobby-brand-bar .lobby-biz-under-bag:active {
  outline: none !important;
}

.lobby-brand-bar .lobby-biz-under-bag .lobby-biz-icon-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.lobby-brand-bar .lobby-biz-under-bag:hover {
  transform: scale(1.04);
}

.lobby-brand-bar .lobby-biz-under-bag:hover .lobby-biz-icon-img {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 8px rgba(0, 232, 255, 0.4));
}

.lobby-brand-bar .lobby-monopoly-under-bag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sf-hex-frame-size);
  height: var(--sf-hex-frame-size);
  margin: 8px 0 0;
  position: relative;
  top: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  overflow: visible;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.lobby-brand-bar .lobby-monopoly-under-bag:focus,
.lobby-brand-bar .lobby-monopoly-under-bag:focus-visible,
.lobby-brand-bar .lobby-monopoly-under-bag:active {
  outline: none !important;
}

.lobby-brand-bar .lobby-monopoly-under-bag .lobby-biz-icon-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.lobby-brand-bar .lobby-monopoly-under-bag:hover {
  transform: scale(1.04);
}

.lobby-brand-bar .lobby-monopoly-under-bag:hover .lobby-biz-icon-img {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 8px rgba(0, 232, 255, 0.4));
}

@keyframes lobbyBagStarLaunch {
  0% { transform: scale(1); }
  40% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

#lobbyPage {
  overflow: hidden !important;

  /* ── ดาว (อิสระ — ไม่ผูกกับช่องอื่น) ── */
  --lobby-star-top: calc(env(safe-area-inset-top, 0px) + 48px);
  --lobby-star-row: calc(1.45em + 28px);

  /* ── ช่องแสดงผลหลัก (stats + rankings + feature มัดรวมกัน) ── */
  /* ฐานเดิม แล้ว -37px = เลื่อนขึ้น (จาก -32px อีก 5px) */
  --lobby-main-display-top: calc(env(safe-area-inset-top, 0px) + 58px + 1.55rem + 34px + 18px - 37px);
  --lobby-main-display-bottom-pad: calc(150px + env(safe-area-inset-bottom, 0px));
}

.lobby-stars-top {
  top: var(--lobby-star-top) !important;
  --lobby-star-cell: 48.64px;
  --lobby-star-icon: var(--lobby-star-cell);
  --lobby-star-outer-extra-x: 48.64px;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible !important;
  color: var(--sf-gold, #ffd978);
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: var(--lobby-star-cell);
  line-height: 1;
  background: rgba(6, 12, 26, 0.55);
  border: 1px solid rgba(0, 229, 255, 0.42);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(0, 229, 255, 0.1),
    0 0 14px rgba(0, 229, 255, 0.08);
  padding: 4px calc(4px + var(--lobby-star-outer-extra-x));
  box-sizing: border-box;
}

.lobby-stars-top .lobby-star-spin {
  box-sizing: border-box;
  width: var(--lobby-star-cell);
  height: var(--lobby-star-cell);
  min-width: var(--lobby-star-cell);
  max-width: var(--lobby-star-cell);
  min-height: var(--lobby-star-cell);
  max-height: var(--lobby-star-cell);
  flex: 0 0 var(--lobby-star-cell);
  aspect-ratio: 1 / 1;
  margin: 0;
  padding: 0;
  border-width: 1px;
  border-style: solid;
  border-radius: 8px;
  overflow: visible;
  position: relative;
  top: 0;
  bottom: auto;
  left: 0;
  right: auto;
  transform: none;
  transform-origin: center center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(0, 229, 255, 0.8);
  background: rgba(6, 12, 26, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(0, 229, 255, 0.15),
    0 0 12px rgba(0, 229, 255, 0.2);
}

.lobby-stars-top .format-number {
  position: relative;
  opacity: 0.95;
  line-height: 1;
  font-size: calc(var(--lobby-star-cell) * 0.42);
  box-sizing: border-box;
  width: auto;
  min-width: var(--lobby-star-cell);
  max-width: none;
  height: var(--lobby-star-cell);
  min-height: var(--lobby-star-cell);
  max-height: var(--lobby-star-cell);
  flex: 0 0 auto;
  aspect-ratio: auto;
  margin: 0;
  padding: 0 12px;
  border-width: 1px;
  border-style: solid;
  border-radius: 8px;
  overflow: visible;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow:
    inset 0 0 0 1px rgba(255, 215, 0, 0.12),
    0 0 10px rgba(255, 215, 0, 0.14);
  background: rgba(6, 12, 26, 0.72);
  color: #ffd978;
  -webkit-text-fill-color: #ffd978;
  filter: none;
  text-shadow:
    0 0 6px rgba(0, 210, 255, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

.lobby-stars-top .format-number::before {
  display: none;
  content: none;
}

.lobby-stars-top .lobby-star-spin .lobby-star-canvas {
  filter: none;
  opacity: 1;
}

/* ช่องแสดงผลหลัก — มัด stats / rankings / feature (ไม่ผูกตำแหน่งดาว) */
/* ไม่ใส่กรอบห่อทั้งชุด — กรอบอยู่เฉพาะช่องข้อความอันดับด้านใน */
#lobbyPage .lobby-main-display.lobby-hero-scifi,
#lobbyPage #lobbyMainDisplay {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  top: var(--lobby-main-display-top) !important;
  margin: 0 !important;
  padding-bottom: var(--lobby-main-display-bottom-pad) !important;
  transform: none !important;
  z-index: 4 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

@media (max-height: 740px) {
  .lobby-feature-grid { display: none; }
  .lobby-rank-panel,
  .lobby-rank-row-pair { margin-bottom: 8px; }
}

@media (max-height: 640px) {
  .lobby-rank-panel,
  .lobby-rank-row-pair { display: none; }
  .lobby-stats-row { margin-bottom: 8px; }
}

/* ── Inventory / Storage Crate Modal (Sci-Fi) ── */
.inventory-bag-scifi-overlay {
  background: rgba(4, 8, 16, 0.52);
  backdrop-filter: blur(3px) saturate(0.92);
  -webkit-backdrop-filter: blur(3px) saturate(0.92);
}

.inventory-bag-scifi-overlay.active {
  animation: inventoryBagOverlayIn 0.28s ease both;
}

@keyframes inventoryBagOverlayIn {
  from { background: rgba(4, 8, 16, 0.08); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); }
  to { background: rgba(4, 8, 16, 0.52); backdrop-filter: blur(3px) saturate(0.92); -webkit-backdrop-filter: blur(3px) saturate(0.92); }
}

.inventory-bag-scifi-overlay .inventory-bag-scifi-panel.modal-content {
  position: relative;
  max-width: min(94vw, 460px);
  max-height: min(86vh, 640px);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inventory-bag-scifi-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(0 14px, 14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px));
  background:
    radial-gradient(circle at 18% 12%, rgba(124, 77, 255, 0.22) 0%, transparent 48%),
    radial-gradient(circle at 82% 88%, rgba(0, 229, 255, 0.16) 0%, transparent 44%),
    rgba(4, 8, 18, 0.97);
  border: 1.5px solid rgba(0, 229, 255, 0.38);
  box-shadow:
    0 0 28px rgba(0, 229, 255, 0.18),
    0 0 48px rgba(124, 77, 255, 0.1),
    inset 0 0 24px rgba(0, 229, 255, 0.06);
  z-index: 0;
}

.inventory-bag-scifi-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.inventory-bag-scifi-corners::before,
.inventory-bag-scifi-corners::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--sf-cyan);
  border-style: solid;
  opacity: 0.85;
}

.inventory-bag-scifi-corners::before {
  top: 6px;
  left: 6px;
  border-width: 2px 0 0 2px;
}

.inventory-bag-scifi-corners::after {
  bottom: 6px;
  right: 6px;
  border-width: 0 2px 2px 0;
}

.inventory-bag-scifi-header {
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.22);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.08) 0%, transparent 100%);
  flex: 0 0 auto;
}

.inventory-bag-scifi-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.inventory-bag-scifi-title-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.45));
}

.inventory-bag-scifi-title-text h2 {
  margin: 0;
  font-size: clamp(17px, 4.2vw, 20px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #e8fbff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.inventory-bag-scifi-sub {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0, 229, 255, 0.72);
}

.inventory-bag-scifi-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  background: rgba(0, 229, 255, 0.06);
  color: var(--sf-cyan);
  font-size: 22px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.inventory-bag-scifi-close:hover {
  color: #fff;
  border-color: rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.14);
  transform: rotate(90deg);
}

.inventory-bag-scifi-body {
  position: relative;
  z-index: 3;
  padding: 14px 16px 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inventory-bag-scifi-empty {
  position: relative;
  min-height: 200px;
  padding: 36px 20px 32px;
  border-radius: 10px;
  border: 1px dashed rgba(0, 229, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.04) 0%, transparent 100%),
    rgba(2, 8, 18, 0.55);
  overflow: hidden;
}

.inventory-bag-scifi-empty-glow {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 140px;
  height: 140px;
  transform: translate(-50%, -58%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.16) 0%, transparent 68%);
  pointer-events: none;
}

.inventory-bag-scifi-empty-icon {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  opacity: 0.72;
  filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.35));
}

.inventory-bag-scifi-empty-text {
  position: relative;
  z-index: 1;
  color: rgba(232, 251, 255, 0.88);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.inventory-bag-scifi-empty-hint {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: rgba(0, 229, 255, 0.55);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.inventory-bag-scifi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 8px;
  padding: 2px 4px 4px 0;
  width: 100%;
  max-height: min(46vh, 340px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  justify-items: stretch;
  align-items: stretch;
  scrollbar-gutter: stable;
}

.inventory-bag-scifi-grid.inventory-bag-list,
.inventory-bag-scifi-grid.slot-session-bag-list {
  gap: 8px;
  padding: 2px 4px 4px 0;
  max-height: min(46vh, 340px);
  overflow-x: hidden;
  overflow-y: auto;
  justify-items: stretch;
}

.inventory-bag-scifi-grid::-webkit-scrollbar {
  width: 6px;
}

.inventory-bag-scifi-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.28);
  border-radius: 999px;
}

.inventory-bag-scifi-slot {
  width: 100%;
  min-width: 0;
  display: flex;
}

.inventory-bag-scifi-slot-inner {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: clamp(118px, 28vw, 148px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  clip-path: none;
  background:
    radial-gradient(circle at 30% 22%, rgba(124, 77, 255, 0.18) 0%, transparent 52%),
    radial-gradient(circle at 72% 78%, rgba(0, 229, 255, 0.12) 0%, transparent 46%),
    rgba(6, 10, 22, 0.92);
  border: 1px solid rgba(0, 229, 255, 0.24);
  box-shadow:
    inset 0 0 12px rgba(0, 229, 255, 0.05),
    0 0 10px rgba(0, 229, 255, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.inventory-bag-scifi-icon-layer {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(78px, 20vw, 104px);
  padding: 10px 8px 6px;
}

.inventory-bag-scifi-amount-layer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 8px;
  border-top: 1px solid rgba(0, 229, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.1) 0%, rgba(0, 229, 255, 0.04) 100%),
    rgba(2, 8, 18, 0.72);
}

.inventory-bag-scifi-slot:hover .inventory-bag-scifi-slot-inner {
  border-color: rgba(0, 229, 255, 0.42);
  box-shadow:
    inset 0 0 14px rgba(0, 229, 255, 0.08),
    0 0 16px rgba(0, 229, 255, 0.18);
}

.inventory-bag-scifi-slot:hover .inventory-bag-scifi-amount-layer {
  border-top-color: rgba(0, 229, 255, 0.38);
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.14) 0%, rgba(0, 229, 255, 0.06) 100%),
    rgba(2, 8, 18, 0.82);
}

.inventory-bag-scifi-slot .inventory-bag-item-icon,
.inventory-bag-scifi-slot .slot-session-bag-item-icon {
  font-size: clamp(58px, 16vw, 78px);
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-coin,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-grenade,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-shield,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-starship,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-reaper,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-bust,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-crate,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-diamond,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-star,
.inventory-bag-scifi-slot .inventory-bag-item-icon .game-icon-key,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-coin,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-grenade,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-shield,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-starship,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-reaper,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-bust,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-crate,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-diamond,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-star,
.inventory-bag-scifi-slot .slot-session-bag-item-icon .game-icon-key {
  width: clamp(58px, 16vw, 78px);
  height: clamp(58px, 16vw, 78px);
}

.inventory-bag-scifi-slot .inventory-bag-item-amount,
.inventory-bag-scifi-slot .slot-session-bag-item-amount {
  color: var(--sf-gold);
  font-size: clamp(16px, 3.8vw, 19px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(255, 217, 120, 0.35);
}

@media (max-width: 768px) {
  .inventory-bag-scifi-header { padding: 14px 14px 12px; }
  .inventory-bag-scifi-body { padding: 12px 12px 16px; }
  .inventory-bag-scifi-empty { min-height: 180px; padding: 28px 16px 24px; }
  .inventory-bag-scifi-empty-icon { width: 60px; height: 60px; }
}

/* ── Slot page — sci-fi chest (มุมบนขวา ตำแหน่งเดียวกับล็อบบี้) ── */
#slotPage .slot-session-bag-btn.slot-chest-btn {
  --sf-hex-frame-size: clamp(86.4px, 13.2vw, 103.2px);
  --sf-hex-icon-size: clamp(57.6px, 8.64vw, 69.6px);
  --sf-hex-rim: linear-gradient(
    155deg,
    #c8ffff 0%,
    #5ef8ff 18%,
    #00d4ff 42%,
    #2a7bff 68%,
    #6dffe8 88%,
    #e8ffff 100%
  );
  --sf-hex-core:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(0, 232, 255, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(20, 80, 255, 0.22) 0%, transparent 55%),
    linear-gradient(165deg, #0c1828 0%, #050c16 48%, #081420 100%);
  --sf-hex-glow:
    0 0 8px rgba(0, 232, 255, 0.55),
    0 0 22px rgba(0, 160, 255, 0.32),
    0 0 36px rgba(45, 120, 255, 0.16),
    inset 0 0 14px rgba(0, 232, 255, 0.14);
  position: relative;
  top: -12px;
  right: auto;
  left: auto;
  bottom: auto;
  z-index: 200;
  width: var(--sf-hex-frame-size);
  height: var(--sf-hex-frame-size);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #e8fbff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  overflow: visible;
  line-height: 0;
  transition: transform 0.2s ease;
}

#slotPage .slot-session-bag-btn.slot-chest-btn:hover {
  transform: scale(1.04);
  background: transparent;
}

#slotPage .slot-session-bag-btn.slot-chest-btn.is-catch {
  animation: slotBagCatch 0.45s ease;
}

#slotPage .slot-session-bag-btn.slot-chest-btn .slot-session-bag-count {
  z-index: 4;
  top: 16px;
  right: 2px;
}

#monopolyPage.monopoly-page {
  padding: 0;
  overflow: hidden;
  background: #07090e;
  z-index: 110;
}

#monopolyPage.monopoly-page.active {
  display: block;
}

.monopoly-room-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
}

.monopoly-room-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
  cursor: grab;
  touch-action: none;
}

.monopoly-page-chrome {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 0 14px;
  pointer-events: none;
}

.monopoly-page-chrome .world-back-btn {
  pointer-events: auto;
}

.monopoly-page-hint {
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 12, 20, 0.55);
  color: #e8d48a;
  font-size: 12px;
  pointer-events: none;
}
