/* Contra la Oposición: rojo de chaleco, amarillo de pegatina y humo */
@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; }

:root { --rojo: #a81e2d; --rojo-2: #7c111d; --amarillo: #f2c230; --papel: #faf4e6; --tinta: #24211d; --titular: 'Oswald', 'Arial Narrow', sans-serif; --texto: 'Spectral', Georgia, serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body { background: #1b1412; color: var(--tinta); font-family: var(--texto); font-size: 17px; line-height: 1.4; }
h1, h3 { font-family: var(--titular); margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--rojo); }

#start-screen { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at 50% 0, #6a1a20, #1b1412 70%); }
.carta { position: relative; width: 100%; max-width: 680px; padding: 22px 24px 14px; background: var(--papel); box-shadow: 0 24px 60px rgba(0,0,0,0.55); }
.carta p { margin: 0 0 8px; }
.carta-org { font-family: var(--titular); letter-spacing: 2px; color: var(--rojo); font-size: 13px; max-width: 76%; }
.carta h1 { font-size: clamp(36px, 8vw, 56px); color: var(--rojo); line-height: 1.02; text-transform: uppercase; }
.carta-sub { font-style: italic; color: #5d5b52; margin-top: 8px !important; border-bottom: 3px solid var(--rojo); padding-bottom: 8px; font-size: 15px; }
.carta-sello { position: absolute; top: 18px; right: 18px; padding: 2px 10px; font-family: var(--titular); font-weight: 700; font-size: 23px; color: var(--rojo); border: 3px solid var(--rojo); border-radius: 5px; transform: rotate(9deg); opacity: 0.8; }
.clases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.btn-clase { text-align: left; padding: 9px 11px; background: #fff; border: 2px solid #cbbd9e; border-radius: 8px; line-height: 1.22; }
.btn-clase:hover { border-color: var(--rojo); background: #fff3e0; }
.btn-clase strong { display: block; font-family: var(--titular); font-weight: 500; font-size: 18px; color: var(--rojo); }
.btn-clase small { font-size: 13.5px; display: block; }
.carta-pie { text-align: center; font-size: 15px; }
.carta-nota { font-size: 14px; color: #6d675b; font-style: italic; }
.enlace { background: none; border: 0; padding: 0; color: var(--rojo); text-decoration: underline; }

#game-container { height: 100%; display: flex; flex-direction: column; max-width: 1180px; margin: 0 auto; user-select: none; -webkit-user-select: none; }
#hud { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--rojo-2); color: #fff; }
.btn-icono { background: none; border: 0; font-size: 20px; padding: 2px; }
.hud-nivel { min-width: 0; flex: 0 1 34%; }
.hud-nivel strong { font-family: var(--titular); font-weight: 500; font-size: 18px; display: block; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-nivel small, .hud-cifras small { font-size: 12px; opacity: 0.88; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.medidores { flex: 1; display: grid; gap: 3px; min-width: 70px; }
.medidor { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.barra { flex: 1; height: 11px; background: rgba(0,0,0,0.4); border-radius: 6px; overflow: hidden; }
.barra div { height: 100%; width: 0; }
#m-detencion { background: #6fb7ff; }
#m-caos { background: linear-gradient(90deg, #f2c230, #ff5a2a); }
#m-caos.lleno { animation: latir 0.5s infinite alternate; }
@keyframes latir { to { filter: brightness(1.6); } }
.hud-cifras { text-align: right; }
.hud-cifras strong { font-family: var(--titular); font-size: 19px; line-height: 1; white-space: nowrap; }
#escenario { position: relative; flex: 1 1 auto; min-height: 0; background: #222; overflow: hidden; }
#escena { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.cartel { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); width: 88%; max-width: 640px; padding: 9px 14px; background: var(--amarillo); text-align: center; font-family: var(--titular); font-size: clamp(17px, 3.8vw, 26px); line-height: 1.14; box-shadow: 0 5px 0 rgba(0,0,0,0.4); pointer-events: none; }
.mandos { flex: 0 0 auto; display: grid; grid-template-columns: 120px 1fr 1.5fr; gap: 10px; align-items: center; padding: 8px 12px 12px; background: #2a1c1a; touch-action: none; }
.pad { position: relative; width: 112px; height: 112px; border-radius: 50%; background: rgba(255,255,255,0.13); border: 3px solid rgba(255,255,255,0.3); touch-action: none; }
.pad-bola { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: #fff; pointer-events: none; }
.btn-golpe, .btn-francia { height: 100%; min-height: 84px; border: 0; border-radius: 12px; font-size: 32px; line-height: 1; touch-action: none; }
.btn-golpe { background: var(--amarillo); }
.btn-golpe:active, .btn-golpe.pulsado { filter: brightness(0.8); }
.btn-francia { background: #33557f; color: #fff; }
.btn-francia:disabled { opacity: 0.35; }
.btn-francia:not(:disabled) { animation: latir 0.5s infinite alternate; }
.btn-golpe small, .btn-francia small { display: block; font-family: var(--titular); font-size: 15px; margin-top: 5px; }
@media (hover: hover) and (min-width: 800px) {
    .mandos { display: none; }
}

.modal { display: none; position: fixed; inset: 0; z-index: 20; padding: 14px; background: rgba(15,8,6,0.72); overflow-y: auto; }
.modal.active { display: flex; align-items: flex-start; justify-content: center; }
.modal-content { width: 100%; max-width: 540px; margin: auto; padding: 20px; background: var(--papel); border-radius: 10px; }
.modal-content h3 { font-size: 27px; color: var(--rojo); line-height: 1.1; margin-bottom: 8px; }
.modal-content ul { padding-left: 20px; margin: 8px 0; }
.modal-content p { margin: 0 0 9px; }
.fin { text-align: center; }
.fin-emoji { font-size: 54px; line-height: 1.1; }
.viviendas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 10px; padding: 9px; background: var(--tinta); color: #fff; border-radius: 8px; }
.viviendas strong { display: block; font-family: var(--titular); font-size: 50px; line-height: 1; color: var(--amarillo); }
.viviendas strong.euros { font-size: 30px; line-height: 1.6; color: #ff8d5c; }
.viviendas small { font-size: 13px; }
.fin-puntos strong { font-family: var(--titular); font-size: 40px; color: var(--rojo); }
.fin-rango { font-family: var(--titular); font-size: 18px; }
.fin-stats { list-style: none; padding: 0 !important; font-size: 15px; }
.opciones { display: grid; gap: 8px; }
.btn-seguir { display: block; width: 100%; padding: 12px; background: var(--rojo); color: #fff; border: 0; border-radius: 8px; font-family: var(--titular); font-size: 19px; }
.btn-op { display: block; width: 100%; padding: 9px; background: #fff; border: 2px solid #cbbd9e; border-radius: 8px; color: var(--tinta); text-decoration: none; font-size: 16px; }

@media (max-width: 560px) {
    .clases { grid-template-columns: 1fr; gap: 6px; }
    .btn-clase small { font-size: 13px; }
    .mandos { grid-template-columns: 112px 0.8fr 1.2fr; gap: 7px; padding: 7px 8px 10px; }
    .hud-nivel strong { font-size: 15px; }
    .hud-cifras strong { font-size: 16px; }
    #hud { gap: 6px; padding: 5px 7px; }
}
.btn-continuar { margin-bottom: 8px; }
#ayuda-modal { z-index: 30; }
