/* ─── Lanka Ludo – Global Styles ─── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;900&family=Poppins:wght@400;600;700&display=swap');

:root {
  --gold:    #FFD700;
  --gold2:   #FFA500;
  --dark:    #0d0d1a;
  --dark2:   #1a0a2e;
  --panel:   #1e1035;
  --panel2:  #150c28;
  --red:     #e74c3c;
  --blue:    #3498db;
  --green:   #2ecc71;
  --yellow:  #f1c40f;
  --purple:  #6c3fa0;
  --border-gold: 2px solid #FFD700;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: var(--dark);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Gold text ── */
.text-gold { color: var(--gold) !important; }
.text-gold2 { color: var(--gold2) !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--dark2); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ─────────────── APP SHELL ─────────────── */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; overflow: hidden; }

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ─────────────── AUTH SCREENS ─────────────── */
.auth-bg {
  background: radial-gradient(ellipse at top, #3a0a0a 0%, #1a0a2e 40%, #0d0d1a 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.8rem;
  background: linear-gradient(135deg, #FFD700, #FFA500, #FF6B00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  letter-spacing: 3px;
}
.auth-logo .sub { color: #aaa; font-size: 0.85rem; letter-spacing: 2px; margin-top: -5px; }

.auth-card {
  background: linear-gradient(135deg, rgba(30,16,53,0.95), rgba(21,12,40,0.98));
  border: 2px solid #FFD70044;
  border-radius: 20px;
  padding: 30px 25px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,215,0,0.1);
}

.auth-card h2 { color: var(--gold); font-size: 1.4rem; margin-bottom: 20px; text-align: center; }

.form-group { margin-bottom: 16px; }
.form-group label { font-size: 0.8rem; color: #ccc; margin-bottom: 5px; display: block; text-transform: uppercase; letter-spacing: 1px; }
.form-control {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 10px;
  color: #1a0a2e;
  padding: 12px 16px;
  width: 100%;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,215,0,0.2);
}
.form-control::placeholder { color: #999; }
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #1a0a2e;
  -webkit-box-shadow: 0 0 0px 1000px #fff inset;
  box-shadow: 0 0 0px 1000px #fff inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* ─────────────── BUTTONS ─────────────── */
.btn-gold {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #1a0a2e;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(255,165,0,0.4);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(255,165,0,0.6); }
.btn-gold:active { transform: translateY(0); }

.btn-outline-gold {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
  border-radius: 12px;
  padding: 10px 24px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-outline-gold:hover { background: rgba(255,215,0,0.1); }

.btn-ghost {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }

/* ─────────────── HOME SCREEN ─────────────── */
.home-bg {
  background: radial-gradient(ellipse at top, #3d0808 0%, #1a0a2e 50%, #0d0d1a 100%);
  min-height: 100vh;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  position: relative;
  z-index: 10;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(30,16,53,0.9), rgba(50,20,80,0.9));
  border: 2px solid #FFD70066;
  border-radius: 15px;
  padding: 8px 12px;
}
.player-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #2a1550;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  overflow: hidden;
}
.player-name { font-weight: 700; font-size: 0.85rem; color: #fff; }
.player-level { font-size: 0.75rem; color: var(--gold); }
.xp-bar-wrap { width: 80px; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 2px; }
.xp-bar { height: 100%; background: linear-gradient(90deg, #FFD700, #FF6B00); border-radius: 3px; transition: width 0.5s; }

.top-icons { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #2a1550, #3d1a70);
  border: 2px solid #FFD70066;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--gold); transform: scale(1.05); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff;
  font-size: 0.6rem; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--dark);
}

/* Currency bar */
.currency-bar {
  display: flex;
  gap: 8px;
  padding: 0 15px 8px;
}
.currency-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(30,16,53,0.85), rgba(40,20,70,0.85));
  border: 2px solid #FFD70044;
  border-radius: 20px;
  padding: 5px 10px;
  min-width: 110px;
}
.currency-icon { font-size: 1.1rem; }
.currency-val { font-weight: 700; font-size: 0.9rem; color: #fff; }
.currency-add {
  width: 22px; height: 22px;
  background: var(--gold);
  color: #1a0a2e;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  margin-left: auto;
}

/* Hero logo area */
.hero-area {
  text-align: center;
  padding: 10px 15px 5px;
  position: relative;
}
.game-title {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(255,165,0,0.5));
}
.game-title .l1 { color: #FF4444; }
.game-title .l2 { color: var(--gold); }
.game-title .l3 { color: var(--blue); }
.game-title .l4 { color: var(--green); }
.game-title .l5 { color: var(--gold); }

/* Mode buttons */
.mode-section { padding: 10px 15px; }
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 10px;
}
.mode-btn {
  background: linear-gradient(135deg, #1e1035, #2a1550);
  border: 2px solid #FFD70066;
  border-radius: 15px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.mode-btn:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 8px 25px rgba(255,215,0,0.2); }
.mode-btn.online { background: linear-gradient(135deg, #1a0a5e, #2d1a8e); border-color: var(--gold); }
.mode-btn .mode-icon { font-size: 1.8rem; }
.mode-btn .mode-name { font-weight: 700; font-size: 0.95rem; color: var(--gold); }
.mode-btn .mode-sub  { font-size: 0.65rem; color: #aaa; }

/* Quick actions */
.quick-actions { padding: 10px 15px; }
.qa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(30,16,53,0.7), rgba(40,20,70,0.7));
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px;
  padding: 12px 15px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.qa-item:hover { border-color: var(--gold); background: rgba(255,215,0,0.05); }
.qa-icon { font-size: 1.5rem; }
.qa-text .qa-title { font-weight: 600; font-size: 0.9rem; }
.qa-text .qa-sub   { font-size: 0.72rem; color: #aaa; }
.qa-arrow { margin-left: auto; color: var(--gold); }

/* ─────────────── BOTTOM NAV ─────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: url('../assets/images/bottom_bg.png') center center / 100% 100% no-repeat;
  border-top: none;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 14px 10px;
  z-index: 1000;
  box-sizing: border-box;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  transition: transform 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active { transform: scale(0.88); }

/* Nav image icon */
.nav-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  filter: brightness(0.6) saturate(0.5);
  transition: filter 0.22s ease, transform 0.22s ease;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Active nav item — full brightness + gold glow */
.nav-item.active .nav-img {
  filter: brightness(1.2) saturate(1.3)
          drop-shadow(0 0 10px rgba(255, 210, 0, 0.9))
          drop-shadow(0 0 20px rgba(255, 180, 0, 0.5))
          drop-shadow(0 3px 8px rgba(0, 0, 0, 0.7));
  transform: translateY(-3px) scale(1.08) translateZ(0);
}

/* Hover state */
.nav-item:hover .nav-img {
  filter: brightness(0.85) saturate(0.9)
          drop-shadow(0 0 8px rgba(255, 200, 0, 0.5));
  transform: translateY(-1px) translateZ(0);
}

/* ─────────────── GAME BOARD ─────────────── */
.game-screen {
  background: #08080f;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ── Top / Bottom player rows ── */
.gs-top-row, .gs-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  flex-shrink: 0;
  background: #0d0d1e;
}
.gs-top-row    { border-bottom: 1.5px solid rgba(255,80,80,0.3); }
.gs-bottom-row { border-top:    1.5px solid rgba(255,80,80,0.3); }

/* ── Player panels (corners) ── */
.gp-panel {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px 8px;
  min-width: 0;
  min-height: 64px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.gp-panel.gp-active {
  border-color: var(--gold);
  background: rgba(255,215,0,0.08);
  box-shadow: 0 0 10px rgba(255,215,0,0.22);
}
.gp-right { flex-direction: row-reverse; }
.gp-right .gp-info { text-align: right; }

.gp-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid #f1c40f;
  background: #e8a800;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  overflow: hidden;
}
.gp-avatar.gp-av-blue   { border-color: #3498db; background: linear-gradient(135deg,#1a5276,#2980b9); }
.gp-avatar.gp-av-green  { border-color: #2ecc71; background: linear-gradient(135deg,#1e8449,#27ae60); }
.gp-avatar.gp-av-yellow { border-color: #f1c40f; background: linear-gradient(135deg,#b7770d,#e67e22); }
.gp-avatar.gp-av-red    { border-color: #e74c3c; background: linear-gradient(135deg,#922b21,#c0392b); }

.gp-info    { flex: 1; min-width: 0; }
.gp-name    { font-weight: 700; font-size: 0.78rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-loc     { font-size: 0.6rem; color: #888; margin-top: 1px; }
.gp-streak  { font-size: 0.63rem; color: #ff9900; font-weight: 600; margin-top: 1px; }
.gp-hearts  { font-size: 0.65rem; color: #aaa; margin-top: 2px; letter-spacing: 1px; }
.gp-pips    { display: flex; gap: 3px; margin-top: 3px; }
.gp-pip     { width: 7px; height: 7px; border-radius: 50%; }
.gp-pip.home { background: #2ecc71; box-shadow: 0 0 4px rgba(46,204,113,0.7); }
.gp-pip.out  { background: var(--gold); }
.gp-pip.base { background: rgba(255,255,255,0.15); }

/* ── Center timer box ── */
.gs-timer-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0a0a20, #12122e);
  border: 2px solid rgba(255,215,0,0.45);
  border-radius: 24px;
  padding: 5px 12px;
  min-width: 94px;
  flex-shrink: 0;
  position: relative;
  gap: 1px;
}
.gs-quit-btn { display: none; }

.gs-back-row {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px 10px;
  background: #0d0d1e;
  border-top: 1px solid rgba(255,215,0,0.12);
  flex-shrink: 0;
}

.gs-back-btn {
  width: 160px;
  height: 42px;
  border-radius: 22px;
  background: linear-gradient(135deg, #b07800, #FFD700);
  border: 2px solid #FFD700;
  color: #1a0a00;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7a5000, 0 5px 14px rgba(255,215,0,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.gs-back-btn:hover  { box-shadow: 0 6px 0 #7a5000, 0 7px 18px rgba(255,215,0,0.55); transform: translateY(-2px); }
.gs-back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a5000, 0 2px 6px rgba(255,215,0,0.3); }
.gs-clock-icon { font-size: 0.85rem; }
.gs-timer-val  { font-size: 1.25rem; font-weight: 900; color: #00e68a; letter-spacing: 2px; line-height: 1; }
.gs-turn-lbl   { font-size: 0.55rem; color: #aaa; font-weight: 600; letter-spacing: 0.5px; }

/* ── Center dice ── */
.gs-dice-center {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; flex-shrink: 0;
}
.gs-dice-ring {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 3px solid #e74c3c;
  box-shadow: 0 0 16px rgba(231,76,60,0.65), 0 0 32px rgba(231,76,60,0.28), inset 0 0 8px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: #0a0a14;
  transition: box-shadow 0.2s;
}
.gs-dice-ring:hover   { box-shadow: 0 0 22px rgba(231,76,60,0.9), 0 0 40px rgba(231,76,60,0.4); }
.gs-dice-ring:active  { box-shadow: 0 0 10px rgba(231,76,60,0.5); }
.gs-dice-ring.disabled { opacity: 0.45; cursor: not-allowed; }
.gs-mode-lbl { font-size: 0.6rem; color: #555; letter-spacing: 1px; }

/* Dark dice override */
.gs-dice {
  width: 52px !important;
  height: 52px !important;
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 60%, #0e0e0e 100%) !important;
  border-color: #333 !important;
  box-shadow: 0 3px 0 #000, 0 4px 8px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.08) !important;
}
.gs-dice .dot {
  background: radial-gradient(circle at 35% 30%, #ffffff, #d8d8d8) !important;
}

/* ── Online waiting overlay ── */
.waiting-overlay {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13,13,26,0.96);
  z-index: 50;
  padding: 20px;
  text-align: center;
  gap: 8px;
}
.waiting-overlay.show { display: flex; }
.wo-icon  { font-size: 2.5rem; }
.wo-title { font-size: 1rem; font-weight: 700; color: var(--gold); }
.wo-codeblock {
  display: none;
  background: rgba(255,215,0,0.1);
  border: 2px solid rgba(255,215,0,0.4);
  border-radius: 12px;
  padding: 12px 20px;
  margin: 6px 0;
}
.wo-codeblock.show { display: block; }
.wo-code-label { font-size: 0.65rem; color: #aaa; letter-spacing: 1px; margin-bottom: 4px; }
.wo-code       { font-size: 1.8rem; font-weight: 900; color: var(--gold); letter-spacing: 8px; }
.wo-copy-btn {
  margin-top: 6px; background: rgba(255,215,0,0.15); border: 1px solid rgba(255,215,0,0.35);
  color: var(--gold); border-radius: 6px; padding: 3px 12px; cursor: pointer; font-size: 0.7rem;
}
.wo-count { font-size: 0.78rem; color: #aaa; }
.wo-color { font-size: 0.68rem; color: #666; margin-top: 4px; }
.wo-cancel-btn {
  margin-top: 14px; background: rgba(255,80,80,0.12); border: 1px solid rgba(255,80,80,0.4);
  color: #ff8080; border-radius: 6px; padding: 6px 16px; cursor: pointer; font-size: 0.75rem;
}

.game-header { display: none; }

.game-board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
}

/* ── Board grid ── */
#ludo-board {
  width:  min(97vw, 460px);
  height: min(97vw, 460px);
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows:    repeat(15, 1fr);
  border: 4px solid var(--gold);
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 3px #0d0d1a,
    0 0 40px rgba(255,215,0,0.25),
    0 12px 50px rgba(0,0,0,0.9);
}

/* ── Default cell ── */
.cell {
  border: 0.5px solid rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  overflow: hidden;
}

/* ── Path cell (white) ── */
.path-cell { border-color: rgba(0,0,0,0.2); }

/* ── Safe square – star overlay ── */
.cell.safe::after {
  content: '★';
  position: absolute;
  font-size: 80%;
  color: rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 0;
  line-height: 1;
}

/* ── Movable cell highlight ── */
.cell.movable {
  outline: 2px solid #00e600;
  outline-offset: -2px;
  cursor: pointer;
  animation: cell-pulse 0.7s ease infinite;
  z-index: 1;
}
@keyframes cell-pulse {
  0%,100% { outline-color: #00e600; }
  50%      { outline-color: #88ff88; box-shadow: inset 0 0 8px rgba(0,230,0,0.35); }
}

/* ── Corner home base – outer border cells ── */
.home-outer-red    { background: #7b241c !important; }
.home-outer-blue   { background: #1a4f8a !important; }
.home-outer-green  { background: #0e5c2a !important; }
.home-outer-yellow { background: #7a4000 !important; }

/* ── Corner home base – inner area ── */
.home-inner-red    { background: #e74c3c !important; }
.home-inner-blue   { background: #2e86c1 !important; }
.home-inner-green  { background: #1e8449 !important; }
.home-inner-yellow { background: #d4890a !important; }

/* ── Token start circles (CSS ::before circle inside cell) ── */
.home-start-red::before,
.home-start-blue::before,
.home-start-green::before,
.home-start-yellow::before {
  content: '';
  width: 64%;
  height: 64%;
  border-radius: 50%;
  position: absolute;
  border: 2px solid rgba(255,255,255,0.55);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.55), 0 2px 5px rgba(0,0,0,0.4);
  z-index: 0;
  pointer-events: none;
}
.home-start-red::before    { background: radial-gradient(circle at 35% 28%, #ff8080, #6e1108); }
.home-start-blue::before   { background: radial-gradient(circle at 35% 28%, #7ec8f8, #0d3d6e); }
.home-start-green::before  { background: radial-gradient(circle at 35% 28%, #6cf0a0, #0a4020); }
.home-start-yellow::before { background: radial-gradient(circle at 35% 28%, #f5c060, #b7600d); }

/* ── Home stretch lanes ── */
.lane-red    { background: #e74c3c !important; }
.lane-blue   { background: #2e86c1 !important; }
.lane-green  { background: #1e8449 !important; }
.lane-yellow { background: #d4890a !important; }

/* ── Center 3×3 ── */
.center-cell {
  background: conic-gradient(
    #e74c3c  0deg  90deg,
    #2e86c1  90deg 180deg,
    #1e8449 180deg 270deg,
    #d4890a 270deg 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  position: relative;
}
.center-cell::after {
  content: '★';
  font-size: 1.5em;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 0 12px rgba(255,255,255,0.6);
  position: absolute;
  pointer-events: none;
}

/* ─────────────── TOKENS ─────────────── */
.token {
  width: 74%;
  height: 74%;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  z-index: 4;
  box-shadow:
    0 3px 0 rgba(0,0,0,0.45),
    0 4px 8px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.45);
  user-select: none;
}
.token:hover { transform: translateY(-2px) scale(1.1); }
.token.red    { background: radial-gradient(circle at 33% 28%, #ff7070, #7a1208); }
.token.blue   { background: radial-gradient(circle at 33% 28%, #70b8f8, #0d3a70); }
.token.green  { background: radial-gradient(circle at 33% 28%, #60e895, #0b4a20); }
.token.yellow { background: radial-gradient(circle at 33% 28%, #ffe070, #7a4800); }
.token.selected {
  box-shadow: 0 3px 0 rgba(0,0,0,0.4), 0 0 0 2.5px #fff, 0 0 14px var(--gold), 0 0 28px rgba(255,215,0,0.4);
  animation: token-pulse 0.55s ease infinite;
}
@keyframes token-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }

/* ── Token move / event animations ── */
@keyframes capture-flash {
  0%   { filter: brightness(1)   saturate(1); transform: scale(1);   }
  28%  { filter: brightness(3.5) saturate(0); transform: scale(1.25); }
  60%  { filter: brightness(2)   saturate(0); transform: scale(0.88); }
  100% { filter: brightness(1)   saturate(1); transform: scale(1);   }
}
.token.capture-flash {
  animation: capture-flash 0.3s ease forwards;
  pointer-events: none;
}
@keyframes home-burst {
  0%   { transform: scale(1);    filter: brightness(1);     opacity: 1; }
  35%  { transform: scale(1.75); filter: brightness(2.5) drop-shadow(0 0 10px gold); opacity: 1; }
  65%  { transform: scale(0.8);  filter: brightness(1.5);   opacity: 0.7; }
  100% { transform: scale(0);    filter: brightness(1);     opacity: 0; }
}
.token.home-burst {
  animation: home-burst 0.48s ease forwards;
  pointer-events: none;
  z-index: 99;
}

.multi-token {
  font-size: 0.5rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.72);
  border-radius: 50%;
  width: 56%;
  height: 56%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 1px; right: 1px;
  pointer-events: none;
  z-index: 5;
  border: 1px solid rgba(255,255,255,0.4);
}

/* ─────────────── DICE ─────────────── */
.dice-area  { display: none; }
.turn-banner { display: none; }

.dice {
  width: 72px;
  height: 72px;
  background: linear-gradient(145deg, #ffffff 0%, #efefef 50%, #d8d8d8 100%);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows:    repeat(3, 1fr);
  padding: 9px;
  gap: 3px;
  border: 1.5px solid #bbb;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow:
    0 7px 0 #999,
    0 8px 12px rgba(0,0,0,0.65),
    inset 0 2px 0 rgba(255,255,255,0.95),
    inset 2px 0 0 rgba(255,255,255,0.6);
}
.dice:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow:
    0 10px 0 #999,
    0 11px 16px rgba(0,0,0,0.65),
    inset 0 2px 0 rgba(255,255,255,0.95),
    inset 2px 0 0 rgba(255,255,255,0.6);
}
.dice:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    0 2px 0 #999,
    0 3px 6px rgba(0,0,0,0.5),
    inset 0 2px 0 rgba(255,255,255,0.9),
    inset 2px 0 0 rgba(255,255,255,0.5);
}
.dice.rolling {
  animation: dice-shake 0.62s cubic-bezier(0.4,0,0.2,1);
}
@keyframes dice-shake {
  0%   { transform: rotate(0deg)   scale(1)    translateY(0);     }
  10%  { transform: rotate(-28deg) scale(1.16) translateY(-7px);  }
  26%  { transform: rotate(26deg)  scale(1.2)  translateY(-11px); }
  42%  { transform: rotate(-20deg) scale(1.14) translateY(-6px);  }
  58%  { transform: rotate(16deg)  scale(1.09) translateY(-3px);  }
  72%  { transform: rotate(-9deg)  scale(1.04) translateY(-1px);  }
  86%  { transform: rotate(5deg)   scale(1.01) translateY(0);     }
  100% { transform: rotate(0deg)   scale(1)    translateY(0);     }
}
.dice.landed {
  animation: dice-landed 0.38s cubic-bezier(0.22,1,0.36,1);
}
@keyframes dice-landed {
  0%   { transform: scale(1.18) translateY(-5px); }
  55%  { transform: scale(0.91) translateY(3px);  }
  100% { transform: scale(1)    translateY(0);    }
}
.dice.six {
  box-shadow:
    0 0 0 2.5px var(--gold),
    0 0 18px rgba(255,215,0,0.8),
    0 0 36px rgba(255,215,0,0.35),
    0 4px 0 #b07800,
    0 5px 14px rgba(0,0,0,0.6);
  transition: box-shadow 0.2s ease;
}
.dot {
  background: radial-gradient(circle at 35% 30%, #444, #111);
  border-radius: 50%;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.dot.hidden { background: transparent !important; box-shadow: none !important; }

.dice-val-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.5px;
}

.roll-btn { display: none; }
.player-panels { display: none; }

/* ─────────────── LEADERBOARD ─────────────── */
/* ─────────────── LEADERBOARD ─────────────── */
.lb-screen {
  background: #0d0d1a;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lb-topbar {
  display: flex;
  align-items: center;
  padding: 12px 14px 8px;
  background: #0a0a18;
  flex-shrink: 0;
}
.lb-topbar-title { flex: 1; text-align: center; }
.lb-game-name {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
}
.lc-r { color: #e74c3c; }
.lc-b { color: #3498db; }
.lc-g { color: #2ecc71; }
.lc-y { color: #f39c12; }
.lb-heading-row {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 3px;
  text-shadow: 0 0 12px rgba(255,215,0,0.5);
  margin-top: 2px;
}
.lb-help-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.lb-notice {
  background: rgba(255,255,255,0.04);
  text-align: center;
  padding: 6px 14px;
  font-size: 0.74rem;
  color: #aaa;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lb-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.lb-tab {
  flex: 1; text-align: center; padding: 9px 2px;
  font-size: 0.65rem; font-weight: 600; color: #777;
  cursor: pointer; letter-spacing: 0.4px;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.lb-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.lb-scroll { flex: 1; overflow-y: auto; padding-bottom: 200px; }

/* ── Podium ── */
.lb-podium {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 14px 8px 8px;
}
.lb-pod {
  flex: 1;
  border-radius: 14px;
  padding: 10px 6px 10px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; text-align: center;
  border: 1.5px solid;
}
.lb-pod.gold   { background: linear-gradient(160deg,#2a1f00,#1a1200); border-color:#FFD700; flex:1.15; box-shadow:0 0 16px rgba(255,215,0,0.2); }
.lb-pod.silver { background: linear-gradient(160deg,#1a1a24,#111118); border-color:#C0C0C0; }
.lb-pod.bronze { background: linear-gradient(160deg,#1e1208,#110c05); border-color:#CD7F32; }

.pod-badge {
  width: 26px; height: 26px;
  clip-path: polygon(50% 0%,93% 25%,93% 75%,50% 100%,7% 75%,7% 25%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.8rem; margin: 0 auto 4px;
}
.pod-badge-1 { background: linear-gradient(135deg,#FFD700,#FFA500); color:#1a0a00; }
.pod-badge-2 { background: linear-gradient(135deg,#E8E8E8,#A8A8A8); color:#1a1a1a; }
.pod-badge-3 { background: linear-gradient(135deg,#E8A060,#A05020); color:#fff; }

.pod-av-wrap {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; border: 3px solid; background: #0d0d1a; flex-shrink: 0;
  width: 56px; height: 56px;
}
.lb-pod.gold .pod-av-wrap { width: 68px; height: 68px; font-size: 2rem; }
.pod-av-wrap.pod-av-gold   { border-color:#FFD700; box-shadow:0 0 12px rgba(255,215,0,0.45); }
.pod-av-wrap.pod-av-silver { border-color:#C0C0C0; }
.pod-av-wrap.pod-av-bronze { border-color:#CD7F32; }

.pod-name {
  font-weight: 700; font-size: 0.72rem; color: #fff;
  margin-top: 4px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}
.pod-loc {
  font-size: 0.58rem; color: #888;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.pod-streak-label { font-size: 0.58rem; color: #aaa; margin-top: 3px; }
.pod-streak-val { font-size: 0.95rem; font-weight: 900; color: var(--gold); }
.lb-pod.gold .pod-streak-val { font-size: 1.1rem; }
.pod-active {
  font-size: 0.56rem; color: #888;
  display: flex; align-items: center; gap: 3px; margin-top: 2px;
}
.active-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2ecc71; display: inline-block; flex-shrink: 0;
}

/* ── Column headers ── */
.lb-cols {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 66px 50px 62px;
  gap: 4px; padding: 6px 10px;
  font-size: 0.56rem; color: #666; text-transform: uppercase; letter-spacing: 0.4px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.07);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.lb-list { padding: 4px 8px 0; }

.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 66px 50px 62px;
  gap: 4px; align-items: center;
  padding: 8px 8px; border-radius: 10px; margin-bottom: 5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  transition: background 0.2s;
}
.lb-row:hover { background: rgba(255,255,255,0.08); }

.lb-rank-num { font-weight: 700; font-size: 0.88rem; color: #aaa; text-align: center; }
.lb-player   { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #1a1040; display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0; border: 1.5px solid rgba(255,215,0,0.2);
}
.lb-name     { font-weight: 600; font-size: 0.73rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-district { font-size: 0.62rem; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-streak   { font-weight: 700; font-size: 0.78rem; color: #ff6b35; text-align: center; }
.lb-points   { font-weight: 700; font-size: 0.78rem; color: var(--gold); text-align: center; }
.lb-time     { font-size: 0.6rem; color: #777; display: flex; align-items: center; gap: 3px; }

.lb-update-notice { text-align: center; font-size: 0.66rem; color: #444; padding: 10px; }

/* ── My Rank Bar ── */
.my-rank-bar {
  position: fixed;
  bottom: 110px;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: linear-gradient(135deg,#1a0a40,#0d0820);
  border-top: 2px solid var(--gold);
  padding: 8px 10px;
  display: flex; align-items: center; gap: 6px;
  z-index: 100; box-sizing: border-box;
}
.mrb-rank-block { text-align: center; min-width: 46px; }
.mrb-yr-label   { font-size: 0.52rem; color: var(--gold); font-weight: 700; letter-spacing: 0.4px; }
.mrb-yr-num     { font-size: 1.5rem; font-weight: 900; color: var(--gold); line-height: 1; }
.mrb-avatar-wrap {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--gold); background: #0d0d1a;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.mrb-info-block { flex: 1; min-width: 0; }
.mrb-uname { font-weight: 700; font-size: 0.78rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrb-uloc  { font-size: 0.6rem; color: #888; }
.mrb-stat-col  { text-align: center; min-width: 46px; }
.mrb-slabel    { font-size: 0.5rem; color: #888; font-weight: 700; letter-spacing: 0.3px; }
.mrb-sval      { font-size: 0.8rem; font-weight: 700; color: var(--gold); }

/* ── Leave game confirm modal ── */
.leave-modal {
  position: relative !important;
  width: 260px !important;
  max-width: 260px !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  padding: 20px 18px 18px !important;
  text-align: center;
  border-color: rgba(255,215,0,0.5) !important;
  margin: auto !important;
  flex-shrink: 0;
  align-self: center;
}
.leave-modal-icon  { font-size: 2rem; line-height: 1; margin-bottom: 8px; }
.leave-modal-title { font-size: 1rem; font-weight: 800; color: var(--gold); margin-bottom: 6px; letter-spacing: 0.5px; }
.leave-modal-msg   { font-size: 0.76rem; color: #bbb; line-height: 1.5; margin-bottom: 16px; }
.leave-modal-warn  { display: block; color: #ff6b6b; font-size: 0.7rem; margin-top: 4px; }
.leave-modal-btns  { display: flex; gap: 8px; }
.leave-btn {
  flex: 1; height: 38px; border-radius: 8px;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
  border: none; transition: transform 0.12s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.leave-btn:active { transform: scale(0.94); }
.leave-btn-yes {
  background: linear-gradient(135deg, #7a1a00, #c0392b);
  color: #fff;
  border: 1.5px solid rgba(255,80,80,0.4);
}

/* ─────────────── FEE NOTICE ─────────────── */
.fee-notice {
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.78rem;
  color: #ccc;
  text-align: center;
  margin-bottom: 14px;
}
.fee-notice strong { color: var(--gold); }

/* ─────────────── MODALS ─────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(4px);
  z-index: 2000;
  overflow: auto;
}
.modal-overlay.show {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.modal {
  display: block !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  z-index: auto !important;
  background: linear-gradient(135deg, #1e1035, #150c28);
  border: 2px solid rgba(255,215,0,0.3);
  border-radius: 20px;
  padding: 22px 20px;
  width: 90%;
  max-width: 360px;
  height: auto;
  max-height: 85vh;
  overflow-y: auto;
  animation: modal-in 0.25s ease;
  box-sizing: border-box;
}
@keyframes modal-in {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal h3 { color: var(--gold); font-size: 1.2rem; margin-bottom: 15px; text-align: center; }
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ─────────────── WIN SCREEN ─────────────── */
.win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 3000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
}
.win-screen.show { display: flex; }

/* Solid card that holds all win content */
.win-box {
  background: linear-gradient(160deg, #2a0a5e 0%, #1a0a2e 60%, #0d0820 100%);
  border: 2px solid var(--gold);
  border-radius: 22px;
  padding: 22px 20px 20px;
  width: 100%;
  max-width: 360px;
  box-shadow:
    0 0 0 1px rgba(255,215,0,0.15),
    0 0 40px rgba(255,215,0,0.25),
    0 24px 60px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.win-trophy { font-size: 4rem; animation: trophy-bounce 1s ease infinite; margin-bottom: 4px; }
@keyframes trophy-bounce { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
.win-title { font-family: 'Cinzel', serif; font-size: 2rem; color: var(--gold); margin: 6px 0 4px; text-shadow: 0 0 20px rgba(255,215,0,0.6); }
.win-sub   { color: #ccc; font-size: 0.95rem; margin-bottom: 14px; }
.win-score-bar {
  background: rgba(255,215,0,0.12);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 20px;
  padding: 5px 18px;
  font-size: 0.85rem;
  color: #ddd;
  margin-bottom: 14px;
  display: none;
}
.win-score-bar span { color: var(--gold); font-weight: 700; }
.win-rewards { display: flex; gap: 16px; justify-content: center; margin-bottom: 16px; }
.wr-item { text-align: center; min-width: 68px; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 8px 10px; border: 1px solid rgba(255,215,0,0.15); }
.wr-icon { font-size: 1.6rem; }
.wr-val  { font-weight: 700; font-size: 1.1rem; color: var(--gold); }
.wr-lbl  { font-size: 0.62rem; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.win-rankings {
  display: none;
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.wr-rank-title {
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 8px;
}
.wr-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.85rem;
}
.wr-rank-row:last-child { border-bottom: none; }
.wr-rank-medal { font-size: 1.1rem; min-width: 28px; }
.wr-rank-name  { flex: 1; font-weight: 600; text-align: left; }
.wr-rank-pts   { color: #aaa; font-size: 0.8rem; }
.wr-red    { color: #e74c3c; }
.wr-blue   { color: #3498db; }
.wr-green  { color: #2ecc71; }
.wr-yellow { color: #f1c40f; }

/* ─────────────── NOTIFICATIONS PANEL ─────────────── */
.notif-panel {
  position: fixed;
  top: 0; right: 0;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  background: linear-gradient(135deg, #1e1035, #0d0d1a);
  border-left: 2px solid rgba(255,215,0,0.2);
  z-index: 1500;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.notif-panel.open { transform: translateX(0); }
.notif-item {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread { border-left: 3px solid var(--gold); }
.ni-title  { font-weight: 600; font-size: 0.85rem; }
.ni-msg    { font-size: 0.75rem; color: #aaa; margin-top: 2px; }
.ni-time   { font-size: 0.65rem; color: #555; margin-top: 3px; }

/* ─────────────── PROFILE SCREEN ─────────────── */
.profile-hero {
  background: linear-gradient(135deg, rgba(40,10,80,0.9), rgba(20,5,40,0.9));
  padding: 25px 20px;
  text-align: center;
  border-bottom: 2px solid rgba(255,215,0,0.2);
}
.profile-avatar-big {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: #2a1550;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 10px;
}
.profile-badge-tag {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #1a0a2e;
  font-weight: 700;
  font-size: 0.7rem;
  border-radius: 20px;
  padding: 3px 12px;
  display: inline-block;
  margin-top: 5px;
  letter-spacing: 1px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 15px;
}
.stat-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.stat-val { font-size: 1.5rem; font-weight: 700; color: var(--gold); }
.stat-lbl { font-size: 0.7rem; color: #888; margin-top: 2px; }

/* ─────────────── TOAST ─────────────── */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(20,10,40,0.95);
  border: 1px solid rgba(255,215,0,0.4);
  border-radius: 12px;
  padding: 10px 20px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.toast.success { border-color: #2ecc71; }
.toast.error   { border-color: #e74c3c; }
@keyframes toast-in  { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; transform:translateY(-10px); } }

/* ─────────────── UTIL ─────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,215,0,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #888;
  padding: 10px 15px 5px;
}

.divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 8px 15px;
}

.back-btn {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  transition: all 0.2s;
}
.back-btn:hover { background: rgba(255,215,0,0.15); border-color: var(--gold); }

.pb-bottom { padding-bottom: 120px; }

/* ─────────────── Responsive ─────────────── */
@media (max-width: 380px) {
  .game-title  { font-size: 2.4rem; }
  .mode-btn    { padding: 10px 6px; }
  .mode-btn .mode-name { font-size: 0.82rem; }
}

/* ══════════════════════════════════════════════
   NEW HOME SCREEN  (hn-*)
══════════════════════════════════════════════ */

.hn-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  /* Background image fills the entire home screen */
  background-image: url('../assets/images/home-bg.jpeg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #0a0a22;
}

/* ── Top Bar ── */
.hn-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(4, 1, 16, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1.5px solid rgba(255, 215, 0, 0.28);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.hn-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hn-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2.5px solid var(--gold);
  background: linear-gradient(135deg, #2a1550, #4a1a80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.25), 0 4px 14px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.hn-pinfo { display: flex; flex-direction: column; }

.hn-username {
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.3;
  white-space: nowrap;
}

.hn-psub {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

.hn-crown { font-size: 0.75rem; }

.hn-xp {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
}

.hn-lvl {
  background: linear-gradient(135deg, #6c3fa0, #4a1a80);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  letter-spacing: 0.5px;
}

.hn-currencies {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.hn-coin {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 215, 0, 0.48);
  border-radius: 20px;
  padding: 5px 8px 5px 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.hn-ci { font-size: 1rem; }

.hn-plus {
  width: 18px;
  height: 18px;
  background: var(--gold);
  color: #1a0a2e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  margin-left: 3px;
  flex-shrink: 0;
  line-height: 1;
}
.hn-plus:hover { background: #ffec40; }

.hn-gear {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.58);
  border: 1.5px solid rgba(255, 215, 0, 0.42);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.hn-gear:hover { border-color: var(--gold); }

/* ── Hero / Background ── */
.hn-hero {
  flex: 1;
  background: transparent;
  position: relative;
  min-height: 0;
}

/* Subtle fade at very bottom of hero into the mode-buttons */
.hn-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;                   /* below the logo (z-index:2) */
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 70%,
    rgba(4, 1, 16, 0.45) 90%,
    rgba(4, 1, 16, 0.65) 100%
  );
  pointer-events: none;
}

/* Lanka Ludo logo image */
.hn-logo {
  position: absolute;
  bottom: 8px;
  left: 50%;
  z-index: 2;
  width: 90%;
  max-width: 380px;
  display: block;
  filter: drop-shadow(0 0 20px rgba(255, 200, 0, 0.65))
          drop-shadow(0 4px 22px rgba(0, 0, 0, 0.95));
  pointer-events: none;
  user-select: none;
  -webkit-transform: translateX(-50%) translateZ(0);
  transform: translateX(-50%) translateZ(0);
}

/* ── Game Mode Buttons (image-based) ── */
.hn-modes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px 8px 100px;
  background: linear-gradient(to bottom, rgba(4, 1, 16, 0.40), rgba(4, 1, 16, 0.75));
  flex-shrink: 0;
}

.hn-mode-img {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, filter 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.hn-mode-img img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.hn-mode-img:hover  { transform: translateY(-4px) scale(1.04); }
.hn-mode-img:active { transform: translateY(1px)  scale(0.97); }

/* ── Responsive tweaks ── */
@media (max-width: 380px) {
  .hn-logo   { width: 92%; }
  .hn-avatar { width: 46px; height: 46px; font-size: 1.4rem; }
  .hn-coin   { font-size: 0.68rem; }
}
