/* ====================================================================
   INDIAN FAIR (भारतीय मेला) - STYLESHEET
   Twilight Indian Mela Theme & Responsive Layout
   ==================================================================== */

:root {
  --bg-deep: #10081e;
  --bg-surface: #1b1130;
  --bg-surface-variant: #281c44;
  --border-color: #453070;
  --border-light: rgba(255, 209, 102, 0.25);
  
  --saffron: #ff9933;
  --amber-gold: #ffd166;
  --sindoor: #e63946;
  --emerald: #06d6a0;
  --sky-blue: #118ab2;
  --magenta: #d90429;
  
  --text-primary: #fff9f0;
  --text-secondary: #cfbfe3;
  --text-muted: #8e7ca6;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(255, 209, 102, 0.3);
  
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-festive: 'Yatra One', cursive, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background: radial-gradient(circle at 50% 15%, #25123d 0%, #10081e 80%);
}

/* Ambient Starry Background */
.festive-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(1.5px 1.5px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 120px, #ffd166, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 150px 70px, #ff9933, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 220px 240px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 310px 180px, #06d6a0, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 450px 90px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 580px 290px, #ffd166, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 700px 150px, #e63946, rgba(0,0,0,0));
  background-size: 550px 550px;
  opacity: 0.65;
  z-index: 0;
}

/* Festive String Lights along top */
.festive-lights-string {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: repeating-linear-gradient(
    90deg,
    #ff9933 0px,
    #ffd166 12px,
    #e63946 24px,
    #06d6a0 36px,
    #118ab2 48px,
    #ff9933 60px
  );
  box-shadow: 0 2px 10px rgba(255, 209, 102, 0.6);
  z-index: 100;
}

/* App Header (2-Row Responsive Architecture) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(18, 10, 34, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1.5px solid var(--border-color);
  padding: 8px 14px 10px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.55), 0 0 15px rgba(255, 209, 102, 0.08);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Row 1: Logo & Carnival Title (Centered Banner) */
.header-row-branding {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 2px 0;
}

.logo-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.logo-group:hover {
  transform: scale(1.025);
}

.logo-emoji {
  font-size: 2.1rem;
  filter: drop-shadow(0 0 12px rgba(255, 209, 102, 0.65));
  animation: gentle-bob 3s ease-in-out infinite;
  display: inline-block;
}

@keyframes gentle-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}

.logo-titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}

.logo-main {
  font-family: var(--font-festive);
  font-size: clamp(1.4rem, 4.5vw, 2.05rem);
  letter-spacing: 0.8px;
  background: linear-gradient(135deg, #ffd166 0%, #ff9933 50%, #ff5252 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(255, 153, 51, 0.4));
  margin: 0;
}

.logo-sub {
  font-size: clamp(0.68rem, 1.8vw, 0.82rem);
  color: var(--amber-gold);
  font-weight: 600;
  letter-spacing: 0.6px;
  opacity: 0.92;
}

/* Row 2: Player Profile & Action Controls */
.header-row-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 209, 102, 0.12);
}

.header-left-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.token-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.15), rgba(255, 153, 51, 0.25));
  border: 1px solid var(--amber-gold);
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.token-icon {
  font-size: 1rem;
}

.token-val {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--amber-gold);
  min-width: 36px;
  text-align: right;
}

.icon-btn-text {
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  color: var(--amber-gold);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.icon-btn-text:hover {
  border-color: var(--amber-gold);
  background: rgba(255, 209, 102, 0.15);
  transform: translateY(-1px);
}

.icon-btn {
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 209, 102, 0.15);
  border-color: var(--amber-gold);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(1px);
}

#btn-lang {
  width: auto;
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--amber-gold);
}

/* Views Management */
.view-active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.view-hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Main Hub View */
.hub-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  position: relative;
  z-index: 10;
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, rgba(40, 28, 68, 0.9), rgba(27, 17, 48, 0.95));
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff9933, #ffd166, #e63946, #06d6a0);
}

.hero-text {
  flex: 1;
  padding: 0 16px;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 209, 102, 0.15);
  color: var(--amber-gold);
  border: 1px solid var(--amber-gold);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-banner h2 {
  font-family: var(--font-festive);
  font-size: 1.85rem;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff9f0, #ffd166);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-banner p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.45;
}

.hero-decor {
  font-size: 2.8rem;
  filter: drop-shadow(0 4px 12px rgba(255, 153, 51, 0.4));
  animation: pulse-glow 3s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* Stalls Grid */
.stalls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Individual Stall Card */
.stall-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.stall-card:hover {
  transform: translateY(-5px);
  border-color: var(--card-accent, var(--amber-gold));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 209, 102, 0.2);
}

.stall-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-color, var(--saffron));
}

.stall-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.stall-icon-box {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.stall-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--amber-gold);
  border: 1px solid rgba(255, 209, 102, 0.2);
}

