.jcv-topbar {
    position: sticky;
    top: 0;
    display: flex;
    background-color: #fff;
    gap: 5rem;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #333;
    z-index: 2000;
}

.jcv-btn {
    cursor: pointer;
    background-color: var(--jcv-bg-btn);
    padding: 5px 10px;
    color: var(--jcv-light);
    border-radius: 8px;
}

.jcv-game-wrapper {
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 8px;
    padding-bottom: 60px;
}

.cont-crono {
    display: flex;
    justify-content: center;
}

.jcv-timer {
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--jcv-bg-focus-color);
    border-radius: 50px;
    margin-right: 2rem;
}

/* Estado inicial: gris */
.jcv-timer.is-initial {
    background-color: var(--jcv-color-no-focus);
    color: var(--jcv-light);
}

/* En marcha: verde */
.jcv-timer.is-running {
    background-color: var(--jcv-bg-focus-color);
    color: var(--jcv-dark-color);
}

/* Parado: rojo */
.jcv-timer.is-stopped {
    background-color: var(--jcv-cell-error);
    color: var(--jcv-light);
}

/* Modal Core (stats) */
.jcv-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}

.jcv-modal.is-open {
    display: block;
}

.jcv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
}

.jcv-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100% - 32px));
    margin: 8vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    padding: 16px 16px 18px;
}

.jcv-modal__content {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jcv-modal__loading {
    opacity: .75;
}

.jcv-stats h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--jcv-color-hightlight);
    font-family: inherit;
}

.jcv-stats__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.jcv-stats__grid>div {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

/* feedback en botón guardar (opcional) */
.jcv-btn.is-ok {
    box-shadow: 0 0 0 2px rgba(46, 204, 113, .35) inset;
}

.jcv-btn.is-err {
    box-shadow: 0 0 0 2px rgba(231, 76, 60, .35) inset;
}

/* Botón de pausa deshabilitado cuando el juego terminó */
.jcv-btn.is-disabled[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}


/* Modal Core (stats) */
.jcv-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}

.jcv-modal.is-open {
    display: block;
}

.jcv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
}

.jcv-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100% - 32px));
    margin: 8vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    padding: 16px 16px 18px;
}

.jcv-modal__close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.jcv-modal__content {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jcv-modal__loading {
    opacity: .75;
}

.jcv-stats h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.jcv-stats__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.jcv-stats__grid>div {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

/* Start Gate (modal de inicio común) */
.jcv-gate {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.jcv-gate__card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    width: min(420px, 90%);
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
}

.jcv-gate__title {
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 8px;
}

.jcv-gate__text {
    font-size: 14px;
    color: #555;
    margin-bottom: 16px;
}

.jcv-gate .jcv-btn {
    min-width: 160px;
}

/* Contenedor de las opciones de dificultad */
.jcv-difficulty-options {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    /* separación entre botones */
    margin-top: 1rem;
}

.crv-sudoku .jcv-difficulty-options .jcv-btn {
    flex: 1 1 0;
    min-width: 0;
    /* ⚡ anula el min-width heredado */
    max-width: none;
    text-align: center;
}

/* Aviso cuando el usuario ya completó el juego (Start Gate) */
.jcv-notice-completed {
    background: #ffe9c6;
    border: 2px solid #fd9500;
    color: #7a3e00;
    max-width: 50rem;
    padding: 8px;
    margin: 10px auto;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.jcv-locked-overlay{
  position:absolute; inset:0; background:rgba(255,255,255,.88);
  display:flex; align-items:flex-start; margin-top: 120px; justify-content:center; z-index:50;
  backdrop-filter:saturate(.7) blur(2px);
}
.jcv-locked-box{
  background:#fff; border:1px solid #eee; border-radius:12px; padding:18px 20px;
  box-shadow:0 10px 30px rgba(0,0,0,.08); text-align:center; max-width:360px;
}
.jcv-locked-title{ font-weight:700; margin-bottom:6px; font-size:18px; }
.jcv-locked-msg{ opacity:.85; }

/* Desactivar tablero/canvas mientras esté bloqueado */
.jcv-game-wrapper.is-locked canvas,
.jcv-game-wrapper.is-locked [data-game-canvas],
.jcv-game-wrapper.is-locked .game-board,
.jcv-game-wrapper.is-locked svg{
  pointer-events:none !important;
  user-select:none !important;
  -webkit-user-drag:none !important;
  touch-action:none !important;
}




/* Botones con iconos */
.jcv-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* espacio entre icono y texto */
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    /* sin fondo sólido */
    color: #333;
    transition: color 0.3s ease;
}

/* Icono */
.jcv-icon-btn .jcv-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
}

.jcv-icon-btn .jcv-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    /* usa el color del texto */
}

