/* ═══════════════════════════════════════════════════════════════════════════
   RESET & COMMON STYLES
   ════════════════════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0a0a0a;
  color: #fff;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: #d4af37;
  text-decoration: none;
}

a:hover {
  color: #f5d76e;
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

button:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #333;
}

th {
  background: #1a1a1a;
  color: #d4af37;
  font-weight: bold;
}

tr:hover {
  background: rgba(212, 175, 55, 0.05);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: #d4af37;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #f5d76e;
}

/* Selection */
::selection {
  background: #d4af37;
  color: #000;
}

/* Focus */
*:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Responsive */
@media (max-width: 768px) {
  html { font-size: 14px; }
}

@media (max-width: 480px) {
  html { font-size: 12px; }
}
/* ═══════════════════════════════════════════════════════════════════════════
   Desktop web (ผู้เล่นเท่านั้น): กรอบแนวตั้ง iPad Pro 12.9"
   ห้องแอดมินใช้ html.admin-fullscreen → จอเต็มเว็บ
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {
  html.player-stage {
    --stage-w: min(1024px, 100vw, calc(100vh * 1024 / 1366));
    --stage-h: min(1366px, 100vh, calc(100vw * 1366 / 1024));
    --stage-left: calc((100vw - var(--stage-w)) / 2);
    --stage-top: calc((100vh - var(--stage-h)) / 2);
    background: #000;
    height: 100%;
    overflow: hidden;
  }

  html.player-stage body {
    position: fixed !important;
    top: var(--stage-top) !important;
    left: var(--stage-left) !important;
    width: var(--stage-w) !important;
    height: var(--stage-h) !important;
    max-width: var(--stage-w) !important;
    max-height: var(--stage-h) !important;
    margin: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    background: #0a0a0a;
    box-shadow: 0 0 0 2px #1c1c1c, 0 0 80px rgba(0, 0, 0, 0.85);
    aspect-ratio: 1024 / 1366;
  }

  html.player-stage #loadingScreen,
  html.player-stage .full-page,
  html.player-stage .modal-overlay:not(.force-update-overlay),
  html.player-stage .tab-bar,
  html.player-stage .social-tab-bar {
    left: var(--stage-left) !important;
    right: auto !important;
    width: var(--stage-w) !important;
    max-width: var(--stage-w) !important;
  }

  html.player-stage #loadingScreen,
  html.player-stage .full-page,
  html.player-stage .modal-overlay:not(.force-update-overlay) {
    top: var(--stage-top) !important;
    height: var(--stage-h) !important;
    max-height: var(--stage-h) !important;
  }

  /* ป๊อปอัปอัปเดตเกม: เต็มจอเสมอ ให้นักเล่นเห็นชัด */
  html.player-stage .force-update-overlay {
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 99999 !important;
  }

  html.player-stage .tab-bar,
  html.player-stage .social-tab-bar {
    bottom: calc(100vh - var(--stage-top) - var(--stage-h)) !important;
    top: auto !important;
  }

  html.player-stage .back-btn {
    left: calc(var(--stage-left) + 20px) !important;
    bottom: calc(100vh - var(--stage-top) - var(--stage-h) + 20px) !important;
  }

  html.player-stage .slot-session-bag-btn {
    right: calc(100vw - var(--stage-left) - var(--stage-w) + 4px) !important;
    bottom: calc(100vh - var(--stage-top) - var(--stage-h) + 4px) !important;
    left: auto !important;
  }

  html.player-stage .toast {
    top: calc(var(--stage-top) + 20px) !important;
    right: calc(100vw - var(--stage-left) - var(--stage-w) + 20px) !important;
    left: auto !important;
  }

  html.player-stage .svg-button-container {
    left: var(--stage-left) !important;
    right: calc(100vw - var(--stage-left) - var(--stage-w)) !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
    bottom: calc(100vh - var(--stage-top) - var(--stage-h) + 110px) !important;
  }

  html.player-stage .level-badge {
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
  }

  html.player-stage .lobby-stars-top {
    top: calc(var(--stage-top) + 20px) !important;
    left: calc(var(--stage-left) + (var(--stage-w) / 2)) !important;
    transform: translateX(-50%) !important;
  }

  html.player-stage .lv-countdown-box {
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  /* ห้องแอดมินเท่านั้น: เต็มจอเว็บ */
  html.admin-fullscreen {
    background: #0a0a0a;
    height: 100%;
    overflow: auto;
  }

  html.admin-fullscreen body {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    margin: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    background: #0a0a0a;
    box-shadow: none !important;
    aspect-ratio: auto !important;
  }

  html.admin-fullscreen #adminPage {
    width: 100% !important;
    max-width: none !important;
    min-height: 100vh;
  }

  html.admin-fullscreen #loadingScreen,
  html.admin-fullscreen .modal-overlay,
  html.admin-fullscreen .toast {
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
  }

  html.admin-fullscreen .toast {
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
  }
}