.stall-info {
  flex: 1;
}

.stall-title {
  font-family: var(--font-festive);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.stall-hindi-title {
  font-size: 0.85rem;
  color: var(--amber-gold);
  font-weight: 600;
  margin-bottom: 6px;
}

.stall-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-bottom: 14px;
}

.stall-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.stall-score-pill {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stall-score-val {
  font-weight: 700;
  color: var(--amber-gold);
  margin-left: 4px;
}

.stall-play-btn {
  background: var(--card-color, var(--saffron));
  color: #1a0b00;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stall-play-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}

/* ====================================================================
   GAMEPLAY STAGE
   ==================================================================== */
#game-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.game-stage-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Game Top Bar (2-Row Responsive Layout) */
.game-top-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 8px 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.game-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.game-bar-branding {
  gap: 8px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-btn:hover {
  border-color: var(--amber-gold);
  color: var(--amber-gold);
}

.game-title-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.current-game-emoji {
  font-size: 1.7rem;
  filter: drop-shadow(0 2px 6px rgba(255, 209, 102, 0.4));
}

.current-game-name {
  font-family: var(--font-festive);
  font-size: 1.15rem;
  color: var(--amber-gold);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-game-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: block;
}

.game-bar-hud {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  padding: 4px 14px;
  border-radius: 8px;
  min-width: 70px;
}

.hud-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.hud-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--amber-gold);
}

.hud-tokens-mini {
  border-color: rgba(255, 209, 102, 0.3);
}

.hud-tokens-val {
  color: #ffd166;
  font-size: 0.92rem;
}

.icon-btn.mini {
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Gameplay Arena */
.gameplay-arena {
  position: relative;
  width: min(100%, calc((100vh - 180px) * 4 / 3), 800px);
  aspect-ratio: 4 / 3;
  max-height: 600px;
  background: #0d0617;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 0 20px rgba(255, 209, 102, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  touch-action: none;
}

#game-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  touch-action: none;
}

#game-dom-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#game-dom-overlay * {
  pointer-events: auto;
}

/* Controls Bar at bottom of screen */
.game-controls-bar {
  margin-top: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}

/* Control Buttons & Widgets */
.ctrl-btn {
  background: linear-gradient(135deg, var(--saffron), #e68524);
  color: #1a0b00;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  transition: all 0.18s ease;
}

.ctrl-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.ctrl-btn:active {
  transform: translateY(1px);
}

.ctrl-btn.secondary {
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.ctrl-btn.secondary:hover {
  border-color: var(--amber-gold);
  color: var(--amber-gold);
}

/* Lucky 7 Specific Layout */
.lucky7-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 90%;
  max-width: 550px;
  text-align: center;
}

.bet-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.bet-card {
  background: var(--bg-surface-variant);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bet-card.selected {
  border-color: var(--amber-gold);
  background: rgba(255, 209, 102, 0.15);
  box-shadow: 0 0 15px rgba(255, 209, 102, 0.3);
  transform: scale(1.03);
}

.bet-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.bet-mult {
  font-size: 0.78rem;
  color: var(--amber-gold);
  font-weight: 600;
  margin-top: 4px;
}

/* Kathputli Lane Keys */
.rhythm-keys-bar {
  display: flex;
  gap: 16px;
  width: 100%;
  justify-content: center;
}

.rhythm-key-btn {
  flex: 1;
  max-width: 90px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-surface-variant);
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
}

.rhythm-key-btn .key-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.rhythm-key-btn.active {
  background: var(--amber-gold);
  color: #10081e;
  border-color: #fff;
  transform: scale(0.95);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 8, 30, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.25s ease;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 1.6rem;
}

.modal-header h3 {
  font-family: var(--font-festive);
  font-size: 1.35rem;
  color: var(--amber-gold);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.close-btn:hover {
  color: var(--sindoor);
}

.modal-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--saffron), #e68524);
  color: #1a0b00;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--amber-gold);
  color: var(--amber-gold);
}

/* Result Card */
.result-card {
  text-align: center;
  max-width: 420px;
}

.result-banner {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.result-title {
  font-family: var(--font-festive);
  font-size: 1.6rem;
  color: var(--amber-gold);
  margin-bottom: 4px;
}

.result-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.result-stats-box {
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.rstat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rstat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.rstat-val {
  font-size: 1.15rem;
  font-weight: 800;
}

.rstat-val.gold { color: var(--amber-gold); }
.rstat-val.green { color: var(--emerald); }
.rstat-val.purple { color: #d084f7; }

/* Leaderboard */
.leaderboard-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}

.tab-btn {
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--amber-gold);
  color: #10081e;
  border-color: var(--amber-gold);
}

.leaderboard-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
  overflow-y: auto;
}

