:root {
  color-scheme: dark;
  --fondo: #0b1020;
  --fondo-2: #131a33;
  --texto: #eef1f8;
  --tenue: #9aa4c4;
  /* tema.js puede sobrescribir estas cinco para cambiar el color de la app */
  --acento: #6ea8fe;
  --acento-2: #b98cff;
  --acento-rgb: 110, 168, 254;
  --sobre-acento: #0b1020;
  --borde: rgba(255, 255, 255, 0.1);
  --sombra: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(120% 90% at 50% 0%, var(--fondo-2) 0%, var(--fondo) 55%) fixed;
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.tarjeta {
  width: min(560px, 100%);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--borde);
  border-radius: 22px;
  box-shadow: var(--sombra);
  padding: 26px 22px;
}

.centro {
  text-align: center;
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.sub {
  margin: 0;
  color: var(--tenue);
  font-size: 0.92rem;
}

.etiqueta {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  color: var(--tenue);
  margin-bottom: 10px;
}

.principal {
  font-size: clamp(2.6rem, 14vw, 4.2rem);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -0.03em;
  background: linear-gradient(100deg, var(--acento), var(--acento-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.principal .unidad {
  display: block;
  font-size: 0.3em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tenue);
  -webkit-text-fill-color: var(--tenue);
  margin-top: 8px;
}

.desglose {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.pastilla {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--borde);
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 84px;
}

.pastilla b {
  display: block;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.pastilla span {
  color: var(--tenue);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.barra {
  margin-top: 22px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.barra > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--acento), var(--acento-2));
  transition: width 0.4s ease;
}

.pie {
  margin-top: 16px;
  color: var(--tenue);
  font-size: 0.85rem;
  line-height: 1.5;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

a.boton,
button.boton {
  appearance: none;
  border: 1px solid var(--borde);
  background: rgba(255, 255, 255, 0.07);
  color: var(--texto);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

a.boton:hover,
button.boton:hover {
  background: rgba(255, 255, 255, 0.13);
}

button.primario,
a.primario {
  background: linear-gradient(100deg, var(--acento), var(--acento-2));
  border-color: transparent;
  color: var(--sobre-acento);
}

button.primario:hover,
a.primario:hover {
  filter: brightness(1.08);
  background: linear-gradient(100deg, var(--acento), var(--acento-2));
}

.aviso {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  border: 1px solid var(--borde);
  background: rgba(var(--acento-rgb), 0.14);
  color: var(--texto);
}

.aviso.error {
  background: rgba(255, 120, 120, 0.14);
  color: #ffd2d2;
}

.pie.error {
  color: #ffb4b4;
  opacity: 1 !important;
}

.oculto {
  display: none !important;
}

/* --- formulario de edición --- */

label {
  display: block;
  font-size: 0.82rem;
  color: var(--tenue);
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
textarea {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--borde);
  background: rgba(0, 0, 0, 0.28);
  color: var(--texto);
  font: inherit;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--acento);
  outline-offset: 1px;
}

.ayuda {
  color: var(--tenue);
  font-size: 0.78rem;
  margin: 6px 0 0;
  line-height: 1.45;
}

.cabecera {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cabecera h1 {
  font-size: 1.15rem;
  margin: 0;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

@media (prefers-reduced-motion: reduce) {
  .barra > i {
    transition: none;
  }
}

/* --- selector de color --- */

.paleta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.tono {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--borde);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.15s ease;
}

.tono:hover {
  transform: scale(1.08);
}

.tono[aria-pressed='true'] {
  border-color: var(--texto);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.tono-libre {
  width: 56px;
  height: 40px;
  padding: 3px;
  border-radius: 12px;
  border: 2px solid var(--borde);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.tono-libre::-webkit-color-swatch-wrapper {
  padding: 0;
}

.tono-libre::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.tono-libre::-moz-color-swatch {
  border: none;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .tono {
    transition: none;
  }
}
