body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Header Styles */
.main-header {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 1rem 0;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-brand h1 {
  color: #f1f5f9;
  font-size: 1.5rem;
  margin: 0;
}

.nav-brand .tagline {
  color: #94a3b8;
  font-size: 0.875rem;
  display: block;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.nav-menu a {
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-menu a:hover {
  color: #3b82f6;
}

.primary-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.primary-btn:hover {
  background: #2563eb;
}

/* Footer Styles */
.main-footer {
  background: #1e293b;
  border-top: 1px solid #334155;
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  color: #f1f5f9;
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.footer-section p {
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section ul li a:hover {
  color: #3b82f6;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s;
}

.social-links a:hover {
  color: #3b82f6;
}

.footer-bottom {
  max-width: 1400px;
  margin: 2rem auto 0;
  padding: 1rem;
  border-top: 1px solid #334155;
  text-align: center;
}

.footer-bottom p {
  color: #64748b;
  font-size: 0.875rem;
  margin: 0;
}

.footer-bottom a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-bottom a:hover {
  color: #3b82f6;
}

/* Adjust body padding for header */
body {
  padding-top: 0;
}

.card {
  max-width: 1400px;
  margin: 2rem auto;
  background: #1e293b;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  .card {
    padding: 2rem;
  }
}

h1, h2, h3 { 
  margin-top: 0; 
  color: #f1f5f9;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
}

.formula-controls {
  background: #020617;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .formula-controls {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

.formula-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .formula-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .formula-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.formula-item {
  background: #1e293b;
  padding: 0.75rem;
  border-radius: 8px;
}

@media (min-width: 768px) {
  .formula-item {
    padding: 1rem;
  }
}

.formula-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .formula-item label {
    font-size: 0.9rem;
  }
}

.formula-inputs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.formula-inputs input {
  width: 90px;
  padding: 0.4rem;
  border-radius: 6px;
  border: none;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .formula-inputs input {
    width: 100px;
    font-size: 0.9rem;
  }
}

.formula-inputs span {
  color: #94a3b8;
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .formula-inputs span {
    font-size: 0.9rem;
  }
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  background: #020617;
  padding: 1rem;
  border-radius: 12px;
}

@media (min-width: 640px) {
  .controls {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .controls {
    grid-template-columns: repeat(3, 1fr);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

label { 
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

input[type="number"] {
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  width: 100%;
  box-sizing: border-box;
  background: #1e293b;
  color: #e5e7eb;
}

input[type="checkbox"] {
  margin-right: 0.5rem;
}

button {
  padding: 0.5rem 1rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  width: 100%;
}

@media (min-width: 640px) {
  button {
    width: auto;
    font-size: 0.9rem;
  }
}

button:hover {
  background: #2563eb;
}

button.secondary {
  background: #64748b;
}

button.secondary:hover {
  background: #475569;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
  }
}

.result {
  margin: 1rem 0;
  padding: 1rem;
  background: #020617;
  border-radius: 12px;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .result {
    font-size: 1rem;
  }
}

table {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-size: 0.75rem;
  background: #020617;
  border-radius: 8px;
  overflow: hidden;
}

@media (min-width: 640px) {
  table {
    font-size: 0.8rem;
  }
}

@media (min-width: 1024px) {
  table {
    font-size: 0.85rem;
  }
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0f172a;
}

th, td {
  padding: 0.5rem 0.25rem;
  text-align: right;
  border-bottom: 1px solid #1e293b;
}

@media (min-width: 640px) {
  th, td {
    padding: 0.625rem 0.375rem;
  }
}

@media (min-width: 1024px) {
  th, td {
    padding: 0.75rem 0.5rem;
  }
}

th:first-child, td:first-child { 
  text-align: left; 
}

th {
  background: #0f172a;
  font-weight: 600;
  color: #f1f5f9;
}

.table-container {
  background: #020617;
  border-radius: 12px;
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .table-container {
    padding: 1.5rem;
  }
}

canvas {
  background: #020617;
  border-radius: 12px;
  padding: 0.5rem;
}

@media (min-width: 768px) {
  canvas {
    padding: 1rem;
  }
}

@media (min-width: 768px) {
  #xpChart {
    height: 250px !important;
    max-height: 250px !important;
    margin-bottom: 2rem !important;
  }
}