/* El foso de las Murallas (18/10/2026). Se sirve tal cual, sin pasar por
   Tailwind: el juego es una pantalla cerrada con sus propios colores, los del
   foso: la piedra de la muralla, el verde del agua, el blanco de la cal y el
   rojo del kayak. */
.foso {
    --papel: #fbf7ef;
    --piedra: #b99f7c;
    --agua: #1f6f78;
    --hondo: #123f4a;
    --kayak: #e2462f;
    --verde: #3f8a4a;
    --tinta: #1d2a30;
    --rojo: #c8352b;
    --sombra: rgba(29, 42, 48, .22);
}

/*
  DENTRO DEL PORTAL, NO A PANTALLA COMPLETA, como el patio y el cortador: un
  alto cómodo con la cabecera y el pie alrededor.
*/
.foso.juego {
    height: min(calc(100vh - 175px), 880px);
    height: min(calc(100dvh - 175px), 880px);
    min-height: 470px;
    color: var(--tinta);
    font-family: 'Baloo 2', ui-rounded, system-ui, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    box-sizing: border-box;
    max-width: 720px;
    margin: 0 auto;
}

/* ------------------------------------------------------------ Marcador */
.foso .marcador { display: flex; align-items: center; gap: 6px; }

.foso .lugar,
.foso .golpes {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--papel);
    border-radius: 999px;
    padding: 4px 12px;
    box-shadow: 0 2px 0 var(--sombra);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    height: 34px;
    box-sizing: border-box;
}

