/* ============================================
   RACING LEGENDS - COMPLETE DESIGN SYSTEM
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
  --primary: #ff4500;
  --primary-dark: #cc3700;
  --primary-glow: rgba(255,69,0,0.4);
  --secondary: #00d4ff;
  --secondary-dark: #0099cc;
  --gold: #ffd700;
  --gold-dark: #cc9900;
  --bg-dark: #0a0a0f;
  --bg-card: #12121a;
  --bg-card2: #1a1a28;
  --bg-card3: #22223a;
  --border: rgba(255,255,255,0.08);
  --border-bright: rgba(255,255,255,0.15);
  --text: #ffffff;
  --text-muted: #8888aa;
  --text-dim: #555577;
  --success: #00ff88;
  --error: #ff4466;
  --warning: #ffaa00;
  --common: #aaaaaa;
  --rare: #4488ff;
  --epic: #aa44ff;
  --legendary: #ff8800;
  --admin-accent: #ff6600;
  --font-game: 'Orbitron', monospace;
  --font-ui: 'Rajdhani', sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px var(--primary-glow);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.screen.hidden { display: none !important; }
.screen.active { display: flex; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: var(--radius);
  font-family: var(--font-game); font-size: 0.85rem; font-weight: 700;
  letter-spacing: 1px; padding: 14px 28px; cursor: pointer;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 20px var(--primary-glow);
  transition: all 0.2s ease;
  text-transform: uppercase;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--primary-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-shine {
  position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shine 3s infinite;
}
@keyframes shine { 0%{left:-100%} 50%{left:150%} 100%{left:150%} }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: var(--text);
  border: 2px solid var(--border-bright); border-radius: var(--radius);
  font-family: var(--font-game); font-size: 0.85rem; font-weight: 600;
  letter-spacing: 1px; padding: 12px 24px; cursor: pointer;
  transition: all 0.2s ease; text-transform: uppercase;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: rgba(255,69,0,0.1); }

.btn-back {
  background: rgba(255,255,255,0.08); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--font-game); font-size: 0.7rem; font-weight: 600;
  padding: 8px 16px; cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.btn-back:hover { background: rgba(255,69,0,0.2); border-color: var(--primary); }

/* ===== INPUTS ===== */
.input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.input-group label {
  font-family: var(--font-game); font-size: 0.65rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase;
}
.input-group input, .input-group select {
  background: rgba(255,255,255,0.05); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: 8px;
  font-family: var(--font-ui); font-size: 1rem; font-weight: 500;
  padding: 12px 16px; outline: none; transition: all 0.2s;
  width: 100%;
}
.input-group input:focus, .input-group select:focus {
  border-color: var(--primary); background: rgba(255,69,0,0.05);
  box-shadow: 0 0 0 3px rgba(255,69,0,0.15);
}
.input-group input::placeholder { color: var(--text-dim); }
.input-group select option { background: var(--bg-card2); color: var(--text); }
.input-group input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* ===== ERROR / MESSAGE ===== */
.error-msg {
  background: rgba(255,68,102,0.15); border: 1px solid rgba(255,68,102,0.4);
  color: var(--error); border-radius: 8px; padding: 10px 14px;
  font-size: 0.85rem; font-weight: 600; text-align: center; margin-bottom: 12px;
}
.error-msg.hidden { display: none; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.page-header h2 {
  font-family: var(--font-game); font-size: 1rem; font-weight: 700;
  letter-spacing: 2px; flex: 1; text-align: center;
}
.header-hud { display: flex; align-items: center; gap: 8px; font-family: var(--font-game); font-size: 0.8rem; font-weight: 700; }
.hud-icon { font-size: 1rem; }
.ml { margin-left: 12px; }

/* ===== HUD ITEMS ===== */
.hud-item { display: flex; align-items: center; gap: 6px; font-family: var(--font-game); font-size: 0.85rem; font-weight: 700; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-card2); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 40px 32px;
  text-align: center; max-width: 360px; width: 90%;
  box-shadow: var(--shadow);
}
.modal-icon { font-size: 2.5rem; margin-bottom: 12px; }
.modal-text { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 24px; line-height: 1.5; }
.modal-box .btn-primary { width: 100%; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-bg {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,69,0,0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(0,212,255,0.15) 0%, transparent 50%),
              linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 100%);
  min-height: 100vh; padding: 20px; position: relative; overflow: hidden;
}
.login-particles { position: absolute; inset: 0; pointer-events: none; }
.login-card {
  background: rgba(18,18,26,0.9); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 48px 40px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow);
  backdrop-filter: blur(20px); position: relative; z-index: 1;
}
.game-logo { text-align: center; margin-bottom: 40px; }
.logo-icon { font-size: 3.5rem; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.game-title {
  font-family: var(--font-game); font-size: 2.2rem; font-weight: 900;
  line-height: 1.1; letter-spacing: 4px;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 50%, var(--gold) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.game-title span { color: var(--primary); -webkit-text-fill-color: var(--primary); }
.logo-underline {
  width: 80px; height: 3px; margin: 12px auto 0;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: 2px;
}
.btn-play { width: 100%; font-size: 1.1rem; padding: 16px; margin-top: 8px; }

/* ============================================
   MAIN MENU
   ============================================ */
.menu-bg {
  flex: 1; min-height: 100vh;
  background: radial-gradient(ellipse at 50% -20%, rgba(255,69,0,0.2) 0%, transparent 60%),
              linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 100%);
  padding: 0 0 40px;
}
.menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.3); backdrop-filter: blur(10px);
}
.menu-logo { font-family: var(--font-game); font-size: 1rem; font-weight: 700; color: var(--primary); }
.player-hud { display: flex; gap: 20px; }
.menu-welcome { text-align: center; padding: 40px 20px 32px; }
.menu-welcome h2 { font-family: var(--font-game); font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.menu-welcome h2 span { color: var(--primary); }
.menu-welcome p { color: var(--text-muted); font-size: 0.95rem; }
.menu-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; padding: 0 24px; max-width: 700px; margin: 0 auto;
}
.menu-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 16px;
  cursor: pointer; transition: all 0.25s ease;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative; overflow: hidden;
}
.menu-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.03));
  opacity: 0; transition: opacity 0.2s;
}
.menu-btn:hover::before { opacity: 1; }
.menu-btn:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 8px 30px rgba(255,69,0,0.2); }
.menu-btn-icon { font-size: 2.2rem; }
.menu-btn-label { font-family: var(--font-game); font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; color: var(--text-muted); }
.menu-btn:hover .menu-btn-label { color: var(--text); }
.btn-race { border-top: 3px solid var(--primary); }
.btn-worlds { border-top: 3px solid var(--secondary); }
.btn-inventory { border-top: 3px solid var(--gold); }
.btn-market { border-top: 3px solid var(--success); }
.btn-profile { border-top: 3px solid #aa44ff; }
.btn-admin { border-top: 3px solid var(--admin-accent); }

/* ============================================
   WORLD SELECTION
   ============================================ */
.worlds-container {
  display: flex; flex-direction: column; gap: 20px;
  padding: 24px; max-width: 800px; margin: 0 auto; width: 100%;
}
.world-card {
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
  transition: all 0.3s ease; position: relative;
}
.world-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
.world-card-banner {
  height: 160px; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.world-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.8) 100%);
}
.world-card-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px;
}
.world-card-name { font-family: var(--font-game); font-size: 1.1rem; font-weight: 700; }
.world-card-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.world-card-levels {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,0.6); border: 1px solid var(--border-bright);
  border-radius: 20px; padding: 4px 12px;
  font-family: var(--font-game); font-size: 0.65rem; font-weight: 700;
}

