/* ¡PROTESTO! - Estética de plató electoral nocturno y tribunal Ace Attorney */
@font-face { font-family: 'Oswald'; src: url('../fonts/oswald-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Spectral'; src: url('../fonts/spectral-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Spectral'; src: url('../fonts/spectral-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/ibm-plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
    --fondo: #090e1a;
    --panel: #f8f5ec;
    --panel-2: #ece5d2;
    --tinta: #171c26;
    --azul: #1d4ed8;
    --azul-osc: #142b5e;
    --rojo: #b91c1c;
    --dorado: #d97706;
    --oro-vivo: #fbbf24;
    --verde: #15803d;
    --titular: 'Oswald', 'Arial Narrow', sans-serif;
    --texto: 'Spectral', Georgia, serif;
    --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
    background: var(--fondo);
    background-image: radial-gradient(ellipse at 50% 0, #1c2c52, #090e1a 72%);
    color: var(--tinta);
    font-family: var(--texto);
    font-size: 17px;
    line-height: 1.4;
}
h1, h2, h3 { font-family: var(--titular); margin: 0; }
button { font: inherit; cursor: pointer; white-space: normal; }
a { color: var(--azul-osc); }
code { font-family: var(--mono); font-size: 0.88em; background: rgba(15, 23, 42, 0.08); padding: 1px 5px; border-radius: 4px; }

/* ---- Portada (Escaleta de TV) ---- */
#start-screen {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 14px 28px;
}
.escaleta {
    position: relative;
    width: 100%;
    max-width: 660px;
    padding: 28px 30px 22px;
    background: var(--panel);
    border-top: 7px solid var(--rojo);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.escaleta-sello {
    position: absolute;
    top: 18px;
    right: 20px;
    padding: 3px 10px;
    font-family: var(--titular);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.4px;
    color: #fff;
    background: var(--rojo);
    border-radius: 4px;
}
.escaleta-org {
    font-family: var(--titular);
    letter-spacing: 2.5px;
    color: var(--azul-osc);
    font-size: 13px;
    margin: 0 0 6px;
    padding-right: 125px;
}
.escaleta h1 {
    font-size: clamp(42px, 9vw, 66px);
    color: var(--rojo);
    line-height: 0.98;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 rgba(23, 28, 38, 0.14);
}
.escaleta-sub {
    font-style: italic;
    color: #4b5563;
    margin: 6px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--azul-osc);
    font-size: 15.5px;
}
.escaleta-intro { margin: 0 0 12px; }

.reparto-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}
.badge-cand {
    font-family: var(--titular);
    font-size: 13px;
    letter-spacing: 0.5px;
    color: #fff;
    padding: 3px 9px;
    border-radius: 4px;
}
.badge-cand.psoe { background: #e30613; }
.badge-cand.pp { background: #1d84ce; }
.badge-cand.vox { background: #468f1d; }
.badge-cand.fa { background: #c4006c; }
.badge-cand.podemos { background: #6c2a8a; }
.badge-cand.salf { background: #4b5563; }

.guia-portada {
    margin: 0 0 16px;
    padding: 10px 14px 10px 30px;
    background: var(--panel-2);
    border-left: 4px solid var(--azul);
    border-radius: 4px;
    font-size: 15.5px;
}
.guia-portada li + li { margin-top: 4px; }

.btn-principal {
    display: block;
    width: 100%;
    padding: 13px 16px;
    border: 0;
    border-radius: 7px;
    background: linear-gradient(160deg, #dc2626, #991b1b);
    color: #fff;
    font-family: var(--titular);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 0 #5c0f0f;
    transition: transform 0.08s, box-shadow 0.08s;
}
.btn-principal:hover { transform: translateY(-1px); box-shadow: 0 5px 0 #5c0f0f; }
.btn-principal:active { transform: translateY(3px); box-shadow: 0 1px 0 #5c0f0f; }
.btn-continuar {
    margin-top: 8px;
    background: linear-gradient(160deg, #16a34a, #15803d);
    box-shadow: 0 4px 0 #0c4b24;
    font-size: 19px;
}
.escaleta-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-sec {
    background: var(--panel-2);
    border: 1px solid #c5bd9f;
    border-radius: 6px;
    padding: 8px 13px;
    font-family: var(--titular);
    font-size: 15.5px;
    color: var(--azul-osc);
}
.btn-sec:hover { background: #e2d9bd; }
.escaleta-pie { margin: 13px 0 4px; font-size: 14px; }
.enlace { background: none; border: 0; padding: 0; color: var(--azul-osc); text-decoration: underline; }
.escaleta-nota { color: #5b574e; font-size: 13.5px; font-style: italic; margin: 5px 0 0; }

/* ---- Pantalla de Juego ---- */
#game-container {
    height: 100dvh;
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #0b1222;
}
#hud {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    background: #102046;
    border-bottom: 2px solid #264385;
    color: #fff;
    font-family: var(--titular);
}
.btn-icono {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 7px;
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 18px;
}
.hud-bloque { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.08; }
.hud-bloque strong { font-size: 19px; letter-spacing: 0.4px; }
.hud-bloque small { font-size: 12.5px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hud-cred { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hud-cred-lbl { font-size: 11px; letter-spacing: 0.7px; text-transform: uppercase; opacity: 0.8; }
.cred-pips { display: flex; gap: 4px; }
.cred-pip {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.25s, transform 0.25s;
}
.cred-pip.on { background: #22c55e; border-color: #bbf7d0; box-shadow: 0 0 6px rgba(34, 197, 94, 0.65); }
.cred-pips.peligro .cred-pip.on { background: #ef4444; border-color: #fecaca; box-shadow: 0 0 8px rgba(239, 68, 68, 0.8); animation: late 0.7s infinite alternate; }
@keyframes late { to { opacity: 0.45; } }

.hud-pts { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1; min-width: 52px; }
.hud-pts small { font-size: 11px; opacity: 0.8; text-transform: uppercase; }
.hud-pts strong { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--oro-vivo); }

.aviso-hito {
    position: fixed;
    left: 50%;
    top: 58px;
    transform: translate(-50%, -12px);
    opacity: 0;
    pointer-events: none;
    z-index: 40;
    background: #1d4ed8;
    color: #fff;
    padding: 7px 15px;
    border-radius: 20px;
    font-family: var(--titular);
    font-size: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transition: opacity 0.25s, transform 0.25s;
}
.aviso-hito.visible { opacity: 1; transform: translate(-50%, 0); }

#escenario {
    position: relative;
    flex: 1 1 auto;
    min-height: 170px;
    background: #070d1d;
    overflow: hidden;
}
#escena {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.tira-frases {
    position: absolute;
    right: 10px;
    bottom: 8px;
    z-index: 5;
    display: flex;
    gap: 5px;
    background: rgba(9, 14, 26, 0.84);
    padding: 5px 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.frase-dot {
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-family: var(--titular);
    font-size: 12px;
    padding: 0 5px;
}
.frase-dot.presionada {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.35);
    color: #dbeafe;
}
.frase-dot.activa {
    background: var(--oro-vivo);
    color: #111827;
    border-color: #fff;
    font-weight: 700;
}
.frase-dot.presionada.activa { border-color: #60a5fa; }
.frase-dot.ampliada { border-color: #38bdf8; color: #7dd3fc; }
.frase-dot.ampliada.activa { background: #38bdf8; color: #090e1a; }

/* ---- Panel inferior estilo caja de diálogo ---- */
.panel {
    flex: none;
    max-height: 50dvh;
    overflow-y: auto;
    background: var(--panel);
    padding: 10px 16px 14px;
    border-top: 3px solid #1e3a8a;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
}
.panel-cab {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}
.placa-hablante {
    display: inline-block;
    padding: 2px 11px;
    border-radius: 4px;
    font-family: var(--titular);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.4px;
    color: #fff;
}
.panel-subtitulo {
    font-family: var(--titular);
    font-size: 14px;
    color: #475569;
    letter-spacing: 0.3px;
}
.dialogo-caja {
    background: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 7px;
    padding: 9px 12px;
    margin-bottom: 9px;
    cursor: pointer;
}
.dialogo-caja.es-ampliada {
    border-color: #0284c7;
    background: #f0f9ff;
}
.etiqueta-ampliada {
    display: inline-block;
    margin-bottom: 3px;
    padding: 1px 7px;
    border-radius: 4px;
    background: #0284c7;
    color: #fff;
    font-family: var(--titular);
    font-size: 12px;
    letter-spacing: 0.5px;
}
.dice { margin: 0; font-size: 17px; }
.dice-falta { visibility: hidden; }

.nota-pinganillo {
    margin: 0 0 9px;
    padding: 6px 10px;
    background: #fef3c7;
    border-left: 4px solid var(--dorado);
    border-radius: 4px;
    font-size: 14.5px;
}
.ficha-dato {
    margin: 0 0 9px;
    padding: 7px 11px;
    background: #e8eef9;
    border-left: 4px solid var(--azul-osc);
    font-size: 14.5px;
}
.ficha-dato strong {
    font-family: var(--titular);
    color: var(--azul-osc);
    letter-spacing: 0.4px;
    margin-right: 4px;
}
.aviso-mod {
    margin: 0 0 8px;
    font-weight: 600;
    color: var(--rojo);
    font-size: 15px;
}

.barra-acciones {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}
.btn-acc {
    min-height: 44px;
    padding: 8px 9px;
    border-radius: 7px;
    border: 2px solid #334155;
    background: #fff;
    color: var(--tinta);
    font-family: var(--titular);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.15;
    box-shadow: 0 2px 0 #334155;
    transition: transform 0.08s;
}
.btn-acc:active { transform: translateY(2px); box-shadow: none; }
.btn-acc.presionar {
    background: #1d4ed8;
    border-color: #1e3a8a;
    color: #fff;
    box-shadow: 0 2px 0 #1e3a8a;
}
.btn-acc.protestar {
    background: #dc2626;
    border-color: #7f1d1d;
    color: #fff;
    box-shadow: 0 2px 0 #7f1d1d;
}
.btn-acc.pista {
    background: #f59e0b;
    border-color: #92400e;
    color: #111827;
    box-shadow: 0 2px 0 #92400e;
}

.opciones { display: flex; flex-direction: column; gap: 7px; }
.btn-op {
    display: block;
    text-align: left;
    text-decoration: none;
    padding: 10px 13px;
    background: #fff;
    color: var(--tinta);
    border: 2px solid var(--azul-osc);
    border-radius: 7px;
    font-family: var(--texto);
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.24;
    box-shadow: 0 2px 0 var(--azul-osc);
}
.btn-op:hover { background: #e8eef9; }
.btn-op:active { transform: translateY(2px); box-shadow: none; }
.btn-op.carpeta-sec {
    background: var(--panel-2);
    border-color: #64748b;
    box-shadow: 0 2px 0 #64748b;
    font-family: var(--titular);
    text-align: center;
}

.btn-seguir {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 11px;
    background: var(--azul-osc);
    color: #fff;
    border: 0;
    border-radius: 7px;
    font-family: var(--titular);
    font-size: 19px;
    font-weight: 600;
}
.btn-seguir:hover { background: #1e40af; }
.btn-compartir { background: linear-gradient(160deg, #dc2626, #991b1b); }

/* ---- Modales ---- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(5, 8, 16, 0.78);
}
.modal.active { display: flex; }
.modal-content {
    width: 100%;
    max-width: 560px;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 18px 20px;
    background: var(--panel);
    border-radius: 7px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}
.modal-content h3 { color: var(--azul-osc); font-size: 27px; margin-bottom: 8px; }
.modal-content p { margin: 0 0 8px; }
.lista-ayuda { padding-left: 18px; margin: 6px 0 10px; font-size: 15.5px; }
.lista-ayuda li + li { margin-top: 5px; }

/* Carpeta de pruebas */
.carpeta-box { max-width: 620px; }
.carpeta-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.carpeta-kicker { font-family: var(--titular); font-size: 12px; letter-spacing: 1.5px; color: var(--rojo); margin: 0 !important; }
.btn-cerrar-x { background: var(--panel-2); border: 1px solid #bdb497; border-radius: 6px; width: 34px; height: 34px; font-weight: 700; }
.carpeta-frase-obj {
    padding: 8px 11px;
    margin-bottom: 10px;
    background: #fff;
    border-left: 4px solid var(--rojo);
    border-radius: 4px;
    font-size: 15px;
}
.carpeta-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.prueba-card {
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    padding: 10px 12px;
}
.prueba-cab { display: flex; align-items: center; gap: 7px; font-family: var(--titular); font-size: 18px; color: var(--azul-osc); }
.prueba-fuente { font-size: 13px; color: #475569; margin: 2px 0 5px !important; font-style: italic; }
.prueba-res { font-size: 15px; margin: 0 0 8px !important; }
.btn-presentar {
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: var(--rojo);
    color: #fff;
    font-family: var(--titular);
    font-size: 16px;
    font-weight: 600;
}
.btn-presentar:hover { background: #991b1b; }

/* Pantalla final y ranking */
.fin { text-align: center; }
.fin-emoji { font-size: 50px; line-height: 1.05; }
.fin-puntos { font-family: var(--titular); color: var(--azul-osc); margin: 4px 0 0; }
.fin-puntos strong { font-size: 52px; line-height: 1; }
.fin-puntos span { font-size: 18px; }
.fin-rango { font-style: italic; font-weight: 600; color: var(--rojo); margin-bottom: 8px !important; }
.fin-acciones-top { margin-bottom: 8px; }
.fin .btn-op { text-align: center; }
.fin-reto { margin: 4px 0 !important; font-size: 14.5px; font-style: italic; color: var(--azul-osc); }
.fin-texto { margin-top: 8px !important; text-align: left; font-size: 15px; }
.fin-stats { list-style: none; padding: 0; margin: 0 0 10px; text-align: left; font-size: 14.5px; }
.fin-stats li { padding: 3px 0; border-bottom: 1px dotted #c8c0aa; }
.fin-plegable { text-align: left; margin-bottom: 10px; }
.fin-plegable summary { padding: 8px 10px; background: var(--panel-2); border-radius: 5px; font-family: var(--titular); font-size: 16px; color: var(--azul-osc); cursor: pointer; }
.repaso-item { padding: 8px 4px; border-bottom: 1px dotted #c8c0aa; font-size: 14.5px; }
.repaso-item strong { color: var(--azul-osc); }
.kofi-fin { margin: 8px 0; padding: 8px 12px; background: var(--panel-2); border-radius: 7px; font-size: 14px; }
.kofi-fin a { font-weight: 700; color: var(--rojo); }

#nickname-input { width: 100%; padding: 10px; font-size: 17px; border: 2px solid var(--azul-osc); border-radius: 6px; margin-bottom: 8px; }
.ranking-list { margin-bottom: 10px; }
.ranking-row { display: grid; grid-template-columns: 42px 1fr auto auto; gap: 8px; padding: 5px 7px; border-bottom: 1px solid #e3ddcb; font-size: 15px; }
.ranking-row.is-me { background: #fff2c6; font-weight: 600; }
.ranking-row.is-top1 .ranking-rank { color: #b58a00; font-weight: 700; }
.ranking-score { font-weight: 600; }
.ranking-time { color: #6b7280; }
.ranking-loading, .ranking-empty, .ranking-error { text-align: center; color: #5b574e; padding: 14px 0; }

/* ---- Móvil ---- */
@media (max-width: 680px) {
    body { font-size: 16px; }
    .escaleta { padding: 22px 16px 18px; }
    .escaleta-sello { top: 10px; right: 10px; font-size: 12px; }
    #hud { gap: 7px; padding: 6px 8px; }
    .btn-icono { width: 32px; height: 32px; font-size: 16px; }
    .hud-bloque strong { font-size: 16px; }
    .hud-bloque small { font-size: 11.5px; }
    .cred-pip { width: 11px; height: 11px; }
    .hud-pts strong { font-size: 18px; }
    .panel { max-height: 55dvh; padding: 8px 11px 11px; }
    .dice { font-size: 15.5px; }
    .barra-acciones {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .btn-acc.protestar { grid-column: 1 / -1; min-height: 46px; font-size: 18px; }
    .btn-op { font-size: 14.5px; padding: 9px 11px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
