/* Hoy en OpoSkill: dato del día + prueba del día (portada). Usa los tokens de variables.css. */

/* ---------- Cabecera y dato del día ---------- */
.hoy-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px 56px;
    align-items: end;
    margin-bottom: 28px;
}

.hoy-heading {
    margin-bottom: 0;
}

.dato-dia {
    margin: 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--border);
}

.dato-dia-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted-dark);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dato-dia-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

/* ---------- Prueba del día: dos columnas ---------- */
.reto {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 40px;
    align-items: start;
}

.reto-info {
    padding-top: 4px;
}

.reto-eyebrow {
    margin-bottom: 10px;
}

.reto-titulo {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 2.6vw, 2.1rem);
    line-height: 1.1;
}

.reto-instr {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.65;
    max-width: 34em;
}

.reto-estado {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
    margin: 0 0 22px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.reto-estado dt {
    color: var(--muted-dark);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reto-estado dd {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
}

.reto-estado-texto {
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
}

.reto-estado-dato {
    color: var(--data);
    font-size: 0.88rem;
}

.reto-estado[data-fase="superada"] .reto-estado-texto { color: var(--success); }
.reto-estado[data-fase="no_superada"] .reto-estado-texto { color: var(--error); }
.reto-estado[data-fase="empezado"] .reto-estado-texto,
.reto-estado[data-fase="empezado"] .reto-estado-dato { color: var(--muted); }

.reto-acciones {
    display: flex;
    gap: 12px;
}

.reto .reto-acciones button {
    margin-top: 0;
}

.reto-acciones button[hidden],
.reto-acciones:has(> button[hidden]) {
    display: none;
}

.reto-nota {
    margin: 14px 0 0;
    color: var(--muted-dark);
    font-size: 0.86rem;
    line-height: 1.5;
}

.reto-invitacion {
    margin: 10px 0 0;
    font-size: 0.92rem;
}

.reto-titulo a {
    color: inherit;
    text-decoration: none;
}

.reto-titulo a:hover {
    text-decoration: underline;
}

.reto-comparativa {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--data);
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.5;
}

.reto-compartir {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 14px;
}

.reto .reto-compartir button {
    margin-top: 0;
}

.reto-compartir[hidden] {
    display: none;
}

.reto-compartir-ok {
    color: var(--success);
    font-size: 0.82rem;
}

.reto-error {
    margin: 10px 0 0;
    color: var(--error);
    font-size: 0.9rem;
}

/* ---------- Marco de consola con el tablero ---------- */
.reto-frame {
    min-width: 0;
}

.reto-bar-fecha {
    margin-left: auto;
    color: var(--muted-dark);
}

.reto-board-wrap {
    background: #0a0f11;
}

.game-container {
    display: none;
}

.game-container.active {
    display: block;
}

.game-area {
    position: relative;
    min-height: 420px;
    padding: 16px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    overflow: hidden;
}

.game-toolbar {
    align-self: stretch;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    min-height: 34px;
}

.game-counter {
    color: var(--data);
    font-size: 0.85rem;
}

.game-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Las herramientas (Deshacer, Reiniciar, Rendirse) solo existen durante la partida */
.reto:not(.is-playing) .game-tools {
    visibility: hidden;
}

.reto button.btn-game-tool {
    margin: 0;
    padding: 7px 10px;
    font-size: 0.82rem;
    font-weight: 500;
}

.reto button[hidden] {
    display: none;
}

.game-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: center;
}

/* Overlay: tapa el tablero antes de empezar y muestra el resultado al terminar */
.game-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: #0a0f11;
    transition: opacity 0.2s ease;
}

.game-overlay[data-state="win"],
.game-overlay[data-state="lose"] {
    background: rgba(10, 15, 17, 0.94);
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--text);
}

.game-overlay[data-state="start"] .overlay-title {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--muted-dark);
}

.game-overlay[data-state="win"] .overlay-title,
.game-overlay[data-state="superada"] .overlay-title { color: var(--success); }
.game-overlay[data-state="lose"] .overlay-title,
.game-overlay[data-state="no_superada"] .overlay-title { color: var(--error); }
.game-overlay[data-state="empezado"] .overlay-title { color: var(--muted); }

.overlay-stats {
    margin: 0;
    color: var(--data);
    font-size: 0.95rem;
}

.overlay-stats:empty {
    display: none;
}

/* ---------- Tableros ---------- */
.grid-board {
    display: grid;
    gap: 6px;
    width: 100%;
    margin: 0 auto;
}

.board-martes { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 290px; }
.board-jueves { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 300px; gap: 4px; }
.board-viernes { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 230px; gap: 8px; }
.board-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); max-width: 330px; gap: 4px; }
.board-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 300px; gap: 4px; }

.cell {
    aspect-ratio: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cell:hover {
    border-color: var(--border-strong);
}

.cell.selected {
    border-color: var(--accent);
    outline: 1px solid var(--accent);
}

.board-martes .cell { font-size: 1.7rem; }
.board-jueves .cell { font-size: 1.25rem; }
.board-7 .cell { font-size: 1.35rem; cursor: default; }
.board-6 .cell { font-size: 1.6rem; cursor: default; }

/* Lunes */
#lunes-figures {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 320px;
    margin: 24px 0;
    font-size: 2.6rem;
    line-height: 1.2;
    text-align: center;
}

#lunes-figures[hidden],
#lunes-question-area[hidden] {
    display: none;
}

#lunes-question-area {
    text-align: center;
}

.lunes-question {
    margin: 12px 0 16px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
    color: var(--text);
}

.lunes-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.reto button.lunes-btn {
    margin: 0;
    min-width: 56px;
    font-family: var(--font-mono);
    font-size: 1.2rem;
}

/* Miércoles */
.divide-board {
    position: relative;
    width: 300px;
    height: 300px;
    flex: 0 0 auto;
    background: var(--card-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    touch-action: none;
}

.divide-dot {
    position: absolute;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    border: 1px solid var(--data);
    border-radius: 50%;
    background: #0a0f11;
    color: var(--data);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1rem;
}

.divide-line {
    position: absolute;
    z-index: 10;
    width: 4px;
    height: 600px;
    background: var(--error);
    cursor: move;
    /* top, left y transform los pone el JS */
}

.divide-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
}

.divide-controls label {
    color: var(--muted);
    font-size: 0.82rem;
}

.divide-controls input[type="range"] {
    width: 180px;
    accent-color: var(--muted);
}

.reto .divide-controls button {
    margin: 0;
}

/* Viernes */
.lights-cell {
    background: var(--card-strong);
}

.lights-cell.on {
    background: #fde047;
    border-color: #facc15;
}

/* Sábado y domingo: cruceta de movimiento */
.maze-controls {
    display: grid;
    grid-template-columns: repeat(3, 48px);
    gap: 6px;
    justify-content: center;
}

.reto button.maze-btn {
    margin: 0;
    padding: 0;
    height: 44px;
    font-size: 1.1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hoy-head,
    .reto {
        grid-template-columns: 1fr;
    }

    .reto {
        gap: 24px;
    }
}

@media (max-width: 420px) {
    .game-area {
        padding: 12px 8px 20px;
    }

    .console-bar .reto-bar-fecha {
        display: none;
    }

    .divide-board {
        width: 290px;
        height: 290px;
    }
}