/* World 1 - Desert */
.world-1-banner {
  background: linear-gradient(135deg, #8B4513 0%, #D2691E 30%, #FF8C00 60%, #FFD700 100%);
}
.world-1-banner::before {
  content: '🏜️'; position: absolute; font-size: 5rem; opacity: 0.3;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
}
/* World 2 - Arctic */
.world-2-banner {
  background: linear-gradient(135deg, #001a33 0%, #003366 30%, #0066cc 60%, #66ccff 100%);
}
.world-2-banner::before {
  content: '🏔️'; position: absolute; font-size: 5rem; opacity: 0.3;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
}
/* World 3 - Neon City */
.world-3-banner {
  background: linear-gradient(135deg, #0a0015 0%, #1a0033 30%, #330066 60%, #6600cc 100%);
}
.world-3-banner::before {
  content: '🌆'; position: absolute; font-size: 5rem; opacity: 0.3;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
}

/* ============================================
   WORLD DETAILS
   ============================================ */
.world-details-content { padding: 24px; max-width: 800px; margin: 0 auto; width: 100%; }
.world-banner {
  height: 180px; border-radius: var(--radius-lg); margin-bottom: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 5rem; position: relative; overflow: hidden;
}
.world-desc { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; margin-bottom: 24px; }
.levels-heading { font-family: var(--font-game); font-size: 0.8rem; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 16px; }
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.level-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all 0.2s ease; position: relative;
}
.level-card:hover { border-color: var(--primary); background: var(--bg-card2); transform: translateY(-2px); }
.level-card-num { font-family: var(--font-game); font-size: 0.65rem; color: var(--text-muted); margin-bottom: 4px; }
.level-card-name { font-family: var(--font-game); font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; }
.level-card-diff { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }
.diff-easy { background: rgba(0,255,136,0.15); color: var(--success); border: 1px solid rgba(0,255,136,0.3); }
.diff-medium { background: rgba(255,170,0,0.15); color: var(--warning); border: 1px solid rgba(255,170,0,0.3); }
.diff-hard { background: rgba(255,68,102,0.15); color: var(--error); border: 1px solid rgba(255,68,102,0.3); }
.diff-extreme { background: rgba(170,68,255,0.15); color: var(--epic); border: 1px solid rgba(170,68,255,0.3); }
.level-card-completed { position: absolute; top: 10px; right: 10px; font-size: 1rem; }

/* ============================================
   LEVEL DETAILS
   ============================================ */
.level-details-content { padding: 24px; max-width: 600px; margin: 0 auto; width: 100%; }
.level-preview {
  height: 200px; border-radius: var(--radius-lg); margin-bottom: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; position: relative; overflow: hidden;
}
.level-info-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px;
}
.level-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.level-info-row:last-child { border-bottom: none; }
.info-label { font-family: var(--font-game); font-size: 0.65rem; color: var(--text-muted); letter-spacing: 1px; }
.info-value { font-family: var(--font-game); font-size: 0.85rem; font-weight: 700; }
.btn-play-race { width: 100%; font-size: 1.1rem; padding: 18px; }

/* ============================================
   RACE SCREEN
   ============================================ */
#screen-race {
  background: #000; overflow: hidden;
  display: flex; flex-direction: column;
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  /* ensure it fills the full viewport on mobile */
  height: 100dvh;
}
/* Race overlay — countdown + crash message centered on canvas, no HUD bar */
.race-overlay-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.race-countdown {
  font-family: var(--font-game); font-size: 5rem; font-weight: 900;
  color: var(--gold); text-shadow: 0 0 30px var(--gold), 0 0 60px rgba(255,200,0,0.5);
  animation: pulse 0.5s ease-in-out;
}
@keyframes pulse { 0%{transform:scale(1.6)} 100%{transform:scale(1)} }
.race-message {
  font-family: var(--font-game); font-size: 1.4rem; font-weight: 700;
  color: var(--success); text-shadow: 0 0 15px var(--success);
  background: rgba(0,0,0,0.55); padding: 6px 18px; border-radius: 8px;
}
.race-countdown.hidden, .race-message.hidden { display: none; }
#raceCanvas {
  flex: 1 1 0;
  display: block;
  width: 100%;
  height: 0;        /* let flex-grow drive the height */
  min-height: 0;    /* critical for mobile flex children */
  touch-action: none;
}
.race-controls-hint {
  display: flex; gap: 20px; justify-content: center;
  padding: 8px; background: rgba(0,0,0,0.7);
  font-family: var(--font-game); font-size: 0.6rem; color: var(--text-muted);
  flex-shrink: 0;
}
/* Score HUD bar — top center of race screen */
#raceScoreBar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  pointer-events: none;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 5px 16px;
}
#raceScoreHUD {
  font-family: var(--font-game);
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFD700;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255,215,0,0.6);
}

