@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================
   Chawwa Ashta - Dark Modern Theme
   Load LAST, after style.css and mobile.css.
   Palette:  night #070814 / indigo #14163A / card #1A1D3A -> #0F1124
             text #F2F4FF / muted #9AA0C0
             teal #3DD6C6 (selected)  amber #FFB020 -> #FF7A18 (main action only)
   ========================================================== */

:root {
  --brass: #8e94c4;
  --gold-accent: #ffb020;
  --gold-glow: rgba(255, 176, 32, 0.45);
  --font-royal: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --t-night: #070814;
  --t-indigo: #14163a;
  --t-card-top: #1a1d3a;
  --t-card-bot: #0f1124;
  --t-raised: #20243d;
  --t-line: rgba(255, 255, 255, 0.08);
  --t-line-strong: rgba(255, 255, 255, 0.16);
  --t-text: #f2f4ff;
  --t-muted: #9aa0c0;
  --t-teal: #3dd6c6;
  --t-amber: linear-gradient(135deg, #ffb020, #ff7a18);
  --t-select: linear-gradient(135deg, #6c4dff, #2fc9b8);
}

:focus-visible { outline: 2px solid var(--t-teal); outline-offset: 2px; }

/* ---------- Base ---------- */
body {
  font-family: var(--font-ui);
  color: var(--t-text);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #1a1c4a 0%, transparent 70%),
    linear-gradient(180deg, var(--t-indigo) 0%, #0a0b1e 50%, var(--t-night) 100%);
  background-attachment: fixed;
}

/* ---------- Header ---------- */
.app-header {
  background: rgba(8, 9, 24, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--t-line);
  box-shadow: none;
}
.title-wrap h1 { font-weight: 800; letter-spacing: 0.5px; color: #fff; text-shadow: none; }
.title-wrap .sub-title { color: var(--t-muted); text-transform: none; letter-spacing: 0.2px; font-size: 12px; }
.logo-icon { filter: none; }

.wallet-badge {
  background: linear-gradient(135deg, #2a2250, #1a1838);
  border: 1px solid rgba(255, 176, 32, 0.45);
  color: #ffc247;
  box-shadow: none;
}
.wallet-badge:hover { box-shadow: 0 4px 16px rgba(255, 176, 32, 0.25); }
.wallet-add-btn { background: var(--t-amber); color: #1a0e00; }

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--t-line);
  color: var(--t-text);
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--t-line-strong); }

/* ---------- Lobby card (two columns on desktop) ---------- */
.lobby-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 36px;
  row-gap: 0;
  align-content: start;
  max-width: 980px;
  padding: 32px 36px 36px;
  background: linear-gradient(180deg, var(--t-card-top) 0%, var(--t-card-bot) 100%);
  border: 1px solid var(--t-line);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 140px rgba(100, 80, 220, 0.14);
  text-align: left;
}
/* JS toggles inline display; keep grid when shown, hidden when hidden */
.lobby-screen[style*="display: block"] { display: grid !important; }
.lobby-screen[style*="display: none"] { display: none !important; }

.lobby-screen h2,
.lobby-screen .lobby-desc { grid-column: 1 / -1; text-align: center; }
.lobby-screen h2 { font-size: 32px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.lobby-screen .lobby-desc { color: var(--t-muted); font-size: 14px; margin-bottom: 26px; }

.lobby-section { grid-column: 1; margin-bottom: 24px; }
#pass-play-skins-section,
#solo-skin-section { grid-column: 2; grid-row: 3 / span 8; }

.lobby-section label {
  font-size: 14px;
  font-weight: 600;
  color: var(--t-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.choice-row { gap: 10px; }
.lobby-section .choice-row { flex-wrap: wrap; }
.mode-choice-btn { flex: 1 1 calc(50% - 5px); }

.choice-btn {
  min-height: 64px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-line);
  border-radius: 14px;
  color: #c9cdea;
  font-size: 14px;
  font-weight: 600;
}
.choice-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--t-line-strong); }
.choice-btn.active {
  background: var(--t-select);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgba(80, 90, 255, 0.35);
}

/* Bot levels */
.bot-level-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-line);
  border-radius: 14px;
  padding: 12px;
}
.bot-level-card:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--t-line-strong); }
.bot-level-card.active {
  background: rgba(61, 214, 198, 0.1);
  border-color: var(--t-teal);
  box-shadow: none;
}
.bot-level-card .b-title { color: #fff; font-size: 14px; }
.bot-level-card .b-desc { color: var(--t-muted); font-size: 12.5px; line-height: 1.4; }
.bot-level-card .b-badge { border-radius: 999px; padding: 2px 8px; }

/* Player tabs */
.player-skin-tabs-row { justify-content: flex-start; gap: 8px; }
.player-skin-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--t-line);
  border-radius: 999px;
  color: #c9cdea;
  font-size: 13px;
}
.player-skin-tab-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--t-line-strong); }
.player-skin-tab-btn.active {
  background: var(--t-select);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(80, 90, 255, 0.3);
}