/* ไอคอนเหรียน (แทน 🪙) / ระเบิด (แทน 💣) / โล่ (แทน 🃏) / ยาน (แทน 🟢) / Grim Reaper (แทน 🔴) */
.game-icon-coin,
.game-icon-grenade,
.game-icon-shield,
.game-icon-starship,
.game-icon-reaper,
.game-icon-bust,
.game-icon-crate,
.game-icon-diamond,
.game-icon-star {
  width: 1.2em;
  height: 1.2em;
  object-fit: contain;
  vertical-align: -0.22em;
  display: inline-block;
  pointer-events: none;
  user-select: none;
  background: transparent;
}

/* Grim Reaper / Crowned Bust / Gold Star: บังคับพื้นไอคอนโปร่งใสทุกจุด */
img.game-icon-reaper,
img.game-icon-bust,
img.game-icon-crate,
img.game-icon-star {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none;
  border: 0;
}

/* เหรียน: เงาอ่อนชุดเดียวกับตอนชนะ/บินเข้ากระเป๋า */
.game-icon-coin {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.store-item .icon .game-icon-coin,
.bank-asset .icon .game-icon-coin,
.store-item .icon .game-icon-grenade,
.bank-asset .icon .game-icon-grenade,
.store-item .icon .game-icon-shield,
.bank-asset .icon .game-icon-shield,
.store-item .icon .game-icon-starship,
.bank-asset .icon .game-icon-starship,
.store-item .icon .game-icon-reaper,
.bank-asset .icon .game-icon-reaper,
.store-item .icon .game-icon-bust,
.bank-asset .icon .game-icon-bust,
.store-item .icon .game-icon-crate,
.bank-asset .icon .game-icon-crate,
.store-item .icon .game-icon-diamond,
.bank-asset .icon .game-icon-diamond,
.store-item .icon .game-icon-star,
.bank-asset .icon .game-icon-star {
  width: 48px;
  height: 48px;
  vertical-align: middle;
}

.reel-col .reel-strip span .game-icon-coin,
.reel-col .reel-strip span .game-icon-grenade,
.reel-col .reel-strip span .game-icon-shield,
.reel-col .reel-strip span .game-icon-starship,
.reel-col .reel-strip span .game-icon-reaper,
.reel-col .reel-strip span .game-icon-bust,
.reel-col .reel-strip span .game-icon-crate,
.reel-col .reel-strip span .game-icon-diamond,
.reel-col .reel-strip span .game-icon-star {
  width: 1.08em;
  height: 1.08em;
  max-width: 98%;
  max-height: 98%;
  vertical-align: middle;
}

#slotWinIcon .game-icon-coin,
.slot-win-icon .game-icon-coin,
#slotWinIcon .game-icon-grenade,
.slot-win-icon .game-icon-grenade,
#slotWinIcon .game-icon-shield,
.slot-win-icon .game-icon-shield,
#slotWinIcon .game-icon-starship,
.slot-win-icon .game-icon-starship,
#slotWinIcon .game-icon-reaper,
.slot-win-icon .game-icon-reaper,
#slotWinIcon .game-icon-bust,
.slot-win-icon .game-icon-bust,
#slotWinIcon .game-icon-crate,
.slot-win-icon .game-icon-crate,
#slotWinIcon .game-icon-diamond,
.slot-win-icon .game-icon-diamond,
#slotWinIcon .game-icon-star,
.slot-win-icon .game-icon-star {
  width: clamp(88px, 20vw, 160px);
  height: clamp(88px, 20vw, 160px);
  object-fit: contain;
  aspect-ratio: 1 / 1;
  vertical-align: middle;
  display: block;
}

#slotWinIcon .game-icon-model,
.slot-win-icon .game-icon-model {
  width: clamp(160px, 42vw, 280px);
  height: clamp(160px, 42vw, 280px);
  display: block;
  background: transparent;
  pointer-events: none;
}

th .game-icon-coin,
th .game-icon-grenade,
th .game-icon-shield,
th .game-icon-starship,
th .game-icon-reaper,
th .game-icon-bust,
th .game-icon-crate,
th .game-icon-diamond,
th .game-icon-star {
  width: 1.3em;
  height: 1.3em;
}