.btn-quit-race {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,68,102,0.2); color: var(--error);
  border: 1px solid rgba(255,68,102,0.4); border-radius: 8px;
  font-family: var(--font-game); font-size: 0.7rem; font-weight: 700;
  padding: 8px 14px; cursor: pointer; z-index: 26;
  transition: all 0.2s;
}
.btn-quit-race:hover { background: rgba(255,68,102,0.4); }

/* ============================================
   RACE COMPLETE
   ============================================ */
.race-complete-bg {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,215,0,0.2) 0%, transparent 60%),
              linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 100%);
  padding: 20px;
}
.race-complete-card {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 48px 40px;
  text-align: center; max-width: 480px; width: 100%;
  box-shadow: 0 0 60px rgba(255,215,0,0.1);
}
.rc-trophy { font-size: 4rem; margin-bottom: 12px; animation: float 2s ease-in-out infinite; }
.rc-title {
  font-family: var(--font-game); font-size: 1.8rem; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--primary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 8px;
}
.rc-level-name { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px; }
.rc-stats { display: flex; gap: 24px; justify-content: center; margin-bottom: 32px; }
.rc-stat-item { text-align: center; }
.rc-stat-label { font-family: var(--font-game); font-size: 0.6rem; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 6px; }
.rc-stat-value { font-family: var(--font-game); font-size: 1.4rem; font-weight: 700; color: var(--gold); }
.rc-buttons { display: flex; flex-direction: column; gap: 12px; }
.rc-buttons .btn-primary, .rc-buttons .btn-secondary { width: 100%; }

/* ============================================
   INVENTORY
   ============================================ */
