:root {
  /* Premium Dark Theme */
  --bg-color: #0f1015;
  --bg-gradient: radial-gradient(circle at top right, #1f2235, #0f1015);
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  
  /* Rarities */
  --rarity-common: #a1a1aa; /* Gewöhnlich */
  --rarity-rare: #3b82f6; /* Sehr Selten */
  --rarity-epic: #a855f7; /* Episch */
  --rarity-legend: #f59e0b; /* Legendär */

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  padding-bottom: 80px; /* space for nav */
}

/* Typography */
h1.accent-text {
  font-size: 2rem;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Layout Utilities */
.text-center { text-align: center; }
.hidden { display: none !important; }

.screen {
  padding: 1.5rem;
  animation: fadeIn 0.4s ease forwards;
}

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

/* Glass Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--glass-shadow);
  margin-bottom: 1.5rem;
}

/* Onboarding */
#screen-onboarding {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding-bottom: 0;
}

/* Forms & Buttons */
input[type="text"] {
  width: 100%;
  padding: 1rem 1.5rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: #fff;
  font-size: 1.1rem;
  outline: none;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

input[type="text"]:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* License Plate Styles */
.license-plate-preview, .profile-plate {
  margin: 0 auto 1.5rem;
  width: 240px;
  height: 60px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Arial', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
  padding-left: 25px; /* space for the D strip */
}

/* German D-Strip */
.license-plate-preview::before, .profile-plate::before {
  content: 'D';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 25px;
  background-color: #003399; /* Blue strip */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><g fill="%23ffcc00" transform="translate(256 256) scale(18)"><path id="s" d="M0-1.5l.3.9h1l-.8.6.3 1-.8-.6-.8.6.3-1-.8-.6h1z"/><use href="%23s" y="-10"/><use href="%23s" y="10"/><use href="%23s" x="-10"/><use href="%23s" x="10"/><use href="%23s" x="-8.66" y="-5"/><use href="%23s" x="8.66" y="5"/><use href="%23s" x="-8.66" y="5"/><use href="%23s" x="8.66" y="-5"/><use href="%23s" x="-5" y="-8.66"/><use href="%23s" x="5" y="8.66"/><use href="%23s" x="-5" y="8.66"/><use href="%23s" x="5" y="-8.66"/></g></svg>');
  background-size: 20px 20px;
  background-position: center 4px;
  background-repeat: no-repeat;
  color: #fff;
  font-size: 0.9rem;
  font-weight: bold;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
}

/* Simulate the TÜV and State seal with ::after */
.license-plate-preview::after, .profile-plate::after {
  content: ':';
  position: absolute;
  left: 50px;
  top: 15px;
  color: transparent;
  width: 16px;
  height: 30px;
  background-image: 
    radial-gradient(circle, #fca5a5 40%, transparent 40%),
    radial-gradient(circle, #6ee7b7 40%, transparent 40%);
  background-size: 16px 16px, 16px 16px;
  background-position: top, bottom;
  background-repeat: no-repeat;
  opacity: 0.8;
  pointer-events: none;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Rank Visuals */
/* Bronze */
.bronze {
  background: linear-gradient(135deg, #cd7f32, #8b5a2b);
  border: 2px solid #8b5a2b;
  color: #fff;
}
/* Silber */
.silber {
  background: linear-gradient(135deg, #e3e4e5, #9ca3af);
  border: 2px solid #9ca3af;
  color: #111;
}
/* Gold */
.gold {
  background: linear-gradient(135deg, #fceabb, #f8b500);
  border: 2px solid #f8b500;
  color: #111;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
/* Platin */
.platin {
  background: linear-gradient(135deg, #e5e4e2, #b0c4de);
  border: 2px solid #b0c4de;
  color: #1f2937;
  box-shadow: 0 0 15px rgba(176, 196, 222, 0.5);
}
/* Diamant */
.diamant {
  background: linear-gradient(135deg, #a8edea, #fed6e3);
  border: 2px solid #a8edea;
  color: #0f1015;
  box-shadow: 0 0 20px rgba(168, 237, 234, 0.6);
}
/* Legende (Lila) */
.legende {
  background: linear-gradient(270deg, #8a2387, #e94057, #f27121);
  background-size: 200% 200%;
  animation: gradientShine 3s ease infinite;
  border: 2px solid #e94057;
  color: #fff;
  box-shadow: 0 0 25px rgba(233, 64, 87, 0.5);
}

@keyframes gradientShine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Dashboard Stats */
.profile-stats {
  display: flex;
  margin-top: 1rem;
  gap: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.rank-badge {
  margin-top: 1rem;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Progress Bar */
.progress-container {
  margin-bottom: 2rem;
  padding: 0 1.5rem;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Search Area */
.search-container {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1f2235;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  margin-top: 5px;
}

.autocomplete-item {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.2s;
}

.autocomplete-item:hover {
  background: rgba(255,255,255,0.05);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.brand-rarity {
  font-size: 0.8rem;
  opacity: 0.8;
}

.brand-points {
  font-size: 0.9rem;
  background: rgba(255,255,255,0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

.collected-icon {
  fill: #10b981;
  width: 20px;
  height: 20px;
  margin-left: 10px;
}

/* Rarities Text Colors */
.r-gewohnlich { color: var(--rarity-common); }
.r-selten { color: var(--rarity-rare); }
.r-episch { color: var(--rarity-epic); }
.r-legendar { color: var(--rarity-legend); }

/* Feedback Banner */
.feedback-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: white;
  padding: 1rem 2rem;
  border-radius: 30px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  z-index: 100;
  animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
  from { top: -50px; opacity: 0; }
  to { top: 20px; opacity: 1; }
}

/* Nav Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 1rem;
  background: rgba(15, 16, 21, 0.8);
  backdrop-filter: blur(15px);
  border-top: 1px solid rgba(255,255,255,0.05);
  z-index: 50;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: color 0.3s;
}

.nav-btn svg {
  width: 24px;
  height: 24px;
}

.nav-btn.active {
  color: var(--accent-color);
}

.nav-btn span {
  font-size: 0.75rem;
}

/* Collection Grid */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.collection-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s;
}

.collection-card:hover {
  transform: translateY(-5px);
}

.collection-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.collection-card.gewohnlich { border-top: 3px solid var(--rarity-common); }
.collection-card.selten { border-top: 3px solid var(--rarity-rare); }
.collection-card.episch { border-top: 3px solid var(--rarity-epic); }
.collection-card.legendar { border-top: 3px solid var(--rarity-legend); }

/* Leaderboard */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.03);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}

.leaderboard-item.is-me {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-color);
}

.lb-rank {
  font-size: 1.2rem;
  font-weight: bold;
  width: 30px;
  color: var(--text-secondary);
}

.lb-plate {
  flex: 1;
  font-size: 1.1rem;
  font-family: monospace;
  font-weight: bold;
}

.lb-points {
  font-weight: 600;
  color: #10b981;
}
