/* ════════════════════════════════════════════════════════════════════════════
   PLAYER PAGE STYLES - SVG BUTTON VERSION (ปรับปรุงใหม่)
   ════════════════════════════════════════════════════════════════════════════ */
.player-page {
    background: #0a0a0a;
    min-height: 100vh;
    padding-bottom: 100px;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
}

.player-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 2px solid #d4af37;
    padding: 20px;
    margin-bottom: 20px;
}

.player-logo {
    color: #d4af37;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.player-balance {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.balance-item {
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-sizing: border-box;
}

.balance-item .value {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.balance-item .label {
    color: #888;
    font-size: 12px;
}

.balance-item.diamond .value { color: #4fc3f7; }
.balance-item.star .value { color: #ffd700; }

.player-country-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid #d4af37;
    border-radius: 8px;
    padding: 10px 15px;
}

.player-content {
    padding: 20px;
}

.player-tab {
    display: none;
}

.player-tab.active {
    display: block;
    animation: fadeIn 0.3s;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #151515;
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.3s;
}

.setting-item:hover {
    border-color: #d4af37;
    background: #1a1a1a;
}

.setting-item .label {
    color: #d4af37;
    font-size: 16px;
}

/* ==========================================
   TAB BAR
   ========================================== */
/* ==========================================
   LOBBY BOTTOM DOCK — ROBIT บน · แท็บบาร์ล่าง
   ========================================== */
.lobby-bottom-dock {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    z-index: 400;
    flex-direction: column;
    align-items: stretch;
    pointer-events: none;
    box-sizing: border-box;
}

/* lobby-bottom-dock จัดตามกรอบ stage ใน 01-reset-common.css (มือถือ+เดสก์ท็อป) */

body:has(#lobbyPage.active) .lobby-bottom-dock {
    display: flex;
}

.lobby-bottom-dock > * {
    pointer-events: auto;
}

.tab-bar {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    background: rgba(6, 10, 20, 0.94);
    border-top: 1px solid rgba(0, 229, 255, 0.22);
    box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(0, 229, 255, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    min-height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding: 4px 0 env(safe-area-inset-bottom, 0px);
    z-index: 2;
    box-sizing: border-box;
    margin: 0;
    border-radius: 0;
    gap: 2px;
    order: 2;
    flex-shrink: 0;
}

.tab-item {
    flex: 1;
    text-align: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.48);
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-height: 54px;
    padding: 4px 2px 2px;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
}

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

.tab-item .icon {
    font-size: 26px;
    margin-bottom: 2px;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.45));
}

.tab-item .icon.tab-icon-scifi {
    font-size: 0;
    filter: none;
}

.tab-item.active .icon:not(.tab-icon-scifi):not(.tab-home-icon) {
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.45));
}

/* โลกกลางแท็บ — ยกขึ้นนิด + วงแหวนนีออน */
.tab-item-lobby {
    justify-content: flex-end;
    position: relative;
    padding-bottom: 0;
    flex-direction: column;
    align-items: center;
    overflow: visible;
    margin-top: -20px;
}

.lobby-earth-stack {
    position: relative;
    width: 68px;
    height: 68px;
    margin-top: 0;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 28%, rgba(124, 77, 255, 0.22) 0%, transparent 52%),
        radial-gradient(circle at 72% 68%, rgba(0, 229, 255, 0.14) 0%, transparent 46%),
        rgba(4, 8, 18, 0.42);
    border: 2px solid rgba(0, 229, 255, 0.52);
    box-shadow:
        0 0 22px rgba(0, 229, 255, 0.36),
        0 0 40px rgba(124, 77, 255, 0.16),
        inset 0 0 20px rgba(0, 229, 255, 0.1),
        0 4px 14px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: visible;
    isolation: isolate;
}

.lobby-earth-stack::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(0, 229, 255, 0.7) 48deg,
        rgba(124, 77, 255, 0.55) 112deg,
        transparent 168deg,
        rgba(0, 229, 255, 0.35) 248deg,
        transparent 360deg
    );
    animation: lobbyEarthOrbitRing 4s linear infinite;
    pointer-events: none;
    z-index: 0;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 1px));
}

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

.tab-item-lobby.active .lobby-earth-stack {
    border-color: rgba(0, 229, 255, 0.82);
    box-shadow:
        0 0 26px rgba(0, 229, 255, 0.48),
        0 0 42px rgba(124, 77, 255, 0.22),
        inset 0 0 22px rgba(0, 229, 255, 0.12),
        0 4px 14px rgba(0, 0, 0, 0.5);
}