.inventory-content { padding: 24px; max-width: 900px; margin: 0 auto; width: 100%; }
.equipped-section { margin-bottom: 32px; }
.equipped-section h3 { font-family: var(--font-game); font-size: 0.75rem; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 12px; }
.equipped-display {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  min-height: 80px;
}
.owned-heading { font-family: var(--font-game); font-size: 0.75rem; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 16px; }
.skins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.skin-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; text-align: center;
  cursor: pointer; transition: all 0.2s ease; position: relative;
}
.skin-card:hover { transform: translateY(-3px); }
.skin-card.equipped { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,215,0,0.2); }
.skin-car-preview {
  width: 80px; height: 50px; margin: 0 auto 10px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.skin-name { font-family: var(--font-game); font-size: 0.7rem; font-weight: 700; margin-bottom: 6px; }
.skin-rarity {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
}
.rarity-common { background: rgba(170,170,170,0.15); color: var(--common); border: 1px solid rgba(170,170,170,0.3); }
.rarity-rare { background: rgba(68,136,255,0.15); color: var(--rare); border: 1px solid rgba(68,136,255,0.3); }
.rarity-epic { background: rgba(170,68,255,0.15); color: var(--epic); border: 1px solid rgba(170,68,255,0.3); }
.rarity-legendary { background: rgba(255,136,0,0.15); color: var(--legendary); border: 1px solid rgba(255,136,0,0.3); }
.skin-equipped-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--gold); color: #000; border-radius: 4px;
  font-size: 0.55rem; font-weight: 700; padding: 2px 6px;
}
.no-skins-msg {
  grid-column: 1/-1; text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 0.95rem;
}
.no-skins-msg .no-skins-icon { font-size: 3rem; margin-bottom: 12px; }

/* ============================================
   MARKET
   ============================================ */
/* ============================================
   MARKET
   ============================================ */
.market-content { padding: 16px; max-width: 700px; margin: 0 auto; width: 100%; }

