/* ========== GLOBAL / APP SHELL ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, #3a2a12 0, #070509 45%, #000 100%);
  color: #f8f5e9;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 24px;
}

/* ========== TOP BAR / BRANDING ========== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #fff7d4 0, #b98b28 40%, #2c2012 70%);
  position: relative;
  box-shadow: 0 0 0 1px rgba(255, 230, 170, 0.7),
              0 8px 20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

/* ใช้ favicon เป็นโลโก้ */
.logo-circle::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: url("favicon.png") center/cover no-repeat;
}

.app-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-title {
  font-size: 18px;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
}

.app-subtitle {
  font-size: 12px;
  opacity: 0.7;
}

/* LANGUAGE SWITCH */
.lang-switch {
  display: flex;
  gap: 4px;
}

.lang-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid rgba(230, 195, 115, 0.8);
  background: rgba(0, 0, 0, 0.4);
  color: #fbe9b9;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.14s ease-out, transform 0.12s ease-out;
}

.lang-btn.active {
  background: radial-gradient(circle at 30% 0, #f8f1d3, #a77b1e);
  color: #20140a;
  transform: translateY(-1px);
}

/* ========== PANELS ========== */
.panel {
  background: linear-gradient(145deg, rgba(9, 9, 12, 0.96), rgba(16, 11, 6, 0.98));
  border-radius: 18px;
  padding: 14px 12px 12px;
  border: 1px solid rgba(233, 201, 111, 0.7);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(10, 10, 12, 0.9);
  margin-bottom: 14px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.panel-desc {
  margin: 0;
  font-size: 13px;
  opacity: 0.75;
}

.panel-desc.small {
  font-size: 12px;
}

/* ========== TEXT HELPERS ========== */
.section-title {
  margin: 0;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #f3e3b1;
}

.hint-text {
  margin: 6px 0 0;
  font-size: 11px;
  opacity: 0.6;
  text-align: center;
}

/* ========== BOARD ========== */
.board-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.board {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 4px;
}

.card-slot {
  width: 84px;
  height: 120px;
  background: #141013 url("images/cardsset/luxu-logo.png") center/contain no-repeat;
  border-radius: 8px;
  border: 1px solid rgba(235, 207, 122, 0.85);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(40, 30, 15, 0.85);
  cursor: pointer;
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out,
    border-color 0.16s ease-out;
}

.card-slot:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 236, 170, 0.95);
  border-color: #ffe89a;
}

/* ========== PLAYER AREA ========== */
.player-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  margin-bottom: 10px;
}

.toggle-label {
  font-size: 12px;
  opacity: 0.7;
}

.toggle-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid rgba(230, 195, 115, 0.9);
  background: radial-gradient(circle at 30% 0, #f8f1d3, #a77b1e);
  color: #20140a;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

.chip-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
}

/* PLAYER ROWS */
.player-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.player {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
  background: radial-gradient(circle at top, #2b2115 0, #0c0905 55%);
  border-radius: 14px;
  padding: 10px 9px 9px;
  border: 1px solid rgba(207, 176, 103, 0.9);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* จะ override ด้านล่างเพื่อจัด center */

/* HEADER ใน PLAYER */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-tag {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffeab3;
}

.player-role {
  font-size: 11px;
  opacity: 0.7;
}

/* PLAYER CARDS */
.card-row {
  display: flex;
  gap: 6px;
  margin: 6px 0 2px;
}

.player .card-slot {
  width: 80px;
height: 115px;

}

/* OUTS BOX */
.outs-box {
  font-size: 11px;
  font-weight: 600;
  color: #f8e18a;
  margin-top: 2px;
  text-align: left;
  line-height: 1.35;
}

/* ========== BUTTONS ========== */
button {
  border: none;
  outline: none;
  font-family: inherit;
}

.btn-ghost {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid rgba(230, 193, 115, 0.8);
  color: #f7e7af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.9;
  transition: background 0.14s ease-out, color 0.14s ease-out, transform 0.12s ease-out;
}

.btn-ghost:hover {
  background: rgba(240, 212, 134, 0.12);
  transform: translateY(-1px);
}

/* ACTION BUTTONS */
.actions-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

#reset {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff8f2;
  background: linear-gradient(135deg, #ff5656, #b61e1e);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.9);
  cursor: pointer;
  transition: transform 0.13s ease-out, box-shadow 0.13s ease-out;
}

#reset:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 1);
}

.btn-outline {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1px solid rgba(236, 209, 139, 0.9);
  color: #fbe9b9;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
  transition: background 0.14s ease-out, color 0.14s ease-out, transform 0.13s ease-out;
}

.btn-outline:hover {
  background: rgba(240, 214, 146, 0.15);
  transform: translateY(-1px);
}

/* ========== DETAILS BOX ========== */
.detail-box {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed rgba(222, 191, 115, 0.8);
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  max-height: 220px;
  overflow-y: auto;
  background: rgba(7, 6, 4, 0.85);
}

/* การ์ดตัวอักษรใน detail */
.card.red {
  color: #ff6b6b;
}

.card.black {
  color: #f8f4e2;
}

/* ========== POPUPS (CARD + RATE) ========== */
.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 420px;
  max-height: 85vh;
  background: #1a1a1a;
  border-radius: 14px;
  box-shadow: 0 0 25px rgba(0,0,0,0.6);
  z-index: 9999;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid rgba(255, 215, 140, 0.35);
}