.tab-item .icon.tab-home-icon {
    position: relative;
    inset: auto;
    margin: 0;
    font-size: 26px;
    line-height: 1;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    z-index: 1;
    background: #020610;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.45);
}

.tab-item .icon.tab-home-icon .lobby-earth-video,
.tab-item .icon.tab-home-icon .lobby-earth-canvas,
.tab-item .icon.tab-home-icon .lobby-earth-holo-img {
    width: 56px !important;
    height: 56px !important;
    display: block;
    pointer-events: none;
    border-radius: 50%;
    object-fit: cover;
    object-position: center center;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.tab-item .label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
    line-height: 1.1;
}

.tab-item.active .label {
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
}

/* ==========================================
   LOBBY PAGE (HOME)
   ========================================== */
#lobbyPage {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: transparent;
    background-image: none;
    padding: 0;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    box-sizing: border-box;
}

.lobby-hero-scifi {
    padding-left: 20px;
    padding-right: 20px;
}

.lobby-hero-scifi {
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
}

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

html:not(.player-stage) #lobbyPage.active {
    min-height: 100dvh;
    height: 100dvh;
}

html.player-stage #lobbyPage.active {
    min-height: 100%;
    height: 100%;
    max-height: 100%;
}

/* ชั้นภาพพื้นหลังเดียว — fixed ไม่เลื่อนตาม scroll (กันกระพริบ) */
#lobbyPage::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: #6ec8f8;
    background-image: url('../assets/images/player-sky-backdrop.jpg?v=20260930sky1');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* เดสก์ท็อป player-stage: ภาพพื้นหลังแค่ในกรอบจอเกม ไม่ล้นนอกเฟรม */
@media (min-width: 1025px) {
  html.player-stage #lobbyPage::before {
    inset: auto;
    left: var(--stage-left);
    top: var(--stage-top);
    width: var(--stage-w);
    height: var(--stage-h);
  }
}

#lobbyPage > *:not(.lobby-ambience):not(.lobby-brand-bar) {
    position: relative;
    z-index: 1;
}

/* ดาวล็อบบี้ต้องอยู่เหนือทุกชั้น และไม่ถูก relative บัง */
#lobbyPage > .lobby-stars-top,
#lobbyPage > .lobby-coins-top {
    position: fixed !important;
    z-index: 1000 !important;
}

/* ใบไม้ในกรอบล็อบบี้เท่านั้น */
.lobby-ambience {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.45;
}

.lobby-ambience.is-live {
    opacity: 0.55;
}

.lobby-ambience.is-reduced {
    display: none;
}

.lobby-ambience-fx {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .lobby-ambience {
        display: none;
    }
}

#lobbyPage.active { display: block; height: 100%; min-height: 100%; }

.lobby-header {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    margin-bottom: 30px;
}

/* กระเป๋า + Business เรียงใต้กัน มุมขวาบน */
.lobby-bag-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.lobby-biz-under-bag {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    position: relative;
    top: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #d4af37;
    cursor: pointer;
    line-height: 0;
    transition: transform 0.25s ease;
}

.lobby-biz-under-bag:hover {
    transform: scale(1.06);
}

.lobby-biz-icon-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

/* ==========================================
   SETTING BUTTON (ขนาดมาตรฐานตามจอ)
   ========================================== */