/* Texto */
.jcv-icon-btn .jcv-icon-label {
    font-size: 14px;
    line-height: 1;
    color: currentColor;
}

/* Hover */
.jcv-icon-btn:hover {
    color: var(--jcv-color-highlight, #0073aa);
}




.jcv-pause-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    position: relative;
    cursor: pointer;
}

.jcv-pause-icon::before,
.jcv-pause-icon::after {
    content: '';
    position: absolute;
    top: 4px;
    width: 4px;
    height: 16px;
    background-color: #333;
    border-radius: 1px;
    transition: background-color 0.3s ease;
}

.jcv-pause-icon::before {
    left: 6px;
}

.jcv-pause-icon::after {
    right: 6px;
}

.jcv-pause-icon:hover::before,
.jcv-pause-icon:hover::after {
    background-color: var(--jcv-color-hightlight);
}


/* --- JCV Toasts (avisos) --- */
#jcv-toast-stack {
    position: fixed;
    inset: auto 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    z-index: 99999;
    pointer-events: none;
}

.jcv-toast {
    background: #111;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
    opacity: 0;
    transform: translateY(8px);
    animation: jcv-fade-in 140ms ease-out forwards, jcv-fade-out 260ms ease-in forwards var(--jcv-toast-timeout, 2800ms);
    border-left: 4px solid #3b82f6;
    pointer-events: auto;
}

.jcv-toast--ok {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.jcv-toast--warn {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.jcv-toast--err {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: var(--jcv-cell-error);
}


@keyframes jcv-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes jcv-fade-out {
    to {
        opacity: 0;
        transform: translateY(8px)
    }
}

/* ===== Modal de pausa ===== */
#jcv-pause-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    /* se controla via .is-open en JS */
}

#jcv-pause-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

#jcv-pause-modal .jcv-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

#jcv-pause-modal .jcv-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(560px, calc(100% - 2rem));
    background: var(--jcv-surface, #fff);
    color: var(--jcv-foreground, #111);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 24px;
    text-align: center;
    animation: jcvModalFadeIn 180ms ease-out both;
}

#jcv-pause-modal .jcv-modal__title {
    margin: 0 0 8px;
    line-height: 1.2;
}

#jcv-pause-modal .jcv-modal__text {
    margin: 0 0 16px;
}

#jcv-pause-modal .jcv-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
}

#jcv-pause-modal .jcv-modal__close {
    position: absolute;
    top: 6px;
    right: 10px;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

#jcv-pause-modal .jcv-modal__close:hover {
    opacity: 1;
}

/* Botón PAUSA deshabilitado */
#jcv-pause-btn[aria-disabled="true"],
#jcv-pause-btn[disabled],
#jcv-pause-btn.is-disabled,
.jcv-topbar .jcv-btn.jcv-pause[data-jcv-disabled="1"] {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: saturate(0.2) contrast(0.9) !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

@keyframes jcvModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Respeto accesibilidad: apagar animaciones si corresponde */
@media (prefers-reduced-motion: reduce) {
    #jcv-pause-modal .jcv-modal__dialog {
        animation: none;
    }
}

/* Estrellas 0..5 usando overlay por porcentaje */
.crv-stars {
    display: inline-flex;
    gap: 4px;
    vertical-align: middle;
}

.crv-star {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    display: block;
}

.jcv-footer-actions {
    position: fixed;
    background-color: #fff;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
}

.jcv-footer-actions {
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    border-top: 1px solid #ccc;
    padding: 10px;
    z-index: 999;
}

.jcv-footer-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.jcv-footer-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #333;
}

.jcv-footer-btn:hover {
    color: var(--jcv-color-highlight, #0073aa);
}


.jcv-footer-btn .dashicons {
    font-size: 3rem;
}

.jcv-game-done-msg {
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  gap: 0.5rem;
  white-space: nowrap;
}







/* =====================
   TOP BAR (Mediaqueries)
   ===================== */

@media screen and (max-width: 900px) {
    .jcv-game-wrapper {
        padding: 0;
    }

    .jcv-topbar {
        padding: 1.5rem 1rem;
    }

    .jcv-ctrls {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .jcv-stats {
        flex: 2 1 1;
    }

}

/* Móvil: oculta el texto, deja solo el icono */
@media (max-width: 768px) {
    .jcv-icon-btn .jcv-icon-label {
        display: none;
    }    
}