:root {
  --fondo: #f7f7f5;
  --superficie: #ffffff;
  --texto: #1a1a1a;
  --texto-suave: #4a4a4a;
  --borde: #c9c9c4;
  --acento: #0b5cad;      /* 6.6:1 sobre blanco */
  --acento-texto: #ffffff;
  --aviso-fondo: #fff4d6;
  --aviso-borde: #8a6100;
  --error: #a4161a;       /* 7.4:1 sobre blanco */
  --error-fondo: #fdecec;
  --bola: #0b5cad;
  --foco: #c2410c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #121212;
    --superficie: #1e1e1e;
    --texto: #f0f0f0;
    --texto-suave: #c8c8c8;
    --borde: #5a5a5a;
    --acento: #7db8f5;
    --acento-texto: #0a0a0a;
    --aviso-fondo: #2d2510;
    --aviso-borde: #e0b44c;
    --error: #ff9a9a;
    --error-fondo: #3a1a1a;
    --bola: #7db8f5;
    --foco: #ffb27a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--fondo);
  color: var(--texto);
}

a { color: var(--acento); }

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
}

.contenedor {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.saltar {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--superficie);
  color: var(--texto);
  padding: .5rem 1rem;
  z-index: 10;
}
.saltar:focus { left: 1rem; }

.cabecera { padding: 1rem 0 .5rem; }
.cabecera h1 { margin: 0 0 .25rem; font-size: 1.6rem; }
.nav { list-style: none; display: flex; gap: 1rem; padding: 0; margin: 0; flex-wrap: wrap; }
.nav a { display: inline-block; padding: .4rem 0; min-height: 44px; line-height: 2; }

.aviso {
  background: var(--aviso-fondo);
  border-top: 2px solid var(--aviso-borde);
  border-bottom: 2px solid var(--aviso-borde);
  padding: .75rem 0;
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  z-index: 5;
}
.aviso p { margin: 0; }
.aviso-titulo { font-size: 1rem; margin: 0 0 .25rem; }

main:focus { outline: none; }

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.tarjeta h2 { margin-top: 0; font-size: 1.3rem; }

.fila-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin: .75rem 0;
}
.fila-form label { flex-basis: 100%; font-weight: 600; }

input[type="number"] {
  width: 6rem;
  font: inherit;
  padding: .5rem;
  min-height: 44px;
  border: 1px solid var(--texto-suave);
  border-radius: 6px;
  background: var(--superficie);
  color: var(--texto);
}
input[type="file"] { font: inherit; max-width: 100%; color: var(--texto); }

button {
  font: inherit;
  min-height: 44px;
  padding: .5rem 1.1rem;
  border-radius: 6px;
  border: 2px solid var(--acento);
  background: var(--acento);
  color: var(--acento-texto);
  cursor: pointer;
  font-weight: 600;
}
button.secundario { background: transparent; color: var(--acento); }
button:disabled { opacity: .6; cursor: not-allowed; }

.combinaciones { padding-left: 1.5rem; margin: 1rem 0; }
.combinaciones li { margin-bottom: .6rem; }
.bolas { display: inline-flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0; vertical-align: middle; }
.bola {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 2px solid var(--bola);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nota, .estado { color: var(--texto-suave); }
.error { color: var(--error); font-weight: 600; }
.error-bloque {
  background: var(--error-fondo);
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: 6px;
  padding: .75rem 1rem;
  overflow-wrap: anywhere;
}
.error-bloque ul { margin: .25rem 0 0; padding-left: 1.2rem; }

.banner-sintetico {
  border: 2px dashed var(--aviso-borde);
  background: var(--aviso-fondo);
  padding: .5rem .75rem;
  border-radius: 6px;
  font-weight: 700;
}

.grupo { border-top: 1px solid var(--borde); padding-top: .75rem; margin-top: 1rem; }
.grupo h3 { margin: .25rem 0 .5rem; font-size: 1.15rem; }
.resumen { margin: .5rem 0; padding-left: 1.2rem; }

.tabla-scroll { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; padding: .25rem 0; }
th, td { border: 1px solid var(--borde); padding: .3rem .5rem; text-align: right; }
th { background: var(--fondo); }
th[scope="row"] { text-align: right; }

.barra {
  display: inline-block;
  height: .7rem;
  background: var(--acento);
  vertical-align: middle;
  margin-left: .4rem;
  border-radius: 2px;
}

.pie { padding: 1rem 0 2rem; color: var(--texto-suave); font-size: .95rem; }

@media (max-width: 400px) {
  .cabecera h1 { font-size: 1.35rem; }
  .bola { width: 2.15rem; height: 2.15rem; }
  th, td { padding: .25rem .35rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