.setting-btn {
    width: clamp(42px, 6.5vw, 52px);
    height: clamp(42px, 6.5vw, 52px);
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #d4af37;
    font-size: clamp(24px, 3.8vw, 32px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: 0.3s;
    padding: 0;
    margin: 0;
    line-height: 1;
}

.setting-btn:hover { 
    background: rgba(212,175,55,0.1);
    transform: scale(1.05);
}

.lobby-header .bag-btn {
    width: clamp(47px, 6.5vw, 57px);
    height: clamp(47px, 6.5vw, 57px);
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #d4af37;
    font-size: clamp(29px, 3.8vw, 37px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: transform 0.3s;
    padding: 0;
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
}

.lobby-header .bag-btn:hover {
    background: transparent;
    transform: scale(1.05);
}

/* ดาวบินจากกระเป๋าล็อบบี้ → ไอคอนดาว */
.lobby-header .bag-btn.is-star-launch {
    animation: lobbyBagStarLaunch 0.35s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

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

/* ดาวถึงแม่ — ไม่เด้งไอคอน/เลข (แม่หันหน้าตรงนิ่งรับใน 3D) */
.lobby-stars-top .lobby-star-spin.is-star-catch-bounce {
    animation: none;
}

.lobby-stars-top .format-number.is-star-count-pop {
    animation: none;
}

.lobby-star-fly-ghost {
    /* ต่ำกว่า .lobby-stars-top (1000) ให้บินลอดเลขดาว */
    z-index: 990;
}

.inventory-bag-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 36px;
    text-align: center;
    min-height: 180px;
}

.inventory-bag-empty-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 16px;
    opacity: 0.55;
}

.inventory-bag-empty-text {
    color: #888;
    font-size: 16px;
}

.inventory-bag-empty[hidden],
.inventory-bag-list[hidden] {
    display: none !important;
}

.inventory-bag-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 18px;
    max-height: min(55vh, 420px);
    overflow-y: auto;
    padding: 12px 4px 8px;
    justify-items: center;
}

.inventory-bag-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    background: transparent;
    border: none;
    min-width: 0;
}

.inventory-bag-item-icon {
    font-size: 56px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-bag-item-icon .game-icon-coin,
.inventory-bag-item-icon .game-icon-grenade,
.inventory-bag-item-icon .game-icon-shield,
.inventory-bag-item-icon .game-icon-starship,
.inventory-bag-item-icon .game-icon-reaper,
.inventory-bag-item-icon .game-icon-bust,
.inventory-bag-item-icon .game-icon-crate,
.inventory-bag-item-icon .game-icon-diamond,
.inventory-bag-item-icon .game-icon-star,
.inventory-bag-item-icon .game-icon-key {
    width: 56px;
    height: 56px;
}

.inventory-bag-item-amount {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

@media (max-width: 768px) {
    .inventory-bag-item-icon { font-size: 48px; }
    .inventory-bag-item-icon .game-icon-coin,
    .inventory-bag-item-icon .game-icon-grenade,
    .inventory-bag-item-icon .game-icon-shield,
    .inventory-bag-item-icon .game-icon-starship,
    .inventory-bag-item-icon .game-icon-reaper,
    .inventory-bag-item-icon .game-icon-bust,
    .inventory-bag-item-icon .game-icon-crate,
    .inventory-bag-item-icon .game-icon-diamond,
    .inventory-bag-item-icon .game-icon-star,
    .inventory-bag-item-icon .game-icon-key {
        width: 48px;
        height: 48px;
    }
    .inventory-bag-item-amount { font-size: 18px; }
}

/* ==========================================
   ✅ SVG BUTTON CONTROLS
   ========================================== */
.svg-button-container {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    height: 80px !important;
    z-index: 1 !important;
    order: 1;
    flex-shrink: 0;
    overflow: visible;
    background: transparent !important;
}

.svg-button-container svg.lobby-gold-bar-hit,
.svg-button-container svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    position: absolute;
    inset: 0;
    z-index: 2;
}

.lobby-gold-bar-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    display: block;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    background: transparent;
}

.lobby-bar-hit:active {
    opacity: 0.92;
}

/* นับถอยหลังในช่องเล็กใต้ ROBIT (พิกัดจาก PNG ครอป 1007×161) */
.robit-countdown-slot {
    position: absolute !important;
    left: 36.15% !important;
    top: 67.08% !important;
    width: 27.51% !important;
    height: 19.88% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 2px !important;
    background: transparent !important;
    border: none !important;
    z-index: 3 !important;
    pointer-events: none;
    box-sizing: border-box;
    overflow: hidden;
}

.robit-countdown-slot #lobbyCountdown {
    color: #fff8e0 !important;
    font-size: clamp(8px, 2.6vw, 13px) !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em !important;
    line-height: 1 !important;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-family: "Arial Black", Arial, sans-serif;
    text-shadow:
      0 0 6px rgba(255, 210, 80, 0.35),
      0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

/* Animation สำหรับ ROBIT hit — เบา ๆ */
@keyframes svgPulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(255, 200, 60, 0.25));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 80, 0.55));
    }
}

.lobby-bar-hit-robit {
    animation: none;
}

.lobby-bar-btn-robit {
    animation: svgPulseGlow 2.2s ease-in-out infinite !important;
}

.lobby-bar-btn-side text {
    font-family: Arial Black, Arial, sans-serif;
}

