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

:root {
  --bg-body: #f6f8fa;
  --bg-card: #ffffff;
  --border-light: #dde1e6;
  --border-strong: #a0a8b4;
  --text-primary: #1a1e24;
  --text-secondary: #3d4752;
  --text-muted: #5e6a78;
  --accent: #0f62fe;
  --accent-light: #e8f0fe;
  --slider-track: #d0d7de;
  --slider-thumb: #0f62fe;
  --formula-bg: #f2f4f8;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  --radius-card: 16px;
  --radius-pill: 40px;
  --radius-field: 8px;
}

body.dark-mode {
  --bg-body: #1a1e24;
  --bg-card: #262b33;
  --border-light: #3d4752;
  --border-strong: #5e6a78;
  --text-primary: #f2f4f8;
  --text-secondary: #d0d7de;
  --text-muted: #a0a8b4;
  --accent: #6ea6ff;
  --accent-light: #2d3f5e;
  --slider-track: #3d4752;
  --slider-thumb: #6ea6ff;
  --formula-bg: #20242c;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body {
  background: var(--bg-body);
  color: var(--text-primary);
  transition:
    background 0.2s,
    color 0.2s;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.calculadora {
  width: 100%;
  max-width: 1000px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.card-header h1 {
  font-size: 1.6rem;
}

.card-header h2 {
  font-size: 1.3rem;
}

.card-header h3 {
  font-size: 1.1rem;
}

.card-header h1,
.card-header h2,
.card-header h3 {
  font-weight: 500;
  letter-spacing: -0.01em;
}

.mode-toggle {
  background: var(--bg-body);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0.2rem;
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.mode-toggle span {
  padding: 0.3rem 1rem;
  font-size: 0.85rem;
  border-radius: 30px;
  transition: 0.1s;
  color: var(--text-secondary);
}

body:not(.dark-mode) .mode-toggle .claro,
body.dark-mode .mode-toggle .oscuro {
  background: var(--accent);
  color: white;
  font-weight: 500;
}

.precio-superior {
  margin-bottom: 1.5rem;
}

.grid-entrada {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.grupo-campos {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.campo label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  font-weight: 500;
}

.campo input {
  background: var(--bg-body);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-field);
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  color: var(--text-primary);
  transition: border 0.15s;
}

.campo input:focus {
  outline: none;
  border-color: var(--accent);
}

.panel-deslizante {
  background: var(--formula-bg);
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  border: 1px solid var(--border-light);
  margin-bottom: 2rem;
}

.fila-deslizante {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.etiqueta-deslizante {
  min-width: 180px;
  font-weight: 450;
}

input[type="range"] {
  flex: 2;
  min-width: 250px;
  height: 6px;
  background: var(--slider-track);
  border-radius: 10px;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--slider-thumb);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.lectura-deslizante {
  background: var(--bg-card);
  padding: 0.3rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.resultado-inmediato {
  margin-top: 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-card);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
}

.etiqueta-resultado {
  font-size: 1rem;
  color: var(--text-secondary);
}

.valor-resultado {
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.2;
}

.impacto-rapido {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
  padding: 0.5rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  font-size: 1rem;
}

.impacto-item {
  color: var(--text-secondary);
}

.caja-formulas {
  background: var(--formula-bg);
  border-radius: 14px;
  padding: 1.8rem;
  font-size: 0.95rem;
  border: 1px solid var(--border-light);
  margin: 1.5rem 0;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
}

.paso {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-light);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.5rem;
}

.paso:last-child {
  border-bottom: none;
}

.math-live,
.inline-code {
  background: var(--bg-card);
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-weight: 450;
  border: 1px solid var(--border-light);
  font-family: inherit;
}

.math-live {
  color: var(--accent);
  border-color: var(--accent);
}

.footer-legal {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 1rem;
  border-top: 1px dashed var(--border-light);
  padding-top: 1rem;
}

.github-link {
  margin-top: 0.5rem;
}

.github-link a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.github-link a:hover {
  border-bottom: 1px solid var(--accent);
}
