:root {
  --rojo: #b3261e;
  --rojo-osc: #8a1c16;
  --verde: #1f5f3a;
  --verde-osc: #143f27;
  --oro: #e9c46a;
  --nieve: #fbf7f0;
  --papel: #ffffff;
  --texto: #241a14;
  --suave: #6f6259;
  --borde: #e4d8c8;
  --linea: #ece3d6;
  --fondo: #0d2619;
  --titulos: 'Fraunces', Georgia, 'Times New Roman', serif;
  --fuente-deco: 'Mountains of Christmas', cursive;
  --fondo2: #1b4a30;
  --franja1: var(--rojo);
  --franja2: #f4ede3;
  --acento-claro: #b9e4c4;
}

/* ---------- Temáticas: solo cambian colores, letra decorativa y la franja ---------- */
[data-tema="reyes"] {
  --rojo: #6a3fa0; --rojo-osc: #50297f;
  --verde: #23608f; --verde-osc: #184569;
  --oro: #f2c94c; --nieve: #fbf8f1; --borde: #e3dccb; --linea: #ebe5d6;
  --fondo: #0b1433; --fondo2: #22336e;
  --franja1: #c9a227; --franja2: #f6f0e1;
  --fuente-deco: 'Cinzel Decorative', Georgia, serif;
  --acento-claro: #f6e3a1;
}
[data-tema="cumple"] {
  --rojo: #d6336c; --rojo-osc: #a91e51;
  --verde: #1f8a7a; --verde-osc: #156458;
  --oro: #ffd166; --nieve: #fffaf6; --borde: #f0dfe4; --linea: #f3e6ea;
  --fondo: #2b0f3f; --fondo2: #6a1f78;
  --franja1: #ff5d8f; --franja2: #ffe9a8;
  --fuente-deco: 'Pacifico', 'Brush Script MT', cursive;
  --acento-claro: #a8f0e2;
}
[data-tema="elegante"] {
  --rojo: #26313f; --rojo-osc: #161d27;
  --verde: #3c6e5d; --verde-osc: #2b5144;
  --oro: #d4b483; --nieve: #faf8f4; --borde: #e2ddd3; --linea: #ebe7df;
  --fondo: #14181f; --fondo2: #2a3240;
  --franja1: #d4b483; --franja2: #faf8f4;
  --fuente-deco: 'Fraunces', Georgia, serif;
  --acento-claro: #e8d5b0;
}
[data-tema="elegante"] .cabecera h1 { font-style: italic; letter-spacing: -.02em; }

* { box-sizing: border-box; }

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

body {
  font-family: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--texto);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, var(--fondo2) 0%, transparent 70%),
    var(--fondo);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

#nieve {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.contenedor {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

.cabecera {
  padding: 36px 8px 0;
  text-align: center;
  color: var(--nieve);
  margin: 8px 0 28px;
}
.cabecera h1 {
  font-family: var(--fuente-deco);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--oro);
  line-height: 1.05;
}
.cabecera p { margin: 0; opacity: .75; font-size: .95rem; }

/* Tarjeta de papel con una franja de bastón de caramelo arriba */
.tarjeta {
  background:
    repeating-linear-gradient(-45deg, var(--franja1) 0 10px, var(--franja2) 10px 20px) top / 100% 6px no-repeat,
    var(--nieve);
  border-radius: 14px;
  padding: 26px 22px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .25);
  position: relative;
  margin-bottom: 18px;
}
.tarjeta h2 {
  font-family: var(--titulos);
  font-weight: 600;
  color: var(--texto);
  font-size: 1.35rem;
  letter-spacing: -.01em;
  margin: 0 0 10px;
}

label { display: block; font-weight: 700; font-size: .92rem; margin: 14px 0 6px; }

input[type=text], input[type=tel] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font: inherit;
  background: var(--papel);
  color: var(--texto);
}
input::placeholder, textarea::placeholder { color: #ab9e92; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--verde); outline-offset: -1px; border-color: transparent; }

.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .fila2 { grid-template-columns: 1fr; } }