/* ---------- Skin grid ---------- */
.skin-dialogue-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 4px;
}
.skin-card-box {
  width: auto;
  min-width: 0;
  height: 108px;
  background: linear-gradient(180deg, #20243d, #151830);
  border: 1px solid var(--t-line);
  border-radius: 16px;
}
.skin-card-box:hover { transform: translateY(-2px); border-color: var(--t-line-strong); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
.skin-card-box.active-selected {
  background: linear-gradient(180deg, #17353f, #12242e) !important;
  border-color: var(--t-teal) !important;
  box-shadow: 0 0 0 1px var(--t-teal), 0 0 22px rgba(61, 214, 198, 0.3) !important;
}
.skin-card-goti-ring {
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: none;
  background: rgba(0, 0, 0, 0.25);
}
.skin-card-label { font-size: 13px; font-weight: 600; color: var(--t-text); max-width: 100%; }
.skin-card-crown { top: 6px; right: 8px; bottom: auto; font-size: 14px; }

/* Taken skins: dimmed, short "In use" instead of loud red text */
.skin-card-overlay-equipped {
  background: rgba(7, 8, 20, 0.72);
  border-radius: 16px;
  font-size: 0;
  backdrop-filter: none;
}
.skin-card-overlay-equipped::after {
  content: 'In use';
  font-size: 12px;
  font-weight: 600;
  color: var(--t-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Wallet card + secondary buttons ---------- */
.lobby-wallet-card {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-line);
  border-radius: 16px;
  margin-bottom: 18px;
}
.lobby-wallet-info .w-title { color: #fff; font-size: 14px; }
.lobby-wallet-info .w-sub { color: var(--t-muted); font-size: 12.5px; }

.btn-open-wallet {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--t-line-strong);
  color: #fff;
}
.btn-open-wallet:hover { box-shadow: none; background: rgba(255, 255, 255, 0.14); }

.btn-watch-ad {
  background: rgba(61, 214, 198, 0.14);
  border: 1px solid var(--t-teal);
  color: #7cf0e3;
  box-shadow: none;
}
.btn-watch-ad:hover:not(:disabled) { background: rgba(61, 214, 198, 0.24); box-shadow: none; }
.btn-watch-ad:disabled { background: rgba(255, 255, 255, 0.05); border-color: var(--t-line); color: var(--t-muted); }

/* Start = the one bright thing */
.btn-start-game {
  grid-column: 1 / -1;
  background: var(--t-amber);
  border: none;
  border-radius: 16px;
  color: #1a0e00;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 17px;
  box-shadow: 0 10px 30px rgba(255, 122, 24, 0.35);
}
.btn-start-game:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(255, 122, 24, 0.5); }

/* Online room */
.online-room-box { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--t-line); border-radius: 14px; }
.room-code-input { background: #0f1124; border: 1px solid var(--t-line-strong); color: #fff; }
.room-code-banner { background: rgba(61, 214, 198, 0.1); border: 1px solid rgba(61, 214, 198, 0.5); }
.room-code-big { color: var(--t-teal); }

/* ---------- In-game ---------- */
.turn-banner,
.player-status-card,
.commentary-box,
.kaudya-tray-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-line);
  box-shadow: none;
}
.turn-banner { border-radius: 14px; }
.turn-banner .turn-tag { color: var(--t-muted); letter-spacing: 1px; }
.turn-banner .current-player-name { font-weight: 800; }

.extra-turn-badge { background: var(--t-amber); color: #1a0e00; }

.player-status-card { border-left-width: 4px; }
.player-status-card.active-turn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(61, 214, 198, 0.55);
  box-shadow: none;
}
.p-pawn-stats { color: var(--t-muted); }
.tod-pill.unlocked { background: rgba(61, 214, 198, 0.15); border-color: var(--t-teal); color: #7cf0e3; }

.commentary-header { color: var(--t-muted); text-transform: none; letter-spacing: 0; font-size: 12px; border-bottom-color: var(--t-line); }
.commentary-entry { color: #c9cdea; border-bottom-color: var(--t-line); }
.commentary-feed::-webkit-scrollbar-thumb { background: #3a3f70; }

/* Board */
.board-outer-frame {
  background: linear-gradient(145deg, #1e2142, #10122a);
  border: 1px solid var(--t-line-strong);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}
.corner-ornament { display: none; }
.board-grid { background: #0b0d22; border-radius: 12px; }
.board-cell { background: #efebdf; }
.board-cell.cell-safe { background: #f7e8bf; }

.kaudya-tray-card { border-radius: 18px; }
.kaudya-tray-header { color: var(--t-muted); text-transform: none; letter-spacing: 0; }
.kaudya-board {
  background: radial-gradient(circle at center, #2a2d58 0%, #14162f 85%);
  border: 1px solid var(--t-line);
}
.roll-result-badge { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--t-line); }
.roll-result-text { color: #ffc247; }

.btn-roll-kaudya {
  background: var(--t-amber);
  border: none;
  color: #1a0e00;
  box-shadow: 0 8px 24px rgba(255, 122, 24, 0.35);
}
.btn-roll-kaudya:hover:not(:disabled) { box-shadow: 0 12px 32px rgba(255, 122, 24, 0.5); }
.btn-roll-kaudya:disabled { background: #2a2d4f; color: var(--t-muted); box-shadow: none; opacity: 1; }

.btn-hint { background: linear-gradient(135deg, #1fb5a6, #127d8f); border: none; box-shadow: none; }
.btn-jugda-action { animation: none; border-color: transparent; background: linear-gradient(135deg, #7c4dff, #4a2bd0); box-shadow: 0 8px 22px rgba(100, 70, 255, 0.4); }
.btn-secondary { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--t-line); color: var(--t-text); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--t-line-strong); }

/* ---------- Modals ---------- */
.modal-overlay { background: rgba(4, 5, 14, 0.82); }
.modal-card {
  background: linear-gradient(180deg, var(--t-card-top), var(--t-card-bot));
  border: 1px solid var(--t-line-strong);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}
.modal-header { background: transparent; border-bottom: 1px solid var(--t-line); }
.modal-header h3 { font-family: var(--font-royal); color: #fff; }
.modal-close-btn { color: var(--t-muted); }

.wallet-tabs { border-bottom-color: var(--t-line); }
.wallet-tab-btn { background: rgba(255, 255, 255, 0.04); color: var(--t-muted); border-radius: 10px; }
.wallet-tab-btn.active { background: rgba(61, 214, 198, 0.14); border-color: var(--t-teal); color: #7cf0e3; }
.wallet-balance-banner { background: linear-gradient(135deg, #251f4d, #15142e); border: 1px solid rgba(255, 176, 32, 0.35); }
.wallet-balance-banner .bal-title { color: var(--t-muted); }
.wallet-balance-banner .bal-amount { color: #ffc247; }

.theme-card { background: rgba(255, 255, 255, 0.04); border-radius: 14px; }
.theme-card.theme-free { border: 1px solid var(--t-line); }
.theme-card.theme-paid-gold { border: 1px solid rgba(255, 176, 32, 0.5); box-shadow: none; }
.theme-card.theme-paid-gold:hover { box-shadow: 0 6px 18px rgba(255, 176, 32, 0.2); }
.theme-card.active-equipped { border-color: var(--t-teal) !important; box-shadow: 0 0 0 1px var(--t-teal) !important; }
.theme-desc { color: var(--t-muted); }
.badge-paid { background: rgba(255, 176, 32, 0.15); color: #ffc247; border-color: rgba(255, 176, 32, 0.6); }

.reward-ad-card,
.hints-store-box,
.blueprint-card,
.monetag-config-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-line);
}
.reward-ad-card.ad-card-featured { background: rgba(255, 255, 255, 0.06); border-color: rgba(61, 214, 198, 0.5); box-shadow: none; }
.reward-ad-sub { color: var(--t-muted); }
.ad-stats-strip { background: rgba(255, 255, 255, 0.04); border-color: var(--t-line); color: #c9cdea; }
.monetag-input { background: #0f1124; border-color: var(--t-line-strong); color: #fff; }

.btn-pay-now,
.btn-confirm-pay {
  background: var(--t-amber);
  border: none;
  color: #1a0e00;
  box-shadow: 0 8px 22px rgba(255, 122, 24, 0.3);
}
.btn-confirm-cancel { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--t-line-strong); color: #fff; }
.btn-stepper { background: rgba(255, 255, 255, 0.06); border-color: var(--t-line-strong); color: #fff; }
.confirm-purchase-box p { color: var(--t-text); }

.rules-list h4 { color: #7cf0e3; font-family: var(--font-royal); font-size: 16px; margin: 16px 0 6px; }
.rules-list h4:first-child { margin-top: 0; }
.rules-list ul { padding-left: 18px; }
.rules-list li { color: #c9cdea; font-size: 14px; line-height: 1.55; margin-bottom: 4px; }

.victory-title { color: #ffc247; }
.receipt-row { color: #c9cdea; border-bottom-color: var(--t-line); }

.chawwa-toast { background: rgba(20, 22, 50, 0.97); border: 1px solid var(--t-line-strong); }

/* ---------- Online room: two clear choices ---------- */
.online-room-box {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.room-option {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.room-option-head { display: flex; align-items: center; gap: 12px; }
.room-option-icon {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(108, 77, 255, 0.18);
  font-size: 18px;
}
.room-option-title { font-size: 14.5px; font-weight: 700; color: #fff; }
.room-option-sub { font-size: 12.5px; color: var(--t-muted); margin-top: 2px; line-height: 1.35; }

.btn-room {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-room-primary {
  width: 100%;
  background: var(--t-select);
  border: none;
  color: #fff;
  box-shadow: 0 8px 22px rgba(80, 90, 255, 0.3);
}
.btn-room-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(80, 90, 255, 0.45); }
.btn-room-secondary {
  background: rgba(61, 214, 198, 0.14);
  border: 1px solid var(--t-teal);
  color: #7cf0e3;
}
.btn-room-secondary:hover { background: rgba(61, 214, 198, 0.26); }

.room-join-row { display: flex; gap: 8px; }
.room-join-row .room-code-input {
  flex: 1; min-width: 0; min-height: 46px;
  text-align: center;
  font-size: 16px;
  letter-spacing: 3px;
}
.room-join-row .room-code-input::placeholder {
  letter-spacing: 0; font-weight: 600; font-size: 13.5px; color: var(--t-muted);
}
.room-join-row .room-code-input:focus {
  outline: none; border-color: var(--t-teal);
  box-shadow: 0 0 0 3px rgba(61, 214, 198, 0.18);
}

.room-or {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 4px;
  color: var(--t-muted); font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
}
.room-or::before, .room-or::after { content: ''; flex: 1; height: 1px; background: var(--t-line); }

.room-code-banner { margin-top: 14px; padding: 14px; border-radius: 14px; gap: 12px; }
.room-code-info { min-width: 0; }
.room-code-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--t-muted); }
.room-code-big { font-size: 28px; letter-spacing: 5px; margin: 2px 0 4px; }
.room-code-status { font-size: 13px; color: #c9cdea; }
.room-code-expiry { font-size: 12px; color: #ffc247; font-weight: 700; margin-top: 4px; }
.room-code-expiry:empty { display: none; }
.btn-copy-code { flex: 0 0 auto; min-height: 42px; padding: 8px 16px; font-size: 13px; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  /* Block layout so the Start button can stay pinned to the bottom */
  .lobby-screen { display: block; padding: 20px 14px 14px; border-radius: 20px; }
  .lobby-screen[style*="display: block"] { display: block !important; }
  .lobby-screen[style*="display: none"] { display: none !important; }
  .lobby-screen h2 { font-size: 26px; }
  .lobby-screen .lobby-desc { margin-bottom: 20px; }
  .room-join-row .room-code-input { min-height: 50px; }
  .btn-room { min-height: 50px; }
  .room-code-big { font-size: 24px; }

  .choice-btn { min-height: 64px; }
  .count-choice-btn { min-height: 52px; }
  .bot-level-grid { grid-template-columns: 1fr; }

  .skin-dialogue-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .skin-card-box { width: auto; min-width: 0; height: 98px; }
  .skin-card-label { font-size: 12.5px; }

  .lobby-wallet-card { margin-top: 8px; }

  .btn-start-game {
    position: sticky;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 10;
    min-height: 60px;
    font-size: 19px;
    margin-top: 8px;
  }
  /* Soft fade above the pinned button */
  .btn-start-game::before {
    content: '';
    position: absolute;
    left: -14px;
    right: -14px;
    top: -30px;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #0f1124);
    pointer-events: none;
  }

  /* Board fits any phone width (safe even if mobile.css is not loaded) */
  .board-grid {
    grid-template-columns: repeat(5, min(86px, calc((100vw - 54px) / 5)));
    grid-template-rows: repeat(5, min(86px, calc((100vw - 54px) / 5)));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
