/* =========================================
   BINGO DE PERSONAJES — Naruto theme
   ========================================= */

.container-bingo {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 15px 30px;
}

/* Title row */
.bingo-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 0 22px;
}

.bingo-title-h1 {
    margin: 0;
    font-family: 'Reggae One', cursive;
    font-size: 1.6rem;
    color: var(--wn-text);
}

.bingo-btn-info {
    background: rgba(255, 107, 0, 0.15);
    border: 1.5px solid rgba(255, 107, 0, 0.4);
    color: #FF6B00;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    padding: 0;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Game container (pergamino card) ── */
.game-container-bingo {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat,
        linear-gradient(160deg, #e8d5b0, #d4b882);
    border: 2px solid #A07840;
    border-radius: 18px;
    padding: 24px 20px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -2px 0 rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
}

/* ── Header: timer | character | skip ── */
.bingo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 8px;
}

.bingo-left,
.bingo-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.bingo-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

/* Timer */
.bingo-timer {
    font-family: 'Reggae One', cursive;
    font-size: 1.6rem;
    color: #4A2E15;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid #8B5A2B;
    border-radius: 10px;
    padding: 6px 14px;
    min-width: 90px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

/* Skip button */
.skip-btn {
    background: linear-gradient(135deg, #FF6B00, #e05200);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-family: 'Reggae One', cursive;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.35);
    letter-spacing: 0.5px;
}

.skip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.45);
}

.skip-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(255, 107, 0, 0.3);
}

/* ── Character photo ── */
.bingo-pool-container {
    width: 160px;
    height: 160px;
    position: relative;
    margin-bottom: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid #8B5A2B;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.bingo-character-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

/* Spinner while loading */
@keyframes bingo-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.bingo-pool-container.bingo-photo-loading .bingo-character-img {
    opacity: 0;
}

.bingo-pool-container.bingo-photo-loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 36px; height: 36px;
    border: 3px solid rgba(139, 90, 43, 0.25);
    border-top-color: #FF6B00;
    border-radius: 50%;
    animation: bingo-spin 0.8s linear infinite;
}

/* Character name */
.bingo-character-name {
    font-family: 'Reggae One', cursive;
    color: #4A2E15;
    font-size: 1.15rem;
    font-weight: 900;
    text-align: center;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
    max-width: 200px;
    word-break: break-word;
    line-height: 1.2;
}

/* ── Grid wrapper (cooldown overlay) ── */
.bingo-grid-wrapper {
    position: relative;
}

.bingo-cooldown-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: all;
    display: none;
}

.bingo-cooldown-overlay.active { display: block; }

/* ── Criteria grid ── */
.bingo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    transition: opacity 0.25s ease;
}

.bingo-grid.cooldown-dim { opacity: 0.4; }

/* Cells */
.bingo-cell {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    border: 2px solid rgba(139, 90, 43, 0.45);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.bingo-cell:has(.bingo-label) {
    background: rgba(255, 255, 255, 0.25);
}

@media (hover: hover) and (pointer: fine) {
    .bingo-cell:hover {
        transform: scale(1.06);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 107, 0, 0.4);
    }
}

.bingo-label {
    color: #4A2E15;
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.25;
    padding: 4px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.bingo-icon {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: block;
}

/* Cell state: correct */
.bingo-cell.cell-correct {
    background: url('../img/Fondo_Pergamino.webp') center / cover no-repeat !important;
    background-color: #a0d4b0 !important;
    background-blend-mode: multiply !important;
    border-color: #3c7355 !important;
    box-shadow: 0 4px 10px rgba(56, 193, 114, 0.35) !important;
}

/* Green overlay on top of icon for correct cells */
.bingo-cell.cell-correct::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(56, 193, 114, 0.45);
    border-radius: inherit;
}

/* Cell state: blocked */
.bingo-cell.cell-blocked {
    pointer-events: none;
    opacity: 0.88;
}

/* Cell state: error flash */
@keyframes blinkRed {
    0%   { background-color: rgba(255, 77, 77, 0.45); }
    50%  { background-color: rgba(220, 30, 30, 0.6); }
    100% { background-color: rgba(255, 77, 77, 0.45); }
}

@keyframes shakeAnim {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-6px); }
    50%  { transform: translateX(6px); }
    75%  { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.bingo-cell.blink-error::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: blinkRed 0.6s ease;
}

.bingo-cell.shake {
    animation: shakeAnim 0.4s ease;
}

/* Win/lose modals match container width */
.container-bingo .game-result-wrapper {
    max-width: 100%;
    width: 100%;
}

.container-bingo .game-result-wrapper .game-result-modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}



/* Tutorial: timer toggle */
.tutorial-timer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}
.tutorial-overlay.tutorial-help-open .tutorial-timer-row { display: none; }

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 30px;
    flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.2);
    border-radius: 30px;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px; width: 22px;
    left: 4px; bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}

input:checked + .slider { background-color: var(--wn-orange, #FF6B00); }
input:checked + .slider:before { transform: translateX(24px); }

.toggle-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #4A2E15;
}

.btn-play {
    background: linear-gradient(135deg, var(--wn-orange, #FF6B00) 0%, #e05200 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 36px;
    font-family: 'Reggae One', cursive;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 107, 0, 0.35);
    transition: transform 0.15s, filter 0.15s;
}

.btn-play:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

/* ── Tutorial step cards ── */
.bingo-tut-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 14px 0 18px;
}

.bingo-tut-card {
    background: rgba(255, 255, 255, 0.3);
    border: 1.5px solid rgba(139, 90, 43, 0.3);
    border-radius: 12px;
    padding: 12px 10px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    text-align: left;
}

.bingo-tut-icon {
    font-size: 1.6rem;
    line-height: 1;
    grid-row: 1 / -1;
    grid-column: 1;
    align-self: center;
}

.bingo-tut-card strong {
    color: #4A2E15;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.3;
    grid-row: 1;
    grid-column: 2;
    align-self: end;
}

.bingo-tut-card small {
    color: #5c4033;
    font-size: 0.77rem;
    line-height: 1.45;
    grid-row: 2;
    grid-column: 2;
    align-self: start;
}

/* ── Responsive ── */
@media screen and (min-width: 601px) and (max-height: 800px) {
    .bingo-pool-container { width: 130px; height: 130px; }
    .bingo-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}

@media (max-width: 600px) {
    .bingo-title-h1 { font-size: 1.2rem; }
    .game-container-bingo { padding: 12px 8px; }
    .bingo-header { margin-bottom: 12px; }
    .bingo-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .bingo-pool-container { width: 115px; height: 115px; }
    .bingo-character-name { font-size: 0.9rem; max-width: 140px; }
    .bingo-timer { font-size: 1.2rem; padding: 4px 8px; min-width: 68px; }
    .skip-btn { padding: 7px 10px; font-size: 0.85rem; }
    .bingo-label { font-size: 0.6rem; }
    .bingo-tut-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
    .bingo-pool-container { width: 100px; height: 100px; }
    .bingo-label { font-size: 0.55rem; }
    .bingo-grid { gap: 5px; }
}