.foso .lugar { flex: 1; }
.foso .lugar b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Los golpes que quedan: un kayak por cada uno; los perdidos, apagados. */
.foso .golpes { flex: none; gap: 2px; padding: 4px 10px; font-size: 17px; }
.foso .golpes span { line-height: 1; }
.foso .golpes .perdido { filter: grayscale(1); opacity: .3; }
.foso .golpes.mal { background: #ffe1d9; animation: latido .5s ease-in-out infinite alternate; }

@keyframes latido { to { transform: scale(1.05); } }

.foso .sonido {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: var(--papel);
    color: var(--tinta);
    box-shadow: 0 2px 0 var(--sombra);
    cursor: pointer;
}

.foso .sonido svg { width: 24px; height: 24px; }
.foso .sonido .con { display: none; }
.foso .sonido[aria-pressed="true"] .con { display: inline; }
.foso .sonido[aria-pressed="true"] .sin { display: none; }
.foso .sonido:focus-visible { outline: 3px solid var(--agua); outline-offset: 2px; }

/* Lo remado, de bocana a bocana, el tiempo, el puesto y los puntos. */
.foso .avance {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    min-width: 0;
}

.foso .avance .tramo { flex: 1; min-width: 0; display: flex; align-items: center; }
.foso .avance .tramo .barra { position: relative; display: block; width: 100%; height: 10px; border-radius: 6px; background: #d9e6e4; overflow: hidden; box-shadow: inset 0 1px 0 rgba(0, 0, 0, .08); }
.foso .avance .tramo .barra i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--agua); border-radius: 6px; }
.foso .avance .tiempo { white-space: nowrap; font-variant-numeric: tabular-nums; }
.foso .avance .tiempo.tarde { color: var(--rojo); }
.foso .avance .puesto { white-space: nowrap; background: #ffe39a; border-radius: 999px; padding: 0 9px; }
.foso .avance .puesto[hidden] { display: none; }
.foso .avance #puntos { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------ Campo */
.foso .campo {
    position: relative;
    flex: 1;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: var(--hondo);
    box-shadow: 0 5px 0 rgba(29, 42, 48, .2), 0 14px 30px rgba(29, 42, 48, .24);
    /* El dedo rema, no mueve la página. */
    touch-action: none;
}

.foso canvas { display: block; width: 100%; height: 100%; }

/* Agacharse: abajo, en medio, entre las dos mitades que reman. */
.foso .agachate {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    font: inherit;
    font-weight: 800;
    font-size: 15px;
    color: var(--tinta);
    background: rgba(251, 247, 239, .9);
    border: 0;
    border-radius: 999px;
    padding: 9px 20px;
    box-shadow: 0 3px 0 rgba(29, 42, 48, .45);
    cursor: pointer;
    touch-action: none;
}

.foso .agachate[hidden] { display: none; }
.foso .agachate.aviso { background: #ffe39a; animation: latido .45s ease-in-out infinite alternate; }
.foso .agachate.pulsado { background: #8fd16a; transform: translateX(-50%) translateY(3px); box-shadow: 0 0 0 rgba(29, 42, 48, .45); animation: none; }

/* ------------------------------------------------------------ Carteles */
.foso .cartel {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 11px;
    text-align: center;
    padding: 18px;
    background: rgba(12, 40, 48, .7);
    color: var(--papel);
    overflow-y: auto;
}

.foso .cartel[hidden] { display: none; }

.foso .firma {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    background: rgba(251, 247, 239, .94);
    color: var(--tinta);
    border-radius: 999px;
    padding: 7px 15px;
    box-shadow: 0 3px 0 rgba(29, 42, 48, .25);
}

.foso .firma[hidden] { display: none; }
.foso .firma .de { font-weight: 600; opacity: .62; font-size: 13px; letter-spacing: .03em; }
.foso .firma .logo { display: block; height: 24px; width: auto; }

.foso .cartel h1 { margin: 0; color: var(--papel); font-size: clamp(28px, 8vw, 44px); line-height: 1.02; text-wrap: balance; }
.foso .cartel p { margin: 0; font-size: 15px; max-width: 36ch; font-weight: 600; line-height: 1.35; }
.foso .cartel .hoy { font-size: 13px; opacity: .85; font-style: italic; }
.foso .cartel .hoy[hidden] { display: none; }

/* Las cuentas de la travesía: una línea por cosa. */
.foso .cuentas {
    margin: 0;
    padding: 10px 16px;
    list-style: none;
    display: grid;
    gap: 3px;
    background: rgba(251, 247, 239, .14);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
}

.foso .cuentas[hidden] { display: none; }
.foso .cuentas .mal { color: #ffb4a3; }
.foso .cuentas .bien { color: #ffd76a; }
.foso .cuentas .etiqueta { opacity: .8; font-weight: 600; font-size: 13px; }

.foso .cartel .marca {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(251, 247, 239, .18);
    font-size: 14px;
}

.foso .cartel .marca[hidden] { display: none; }

.foso .boton {
    font: inherit;
    font-weight: 800;
    font-size: 19px;
    color: var(--tinta);
    background: #f2c14e;
    border: 0;
    border-radius: 999px;
    padding: 11px 30px;
    cursor: pointer;
    box-shadow: 0 4px 0 #a97f1d;
}

.foso .boton:active { transform: translateY(3px); box-shadow: 0 1px 0 #a97f1d; }
.foso .boton:focus-visible { outline: 3px solid var(--papel); outline-offset: 3px; }

.foso .boton.otro {
    background: transparent;
    color: var(--papel);
    box-shadow: inset 0 0 0 2px var(--papel);
    font-size: 16px;
    padding: 8px 22px;
}

.foso .boton.otro[hidden] { display: none; }

.foso .pie { margin: 0; text-align: center; font-size: 12px; font-weight: 600; opacity: .7; }

/*
  TUMBADO, SIN EL PORTAL ALREDEDOR, igual que el patio: la cabecera y la
  barra de abajo son fijas y en un móvil apaisado se comerían el foso.
*/
@media (orientation: landscape) and (max-height: 560px) {
    body:has(.foso.juego) #cabecera-del-portal,
    body:has(.foso.juego) .barra-de-abajo,
    body:has(.foso.juego) #aviso-de-especial { display: none; }
    body:has(.foso.juego) #contenido { padding-block: 0; }
    body:has(.foso.juego) { padding-bottom: 0; }

    .foso.juego { height: 100vh; height: 100dvh; min-height: 280px; gap: 4px; padding: 4px 8px; }
    .foso .pie { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .foso .golpes.mal,
    .foso .agachate.aviso { animation: none; }
}
