/* Web pública del bus de la boda (luisysandra.nadunet.es). Móvil primero;
   modo oscuro automático (la vuelta es a las 4:30). Sin estilos en línea:
   la CSP solo deja este fichero. */
:root {
    --bg: #faf6ef;
    --card: #ffffff;
    --ink: #2a2421;
    --muted: #84786e;
    --line: #ebe1d5;
    --accent: #2f5d50;
    --accent-ink: #ffffff;
    --accent-soft: #e4efe9;
    --gold: #b0814f;
    --gold-soft: #f6ecdf;
    --ok: #2e7d4f;
    --ok-soft: #e3f4e8;
    --late: #c0392b;
    --late-soft: #fdecea;
    --warn: #9a6b12;
    --warn-soft: #fbf1db;
    --shadow: 0 2px 10px rgba(60, 40, 20, .07);
    --radius: 18px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14110f;
        --card: #1f1a17;
        --ink: #f2ebe3;
        --muted: #ab9f94;
        --line: #362d27;
        --accent: #6fb39c;
        --accent-ink: #10201b;
        --accent-soft: #1e3029;
        --gold: #d9ab78;
        --gold-soft: #2e241b;
        --ok: #7ccf9a;
        --ok-soft: #173023;
        --late: #f08a7c;
        --late-soft: #3a1d19;
        --warn: #e8c070;
        --warn-soft: #33290f;
        --shadow: 0 2px 10px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px; line-height: 1.45;
    background: var(--bg); color: var(--ink);
    padding: 0 16px calc(28px + env(safe-area-inset-bottom));
}
button { font: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---- Cabecera ---- */
.cab { max-width: 520px; margin: 0 auto; padding: 22px 0 10px; text-align: center; }
.cab-sup { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.novios {
    margin: 2px 0 8px; font-family: Georgia, "Times New Roman", serif; font-style: italic;
    font-weight: 400; font-size: 40px; line-height: 1.1; color: var(--ink);
}
.viaje {
    display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; align-items: center;
    font-size: 14px; color: var(--muted); background: var(--card); border: 1px solid var(--line);
    border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow);
}
.viaje:empty { display: none; }
.viaje b { color: var(--ink); }
.viaje .cuenta { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.viaje .cuenta.tarde { color: var(--late); }

/* ---- Contenido ---- */
.app { max-width: 520px; margin: 10px auto 0; }
.tarjeta {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.tarjeta h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.2; }
.tarjeta p { margin: 6px 0; }
.centro { text-align: center; }
.cargando { color: var(--muted); }
.muted { color: var(--muted); }
.tarjeta > .emoji { font-size: 48px; line-height: 1; margin-bottom: 6px; }
.peque { font-size: 14px; }

.campo {
    width: 100%; font-size: 20px; padding: 14px 16px; border-radius: 14px;
    border: 2px solid var(--line); background: var(--bg); color: var(--ink); outline: none;
}
.campo:focus { border-color: var(--accent); }
textarea.campo { font-size: 17px; min-height: 120px; resize: vertical; font-family: inherit; }

.btn {
    display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px 18px;
    background: var(--accent); color: var(--accent-ink); font-size: 18px; font-weight: 700;
    cursor: pointer; text-align: center; text-decoration: none; margin-top: 10px;
    transition: transform .08s ease, filter .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.sec { background: var(--accent-soft); color: var(--accent); }
.btn.oro { background: var(--gold); color: #fff; }
.btn.mini { display: inline-block; width: auto; padding: 8px 14px; font-size: 15px; margin-top: 0; }
.enlace {
    background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px;
    cursor: pointer; font-size: 15px;
}
.fila-btns { display: flex; gap: 10px; }
.fila-btns .btn { flex: 1; }

/* Resultados de la búsqueda de nombre */
.resultados { margin-top: 12px; display: grid; gap: 8px; }
.persona {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px;
    font-size: 19px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.persona:active, .persona:hover { border-color: var(--accent); }
.persona .marca { font-size: 13px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.persona .flecha { color: var(--accent); font-size: 22px; }
.ayuda { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* Resultado de subir */
.veredicto { text-align: center; padding: 26px 20px; position: relative; overflow: hidden; }
.veredicto .emoji { font-size: 64px; line-height: 1; }
.veredicto h2 { font-size: 28px; margin-top: 10px; }
.veredicto .frase { font-size: 19px; margin: 12px 0 8px; }
.veredicto .hora { font-size: 14px; color: var(--muted); }
.veredicto.ok { background: linear-gradient(180deg, var(--ok-soft), var(--card) 70%); border-color: var(--ok); }
.veredicto.ok h2 { color: var(--ok); }
.veredicto.tarde { background: linear-gradient(180deg, var(--late-soft), var(--card) 70%); border-color: var(--late); }
.veredicto.tarde h2 { color: var(--late); }
.sello {
    display: inline-block; margin-top: 10px; padding: 6px 12px; border: 2px dashed var(--late);
    color: var(--late); border-radius: 10px; font-weight: 800; font-size: 14px; transform: rotate(-3deg);
    text-transform: uppercase; letter-spacing: .04em;
}
.aviso-normas {
    background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 12px 14px;
    font-size: 15px; font-weight: 600; margin-bottom: 14px;
}
.a-bordo { display: flex; align-items: center; gap: 12px; }
.a-bordo .emoji { font-size: 34px; }
.a-bordo b { display: block; font-size: 19px; }
.pildora {
    display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
    background: var(--ok-soft); color: var(--ok);
}
.pildora.tarde { background: var(--late-soft); color: var(--late); }

/* Menú de juegos */
.seccion { margin: 22px 4px 10px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.juegos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.juego {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px;
    text-align: left; cursor: pointer; color: var(--ink); box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 4px; min-height: 120px;
    -webkit-tap-highlight-color: transparent; transition: transform .1s ease, border-color .15s ease;
}
.juego:active { transform: scale(.98); }
.juego:hover { border-color: var(--gold); }
.juego .ico { font-size: 32px; line-height: 1; }
.juego b { font-size: 17px; }
.juego span.desc { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.juego.ancho { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }

.volver { margin: 0 0 10px; }
.titulo-juego { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.titulo-juego .ico { font-size: 34px; }
.titulo-juego h2 { margin: 0; }

/* Semáforo */
.semaforo {
    user-select: none; -webkit-user-select: none; touch-action: manipulation;
    height: 300px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 800; text-align: center; cursor: pointer; margin-top: 12px;
    background: var(--line); color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.semaforo .luz { width: 90px; height: 90px; border-radius: 50%; background: rgba(0,0,0,.15); margin-bottom: 14px; }
.semaforo.rojo { background: #3a1412; color: #ffd9d4; }
.semaforo.rojo .luz { background: #ff3b30; box-shadow: 0 0 40px #ff3b30; }
.semaforo.verde { background: #0f3b22; color: #d9ffe6; }
.semaforo.verde .luz { background: #34c759; box-shadow: 0 0 50px #34c759; }
.semaforo.multa { background: var(--late-soft); color: var(--late); }
.semaforo small { font-size: 15px; font-weight: 600; opacity: .85; margin-top: 6px; }

/* Claxon */
.claxon-zona { display: flex; flex-direction: column; align-items: center; margin-top: 12px; }
.claxon {
    width: 230px; height: 230px; border-radius: 50%; border: 0; cursor: pointer;
    background: radial-gradient(circle at 35% 30%, #f6c66d, var(--gold) 60%, #7d5530);
    color: #fff; font-size: 80px; box-shadow: 0 10px 0 #6b4627, 0 14px 30px rgba(0,0,0,.25);
    user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    transition: transform .05s ease, box-shadow .05s ease;
}
.claxon.pulsado, .claxon:active { transform: translateY(8px); box-shadow: 0 2px 0 #6b4627, 0 6px 16px rgba(0,0,0,.25); }
.claxon[disabled] { filter: grayscale(.6); cursor: default; }
.contador { font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 20px; line-height: 1; }
.barra-tiempo { width: 100%; height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 16px; }
.barra-tiempo div { height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.sonido { margin-top: 10px; }

/* Resultado de un juego */
.marca-juego { font-size: 52px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 8px 0 4px; }
.marca-juego small { font-size: 20px; color: var(--muted); font-weight: 600; }
.record { text-align: center; color: var(--gold); font-weight: 800; }

/* Porra */
.pregunta { margin-bottom: 14px; }
.pregunta h3 { margin: 0 0 10px; font-size: 18px; }
.opcion {
    position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
    background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px;
    font-size: 16px; color: var(--ink); cursor: pointer; text-align: left; overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.opcion .relleno { position: absolute; inset: 0 auto 0 0; background: var(--gold-soft); z-index: 0; width: 0; transition: width .4s ease; }
.opcion > span { position: relative; z-index: 1; }
.opcion .pct { font-size: 13px; font-weight: 700; color: var(--muted); }
.opcion.mia { border-color: var(--accent); font-weight: 700; }
.opcion.correcta { border-color: var(--ok); }
.opcion.correcta .pct::before { content: '✓ '; color: var(--ok); }
.opcion[disabled] { cursor: default; }

/* Clasificación */
.pestanas { display: flex; gap: 6px; margin: 4px 0 12px; }
.pestana {
    flex: 1; border: 0; background: var(--bg); color: var(--muted); border-radius: 12px; padding: 10px 6px;
    font-weight: 700; cursor: pointer; font-size: 15px;
}
.pestana.activa { background: var(--accent); color: var(--accent-ink); }
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.ranking li:last-child { border-bottom: 0; }
.ranking .pos { width: 34px; text-align: center; font-weight: 800; color: var(--muted); font-size: 18px; }
.ranking .nom { flex: 1; font-weight: 600; }
.ranking .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.ranking li.yo { background: var(--accent-soft); border-radius: 10px; }
.ranking li.sep { justify-content: center; color: var(--muted); border-bottom: 0; padding: 2px; }

.contador-txt { text-align: right; font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Avisos */
.error-caja { background: var(--late-soft); color: var(--late); border-radius: 12px; padding: 12px 14px; margin-top: 12px; font-weight: 600; }
.ok-caja { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; margin-top: 12px; font-weight: 600; }
.toast {
    position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 600;
    box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); text-align: center;
}

/* Pie */
.pie { max-width: 520px; margin: 24px auto 0; text-align: center; font-size: 14px; color: var(--muted); }
.pie ul { list-style: none; padding: 0; margin: 0 0 12px; }
.pie li { margin: 4px 0; }
.pie .quien { margin-top: 8px; }

/* Foto de fondo (si el encargado ha subido una): fija detrás de todo, con
   un velo para que se lean la cabecera y el pie; las tarjetas son opacas. */
/* Más alta que la pantalla y anclada arriba: las caras de los novios (en la
   mitad de abajo de su foto) quedan por debajo de la tarjeta del nombre. */
.fondo { position: fixed; left: 0; top: 0; width: 100%; height: 132%; object-fit: cover; object-position: 50% 0; z-index: -2; }
body.con-fondo { background: #1b1714; }
body.con-fondo::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(180deg, rgba(20, 14, 10, .62) 0%, rgba(20, 14, 10, .38) 20%, rgba(20, 14, 10, .08) 42%,
                rgba(20, 14, 10, .06) 66%, rgba(20, 14, 10, .62) 100%);
}
/* Con foto, el pie (normas) baja al fondo de la pantalla para dejar a la
   vista la parte central de la foto (en la de los novios, sus caras). */
body.con-fondo { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
body.con-fondo .cab, body.con-fondo .app { width: 100%; }
body.con-fondo .pie { margin-top: auto; padding-top: 24px; }
body.con-fondo .cab-sup { color: #f6d9a8; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
body.con-fondo .novios { color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .55); }
body.con-fondo .seccion, body.con-fondo .pie { color: rgba(255, 255, 255, .92); text-shadow: 0 1px 5px rgba(0, 0, 0, .7); }
body.con-fondo .pie .enlace { color: #fff; }
body.con-fondo .tarjeta, body.con-fondo .juego { box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }

/* Confeti (canvas a pantalla completa, no tapa toques) */
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

@media (max-width: 360px) {
    .novios { font-size: 32px; }
    .juegos { grid-template-columns: 1fr; }
    .claxon { width: 190px; height: 190px; font-size: 64px; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