/* ==========================================
   ✅ LEVEL BADGE - HOME มุมขวาล่าง / ATTACK มุมซ้ายล่าง (ตำแหน่งสมมาตร)
   ========================================== */
.level-badge {
    position: absolute !important;
    bottom: -8px !important;
    right: 8px !important;
    left: auto !important;
    top: auto !important;
    background: transparent !important;
    background-image: none !important;
    color: #ffd700 !important;
    font-size: 14px !important;
    font-weight: 900 !important;
    padding: 0 4px 2px 0 !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 302 !important;
    font-family: Arial Black, Arial, sans-serif;
    white-space: nowrap;
    box-shadow: none !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    line-height: 1.1;
}

.level-badge.level-badge-attack,
.svg-button-container > .level-badge#attackLevelBadge {
    right: auto !important;
    left: 8px !important;
    padding: 0 0 2px 4px !important;
}

/* เว็บ/เดสก์ท็อป: Lv ใหญ่ หนา สีเหลืองเหมือน HOME ไม่มีพื้นหลัง */
@media (min-width: 769px) {
  .svg-button-container > .level-badge#levelBadge,
  .svg-button-container > .level-badge#attackLevelBadge {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #ffd700 !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    border: 0 !important;
    box-shadow: none !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
    font-family: Arial Black, Arial, sans-serif !important;
  }
  .svg-button-container > .level-badge#levelBadge {
    padding: 0 5px 2px 0 !important;
  }
  .svg-button-container > .level-badge#attackLevelBadge {
    padding: 0 0 2px 5px !important;
  }
}

/* ==========================================
   ✅ COUNTDOWN — ย้ายไปช่องเล็กใต้ ROBIT
   ========================================== */
.tab-item-lobby .lv-countdown-box {
    display: none !important;
}

.robit-countdown-slot #lobbyCountdown {
    color: #fff8e0 !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
    line-height: 1;
}

/* ซ่อนส่วนที่ไม่ใช้แล้ว */
.lobby-country, .lobby-stars { 
    display: none !important; 
}

/* ==========================================
   WORLD PAGE — ฐานโลกเต็มจอ (Google Earth shell)
   ========================================== */
#worldPage.world-page {
  padding: 0;
  overflow: hidden;
  background-color: #6ec8f8;
  background-image: url('../assets/images/player-sky-backdrop.jpg?v=20260930sky1');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 110;
}

#worldPage.world-page.active {
  display: block;
}

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

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

.world-resource-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

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

.world-back-btn {
  pointer-events: auto;
  position: relative;
  margin: 0;
  padding: 0;
  width: min(90px, 27vw);
  border: none;
  border-radius: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  transition: transform 0.18s cubic-bezier(0.22, 1.28, 0.36, 1), filter 0.18s ease-out;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.65)) drop-shadow(0 3px 6px rgba(0, 200, 255, 0.28));
}

.world-back-btn img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.world-back-btn:hover {
  background: transparent;
  filter: brightness(1.08) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.72)) drop-shadow(0 4px 8px rgba(0, 200, 255, 0.36));
}

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

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

.world-page-hint {
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* ==========================================
   BUSINESS PAGE - Map
   ========================================== */
#businessPage {
    background: transparent;
    overflow: hidden;
}

.biz-stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-radius: 12px;
}

.biz-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.biz-stat-icon { font-size: 24px; }
.biz-stat-icon .game-icon-key {
  width: 28px;
  height: 28px;
  vertical-align: middle;
}
.biz-stat-value { color: #d4af37; font-size: 24px; font-weight: bold; }
.biz-stat-label { color: #888; font-size: 14px; }

.map-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 250px);
    overflow: hidden;
    background: #0a0a0a;
    border-radius: 12px;
    border: none;
    touch-action: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.map-content {
    position: relative;
    width: 1290px;
    height: 800px;
    background: radial-gradient(circle at center, #1a1a1a 0%, #0a0a0a 100%);
    transform-origin: center center;
}

.level-node {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #d4af37;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    box-sizing: border-box;
}

.level-node:hover { transform: scale(1.1); }

.level-node.unlocked {
    border-color: #00cc66;
    box-shadow: 0 0 20px rgba(0, 204, 102, 0.6);
}

.level-node.current {
    border-color: #ffd700;
    animation: pulseYellow 2s infinite;
}

@keyframes pulseYellow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); border-color: #ffd700; }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.9); border-color: #ffed4e; }
}