/* Refresh bar */
.market-refresh-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px; margin-bottom: 14px;
}
.market-refresh-label { font-family: var(--font-game); font-size: 0.7rem; color: var(--text-muted); }
.market-refresh-timer { font-family: var(--font-game); font-size: 0.85rem; font-weight: 700; color: var(--gold); letter-spacing: 1px; flex: 1; }
.market-redeem-link {
  background: rgba(255,215,0,0.1); border: 1px solid rgba(255,215,0,0.3);
  color: var(--gold); border-radius: 20px; padding: 5px 14px;
  font-family: var(--font-game); font-size: 0.65rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.market-redeem-link:hover { background: rgba(255,215,0,0.2); }

/* Rarity legend */
.market-rarity-legend { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.rarity-pill {
  padding: 4px 12px; border-radius: 20px;
  font-family: var(--font-game); font-size: 0.65rem; font-weight: 700;
  border: 1px solid currentColor;
}
.rarity-pill.rarity-rare      { color: #4fc3f7; background: rgba(79,195,247,0.12); }
.rarity-pill.rarity-epic      { color: #ce93d8; background: rgba(206,147,216,0.12); }
.rarity-pill.rarity-legendary { color: #ffb300; background: rgba(255,179,0,0.12); }

/* Skin grid */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  padding-bottom: 24px;
}

/* Skin card */
.mkt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  display: flex; flex-direction: column;
  position: relative;
}
.mkt-card:hover:not(.mkt-card--owned) {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.mkt-card--rare      { border-color: rgba(79,195,247,0.4); }
.mkt-card--epic      { border-color: rgba(206,147,216,0.4); }
.mkt-card--legendary { border-color: rgba(255,179,0,0.5); box-shadow: 0 0 12px rgba(255,179,0,0.15); }
.mkt-card--owned     { opacity: 0.55; cursor: default; }

/* Car preview canvas inside card */
.mkt-card-preview {
  width: 100%; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem;
  position: relative; overflow: hidden;
}
.mkt-card-preview canvas { width: 100%; height: 100%; display: block; }

/* Rarity badge */
.mkt-card-rarity {
  position: absolute; top: 8px; left: 8px;
  padding: 2px 8px; border-radius: 10px;
  font-family: var(--font-game); font-size: 0.55rem; font-weight: 700;
  border: 1px solid currentColor;
}
.mkt-card-rarity.rarity-rare      { color: #4fc3f7; background: rgba(0,0,0,0.6); }
.mkt-card-rarity.rarity-epic      { color: #ce93d8; background: rgba(0,0,0,0.6); }
.mkt-card-rarity.rarity-legendary { color: #ffb300; background: rgba(0,0,0,0.6); }

.mkt-card-body { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mkt-card-name { font-family: var(--font-game); font-size: 0.75rem; font-weight: 700; line-height: 1.2; }
.mkt-card-price {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-game); font-size: 0.8rem; font-weight: 700; color: #4fc3f7;
  margin-top: auto;
}
.mkt-card-price.epic-price  { color: #ce93d8; }
.mkt-card-price.legend-price { color: #ffb300; }
.mkt-card-owned-badge {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 6px;
  background: rgba(0,255,136,0.1); border-top: 1px solid rgba(0,255,136,0.2);
  font-family: var(--font-game); font-size: 0.65rem; font-weight: 700; color: var(--success);
}

/* Buy button on card */
.mkt-card-buy {
  width: 100%; padding: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-family: var(--font-game); font-size: 0.7rem; font-weight: 700;
  color: #fff; cursor: pointer; transition: opacity 0.2s;
}
.mkt-card-buy:hover { opacity: 0.85; }
.mkt-card-buy.epic-buy   { background: linear-gradient(135deg, #9c27b0, #6a0080); }
.mkt-card-buy.legend-buy { background: linear-gradient(135deg, #f57f17, #e65100); }

/* Purchase modal */
.mkt-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.mkt-modal.hidden { display: none; }
.mkt-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 320px; width: 100%;
  text-align: center;
  display: flex; flex-direction: column; gap: 10px;
}
.mkt-modal-car { font-size: 4rem; line-height: 1; }
.mkt-modal-name { font-family: var(--font-game); font-size: 1rem; font-weight: 700; }
.mkt-modal-rarity { font-family: var(--font-game); font-size: 0.7rem; font-weight: 700; }
.mkt-modal-rarity.rarity-rare      { color: #4fc3f7; }
.mkt-modal-rarity.rarity-epic      { color: #ce93d8; }
.mkt-modal-rarity.rarity-legendary { color: #ffb300; }
.mkt-modal-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.mkt-modal-price {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-game); font-size: 1.3rem; font-weight: 700; color: #4fc3f7;
}
.mkt-modal-msg {
  padding: 8px 12px; border-radius: var(--radius);
  font-family: var(--font-game); font-size: 0.75rem; font-weight: 700;
}
.mkt-modal-msg.success { background: rgba(0,255,136,0.1); color: var(--success); border: 1px solid rgba(0,255,136,0.3); }
.mkt-modal-msg.error   { background: rgba(255,68,102,0.1); color: var(--error);   border: 1px solid rgba(255,68,102,0.3); }
.mkt-modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.mkt-modal-actions .btn-secondary { flex: 1; }
.mkt-modal-actions .btn-primary   { flex: 2; }

/* ============================================
   REDEEM CODE
   ============================================ */
.redeem-content { padding: 24px; max-width: 500px; margin: 0 auto; width: 100%; }
.redeem-card {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg); padding: 40px; text-align: center;
}
.redeem-icon { font-size: 3rem; margin-bottom: 16px; }
.redeem-card h3 { font-family: var(--font-game); font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.redeem-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }
.redeem-card .input-group input { text-align: center; font-family: var(--font-game); font-size: 1rem; letter-spacing: 3px; }
.redeem-msg {
  padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
  text-align: center; margin-bottom: 12px;
}
.redeem-msg.hidden { display: none; }
.redeem-msg.success { background: rgba(0,255,136,0.15); border: 1px solid rgba(0,255,136,0.4); color: var(--success); }
.redeem-msg.error { background: rgba(255,68,102,0.15); border: 1px solid rgba(255,68,102,0.4); color: var(--error); }
.redeem-msg.info { background: rgba(0,212,255,0.15); border: 1px solid rgba(0,212,255,0.4); color: var(--secondary); }
.redeem-card .btn-primary { width: 100%; }

/* Redeem hints card */
.redeem-hints-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-top: 16px;
  text-align: left;
}
.redeem-hints-grid { display: flex; flex-direction: column; gap: 6px; }
.redeem-hint-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; background: rgba(255,255,255,0.04);
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; transition: background 0.15s;
}
.redeem-hint-row:hover { background: rgba(255,255,255,0.09); }
.hint-code {
  font-family: var(--font-game); font-size: 0.72rem; font-weight: 700;
  color: var(--primary); letter-spacing: 0.05em;
}
.hint-reward {
  font-size: 0.72rem; color: var(--text-muted); font-weight: 600;
}

/* ============================================
   PROFILE
   ============================================ */
.profile-content { padding: 24px; max-width: 700px; margin: 0 auto; width: 100%; text-align: center; }
.profile-avatar {
  font-size: 4rem; width: 100px; height: 100px;
  background: var(--bg-card2); border: 2px solid var(--border-bright);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.profile-name { font-family: var(--font-game); font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.profile-id { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 32px; font-family: monospace; }
.profile-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: center; }
.profile-stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 12px;
}
.psc-icon { font-size: 1.5rem; margin-bottom: 8px; }
.psc-value { font-family: var(--font-game); font-size: 1.1rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.psc-label { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-game); letter-spacing: 1px; }

/* ============================================
   ADMIN LOGIN
   ============================================ */
.admin-login-bg {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,102,0,0.2) 0%, transparent 60%),
              linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 100%);
  padding: 20px;
}
.admin-login-card {
  background: var(--bg-card); border: 1px solid rgba(255,102,0,0.3);
  border-radius: var(--radius-lg); padding: 48px 40px;
  width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 0 40px rgba(255,102,0,0.1);
}
.admin-icon { font-size: 3rem; margin-bottom: 16px; }
.admin-login-card h2 { font-family: var(--font-game); font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; color: var(--admin-accent); }
.admin-login-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }
.admin-login-btns { display: flex; gap: 12px; }
.admin-login-btns .btn-primary, .admin-login-btns .btn-secondary { flex: 1; }

/* ============================================
   ADMIN DASHBOARD
   ============================================ */
.admin-header { background: rgba(255,102,0,0.05); border-bottom-color: rgba(255,102,0,0.2); }
.admin-logo { font-family: var(--font-game); font-size: 1rem; font-weight: 700; color: var(--admin-accent); flex: 1; text-align: center; }
.admin-dashboard-content { padding: 40px 24px; max-width: 600px; margin: 0 auto; width: 100%; }
.admin-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.admin-menu-btn {
  background: var(--bg-card); border: 1px solid rgba(255,102,0,0.2);
  border-radius: var(--radius-lg); padding: 32px 16px;
  cursor: pointer; transition: all 0.25s ease;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.admin-menu-btn:hover { border-color: var(--admin-accent); background: var(--bg-card2); transform: translateY(-4px); box-shadow: 0 8px 30px rgba(255,102,0,0.15); }
.admin-btn-icon { font-size: 2.2rem; }
.admin-btn-label { font-family: var(--font-game); font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; color: var(--text-muted); }
.admin-menu-btn:hover .admin-btn-label { color: var(--admin-accent); }

/* ============================================
   ADMIN PLAYERS
   ============================================ */
.admin-players-content { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.admin-search-bar { display: flex; gap: 12px; }
.admin-search-bar input {
  flex: 1; background: rgba(255,255,255,0.05); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: 8px;
  font-family: var(--font-ui); font-size: 0.95rem; padding: 10px 16px; outline: none;
}
.admin-search-bar input:focus { border-color: var(--admin-accent); }
.btn-search {
  background: rgba(255,102,0,0.2); color: var(--admin-accent);
  border: 1px solid rgba(255,102,0,0.4); border-radius: 8px;
  font-family: var(--font-game); font-size: 0.7rem; font-weight: 700;
  padding: 10px 20px; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-search:hover { background: rgba(255,102,0,0.35); }
.admin-players-layout { display: flex; gap: 16px; flex: 1; min-height: 0; }
.player-list-panel {
  width: 240px; flex-shrink: 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.player-list-panel h3 { font-family: var(--font-game); font-size: 0.7rem; letter-spacing: 2px; color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border); }
.player-list { flex: 1; overflow-y: auto; }
.player-list-item {
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.15s; font-size: 0.9rem;
}
.player-list-item:hover { background: rgba(255,102,0,0.1); }
.player-list-item.selected { background: rgba(255,102,0,0.15); border-left: 3px solid var(--admin-accent); }
.player-list-item-name { font-weight: 600; }
.player-list-item-id { font-size: 0.7rem; color: var(--text-muted); font-family: monospace; }
.player-detail-panel {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-y: auto; padding: 20px;
}
.no-player-selected { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); font-size: 0.9rem; }
.player-detail-header { margin-bottom: 20px; }
.player-detail-name { font-family: var(--font-game); font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.player-detail-id { font-size: 0.7rem; color: var(--text-muted); font-family: monospace; }
.player-detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.pds-item { background: var(--bg-card2); border-radius: 8px; padding: 12px; }
.pds-label { font-family: var(--font-game); font-size: 0.6rem; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 4px; }
.pds-value { font-family: var(--font-game); font-size: 1rem; font-weight: 700; }
.admin-control-section { margin-bottom: 20px; }
.admin-control-section h4 { font-family: var(--font-game); font-size: 0.7rem; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.admin-control-row { display: flex; gap: 8px; align-items: flex-end; }
.admin-control-row .input-group { flex: 1; margin-bottom: 0; }
.admin-control-row .input-group input { padding: 10px 12px; }
.btn-add { background: rgba(0,255,136,0.15); color: var(--success); border: 1px solid rgba(0,255,136,0.3); border-radius: 8px; font-family: var(--font-game); font-size: 0.65rem; font-weight: 700; padding: 10px 14px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.btn-add:hover { background: rgba(0,255,136,0.25); }
.btn-remove { background: rgba(255,68,102,0.15); color: var(--error); border: 1px solid rgba(255,68,102,0.3); border-radius: 8px; font-family: var(--font-game); font-size: 0.65rem; font-weight: 700; padding: 10px 14px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.btn-remove:hover { background: rgba(255,68,102,0.25); }

/* ============================================
   ADMIN MAKE CODE
   ============================================ */
.make-code-content { padding: 20px; display: flex; gap: 20px; flex: 1; }
.make-code-card {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; max-width: 480px;
}
.reward-section { margin-bottom: 0; }
.reward-section.hidden { display: none; }
.make-code-btns { display: flex; gap: 12px; margin-top: 20px; }
.make-code-btns .btn-primary, .make-code-btns .btn-secondary { flex: 1; }
.skin-preview-admin {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; text-align: center;
  margin-top: 8px; min-height: 60px; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--text-muted);
}
.existing-codes-panel {
  width: 300px; flex-shrink: 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; overflow-y: auto;
}
.existing-codes-panel h3 { font-family: var(--font-game); font-size: 0.7rem; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 16px; }
.existing-codes-list { display: flex; flex-direction: column; gap: 10px; }
.code-item {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
}
.code-item-code { font-family: var(--font-game); font-size: 0.8rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.code-item-reward { font-size: 0.75rem; color: var(--text-muted); }
.code-item-redeemed { font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; }
.no-codes-msg { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 20px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-menu-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-players-layout { flex-direction: column; }
  .player-list-panel { width: 100%; max-height: 200px; }
  .make-code-content { flex-direction: column; }
  .existing-codes-panel { width: 100%; }
  .login-card { padding: 32px 24px; }
  .race-complete-card { padding: 32px 24px; }
}
/* ============================================
   PIN PAD STYLES
   ============================================ */

.pin-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 14px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  transition: background 0.15s, transform 0.1s;
  display: inline-block;
}

.pin-dot.filled {
  background: var(--accent);
  transform: scale(1.15);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.pin-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: inherit;
  padding: 14px 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-btn:hover {
  background: rgba(255,255,255,0.14);
}

.pin-btn:active {
  background: var(--accent);
  transform: scale(0.93);
}

.pin-btn-clear {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.pin-btn-back {
  font-size: 1.1rem;
}

/* ============================================
   SKIN SHOP STYLES
   ============================================ */

.shop-content {
  padding: 16px;
  overflow-y: auto;
  height: calc(100vh - 64px);
}

.shop-msg {
  text-align: center;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.shop-msg.success {
  background: rgba(0,255,100,0.12);
  color: #00ff64;
  border: 1px solid rgba(0,255,100,0.25);
}

.shop-msg.error {
  background: rgba(255,60,60,0.12);
  color: #ff6060;
  border: 1px solid rgba(255,60,60,0.25);
}

.shop-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.shop-filter-bar::-webkit-scrollbar { display: none; }

.shop-filter-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.shop-filter-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.shop-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.shop-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 14px 12px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}

.shop-card:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.09);
}

.shop-card.owned {
  border-color: rgba(0,255,100,0.35);
  background: rgba(0,255,100,0.05);
}

.shop-card.cant-afford {
  opacity: 0.55;
}

.shop-card-preview {
  font-size: 2.4rem;
  text-align: center;
  margin-bottom: 8px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.shop-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-card-rarity {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 8px;
}

.shop-card-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffd700;
}

.shop-card-owned-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,255,100,0.2);
  border: 1px solid rgba(0,255,100,0.4);
  border-radius: 6px;
  font-size: 0.55rem;
  font-weight: 700;
  color: #00ff64;
  padding: 2px 6px;
  letter-spacing: 0.06em;
}

/* ============================================
   RARITY COLORS
   ============================================ */

.rarity-common    { color: #aaaaaa; }
.rarity-uncommon  { color: #44cc44; }
.rarity-rare      { color: #4488ff; }
.rarity-epic      { color: #cc44ff; }
.rarity-legendary { color: #ffd700; }

/* ============================================
   SKIN SHOP BUTTON IN MENU
   ============================================ */

.btn-skinshop {
  background: linear-gradient(135deg, #7b2ff7 0%, #f107a3 100%);
}

/* ============================================
   RACE COMPLETE REWARD BOX
   ============================================ */

.rc-reward-box {
  background: rgba(255,215,0,0.12);
  border: 1px solid rgba(255,215,0,0.35);
  border-radius: 14px;
  padding: 12px 20px;
  margin: 14px 0;
  text-align: center;
}

.rc-reward-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd700;
  line-height: 1.5;
}

/* ============================================
   MENU GRID — 7 BUTTONS (3+2+2 layout)
   ============================================ */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 16px 24px;
}

/* Last row: if 7 items, center the last one */
.menu-grid .menu-btn:last-child:nth-child(3n+1) {
  grid-column: 2;
}


/* ============================================
   ADMIN PIN ASTERISK DISPLAY
   ============================================ */

.admin-pin-display {
  gap: 10px;
  margin-bottom: 18px;
}

.pin-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  font-size: 1.4rem;
  font-weight: 900;
  color: rgba(255,255,255,0.25);
  transition: all 0.15s;
  font-family: monospace;
}

.pin-char.filled {
  border-color: var(--accent);
  background: rgba(255,100,0,0.12);
  color: #fff;
}


/* ============================================
   SECRET RARITY
   ============================================ */
.rarity-secret {
  background: linear-gradient(135deg, #1a0033, #3300aa, #6600cc);
  color: #fff;
  border: 1px solid #aa44ff;
  box-shadow: 0 0 12px rgba(170,68,255,0.5);
}
.rarity-secret .rarity-badge {
  background: linear-gradient(90deg, #6600cc, #aa44ff);
  color: #fff;
  text-shadow: 0 0 6px #fff;
}

/* ============================================
   MOBILE CONTROLS
   ============================================ */
.mobile-controls {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
  z-index: 30;
}
.mobile-btn {
  pointer-events: all;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: background 0.1s, transform 0.1s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex-shrink: 0;
}
.mobile-btn:active {
  background: rgba(255,100,0,0.75);
  transform: scale(0.92);
  border-color: #ff6400;
}
@media (max-width: 480px) {
  .mobile-btn { width: 72px; height: 72px; font-size: 1.6rem; }
  .mobile-controls { bottom: 20px; padding: 0 16px; }
}

/* ============================================
   LOCKED LEVELS & WORLDS
   ============================================ */
.level-locked {
  opacity: 0.45;
  cursor: not-allowed !important;
  filter: grayscale(0.6);
}
.level-locked .level-card-name {
  color: #aaa;
}
.level-card-lock-msg {
  font-size: 0.65rem;
  color: #ff6666;
  margin-top: 4px;
  font-family: var(--font-game);
  letter-spacing: 0.05em;
}
.world-locked {
  opacity: 0.45;
  cursor: not-allowed !important;
  filter: grayscale(0.7);
}
.world-locked .world-card-banner {
  cursor: not-allowed;
}

/* ============================================
   CODE ITEM IMPROVEMENTS
   ============================================ */
.code-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  margin-bottom: 8px;
}
.code-item-main {
  flex: 1;
  min-width: 0;
}
.code-item-code {
  font-family: var(--font-game);
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.1em;
  word-break: break-all;
}
.code-expired .code-item-code,
.code-item-code.code-expired {
  color: #ff6666;
  text-decoration: line-through;
}
.code-item-reward {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 2px;
}
.code-item-usage {
  font-size: 0.72rem;
  color: #888;
  margin-top: 2px;
}
.btn-delete-code {
  background: rgba(255,60,60,0.15);
  border: 1px solid rgba(255,60,60,0.3);
  border-radius: 8px;
  color: #ff6666;
  font-size: 1.1rem;
  padding: 6px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-delete-code:active {
  background: rgba(255,60,60,0.4);
}

/* ============================================
   DAILY QUESTS SCREEN
   ============================================ */
.quests-page {
  padding: 16px;
  max-width: 520px;
  margin: 0 auto;
}
.quests-timer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-game);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  letter-spacing: 0.06em;
}
.quests-timer-icon { font-size: 1rem; }

.quests-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Quest card */
.quest-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 16px;
  transition: border-color 0.2s;
}
.quest-card.quest-done {
  border-color: rgba(170,68,255,0.5);
  background: rgba(170,68,255,0.07);
}
.quest-card.quest-claimed {
  border-color: rgba(0,200,100,0.3);
  background: rgba(0,200,100,0.05);
  opacity: 0.7;
}

.quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.quest-name {
  font-family: var(--font-game);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
}
.quest-reward {
  font-family: var(--font-game);
  font-size: 0.85rem;
  color: #aa44ff;
  font-weight: 700;
}
.quest-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Progress bar */
.quest-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.quest-progress-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}
.quest-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #aa44ff, #ff44aa);
  border-radius: 99px;
  transition: width 0.4s ease;
  min-width: 4px;
}
.quest-progress-label {
  font-family: var(--font-game);
  font-size: 0.72rem;
  color: #aaa;
  white-space: nowrap;
}

/* Claim button */
.quest-claim-btn {
  width: 100%;
  padding: 10px 0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #aa44ff, #7722cc);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-game);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.quest-claim-btn:active {
  opacity: 0.8;
  transform: scale(0.98);
}

/* Status badges */
.quest-claimed-badge {
  font-family: var(--font-game);
  font-size: 0.78rem;
  color: #00c864;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 6px 0;
}
.quest-status-pending {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
  font-style: italic;
}

/* Daily Quests menu button */
.btn-quests {
  background: linear-gradient(135deg, #2a1a4a, #3d1a6e) !important;
  border-color: #aa44ff !important;
}
.btn-quests .menu-btn-icon { color: #cc66ff; }
