/* La bodega del barco (18/10/2026). Se sirve tal cual, sin pasar por
   Tailwind: el juego es una pantalla cerrada con sus propios colores, los de
   un puerto: el azul del mar, el gris de la cubierta, el amarillo de las
   rayas de los carriles y el blanco del barco. */
.bodega {
    --papel: #f6f8fa;
    --mar: #1f5f8b;
    --hondo: #123a57;
    --cubierta: #5d666e;
    --raya: #f2c230;
    --verde: #2f9e6e;
    --tinta: #1b2a36;
    --rojo: #d2433a;
    --sombra: rgba(27, 42, 54, .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. Es un juego de pie: la
  bodega se ve a lo largo, de la proa a la rampa.
*/
.bodega.juego {
    height: min(calc(100vh - 175px), 900px);
    height: min(calc(100dvh - 175px), 900px);
    min-height: 480px;
    color: var(--tinta);
    font-family: 'Baloo 2', ui-rounded, system-ui, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    box-sizing: border-box;
    max-width: 720px;
    margin: 0 auto;
}

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

.bodega .lugar,
.bodega .tierra,
.bodega .escora {
    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;
}

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

/* Los que se quedan en tierra: un cochecito por cada uno que se puede perder. */
.bodega .tierra { flex: none; font-size: 14px; white-space: nowrap; padding: 4px 10px; gap: 4px; }
.bodega .tierra span { display: inline-block; }
.bodega .tierra .perdida { opacity: .22; filter: grayscale(1); }
.bodega .tierra.mal { background: #ffe1d9; }

/* La escora, en grados, con el barquito; ámbar al acercarse y rojo pasado. */
.bodega .escora { flex: none; padding: 4px 10px; font-size: 14px; white-space: nowrap; }
.bodega .escora svg { width: 24px; height: 13px; flex: none; transition: transform .3s; }
.bodega .escora.medio { background: #fff1c7; }
.bodega .escora.mal { background: #ffd2c4; color: var(--rojo); animation: bodega-latido .45s ease-in-out infinite alternate; }

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

.bodega .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;
}

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

/* El rumbo, el reloj hasta la bocina y los puntos. */
.bodega .avance {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    min-width: 0;
}

.bodega .avance .rumbo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; color: var(--mar); }
.bodega .avance .reloj { display: flex; align-items: center; gap: 5px; flex: none; }
.bodega .avance .reloj .barra { position: relative; display: block; width: 58px; height: 9px; border-radius: 6px; background: #dfe6ec; overflow: hidden; }
.bodega .avance .reloj .barra i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--verde); border-radius: 6px; }
.bodega .avance .reloj b { font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 3.2ch; text-align: right; }
.bodega .avance .reloj.prisa .barra i { background: var(--rojo); }
.bodega .avance .reloj.prisa b { color: var(--rojo); animation: bodega-latido .5s ease-in-out infinite alternate; }
.bodega .avance #puntos { font-variant-numeric: tabular-nums; white-space: nowrap; }

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

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

/* Los tres botones, en fila, al pie del muelle. */
.bodega .acciones {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    gap: 7px;
}

.bodega .acciones[hidden] { display: none; }

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

.bodega .boton:active { transform: translateY(3px); box-shadow: 0 1px 0 #a88413; }
.bodega .boton:focus-visible { outline: 3px solid var(--papel); outline-offset: 3px; }
.bodega .boton:disabled { opacity: .45; cursor: default; transform: none; }

.bodega .boton.chico {
    flex: 1;
    font-size: 14px;
    line-height: 1.1;
    padding: 9px 6px;
    background: var(--papel);
    box-shadow: 0 3px 0 rgba(27, 42, 54, .5);
    min-width: 0;
}

.bodega .boton.chico.listo { background: #ffe39a; }
.bodega .boton.chico.zarpar { background: #dfe6ec; }
.bodega .boton.chico.zarpar.listo { background: #8fd16a; box-shadow: 0 3px 0 #4f8a32; animation: bodega-latido .6s ease-in-out infinite alternate; }
.bodega .boton.chico.aviso { background: #ffd2c4; animation: bodega-latido .5s ease-in-out infinite alternate; }

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

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

/* Con las cuentas del viaje, todo más apretado, y centrado sin cortar arriba si no cabe. */
.bodega .cartel { place-content: safe center; }
.bodega .cartel:has(.cuentas:not([hidden])) { gap: 8px; padding: 12px 14px; }
.bodega .cartel:has(.cuentas:not([hidden])) h1 { font-size: clamp(24px, 6.5vw, 34px); }
.bodega .cartel:has(.cuentas:not([hidden])) .cuentas { font-size: 14px; padding: 8px 14px; gap: 2px; }
.bodega .cartel:has(.cuentas:not([hidden])) .firma { display: none; }

.bodega .firma {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    background: rgba(246, 248, 250, .94);
    color: var(--tinta);
    border-radius: 999px;
    padding: 7px 15px;
    box-shadow: 0 3px 0 rgba(27, 42, 54, .25);
}

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

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

/* Las cuentas de cada viaje: una línea por cosa. */
.bodega .cuentas {
    margin: 0;
    padding: 10px 16px;
    list-style: none;
    display: grid;
    gap: 4px;
    background: rgba(246, 248, 250, .14);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
}

.bodega .cuentas[hidden] { display: none; }
.bodega .cuentas .mal { color: #ffb4a3; }
.bodega .cuentas .bien { color: #ffd76a; }

.bodega .cartel .marca {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(246, 248, 250, .18);
    font-size: 14px;
}

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

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

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

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

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

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

@media (prefers-reduced-motion: reduce) {
    .bodega .escora.mal,
    .bodega .boton.chico.zarpar.listo,
    .bodega .boton.chico.aviso,
    .bodega .avance .reloj.prisa b { animation: none; }
}