.popup-inner {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  background: radial-gradient(circle at top, #2d2215 0, #060508 55%);
  border-radius: 18px;
  border: 1px solid rgba(235, 205, 130, 0.85);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 1);
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
}

.popup-inner-small {
  max-width: 360px;
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.popup-title {
  font-size: 20px;
  text-align: center;
  color: #ffe9b5;
  margin-bottom: 10px;
  font-weight: 600;
}

.popup-close {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(240, 211, 142, 0.8);
  color: #fbeec4;
  cursor: pointer;
  transition: background 0.14s ease-out, transform 0.12s ease-out;
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

/* TAB BUTTONS (SUITS) */
.popup-tabs {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.tab-btn {
  flex: 1;
  padding: 7px 8px;
  border-radius: 999px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #fef7dd;
  cursor: pointer;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, filter 0.12s ease-out;
}

.tab-btn:nth-child(1) { background: linear-gradient(135deg, #0b4c27, #052812); }
.tab-btn:nth-child(2) { background: linear-gradient(135deg, #134e82, #072338); }
.tab-btn:nth-child(3) { background: linear-gradient(135deg, #7b1010, #3b0606); }
.tab-btn:nth-child(4) { background: linear-gradient(135deg, #1a1a1a, #050505); }

.tab-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 13px rgba(0, 0, 0, 0.8);
  filter: brightness(1.08);
}

/* CARDS IN POPUP */
.tab-content {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: 6px;
}

.tab-content img {
  width: 58px;
  margin: 5px;
  cursor: pointer;
  border-radius: 10px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.75);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.tab-content img:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.9);
}

/* RATE TABLE */
.rate-table {
  width: 100%;
  font-size: 16px;
  color: #f8f4e0;
}

.rate-table th {
  font-size: 16px;
  padding: 6px 0;
}

.rate-table td {
  padding: 6px 0;
}

.rate-table thead {
  border-bottom: 1px solid rgba(235, 205, 130, 0.9);
}

.rate-table tbody tr:nth-child(odd) {
  background: rgba(0, 0, 0, 0.25);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 380px) {
  .player {
    flex: 1 1 100%;
  }

  .player .card-slot {
    width: 60px;
    height: 88px;
  }

  .board .card-slot {
    width: 64px;
    height: 92px;
  }
}

/* --- FIX: Centering for player card UI --- */
.player {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-row {
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.outs-box {
  text-align: center;
  width: 100%;
  margin-top: 4px;
}

/* (… โค้ดเดิมของคุณสำหรับ global, panel, board, player, popup ฯลฯ …) */

/* ========== INFO PANEL / EDUCATIONAL CONTENT ========== */
.panel-info .info-content {
  font-size: 13px;
  line-height: 1.6;
  color: #f8f5e9;
  opacity: 0.9;
}

.panel-info p {
  margin: 6px 0;
}

.panel-info .info-disclaimer {
  font-size: 12px;
  opacity: 0.8;
  border-top: 1px dashed rgba(222, 191, 115, 0.8);
  padding-top: 6px;
}

/* ========== FOOTER ========== */
.site-footer {
  margin-top: 6px;
  padding: 8px 4px 0;
  text-align: center;
  font-size: 11px;
  color: rgba(248, 245, 233, 0.7);
}

.footer-text {
  margin: 0;
}

/* --- FIX: Centering for player card UI --- */
.player {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-row {
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.outs-box {
  text-align: center;
  width: 100%;
  margin-top: 4px;
}
.panel-info a {
  color: #e9d081;
  text-decoration: none;
  font-weight: 500;
}

.panel-info a:hover {
  text-decoration: underline;
}
.rate-note {
  font-size: 12.5px; 
  line-height: 1.45;
  text-align: center;
  color: rgba(255, 240, 200, 0.82);
  margin-bottom: 14px;
}
.popup-close {
  background: none;
  border: none;
  color: #e8cf95;
  font-size: 22px;
  position: absolute;
  top: 8px;
  right: 10px;
  cursor: pointer;
}
.popup-close:hover {
  color: #fff4d2;
}
.info-feature-text {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  opacity: 0.95;
}
/* Panel for Privacy Policy & Terms */
.info-panel {
  margin: 32px auto;
  max-width: 800px;
  padding: 20px;
  background: rgba(20, 15, 10, 0.85);
  border: 1px solid rgba(235, 207, 122, 0.3);
  border-radius: 12px;
  color: #e7dcb5;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

.info-panel h2 {
  color: #f1d98b;
  margin-bottom: 12px;
}

.info-panel a {
  color: #ffde79;
  text-decoration: underline;
}

.site-footer .footer-text a {
  color: #ffde79;
  text-decoration: none;
  margin: 0 4px;
}

.site-footer .footer-text a:hover {
  text-decoration: underline;
}