.level-node.locked {
    border-color: #444;
    background: #222;
    opacity: 0.4;
    cursor: not-allowed;
}

.level-node .lv-icon { font-size: 24px; margin-bottom: 2px; }
.level-node .lv-text { color: #fff; font-size: 14px; font-weight: bold; }
.level-node .lv-req { color: #888; font-size: 10px; }

.modal-back-btn {
    position: relative;
    width: min(126px, 36vw);
    max-width: 154px;
    margin: 16px 0 12px 0;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.65)) drop-shadow(0 3px 6px rgba(0, 200, 255, 0.28));
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: transparent;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    transform-origin: center center;
    transition: transform 0.18s cubic-bezier(0.22, 1.28, 0.36, 1), filter 0.15s ease;
}

.modal-back-btn img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    user-select: none;
}

.modal-back-btn:hover {
    filter: brightness(1.08) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.72)) drop-shadow(0 4px 8px rgba(0, 200, 255, 0.36));
}

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

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

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .player-balance { grid-template-columns: repeat(2, 1fr); }
    .balance-item .value { font-size: 20px; }
    
    .tab-bar { min-height: calc(64px + env(safe-area-inset-bottom, 0px)); height: auto; }
    .tab-item .icon { font-size: 24px; }
    .tab-item .icon.tab-home-icon {
      width: 52px;
      height: 52px;
    }
    .lobby-earth-stack {
      width: 62px;
      height: 62px;
    }
    .tab-item-lobby {
      margin-top: -24px;
    }
    .tab-item .icon.tab-home-icon .lobby-earth-canvas {
      width: 52px !important;
      height: 52px !important;
    }
    .tab-item .label { font-size: 10px; }
    
    .setting-btn { 
        width: clamp(56px, 15vw, 68px);
        height: clamp(56px, 15vw, 68px);
        font-size: clamp(34px, 8.5vw, 46px);
        margin: -6px 0 0 -8px;
        position: relative;
        top: -4px;
        left: -4px;
    }

    .lobby-bag-stack {
        margin: -6px -8px 0 auto;
        position: relative;
        top: -4px;
        right: -4px;
    }

    .lobby-header .bag-btn {
        width: clamp(61px, 15vw, 73px);
        height: clamp(61px, 15vw, 73px);
        font-size: clamp(39px, 8.5vw, 51px);
        margin: 0;
        background: transparent;
    }

    .lobby-biz-icon-img {
        width: 100%;
        height: 100%;
    }

    #lobbyPage {
        padding-top: 8px;
        padding-left: 8px;
        --lobby-star-top: calc(env(safe-area-inset-top, 0px) + 42px);
        /* ช่องแสดงผลหลัก — ขึ้น 37px จากฐานเดิม (จาก 32px อีก 5px) */
        --lobby-main-display-top: calc(env(safe-area-inset-top, 0px) + 52px + 1.55rem + 34px + 18px - 37px);
    }

    .lobby-header {
        margin-bottom: 18px;
    }
    
    .lobby-stars-top {
        font-size: 48.64px;
        top: var(--lobby-star-top, calc(env(safe-area-inset-top, 0px) + 42px)) !important;
        pointer-events: none;
        height: auto;
        min-height: 0;
        max-height: none;
        --lobby-star-cell: 48.64px;
        --lobby-star-icon: 48.64px;
        --lobby-star-outer-extra-x: 48.64px;
        padding: 4px calc(4px + var(--lobby-star-outer-extra-x));
    }

    .lobby-stars-top .lobby-star-spin {
        width: 48.64px;
        height: 48.64px;
        min-width: 48.64px;
        max-width: 48.64px;
        min-height: 48.64px;
        max-height: 48.64px;
        flex: 0 0 48.64px;
        margin: 0;
        overflow: visible;
    }

    .lobby-stars-top .format-number {
        width: auto;
        min-width: 48.64px;
        max-width: none;
        height: 48.64px;
        min-height: 48.64px;
        max-height: 48.64px;
        flex: 0 0 auto;
        padding: 0 12px;
        margin: 0;
        overflow: visible;
        white-space: nowrap;
    }
    
    .svg-button-container {
        height: 72px !important;
    }
    
    .svg-button-container .level-badge {
        bottom: -8px !important;
        right: 8px !important;
        left: auto !important;
        top: auto !important;
        background: transparent !important;
        color: #ffd700 !important;
        font-size: 17px !important;
        font-weight: 900 !important;
        padding: 0 3px 1px 0 !important;
        border: none !important;
        box-shadow: none !important;
        line-height: 1 !important;
        font-family: Arial Black, Arial, sans-serif !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7) !important;
        -webkit-text-stroke: 0.35px #ffd700;
    }
    .svg-button-container .level-badge.level-badge-attack,
    .svg-button-container .level-badge#attackLevelBadge {
        right: auto !important;
        left: 8px !important;
        padding: 0 0 1px 3px !important;
    }
    .level-node .lv-icon { font-size: 20px; }
    .level-node .lv-text { font-size: 12px; }
}