.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-variant);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lb-rank {
  font-weight: 800;
  font-size: 0.9rem;
  width: 24px;
  color: var(--amber-gold);
}

.lb-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.lb-score {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--emerald);
}

/* Credits & Info */
.credits-badge-pill {
  display: inline-block;
  background: rgba(6, 214, 160, 0.15);
  color: var(--emerald);
  border: 1px solid var(--emerald);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  margin-bottom: 12px;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.feature-pills .pill {
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.3);
  color: var(--amber-gold);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.credits-list {
  list-style: none;
  margin: 12px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credits-list li {
  font-size: 0.85rem;
  line-height: 1.4;
  padding-left: 6px;
}

.credits-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Creator Spotlight Card */
.creator-credit-banner {
  background: linear-gradient(135deg, rgba(255, 153, 51, 0.16), rgba(255, 209, 102, 0.12));
  border: 1.5px solid var(--amber-gold);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 12px 0 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(255, 153, 51, 0.15);
}

.creator-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--saffron);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.creator-name {
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.45;
  font-weight: 500;
}

.creator-name strong {
  color: var(--amber-gold);
  font-size: 1.15rem;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.4);
}

.creator-decor {
  margin-top: 6px;
  font-size: 0.85rem;
  letter-spacing: 4px;
}

/* Hub Footer */
.hub-footer {
  margin-top: 36px;
  padding: 24px 16px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hub-footer strong {
  color: var(--amber-gold);
  font-weight: 700;
}

/* ====================================================================
   PROFILE PILL IN TOP BAR
   ==================================================================== */
.profile-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-variant);
  border: 1.5px solid var(--amber-gold);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  color: #fff;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.profile-pill-btn:hover {
  background: rgba(255, 209, 102, 0.15);
  transform: translateY(-1px);
}

.profile-avatar {
  font-size: 1.15rem;
}

.profile-name {
  font-size: 0.88rem;
  font-weight: 700;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--amber-gold);
}

.profile-edit-badge {
  font-size: 0.72rem;
  opacity: 0.75;
}

/* ====================================================================
   UPFRONT ONBOARDING MODAL
   ==================================================================== */
.onboarding-card {
  max-width: 460px;
  border: 2px solid var(--amber-gold);
  background: radial-gradient(circle at top center, #24143e 0%, #10081e 100%);
  box-shadow: 0 12px 40px rgba(0,0,0,0.8), 0 0 25px rgba(255, 209, 102, 0.25);
}

.onboarding-header {
  text-align: center;
  margin-bottom: 12px;
}

.onboarding-emblem {
  font-size: 2.8rem;
  display: inline-block;
  margin-bottom: 4px;
  animation: gentlePulse 2.5s infinite ease-in-out;
}

.onboarding-header h2 {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--amber-gold);
  margin-bottom: 2px;
}

.onboarding-hindi-title {
  display: block;
  font-size: 0.95rem;
  color: var(--saffron);
  font-weight: 700;
  margin-bottom: 6px;
}

.onboarding-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Upfront Language Selection Cards */
.lang-selection-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.lang-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  transition: all 0.2s ease;
}

.lang-card:hover {
  border-color: var(--amber-gold);
  background: rgba(255, 209, 102, 0.08);
}

.lang-card.active {
  border-color: var(--amber-gold);
  background: rgba(255, 209, 102, 0.16);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.2);
}

.lang-card-flag {
  font-size: 1.6rem;
}

.lang-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lang-card-info strong {
  font-size: 0.95rem;
  color: #fff;
}

.lang-card.active .lang-card-info strong {
  color: var(--amber-gold);
}

.lang-card-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lang-card-check {
  font-size: 1rem;
  font-weight: 900;
  color: var(--amber-gold);
  opacity: 0;
  transition: opacity 0.2s;
}

.lang-card.active .lang-card-check {
  opacity: 1;
}

/* Form inputs & Avatar picker */
.form-group {
  margin-bottom: 14px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--amber-gold);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  box-sizing: border-box;
  background: #140b24;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--amber-gold);
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.25);
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 4px 0;
}

.avatar-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.avatar-bubble:hover {
  transform: scale(1.1);
  border-color: var(--amber-gold);
}

.avatar-bubble.selected {
  border-color: var(--amber-gold);
  background: rgba(255, 209, 102, 0.25);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.4);
  transform: scale(1.15);
}

.btn-large {
  width: 100%;
  padding: 12px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ====================================================================
   ENHANCED LEADERBOARD WITH TABS, SEARCH & ADD FRIEND
   ==================================================================== */
.modal-large {
  max-width: 620px;
  width: 94%;
}

.main-lb-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #fff;
  border-color: var(--amber-gold);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(255, 153, 51, 0.2), rgba(255, 209, 102, 0.15));
  border-color: var(--amber-gold);
  color: var(--amber-gold);
  box-shadow: 0 2px 10px rgba(255, 209, 102, 0.15);
}

