:root {
  /* Brand Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;

  /* Wheel Colors */
  --wheel-1: #ef4444;
  --wheel-2: #3b82f6;
  --wheel-3: #10b981;
  --wheel-4: #f59e0b;
  --wheel-5: #8b5cf6;
  --wheel-6: #ec4899;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-sm) 0;
  font-weight: 700;
  line-height: 1.2;
}

p {
  margin: 0 0 var(--spacing-md) 0;
  line-height: 1.5;
  color: var(--text-muted);
}

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }

/* Layout Helpers */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--spacing-sm); }
.gap-4 { gap: var(--spacing-md); }
.gap-6 { gap: var(--spacing-lg); }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Navigation */
.navbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  background: var(--bg-body);
  color: var(--primary);
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  background: white;
}

/* Main Grid Layout */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg) 0;
  height: calc(100vh - 80px); /* rough height minus header */
  min-height: 600px;
}

@media (max-width: 1024px) {
  .app-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

/* Wheel Component */
.wheel-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 10px solid white;
  box-shadow: var(--shadow-xl);
  background: conic-gradient(
    var(--wheel-1) 0% 16.6%,
    var(--wheel-2) 16.6% 33.3%,
    var(--wheel-3) 33.3% 50%,
    var(--wheel-4) 50% 66.6%,
    var(--wheel-5) 66.6% 83.3%,
    var(--wheel-6) 83.3% 100%
  );
  position: relative;
  transition: transform 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: white;
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-weight: 800;
  color: var(--text-muted);
}

.wheel-pointer {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; 
  height: 0; 
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 40px solid var(--text-main);
  z-index: 20;
  filter: drop-shadow(0 4px 2px rgba(0,0,0,0.2));
}

/* Sidebar / Editor */
.editor-toolbar {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.entry-list {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  max-height: 400px;
  overflow-y: auto;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: white;
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-xs);
  border: 1px solid transparent;
}

.entry-item:hover {
  border-color: var(--border-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-body);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-main);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
}

/* Inputs */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  transition: border 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.tab {
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform 0.2s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

/* Badges & Icons */
.badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: #e0e7ff; color: var(--primary); }
.badge-success { background: #d1fae5; color: var(--success); }

/* Utility */
.placeholder-icon {
  width: 24px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 4px;
  display: inline-block;
}

.hidden { display: none; }

@media (min-width: 1024px) {
  .lg-flex { display: flex !important; }
  .lg-block { display: block !important; }
}

@media (max-width: 1023px) {
  .lg-flex { display: none !important; }
  .lg-hidden { display: none !important; }
}

/* Flag styles */
.flag {
  width: 20px;
  height: 15px;
  background-color: #eee;
  display: inline-block;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
}

/* Generators Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.tool-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.tool-card:hover .card {
  border-color: var(--primary);
  transform: translateY(-4px);
}

/* Winner Animation Specifics */
.trophy-container {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  text-align: center;
}

.winner-text {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

/* Multi-wheel grid */
.multi-wheel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

/* Footer Company Branding */
.branding-footer {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(255,255,255,0.8);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(5px);
  z-index: 40;
}

/* Full Screen Toggle */
.fullscreen-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 30;
  background: white;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.fullscreen-toggle:hover {
  transform: scale(1.1);
  color: var(--primary);
}

/* Language Dropdown */
.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 150px;
  display: none;
  z-index: 60;
  padding: var(--spacing-xs);
}

.lang-selector:hover .lang-dropdown {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.lang-option:hover {
  background: var(--bg-body);
}

/* =========================================
   Mobile Responsive Styles (max-width: 767px)
   ========================================= */
@media (max-width: 767px) {
  
  /* Layout & Container */
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .app-grid {
    padding: var(--spacing-md) 0;
    gap: var(--spacing-md);
    min-height: auto;
    height: auto;
  }

  /* Navigation */
  .navbar .container {
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }

  .mobile-menu-btn {
    display: flex !important; /* Force show on mobile */
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    color: var(--text-main);
    background: transparent;
    border: none;
    cursor: pointer;
  }
  
  /* Typography */
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  /* Components */
  .wheel-container {
    max-width: 100%;
    margin-bottom: var(--spacing-lg);
  }
  
  .wheel-center {
    width: 60px;
    height: 60px;
    font-size: 0.875rem;
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  /* Buttons & Touch Targets */
  .btn {
    min-height: 44px; /* Touch target size */
    padding: 12px 16px;
  }
  
  .btn-sm {
    min-height: 32px;
    padding: 8px 12px;
  }
  
  .editor-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  
  .editor-toolbar .btn {
    width: 100%;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    height: auto;
    padding: 8px;
  }

  /* Hide non-essential */
  .branding-footer {
    display: none; 
  }
  
  /* Tabs */
  .tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  
  .tab {
    padding: 12px 16px;
  }
}

/* Utility to show mobile menu button only on mobile */
.mobile-menu-btn {
  display: none;
}