@media (max-width: 375px) {
    .svg-button-container {
        height: 68px !important;
    }
    
    .svg-button-container .level-badge {
        bottom: -8px !important;
        right: 8px !important;
        left: auto !important;
        background: transparent !important;
        color: #ffd700 !important;
        font-size: 15px !important;
        font-weight: 900 !important;
        padding: 0 2px 1px 0 !important;
        border: none !important;
        box-shadow: none !important;
        line-height: 1 !important;
        font-family: Arial Black, Arial, sans-serif !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7) !important;
        -webkit-text-stroke: 0.35px #ffd700;
    }
    .svg-button-container .level-badge.level-badge-attack,
    .svg-button-container .level-badge#attackLevelBadge {
        right: auto !important;
        left: 8px !important;
        padding: 0 0 1px 2px !important;
    }
    .svg-button-container {
        height: 78px !important;
    }
    
    .svg-button-container .level-badge {
        bottom: -8px !important;
        right: 8px !important;
        left: auto !important;
        top: auto !important;
        background: transparent !important;
        color: #ffd700 !important;
        font-size: 17px !important;
        font-weight: 900 !important;
        padding: 0 3px 1px 0 !important;
        border: none !important;
        box-shadow: none !important;
        line-height: 1 !important;
        font-family: Arial Black, Arial, sans-serif !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7) !important;
        -webkit-text-stroke: 0.35px #ffd700;
    }
    .svg-button-container .level-badge.level-badge-attack,
    .svg-button-container .level-badge#attackLevelBadge {
        right: auto !important;
        left: 8px !important;
        padding: 0 0 1px 3px !important;
    }
    .svg-button-container {
        height: 84px !important;
        width: 100% !important;
    }
    
    .level-badge {
        bottom: -8px !important;
        right: 8px !important;
    }
    .level-badge.level-badge-attack,
    .level-badge#attackLevelBadge {
        right: auto !important;
        left: 8px !important;
    }
}

/* จอเว็บใหญ่ (ผู้เล่นเท่านั้น): แถบปุ่มชิดขอบกรอบแนวตั้ง iPad Pro */
@media (min-width: 1025px) {
    html.player-stage .lobby-bottom-dock .svg-button-container {
        height: 84px !important;
        width: 100% !important;
    }

    html.player-stage .level-badge {
        bottom: -8px !important;
        right: 8px !important;
        left: auto !important;
    }
    html.player-stage .level-badge.level-badge-attack,
    html.player-stage .level-badge#attackLevelBadge {
        right: auto !important;
        left: 8px !important;
    }
}

/* มือถือเท่านั้น: Lv ชิดขวาล่าง HOME / ซ้ายล่าง ATTACK, ไม่มีพื้นหลัง, สีเหลือง ใหญ่ หนา */
@media (max-width: 768px) {
  .svg-button-container > .level-badge#levelBadge,
  .svg-button-container > .level-badge#attackLevelBadge {
    position: absolute !important;
    bottom: -8px !important;
    top: auto !important;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #ffd700 !important;
    font-weight: 900 !important;
    font-size: 17px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7) !important;
    -webkit-text-stroke: 0.35px #ffd700;
    font-family: Arial Black, Arial, sans-serif !important;
    line-height: 1 !important;
    z-index: 305 !important;
  }
  .svg-button-container > .level-badge#levelBadge {
    right: 8px !important;
    left: auto !important;
    padding: 0 2px 0 0 !important;
  }
  .svg-button-container > .level-badge#attackLevelBadge {
    left: 8px !important;
    right: auto !important;
    padding: 0 0 0 2px !important;
  }
}


.world-live-status {
  font-weight: 800;
  letter-spacing: 0.4px;
}