/* Search bar & Add Friend action */
.friend-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 0.65;
}

#friend-search-input {
  width: 100%;
  background: #140b24;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 30px 8px 32px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

#friend-search-input:focus {
  border-color: var(--amber-gold);
}

.clear-search-btn {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
  display: none;
}

.clear-search-btn.show {
  display: block;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  white-space: nowrap;
}

/* Category Filter Chips */
.game-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: thin;
}

.game-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.game-chip:hover {
  border-color: var(--amber-gold);
  color: #fff;
}

.game-chip.active {
  background: var(--amber-gold);
  color: #1a0b00;
  border-color: var(--amber-gold);
  font-weight: 800;
}

/* Row customizations */
.lb-row.user-row {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.15), rgba(255, 153, 51, 0.1));
  border: 1.5px solid var(--amber-gold);
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.15);
}

.lb-badge-you {
  background: var(--amber-gold);
  color: #1a0b00;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.lb-badge-rival {
  background: rgba(255, 82, 82, 0.2);
  color: #ff5252;
  border: 1px solid #ff5252;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
}

.lb-stall-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-delete-friend {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: 4px;
  margin-left: 8px;
  transition: all 0.15s;
}

.btn-delete-friend:hover {
  color: #ff5252;
  background: rgba(255, 82, 82, 0.15);
}

.lb-empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
}

.lb-empty-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.lb-empty-state h4 {
  color: var(--amber-gold);
  margin-bottom: 4px;
  font-size: 1rem;
}

.lb-empty-state p {
  font-size: 0.82rem;
  line-height: 1.4;
}

/* ====================================================================
   RESPONSIVE DESIGN (Mobile, Foldables, Tablets, & Desktops)
   ==================================================================== */
@media (max-width: 680px) {
  .app-header {
    padding: 6px 10px 8px;
  }
  .header-container {
    gap: 6px;
  }
  .logo-emoji {
    font-size: 1.7rem;
  }
  .logo-main {
    font-size: clamp(1.2rem, 4vw, 1.45rem);
  }
  .logo-sub {
    font-size: 0.64rem;
  }
  .header-row-controls {
    justify-content: space-between;
    gap: 4px;
    padding-top: 4px;
  }
  .header-left-actions {
    gap: 5px;
    flex-wrap: nowrap;
  }
  .header-right-actions {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .profile-pill-btn {
    padding: 3px 7px;
    font-size: 0.76rem;
  }
  .profile-name {
    max-width: 60px;
    font-size: 0.76rem;
  }
  .token-pill {
    padding: 3px 7px;
  }
  .token-val {
    font-size: 0.8rem;
    min-width: 32px;
  }
  .icon-btn-text {
    padding: 3px 8px;
    font-size: 0.76rem;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
    border-radius: 8px;
  }
  .hero-banner {
    flex-direction: column;
    padding: 16px 12px;
    margin-bottom: 18px;
    text-align: center;
  }
  .hero-decor {
    display: none;
  }
  .hero-banner h2 {
    font-size: 1.25rem;
  }
  .hero-banner p {
    font-size: 0.78rem;
  }
  .stalls-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .game-stage-container {
    padding: 4px 6px 14px;
  }
  .game-top-bar {
    padding: 6px 10px;
    gap: 6px;
  }
  .current-game-name {
    font-size: 0.98rem;
  }
  .current-game-sub {
    font-size: 0.66rem;
  }
  .current-game-emoji {
    font-size: 1.35rem;
  }
  .hud-stat {
    padding: 3px 8px;
    min-width: 58px;
  }
  .hud-val {
    font-size: 0.92rem;
  }
  .gameplay-arena {
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: calc(100vh - 180px);
    border-radius: 12px;
  }
  .game-controls-bar {
    padding: 6px 10px;
    gap: 6px;
    min-height: 52px;
  }
  .ctrl-btn {
    padding: 7px 12px;
    font-size: 0.84rem;
  }
}

/* Compact phones (iPhone SE, 320px - 380px) */
@media (max-width: 380px) {
  .header-row-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .header-left-actions {
    width: 100%;
    justify-content: center;
    gap: 8px;
  }
  .header-right-actions {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }
  .profile-name {
    max-width: 80px;
  }
  .modal-card {
    padding: 16px 12px;
    width: 95vw;
  }
}

@media (min-width: 681px) and (max-width: 1024px) {
  .stalls-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
  .gameplay-arena {
    width: min(100%, calc((100vh - 200px) * 4 / 3), 720px);
    max-height: 540px;
  }
}

@media (min-width: 1025px) {
  .stalls-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
  }
  .gameplay-arena {
    width: min(100%, calc((100vh - 210px) * 4 / 3), 800px);
    max-height: 600px;
  }
}
