/* Minijuegos — layout, temas por motor y componentes compartidos */
:root {
    --accent-minijuego: #8b5cf6;
    --mj-accent: var(--accent-minijuego);
    --mj-accent-soft: rgba(139, 92, 246, 0.15);
    --mj-accent-border: rgba(139, 92, 246, 0.35);
    --mj-panel-bg: var(--surface-2, #1e293b);
    --mj-radius: var(--radius-lg, 16px);
}

/* Acentos por motor */
.minijuego-verdadero_falso { --mj-accent: #f59e0b; --mj-accent-soft: rgba(245, 158, 11, 0.14); --mj-accent-border: rgba(245, 158, 11, 0.4); }
.minijuego-detective     { --mj-accent: #6366f1; --mj-accent-soft: rgba(99, 102, 241, 0.14); --mj-accent-border: rgba(99, 102, 241, 0.4); }
.minijuego-coordenadas   { --mj-accent: #d97706; --mj-accent-soft: rgba(217, 119, 6, 0.14); --mj-accent-border: rgba(217, 119, 6, 0.4); }
.minijuego-pares         { --mj-accent: #10b981; --mj-accent-soft: rgba(16, 185, 129, 0.14); --mj-accent-border: rgba(16, 185, 129, 0.4); }
.minijuego-orden         { --mj-accent: #a855f7; --mj-accent-soft: rgba(168, 85, 247, 0.14); --mj-accent-border: rgba(168, 85, 247, 0.4); }
.minijuego-pixel         { --mj-accent: #06b6d4; --mj-accent-soft: rgba(6, 182, 212, 0.14); --mj-accent-border: rgba(6, 182, 212, 0.4); }
.minijuego-mercadillo    { --mj-accent: #eab308; --mj-accent-soft: rgba(234, 179, 8, 0.14); --mj-accent-border: rgba(234, 179, 8, 0.4); }
.minijuego-palabras      { --mj-accent: #ec4899; --mj-accent-soft: rgba(236, 72, 153, 0.14); --mj-accent-border: rgba(236, 72, 153, 0.4); }
.minijuego-laberinto     { --mj-accent: #14b8a6; --mj-accent-soft: rgba(20, 184, 166, 0.14); --mj-accent-border: rgba(20, 184, 166, 0.4); }
.minijuego-simon         { --mj-accent: #8b5cf6; --mj-accent-soft: rgba(139, 92, 246, 0.14); --mj-accent-border: rgba(139, 92, 246, 0.4); }
.minijuego-sudoku        { --mj-accent: #3b82f6; --mj-accent-soft: rgba(59, 130, 246, 0.14); --mj-accent-border: rgba(59, 130, 246, 0.4); }

.game-accent-minijuego {
    border-top-color: var(--mj-accent);
}

.juego-hero.game-accent-minijuego,
.app-nivel-card.game-accent-minijuego,
.hub-continue-card.game-accent-minijuego,
.hub-topic-games .hub-game-card.game-accent-minijuego {
    border-left-color: var(--mj-accent);
}

.minijuego-container {
    max-width: 640px;
    margin: 0 auto;
}

.minijuego-stage {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: min(55vh, 480px);
    padding: 1rem 0.75rem 2rem;
    gap: 1rem;
}

.minijuego-stage.is-hidden {
    display: none;
}

/* Entrada animada */
.minijuego-stage.mj-enter .mj-panel {
    animation: mj-slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.minijuego-stage.mj-enter .mj-badge {
    animation: mj-fade-in 0.35s ease both;
}

@keyframes mj-slide-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mj-fade-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* Panel y badge compartidos */
.mj-panel {
    background: linear-gradient(145deg, var(--mj-panel-bg) 0%, color-mix(in srgb, var(--mj-panel-bg) 85%, var(--mj-accent) 15%) 100%);
    border: 1px solid var(--mj-accent-border);
    border-radius: var(--mj-radius);
    padding: 1.25rem 1rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mj-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mj-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: var(--mj-accent-soft);
    border: 1px solid var(--mj-accent-border);
    color: var(--mj-accent);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mj-badge-icon {
    font-size: 1rem;
    line-height: 1;
}

.mj-btn-icon {
    margin-right: 0.35rem;
    font-weight: 800;
}

/* Verdadero o mito */
.mj-vf-deck {
    perspective: 800px;
}

.mj-card-stack {
    position: relative;
    background: var(--surface-2, #1e293b);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
    border-radius: var(--radius-lg, 16px);
    padding: 1.75rem 1.25rem;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    touch-action: pan-y;
    user-select: none;
    transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.28s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.mj-panel-vf .mj-card-stack {
    border-color: var(--mj-accent-border);
    background: linear-gradient(160deg, #1e293b 0%, rgba(245, 158, 11, 0.06) 100%);
}

.mj-vf-swipe-fx {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.mj-vf-swipe-left  { left: 1rem; color: #f87171; }
.mj-vf-swipe-right { right: 1rem; color: #4ade80; }

.mj-card-stack.swipe-left  { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.mj-card-stack.swipe-right { transform: translateX(120%) rotate(8deg); opacity: 0; }
.mj-card-stack.swipe-hint-left  .mj-vf-swipe-left  { opacity: 0.7; }
.mj-card-stack.swipe-hint-right .mj-vf-swipe-right { opacity: 0.7; }

.mj-vf-text {
    font-size: 1.2rem;
    line-height: 1.45;
    margin: 0;
    font-weight: 600;
    text-align: center;
}

.mj-vf-swipe-hint {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted, #94a3b8);
    text-align: center;
}

.mj-vf-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.mj-btn {
    min-height: 52px;
    border: none;
    border-radius: var(--radius-md, 12px);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mj-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mj-btn-myth {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.mj-btn-true {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.mj-btn:active:not(:disabled) {
    transform: scale(0.97);
}

/* Detective */
.mj-detective-case {
    position: relative;
}

.mj-detective-content {
    position: relative;
    background: var(--surface-2, #1e293b);
    border-radius: var(--radius-md, 12px);
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    font-size: 1.1rem;
    line-height: 1.5;
    border-left: 4px solid var(--mj-accent);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.mj-panel-detective .mj-detective-content::before {
    content: '“';
    position: absolute;
    left: 1.5rem;
    top: 0.5rem;
    font-size: 2rem;
    color: var(--mj-accent);
    opacity: 0.35;
    line-height: 1;
}

.mj-options-label {
    font-size: 0.85rem;
    color: var(--text-muted, #94a3b8);
    margin: 0;
    text-align: center;
}

.mj-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.mj-option-btn {
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    background: var(--surface-2, #1e293b);
    color: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mj-option-letter {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 6px;
    background: var(--mj-accent-soft);
    color: var(--mj-accent);
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mj-option-btn:hover:not(:disabled) {
    border-color: var(--mj-accent);
    box-shadow: 0 0 0 2px var(--mj-accent-soft);
}

.mj-option-btn.is-picked {
    border-color: var(--mj-accent);
    background: var(--mj-accent-soft);
}

.mj-option-btn:disabled {
    opacity: 0.55;
}

/* Mapa del tesoro */
.mj-treasure-scroll {
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.08) 0%, transparent 100%);
    border-radius: var(--radius-md, 12px);
    padding: 1rem 0.75rem;
    border: 1px dashed var(--mj-accent-border);
}

.mj-treasure-clue {
    font-size: 1.1rem;
    font-weight: 700;
    color: inherit;
    text-align: center;
    margin: 0 0 1rem;
    line-height: 1.4;
}

.mj-grid-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.mj-grid-body {
    display: flex;
    gap: 0.35rem;
    align-items: stretch;
}

.mj-grid-labels {
    display: flex;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
}

.mj-grid-cols {
    display: grid;
    grid-template-columns: repeat(var(--mj-cols, 5), 1fr);
    gap: 4px;
    padding-left: 1.5rem;
    width: 100%;
    max-width: 320px;
}

.mj-grid-cols span {
    text-align: center;
}

.mj-grid-rows {
    flex-direction: column;
    justify-content: space-around;
    width: 1.25rem;
    padding: 2px 0;
}

.mj-grid {
    display: grid;
    grid-template-columns: repeat(var(--mj-cols, 5), 1fr);
    gap: 4px;
    max-width: 320px;
}

.mj-grid-map .mj-grid-cell {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(217, 119, 6, 0.06);
}

.mj-grid-cell {
    aspect-ratio: 1;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--mj-accent-border);
    border-radius: 6px;
    background: var(--mj-accent-soft);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mj-grid-cell-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mj-accent);
    opacity: 0.35;
}

.mj-grid-cell:hover:not(:disabled) {
    background: color-mix(in srgb, var(--mj-accent) 25%, transparent);
}

.mj-grid-cell.is-selected {
    background: color-mix(in srgb, var(--mj-accent) 40%, transparent);
    box-shadow: 0 0 0 2px var(--mj-accent);
}

.mj-grid-cell.is-selected .mj-grid-cell-dot {
    opacity: 1;
    transform: scale(1.4);
}

.mj-grid-cell:active:not(:disabled) {
    transform: scale(0.94);
}

/* Feedback */
.mj-feedback {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md, 12px);
    font-weight: 600;
    text-align: center;
    animation: mj-fade-in 0.3s ease both;
}

.mj-feedback.is-correct {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.mj-feedback.is-wrong {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Une los puntos */
.mj-pairs-board {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    min-height: 180px;
}

.mj-pairs-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.mj-pairs-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.mj-pairs-col-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #94a3b8);
    padding: 0 0.25rem;
}

.mj-pair-btn {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    background: var(--surface-2, #1e293b);
    color: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.mj-pair-btn.is-selected {
    border-color: var(--mj-accent);
    box-shadow: 0 0 0 2px var(--mj-accent-soft);
    transform: translateX(2px);
}

.mj-pairs-col-right .mj-pair-btn.is-selected {
    transform: translateX(-2px);
}

.mj-pair-btn.is-matched {
    opacity: 0.55;
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.08);
}

.mj-pair-btn.is-wrong-flash {
    animation: mj-flash-wrong 0.45s ease;
}

@keyframes mj-flash-wrong {
    50% { background: rgba(239, 68, 68, 0.25); }
}

.mj-pairs-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted, #94a3b8);
    margin: 0;
}

/* Cápsula del tiempo */
.mj-orden-rail {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 0.5rem;
    margin-bottom: -0.25rem;
}

.mj-orden-rail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--mj-accent);
    flex-shrink: 0;
}

.mj-orden-rail-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--mj-accent), color-mix(in srgb, var(--mj-accent) 30%, transparent));
}

.mj-orden-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 0.25rem;
    padding: 0 0.25rem;
}

.mj-orden-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mj-orden-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    background: var(--surface-2, #1e293b);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: var(--radius-md, 12px);
    cursor: grab;
    touch-action: none;
    animation: mj-slide-up 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--mj-orden-i, 0) * 0.05s);
}

.mj-orden-item.is-dragging {
    opacity: 0.6;
    cursor: grabbing;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.mj-orden-handle {
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}

.mj-orden-step {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--mj-accent-soft);
    color: var(--mj-accent);
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mj-orden-label {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.mj-orden-move {
    display: flex;
    gap: 0.25rem;
}

.mj-orden-move button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
}

.mj-btn-check {
    width: 100%;
    background: var(--mj-accent);
    color: #fff;
    border: none;
    margin-top: 0.25rem;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--mj-accent) 40%, transparent);
}

.mj-btn-check:hover:not(:disabled) {
    filter: brightness(1.08);
}

/* Píxel */
.mj-pixel-arcade {
    position: relative;
    background: #0f172a;
    border-radius: var(--radius-md, 12px);
    border: 3px solid var(--mj-accent-border);
    padding: 0.75rem;
    box-shadow: inset 0 0 40px rgba(6, 182, 212, 0.08), 0 0 0 1px rgba(255,255,255,0.05);
}

.mj-pixel-scanlines {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    z-index: 2;
}

.mj-pixel-wrap {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

#mj-pixel-canvas {
    border-radius: 4px;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.mj-pixel-reveal-bar {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    margin-top: 0.65rem;
    overflow: hidden;
}

.mj-pixel-reveal-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--mj-accent), #22d3ee);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 100%;
}

.mj-pixel-guess {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mj-pixel-input {
    flex: 1;
    min-width: 140px;
    min-height: 48px;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.15));
    background: var(--surface-2, #1e293b);
    color: inherit;
    font-size: 1rem;
}

.mj-pixel-guess .mj-btn-check {
    width: auto;
    min-width: 120px;
    margin-top: 0;
}

/* Mercadillo */
.mj-shop-header {
    display: flex;
    justify-content: flex-end;
}

.mj-shop-wallet {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid rgba(234, 179, 8, 0.35);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
}

.mj-shop-coin {
    animation: mj-coin-bob 2s ease-in-out infinite;
}

@keyframes mj-coin-bob {
    50% { transform: translateY(-2px); }
}

.mj-shop-shelf {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-md, 12px);
    border-bottom: 3px solid rgba(234, 179, 8, 0.25);
}

.mj-shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.65rem 0.85rem;
    background: var(--surface-2, #1e293b);
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
    min-width: 88px;
    transition: transform 0.15s;
}

.mj-shop-item:hover {
    transform: translateY(-2px);
}

.mj-shop-emoji {
    font-size: 1.1rem;
}

.mj-shop-name {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.mj-shop-price {
    color: #facc15;
    font-weight: 700;
}

.mj-shop-question {
    font-weight: 700;
    text-align: center;
    margin: 0;
    line-height: 1.4;
}

.mj-options-grid-shop .mj-shop-opt {
    justify-content: center;
    font-size: 1.05rem;
}

.mj-shop-opt-coin {
    font-size: 0.9rem;
}

/* Constructor de palabras */
.mj-words-goal {
    text-align: center;
    color: var(--text-muted, #94a3b8);
    font-size: 0.9rem;
    margin: 0;
}

.mj-letters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.mj-letter {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 2px solid var(--mj-accent-border);
    background: linear-gradient(145deg, #fef3c7 0%, #fde68a 100%);
    font-size: 0;
    color: #78350f;
    cursor: pointer;
    box-shadow: 0 3px 0 #d97706, 0 4px 8px rgba(0,0,0,0.15);
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.15s;
    animation: mj-slide-up 0.35s ease both;
    animation-delay: calc(var(--mj-letter-i, 0) * 0.04s);
}

.mj-letter-char {
    font-size: 1.35rem;
    font-weight: 800;
    font-family: Georgia, 'Times New Roman', serif;
}

.mj-letter:active:not(.is-used) {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #d97706;
}

.mj-letter.is-used {
    opacity: 0.35;
    transform: scale(0.92);
    box-shadow: none;
}

.mj-word-build {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.5rem;
    align-items: center;
    padding: 0.5rem;
    background: rgba(0,0,0,0.12);
    border-radius: var(--radius-md, 12px);
}

.mj-word-placeholder {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted, #94a3b8);
    letter-spacing: 0.12em;
}

.mj-word-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2.25rem;
    padding: 0 0.35rem;
    background: linear-gradient(145deg, #fef3c7, #fde68a);
    color: #78350f;
    border-radius: 6px;
    font-size: 1.25rem;
    font-weight: 800;
    font-family: Georgia, serif;
    animation: mj-fade-in 0.2s ease both;
    animation-delay: calc(var(--mj-tile-i, 0) * 0.04s);
}

.mj-words-actions {
    display: flex;
    gap: 0.5rem;
}

.mj-btn-secondary {
    flex: 1;
    background: var(--surface-2, #1e293b);
    color: inherit;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.12));
}

.mj-words-found {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.mj-words-found li {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.mj-words-done {
    margin-top: 0.25rem;
}

/* Laberinto */
.mj-maze-track {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 0.75rem;
    background: rgba(0,0,0,0.12);
    border-radius: var(--radius-md, 12px);
}

.mj-maze-node {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    flex-shrink: 0;
    transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
}

.mj-maze-connector {
    width: 12px;
    height: 2px;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.mj-maze-node.is-visited {
    background: color-mix(in srgb, var(--mj-accent) 50%, transparent);
}

.mj-maze-node.is-here {
    background: var(--mj-accent);
    box-shadow: 0 0 0 4px var(--mj-accent-soft);
    transform: scale(1.25);
}

.mj-maze-node.is-visited + .mj-maze-connector,
.mj-maze-connector:has(+ .mj-maze-node.is-visited) {
    background: var(--mj-accent);
}

.mj-maze-progress {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--mj-accent);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mj-maze-prompt {
    font-size: 1.05rem;
    line-height: 1.45;
    margin: 0;
    text-align: center;
}

.mj-maze-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mj-maze-choice {
    width: 100%;
    text-align: left;
}

.mj-maze-choice-arrow {
    color: var(--mj-accent);
    font-weight: 800;
}

/* Simon */
.mj-simon-console {
    position: relative;
    max-width: 300px;
    margin: 0 auto;
    padding: 0.5rem;
    background: #0f172a;
    border-radius: 20px;
    border: 2px solid var(--mj-accent-border);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.4);
}

.mj-simon-pads {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.mj-simon-pad {
    position: relative;
    aspect-ratio: 1;
    border: none;
    border-radius: 14px;
    background: var(--pad-color);
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.12s, transform 0.1s, filter 0.12s;
    overflow: hidden;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.2);
}

.mj-simon-pad-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 50%);
    pointer-events: none;
}

.mj-simon-pad-num {
    position: absolute;
    bottom: 0.35rem;
    right: 0.45rem;
    font-size: 0.65rem;
    font-weight: 800;
    color: rgba(0,0,0,0.35);
}

.mj-simon-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted, #94a3b8);
    box-shadow: 0 0 0 3px #0f172a;
    pointer-events: none;
    z-index: 2;
}

.mj-simon-pad.is-lit {
    opacity: 1;
    transform: scale(1.05);
    filter: brightness(1.2);
    box-shadow: 0 0 28px color-mix(in srgb, var(--pad-color) 70%, transparent), inset 0 -2px 0 rgba(0,0,0,0.15);
}

.mj-simon-pad:disabled {
    cursor: not-allowed;
}

.mj-simon-status {
    text-align: center;
    color: var(--text-muted, #94a3b8);
    margin: 0;
    font-weight: 600;
    transition: color 0.2s;
}

.mj-simon-status.is-active {
    color: var(--mj-accent);
}

@media (max-width: 400px) {
    .mj-options-grid {
        grid-template-columns: 1fr;
    }
    .mj-grid-cell {
        min-width: 40px;
        min-height: 40px;
    }
    .mj-letter {
        width: 46px;
        height: 46px;
    }
}

/* QA móvil — áreas táctiles, overflow y safe areas */
.mj-pairs-progress,
.mj-words-progress {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--mj-accent);
    margin: 0;
}

.map-confirm-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.map-confirm-actions .mj-btn-check {
    flex: 1;
    min-width: 140px;
    margin-top: 0;
}

.map-confirm-actions .mj-btn-secondary {
    flex: 1;
    min-width: 120px;
}

.mj-words-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.mj-words-actions .mj-btn-check {
    grid-column: 1 / -1;
}

@media (max-width: 767px) {
    .minijuego-container {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .minijuego-stage {
        min-height: min(50vh, 420px);
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }

    .mj-panel {
        padding: 1rem 0.85rem 1.25rem;
    }

    .mj-vf-actions {
        gap: 0.5rem;
    }

    .mj-btn,
    .mj-option-btn,
    .mj-pair-btn {
        min-height: 48px;
    }

    .mj-pairs-board {
        gap: 0.65rem;
    }

    .mj-pairs-col-label {
        font-size: 0.65rem;
    }

    .mj-pair-btn {
        font-size: 0.82rem;
        padding: 0.45rem 0.55rem;
    }

    .mj-orden-move button {
        width: 36px;
        height: 36px;
    }

    .mj-pixel-guess {
        flex-direction: column;
    }

    .mj-pixel-guess .mj-btn-check {
        width: 100%;
    }

    .mj-simon-console {
        max-width: 100%;
    }

    .mj-simon-pads {
        gap: 0.5rem;
    }

    .mj-word-build {
        min-height: 2.75rem;
    }

    .mj-maze-track {
        gap: 0;
        padding: 0.5rem;
    }

    .mj-maze-connector {
        width: 8px;
    }
}

@media (max-width: 360px) {
    .mj-grid {
        max-width: 100%;
    }

    .mj-grid-cell {
        min-width: 36px;
        min-height: 36px;
    }

    .mj-grid-cols {
        max-width: 100%;
        padding-left: 1.1rem;
    }

    .mj-letter {
        width: 42px;
        height: 42px;
    }

    .mj-letter-char {
        font-size: 1.15rem;
    }
}

.minijuego-play .game-container {
    overflow-x: hidden;
}

/* Sudoku 4×4 */
.mj-sudoku-wrap {
    display: flex;
    justify-content: center;
    margin: 0.75rem 0 1rem;
}

.mj-sudoku-grid {
    display: grid;
    grid-template-columns: repeat(var(--sudoku-size, 4), 1fr);
    gap: 0;
    width: min(100%, 260px);
    aspect-ratio: 1;
    background: var(--mj-accent-border, rgba(59, 130, 246, 0.55));
    border: 3px solid var(--mj-accent-border, rgba(59, 130, 246, 0.55));
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 32px rgba(59, 130, 246, 0.15);
}

.mj-sudoku-hint {
    margin: 0 0 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--hub-text-muted, #64748b);
    letter-spacing: 0.02em;
}

.mj-sudoku-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    font-family: var(--font-display, system-ui, sans-serif);
    font-size: 1.45rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #1e293b;
    min-height: 0;
    border: 1px solid rgba(59, 130, 246, 0.18);
    transition: background 0.2s, transform 0.2s;
}

.mj-sudoku-cell.box-edge-r {
    border-right-width: 3px;
    border-right-color: var(--mj-accent-border, rgba(59, 130, 246, 0.55));
}

.mj-sudoku-cell.box-edge-b {
    border-bottom-width: 3px;
    border-bottom-color: var(--mj-accent-border, rgba(59, 130, 246, 0.55));
}

.mj-sudoku-cell.is-peer {
    background: rgba(59, 130, 246, 0.08);
}

.mj-sudoku-cell.is-empty {
    background: var(--mj-accent-soft, rgba(59, 130, 246, 0.18));
}

.mj-sudoku-cell.is-highlight {
    background: var(--mj-accent-soft, rgba(59, 130, 246, 0.28));
    box-shadow: inset 0 0 0 2px var(--mj-accent, #3b82f6);
    z-index: 1;
    animation: mj-sudoku-pulse 1.5s ease-in-out infinite;
}

.mj-sudoku-cell.is-filled {
    animation: none;
    color: var(--mj-accent, #3b82f6);
}

.mj-sudoku-cell.is-correct {
    background: rgba(16, 185, 129, 0.2);
    box-shadow: inset 0 0 0 2px #10b981;
    color: #059669;
}

.mj-sudoku-cell.is-wrong {
    background: rgba(239, 68, 68, 0.15);
    box-shadow: inset 0 0 0 2px #ef4444;
    color: #dc2626;
}

@keyframes mj-sudoku-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.mj-options-grid-sudoku {
    grid-template-columns: repeat(4, 1fr);
    max-width: 280px;
    margin-inline: auto;
}

.mj-sudoku-opt {
    font-size: 1.25rem;
    font-weight: 700;
    min-height: 3rem;
}

@media (prefers-reduced-motion: reduce) {
    .minijuego-stage * {
        animation: none !important;
        transition: none !important;
    }
}