/* Botones: principal (rojo), verde, secundario (borde) y enlace (solo texto) */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, border-color .15s;
  color: #fff;
  background: var(--rojo);
}
.boton:hover { background: var(--rojo-osc); }
.boton:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.boton:disabled { opacity: .55; cursor: wait; }
.boton.verde { background: var(--verde); }
.boton.verde:hover { background: var(--verde-osc); }
.boton.secundario { background: transparent; color: var(--texto); border-color: var(--borde); }
.boton.secundario:hover { background: #f1e9dd; }
.boton.grande { font-size: 1.05rem; padding: 14px 22px; width: 100%; }
.boton.peq { padding: 7px 12px; font-size: .88rem; }
.enlace {
  background: none; border: 0; padding: 4px 0; font: inherit; font-size: .88rem; font-weight: 700;
  color: var(--verde); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.enlace:hover { color: var(--verde-osc); }
.enlace.peligro { color: var(--rojo); }

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

/* Lista de participantes */
.participante {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.quitar {
  border: 0; background: transparent; font-size: 1.2rem; line-height: 1; cursor: pointer; color: #a89a8d;
  width: 36px; height: 36px; border-radius: 8px;
}
.quitar:hover { background: #f3e4e1; color: var(--rojo); }
@media (max-width: 520px) {
  .participante { grid-template-columns: 1fr auto; padding-bottom: 10px; border-bottom: 1px solid var(--linea); }
  .participante input[type=tel] { grid-column: 1; }
  .participante .quitar { grid-row: 1 / span 2; grid-column: 2; }
}

.ayuda { color: var(--suave); font-size: .9rem; margin: 6px 0; }
.error {
  border: 0;
  background: #fbe9e7; color: var(--rojo-osc); border-radius: 8px; padding: 10px 12px;
  margin-top: 12px; font-weight: 600; font-size: .95rem;
}
.oculto { display: none !important; }

details { margin-top: 14px; }
summary { cursor: pointer; font-weight: 700; color: var(--verde); }
.exclusion { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.exclusion select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--borde); font: inherit; background: var(--papel);
}

/* Panel de administrador */
.lista-admin { list-style: none; margin: 0; padding: 0; }
.lista-admin li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--linea);
}
.lista-admin li:last-child { border-bottom: 0; }
.lista-admin .nombre { font-weight: 800; font-size: 1.05rem; }
.lista-admin .meta { color: var(--suave); font-size: .86rem; }
.lista-admin .botones { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 4px; }

/* Estado con un punto de color */
.estado {
  align-self: start;
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: .85rem; white-space: nowrap;
}
.estado::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.estado.si { color: var(--verde); }
.estado.no { color: #a46a1f; }
.estados { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.contador { font-size: .82rem; color: var(--suave); white-space: nowrap; }
.contador.cero { color: #a89a8d; }

.enlace-grupo {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .9rem; word-break: break-all;
  background: #f1e9dd; border-radius: 8px; padding: 10px 12px; margin: 8px 0 0;
}
.deseos-admin { grid-column: 1 / -1; margin-top: 2px; }
.deseos-admin summary { font-size: .88rem; }
.deseos-admin div { white-space: pre-wrap; word-break: break-word; background: #eef4ee; border-radius: 8px; padding: 10px 12px; margin-top: 6px; font-size: .95rem; }
.aviso {
  margin-top: 6px; padding: 8px 10px; border-radius: 8px; font-size: .85rem; font-weight: 600;
  background: #fbf0d6; color: #6e4c00; border-left: 3px solid #d9a521;
}
.editar { grid-column: 1 / -1; display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: #f1e9dd; }
.editar .ayuda { margin: 0; }

.progreso { height: 6px; background: #ebe1d3; border-radius: 3px; overflow: hidden; margin: 10px 0 6px; }
.progreso > div { height: 100%; background: var(--verde); transition: width .4s; }

.resumen { display: flex; gap: 4px 16px; flex-wrap: wrap; color: var(--suave); font-size: .92rem; }
.resumen b { color: var(--texto); }

/* Página de participante */
.centro { text-align: center; }
@keyframes bote { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes aparecer { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.chip { display: inline-block; background: #f1e9dd; border-radius: 6px; padding: 5px 10px; margin: 3px; font-weight: 600; font-size: .92rem; }

.pie { text-align: center; color: rgba(255, 255, 255, .45); font-size: .82rem; margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1c1714; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-weight: 600; font-size: .95rem; z-index: 10; box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}

/* Botón de la música */
.boton-musica {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(13, 38, 25, .55); color: #fff;
  cursor: pointer; padding: 0;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.boton-musica:hover { background: rgba(13, 38, 25, .8); }
.boton-musica[aria-pressed="false"] { color: rgba(255, 255, 255, .6); }
.boton-musica.flotante {
  position: fixed; z-index: 20;
  top: calc(env(safe-area-inset-top) + 10px); right: calc(env(safe-area-inset-right) + 10px);
}

/* Selector de idioma */
.selector-idioma {
  height: 36px; border-radius: 18px; padding: 0 30px 0 12px;
  border: 1px solid rgba(255, 255, 255, .25); color: #fff; font: inherit; font-size: .85rem; font-weight: 700;
  background: rgba(0, 0, 0, .25) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.selector-idioma option { color: #000; }
.selector-idioma.flotante {
  position: fixed; z-index: 20;
  top: calc(env(safe-area-inset-top) + 14px); left: calc(env(safe-area-inset-left) + 10px);
}

/* Elegir temática */
.temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tema-op { position: relative; cursor: pointer; }
.tema-op input { position: absolute; opacity: 0; pointer-events: none; }
.tema-op .muestra {
  display: block; border-radius: 10px; padding: 12px 12px 10px; color: #fff; min-height: 76px;
  border: 2px solid transparent; transition: border-color .15s, transform .1s;
}
.tema-op input:checked + .muestra { border-color: var(--texto); box-shadow: 0 0 0 2px var(--nieve) inset; }
.tema-op input:focus-visible + .muestra { outline: 2px solid var(--oro); outline-offset: 2px; }
.tema-op .muestra b { display: block; font-size: 1.15rem; line-height: 1.2; margin-bottom: 2px; }
.tema-op .muestra small { opacity: .85; font-size: .78rem; line-height: 1.3; display: block; }
.muestra.navidad { background: radial-gradient(ellipse at top, #1b4a30, #0d2619); }
.muestra.navidad b { font-family: 'Mountains of Christmas', cursive; color: #e9c46a; }
.muestra.reyes { background: radial-gradient(ellipse at top, #22336e, #0b1433); }
.muestra.reyes b { font-family: 'Cinzel Decorative', serif; color: #f2c94c; font-size: 1rem; }
.muestra.cumple { background: radial-gradient(ellipse at top, #6a1f78, #2b0f3f); }
.muestra.cumple b { font-family: 'Pacifico', cursive; color: #ffd166; font-weight: 400; }
.muestra.elegante { background: radial-gradient(ellipse at top, #2a3240, #14181f); }
.muestra.elegante b { font-family: 'Fraunces', serif; font-style: italic; color: #d4b483; }
select.campo {
  width: 100%; padding: 11px 12px; border: 1px solid var(--borde); border-radius: 8px;
  font: inherit; background: var(--papel); color: var(--texto);
}
.recargar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.recargar .meta { color: var(--suave); font-size: .86rem; }
/* La letra de Reyes es de mayúsculas y muy ancha: un poco más pequeña */
[data-tema="reyes"] .cabecera h1 { font-size: clamp(1.9rem, 6.5vw, 2.7rem); }
[data-tema="reyes"] .top h1 { font-size: clamp(1.5rem, 6.5vw, 2.1rem) !important; }
[data-tema="reyes"] .nombre-final, [data-tema="reyes"] .nombre { font-size: clamp(2.2rem, 10vw, 6.5rem) !important; }
[data-tema="cumple"] .cabecera h1, [data-tema="cumple"] .top h1 { font-weight: 400; }
