:root {
  /* Sleek Dark Mode Palette */
  --bg: #0f172a;           /* Deep Slate background */
  --card-bg: #1e293b;      /* Lighter Slate for the card */
  --input-bg: #0f172a;     /* Match background for inputs */
  --text-main: #f8fafc;    /* Near white text */
  --text-muted: #94a3b8;   /* Soft gray text */
  --primary: #3b82f6;      /* Vibrant Blue */
  --primary-hover: #2563eb;
  --border: #334155;       /* Subtle dark borders */
  --border-focus: #64748b;
  --error: #ef4444;        /* Soft red for errors */
  --success: #10b981;      /* Emerald green for checkmarks */
  --radius: 20px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  /* Centering logic for all devices */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

/* App Container */
.app-card {
  background: var(--card-bg);
  width: 100%;
  max-width: 440px; /* Constrains width on desktop */
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  padding: 2rem;
  border: 1px solid var(--border);
}

/* Typography & Header */
.hero { margin-bottom: 2rem; text-align: center; }
.eyebrow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--primary); font-weight: 700; margin-bottom: 0.5rem; }
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; letter-spacing: -0.025em; }
.subtitle { color: var(--text-muted); font-size: 0.875rem; }

/* Install Button */
.install-btn {
  margin-top: 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.install-btn:hover { background: var(--primary); color: #fff; }
.install-btn.hidden { display: none; }

/* Sections */
.section { margin-bottom: 1.5rem; }
.section-label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--text-main); }

/* Gamemode Grid */
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.mode-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: inherit;
  color: inherit;
}
.mode-card:hover { border-color: var(--border-focus); background: rgba(255,255,255,0.02); }
.mode-card.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.mode-name { font-weight: 600; font-size: 1rem; }
.mode-size { font-size: 0.75rem; color: var(--text-muted); }
.active .mode-size { color: rgba(255,255,255,0.8); }

/* Inputs */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
input {
  background: var(--input-bg);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  width: 100%;
  color-scheme: dark; /* Adapts native UI elements like scrollbars */
}
input::placeholder { color: #475569; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }
input.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

/* Error Message */
.error-message { color: var(--error); font-size: 0.875rem; margin-bottom: 1rem; min-height: 1.25rem; font-weight: 500; }
.error-message:empty { display: none; }

/* Calculate Button */
.primary-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 1rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.primary-btn:hover { background: var(--primary-hover); }
.primary-btn:active { transform: scale(0.98); }

/* Results */
.results {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: none;
}
.results.show { display: block; animation: fadeIn 0.3s ease-out; }
.results-header h2 { font-size: 1.125rem; font-weight: 600; }
.results-header p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Combos */
.combo-list { 
  list-style: none; 
  display: flex; 
  flex-direction: column; 
  gap: 0.75rem; 
  max-height: 250px; /* Scrollable if too many combinations */
  overflow-y: auto;
  padding-right: 0.5rem;
}
/* Scrollbar styling */
.combo-list::-webkit-scrollbar { width: 6px; }
.combo-list::-webkit-scrollbar-track { background: var(--input-bg); border-radius: 4px; }
.combo-list::-webkit-scrollbar-thumb { background: var(--border-focus); border-radius: 4px; }

.combo-item {
  background: var(--input-bg);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.combo-item::before { 
  content: '✓'; 
  color: var(--success); 
  font-weight: bold; 
  font-size: 1.1rem;
}

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

/* Mobile Tweaks */
@media (max-width: 400px) {
  .app-card { padding: 1.5rem; }
}