/* ======================================================
   Spot the Difference – Game Styles
   ====================================================== */

.mmb-std-game {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    color: #333;
}

/* ── Single HUD row: Score | Pips | Attempts ── */
.mmb-std-hud-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: #f0f4ff;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}
.mmb-std-score-inline {
    white-space: nowrap;
    flex-shrink: 0;
}
.mmb-std-score-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2563eb;
}
.mmb-std-score-value.mmb-std-score-negative {
    color: #dc2626;
}

/* ── Screens ── */
.mmb-std-screen {
    animation: mmb-std-fadein 0.3s ease;
}
@keyframes mmb-std-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mmb-std-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Pending (dashed) circle – spins while waiting for server validation */
.mmb-std-pending-circle {
    transform-box: fill-box;
    transform-origin: center;
    animation: mmb-std-spin 0.8s linear infinite;
}

/* ── Setup ── */
#mmb-std-setup h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}
#mmb-std-setup p {
    margin-bottom: 12px;
    color: #555;
}
.mmb-std-setup-attempts {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px !important;
}

/* ── Attempts badge ── */
.mmb-std-attempts-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Images layout ── */
.mmb-std-images-wrap {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.mmb-std-image-panel {
    flex: 1;
    min-width: 0;
}
/* ── Progress pips (flex:1 inside the HUD row) ── */
.mmb-std-pips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 22px;
    flex: 1;
}
.mmb-std-pip {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: transparent;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.25s ease, border-color 0.25s ease;
}
.mmb-std-pip.mmb-std-pip-found {
    background: #22c55e;
    border-color: #16a34a;
}

/* ── Images area: relative wrapper so the overlay can be absolute ── */
.mmb-std-images-area {
    position: relative;
}

/* ── End overlay: centered over both images when the game ends ── */
.mmb-std-end-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.60);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    animation: mmb-std-fadein 0.35s ease;
}
.mmb-std-end-message {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin: 0;
    padding: 0 20px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.mmb-std-image-container {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f3f4f6;
    cursor: crosshair;
}
/* Inner element receives the scale + translate transform */
.mmb-std-image-inner {
    position: relative;
    transform-origin: top left;
    transition: transform 0.15s ease;
    will-change: transform;
}
.mmb-std-image-inner img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
}
.mmb-std-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* ── Zoom controls ── */
.mmb-std-zoom-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* ── Buttons ── */
.mmb-std-btn {
    display: inline-block;
    padding: 9px 20px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}
.mmb-std-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.mmb-std-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    font-size: 1rem;
    padding: 12px 28px;
}
.mmb-std-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
.mmb-std-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
/* Icon-only zoom buttons (+/-): square outline, no fill */
.mmb-std-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    background: transparent;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    line-height: 1;
}
.mmb-std-btn-icon:hover {
    background: transparent;
    border-color: #6b7280;
    color: #111;
}

/* ── Feedback ── */
.mmb-std-feedback {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}
.mmb-std-feedback.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.mmb-std-feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.mmb-std-feedback.info {
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #7dd3fc;
}

/* ── Grab cursor when zoomed in ── */
.mmb-std-image-container.mmb-std-grab { cursor: grab; }
.mmb-std-image-container.mmb-std-grabbing { cursor: grabbing; }

/* (completion styling is handled by the end overlay) */

/* ── Mobile ── */
@media (max-width: 680px) {
    .mmb-std-images-wrap {
        flex-direction: column;
    }
    .mmb-std-image-panel {
        width: 100%;
    }
    .mmb-std-hud-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    /* On mobile, hide image B when game ends so only one image shows under the overlay */
    .mmb-std-game-ended #mmb-std-panel-b {
        display: none;
    }
}

