/* matura-match.css — Moduł gier słownikowych (Desktop: karta aplikacji | Mobile: płaski układ pełnoszerokościowy + Smart Tap) */
.matura-match {
    display: none !important;
}

/* =========================================================
   1. GŁÓWNY KONTENER APLIKACJI (.mm-app-shell) + DOTYK 0ms
   ========================================================= */
.mm-app-shell {
    width: 100%;
    max-width: 640px;
    margin: 1rem auto;
    background: var(--theme-palette-color-8, #ffffff);
    border: 1px solid var(--theme-palette-color-5, #cbd5e1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(4, 31, 63, 0.06);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.mm-app-shell button,
.mm-toggle-btn,
.mm-menu-card,
.mm-quit-link,
.mm-tile,
.mm-btn-wrong,
.mm-btn-right,
.mm-speller-tile,
.mm-hint-btn,
.mm-btn-primary,
.mm-btn-secondary {
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.mm-header {
    background: var(--theme-palette-color-4, #041f3f);
    color: #ffffff;
    padding: 0.78rem 1.15rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mm-title {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 0.98rem !important;
    font-weight: 700;
    line-height: 1.2;
}

.mm-controls {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.mm-toggle-btn {
    background-color: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    cursor: pointer;
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, opacity 0.08s ease-out;
}

.mm-toggle-btn.is-off {
    opacity: 0.48;
    text-decoration: line-through;
}

/* Obszar roboczy aplikacji */
.mm-body {
    flex: 1;
    min-height: 430px;
    padding: 1.35rem 1.4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--theme-palette-color-8, #ffffff);
}

/* =========================================================
   2. MENU WYBORU TRYBU
   ========================================================= */
.mm-menu-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    gap: 0.8rem;
}

.mm-menu-intro {
    text-align: center;
    margin: 0 0 0.25rem;
    color: var(--theme-palette-color-3, #1e293b);
    font-size: 0.92rem;
    line-height: 1.4;
}

.mm-menu-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    padding: 0.95rem 1.1rem;
    background-color: var(--theme-palette-color-6, #f8fafc);
    border: 2px solid var(--theme-palette-color-5, #cbd5e1);
    border-radius: 14px;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out;
}

.mm-menu-card-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--theme-palette-color-4, #041f3f);
    margin-bottom: 0.25rem;
}

.mm-menu-card-desc {
    font-size: 0.85rem;
    color: var(--theme-palette-color-3, #1e293b);
    line-height: 1.38;
}

/* =========================================================
   3. PASEK STATYSTYK I INSTRUKCJI
   ========================================================= */
.mm-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.mm-badges {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.mm-badge {
    background: var(--theme-palette-color-6, #f8fafc);
    border: 1px solid var(--theme-palette-color-5, #cbd5e1);
    color: var(--theme-palette-color-4, #041f3f);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mm-badge-combo {
    border-color: var(--theme-palette-color-1, #5da733);
    color: var(--theme-palette-color-2, #478524);
}

.mm-quit-link {
    background-color: var(--theme-palette-color-4, #041f3f);
    border: 1px solid var(--theme-palette-color-4, #041f3f);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 999px;
    padding: 5px 13px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(4, 31, 63, 0.16);
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out;
}

.mm-instruction {
    background: var(--theme-palette-color-6, #f8fafc);
    border-left: 3px solid var(--theme-palette-color-1, #5da733);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.84rem;
    color: var(--theme-palette-color-3, #1e293b);
    margin-bottom: 0.95rem;
    line-height: 1.42;
}

/* =========================================================
   4. TRYB 1: POJEDYNEK PAR
   ========================================================= */
.mm-match-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
    margin-bottom: auto;
}

.mm-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
}

.mm-tile {
    width: 100%;
    margin: 0;
    padding: 0.72rem 0.65rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid var(--theme-palette-color-5, #cbd5e1);
    border-radius: 11px;
    cursor: pointer;
    background-color: var(--theme-palette-color-8, #ffffff);
    color: var(--theme-palette-color-3, #1e293b);
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.28;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, opacity 0.14s ease-out;
}

.mm-tile.is-selected {
    border-color: var(--theme-palette-color-1, #5da733);
    background-color: rgba(93, 167, 51, 0.12);
    color: var(--theme-palette-color-4, #041f3f);
    transform: scale(1.015);
}

.mm-tile.is-wrong {
    border-color: #dc2626;
    background-color: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.mm-tile.is-matched,
.mm-tile:disabled {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.94);
}

/* =========================================================
   5. TRYB 2: SZYBKA DECYZJA
   ========================================================= */
.mm-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--theme-palette-color-5, #cbd5e1);
    border-radius: 999px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.mm-progress-fill {
    height: 100%;
    width: 100%;
    background-color: var(--theme-palette-color-1, #5da733);
    transform-origin: left center;
    will-change: transform;
    transition: background-color 0.15s ease-out;
}

.mm-progress-fill.is-danger {
    background-color: #dc2626;
}

.mm-decision-card {
    text-align: center;
    padding: 1.75rem 1rem;
    background-color: var(--theme-palette-color-6, #f8fafc);
    border-radius: 14px;
    margin: auto 0;
    border: 1px solid var(--theme-palette-color-5, #cbd5e1);
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out;
}

.mm-decision-card.is-wrong {
    border-color: #dc2626;
    background-color: rgba(220, 38, 38, 0.07);
}

.mm-decision-en {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--theme-palette-color-4, #041f3f);
    margin-bottom: 0.5rem;
    line-height: 1.25;
}

.mm-decision-divider {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.mm-decision-pl {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--theme-palette-color-3, #1e293b);
    line-height: 1.32;
}

.mm-decision-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-top: 1rem;
}

.mm-btn-wrong,
.mm-btn-right {
    padding: 0.88rem 0.75rem;
    font-size: 0.98rem;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, opacity 0.08s ease-out;
}

.mm-btn-wrong {
    background-color: #dc2626;
}

.mm-btn-right {
    background-color: var(--theme-palette-color-1, #5da733);
}

.mm-btn-wrong.is-selected,
.mm-btn-right.is-selected {
    transform: scale(0.97);
}

/* =========================================================
   6. TRYB 3: MISTRZ PISOWNI (HYBRYDA)
   ========================================================= */
.mm-speller-prompt {
    text-align: center;
    padding: 1.05rem 0.9rem;
    background: var(--theme-palette-color-6, #f8fafc);
    border: 1px solid var(--theme-palette-color-5, #cbd5e1);
    border-radius: 14px;
    margin-bottom: 0.95rem;
}

.mm-speller-mode-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-palette-color-2, #478524);
    background: rgba(93, 167, 51, 0.12);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 0.45rem;
}

.mm-speller-pl {
    font-size: 1.16rem;
    font-weight: 700;
    color: var(--theme-palette-color-4, #041f3f);
    line-height: 1.32;
}

.mm-speller-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    margin: 0.5rem 0 1.2rem;
    padding: 0.4rem 0.35rem;
    border-radius: 10px;
    transition: background-color 0.15s ease-out;
}

.mm-speller-slots.is-word-won {
    background-color: rgba(93, 167, 51, 0.14);
}

.mm-speller-slot {
    width: 32px;
    height: 40px;
    border-bottom: 3px solid var(--theme-palette-color-5, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-palette-color-4, #041f3f);
    text-transform: lowercase;
    transition: transform 0.08s ease-out, border-color 0.08s ease-out, color 0.08s ease-out;
    user-select: none;
}

.mm-speller-slots.is-compact .mm-speller-slot {
    width: 24px;
    height: 34px;
    font-size: 1.06rem;
}

.mm-speller-slots.is-compact {
    gap: 4px;
}

.mm-speller-slot.is-active {
    border-bottom-color: var(--theme-palette-color-4, #041f3f);
    transform: translateY(-2px);
}

.mm-speller-slot.is-filled {
    border-bottom-color: var(--theme-palette-color-1, #5da733);
    color: var(--theme-palette-color-2, #478524);
}

.mm-speller-slot.is-prefilled {
    border-bottom-color: transparent;
    color: var(--theme-palette-color-4, #041f3f);
}

.mm-speller-slot.is-hinted {
    border-bottom-color: #eab308;
    color: #a16207;
}

.mm-speller-slot.is-wrong {
    border-bottom-color: #dc2626;
    color: #dc2626;
}

.mm-speller-slot.is-separator {
    border-bottom: none;
    width: 14px;
    color: #64748b;
}

.mm-speller-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    justify-content: center;
    margin: auto 0;
}

.mm-speller-tile {
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    background-color: var(--theme-palette-color-8, #ffffff);
    border: 2px solid var(--theme-palette-color-5, #cbd5e1);
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--theme-palette-color-4, #041f3f);
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: lowercase;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--theme-palette-color-5, #cbd5e1);
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, opacity 0.12s ease-out;
}

.mm-speller-tile.is-wrong {
    border-color: #dc2626;
    background-color: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.mm-speller-tile.is-matched,
.mm-speller-tile:disabled {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.84);
}

.mm-speller-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.mm-hint-btn {
    background-color: var(--theme-palette-color-6, #f8fafc);
    border: 1.5px solid var(--theme-palette-color-5, #cbd5e1);
    color: var(--theme-palette-color-4, #041f3f);
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--theme-palette-color-5, #cbd5e1);
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, opacity 0.08s ease-out;
}

.mm-hint-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* =========================================================
   7. EKRAN KOŃCOWY, NATYCHMIASTOWE :ACTIVE ORAZ :HOVER
   ========================================================= */
.mm-result {
    text-align: center;
    margin: auto 0;
    padding: 1.25rem 0.5rem;
}

.mm-result h4 {
    color: var(--theme-palette-color-4, #041f3f) !important;
    font-size: 1.28rem !important;
    margin: 0 0 0.6rem !important;
}

.mm-result p {
    margin: 0 0 1.4rem;
    font-size: 0.96rem;
    line-height: 1.55;
    color: var(--theme-palette-color-3, #1e293b);
}

.mm-result-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.75rem;
    max-width: 440px;
    margin: 0 auto;
}

.mm-btn-primary,
.mm-btn-secondary {
    flex: 1;
    padding: 0.78rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    border: 2px solid transparent;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.08s ease-out, background-color 0.08s ease-out, border-color 0.08s ease-out, opacity 0.08s ease-out;
}

.mm-btn-primary {
    background-color: var(--theme-palette-color-1, #5da733);
}

.mm-btn-secondary {
    background-color: var(--theme-palette-color-4, #041f3f);
    font-weight: 600;
}

/* Subtelny, natychmiastowy feedback dotykowy Smart Tap (.is-touch-pressed) — znika bez śladu przy rozpoczęciu przewijania */
.mm-toggle-btn.is-touch-pressed:not(:disabled),
.mm-menu-card.is-touch-pressed:not(:disabled),
.mm-quit-link.is-touch-pressed:not(:disabled),
.mm-tile.is-touch-pressed:not(:disabled):not(.is-matched),
.mm-btn-wrong.is-touch-pressed:not(:disabled),
.mm-btn-right.is-touch-pressed:not(:disabled),
.mm-speller-tile.is-touch-pressed:not(:disabled):not(.is-matched),
.mm-hint-btn.is-touch-pressed:not(:disabled),
.mm-btn-primary.is-touch-pressed:not(:disabled),
.mm-btn-secondary.is-touch-pressed:not(:disabled) {
    transform: scale(0.98);
}

.mm-menu-card.is-touch-pressed:not(:disabled),
.mm-tile.is-touch-pressed:not(:disabled):not(.is-matched):not(.is-selected):not(.is-wrong),
.mm-speller-tile.is-touch-pressed:not(:disabled):not(.is-matched):not(.is-wrong),
.mm-hint-btn.is-touch-pressed:not(:disabled) {
    border-color: var(--theme-palette-color-4, #041f3f);
}

.mm-toggle-btn.is-touch-pressed:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.24);
}

.mm-speller-tile.is-touch-pressed:not(:disabled):not(.is-matched) {
    box-shadow: 0 1px 0 var(--theme-palette-color-5, #cbd5e1);
}

/* Reguły :hover oraz myszowe :active ograniczone wyłącznie do urządzeń ze wskaźnikiem myszy (brak klejących stanów na mobile) */
@media (hover: hover) {
    .mm-toggle-btn:hover:not(:disabled) {
        background-color: rgba(255, 255, 255, 0.25);
    }

    .mm-menu-card:hover:not(:disabled) {
        border-color: var(--theme-palette-color-1, #5da733);
        background-color: var(--theme-palette-color-8, #ffffff);
        transform: translateY(-2px);
    }

    .mm-quit-link:hover:not(:disabled) {
        background-color: var(--theme-palette-color-1, #5da733);
        border-color: var(--theme-palette-color-1, #5da733);
        color: #ffffff !important;
    }

    .mm-tile:hover:not(.is-matched):not(.is-selected):not(.is-wrong):not(:disabled) {
        border-color: var(--theme-palette-color-4, #041f3f);
    }

    .mm-btn-wrong:hover:not(:disabled),
    .mm-btn-right:hover:not(:disabled) {
        opacity: 0.92;
    }

    .mm-speller-tile:hover:not(.is-wrong):not(:disabled) {
        border-color: var(--theme-palette-color-1, #5da733);
    }

    .mm-hint-btn:hover:not(:disabled) {
        border-color: #eab308;
        background-color: rgba(234, 179, 8, 0.12);
    }

    .mm-btn-primary:hover:not(:disabled) {
        background-color: var(--theme-palette-color-2, #478524);
    }

    .mm-btn-secondary:hover:not(:disabled) {
        opacity: 0.92;
    }

    .mm-toggle-btn:active:not(:disabled),
    .mm-menu-card:active:not(:disabled),
    .mm-menu-card:hover:active:not(:disabled),
    .mm-quit-link:active:not(:disabled),
    .mm-tile:active:not(:disabled):not(.is-matched),
    .mm-btn-wrong:active:not(:disabled),
    .mm-btn-right:active:not(:disabled),
    .mm-speller-tile:active:not(:disabled):not(.is-matched),
    .mm-hint-btn:active:not(:disabled),
    .mm-btn-primary:active:not(:disabled),
    .mm-btn-secondary:active:not(:disabled) {
        transform: scale(0.97);
    }
}

@keyframes mm-shake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-5px, 0, 0); }
    75% { transform: translate3d(5px, 0, 0); }
}

.mm-shake {
    animation: mm-shake 0.28s ease-out;
}

.mm-section-heading + .mm-app-shell {
    margin-top: 1.15rem;
}

/* =========================================================
   8. DOSTOSOWANIE MOBILNE (<= 768px)
   ========================================================= */
@media (max-width: 768px) {
    .mm-app-shell {
        max-width: 100%;
        margin: 0;
        border-radius: 12px;
        box-shadow: 0 3px 10px rgba(4, 31, 63, 0.05);
    }

    .mm-header {
        padding: 0.7rem 0.85rem;
    }

    .mm-body {
        padding: 0.9rem 0.75rem;
        min-height: auto;
        gap: 0.75rem;
    }

    .mm-menu-wrap {
        max-width: 100%;
        gap: 0.7rem;
    }

    .mm-menu-card {
        padding: 0.95rem 0.9rem;
        border-radius: 12px;
    }

    .mm-menu-card-title {
        font-size: 1.05rem;
    }

    .mm-menu-card-desc {
        font-size: 0.86rem;
    }

    .mm-quit-link {
        padding: 6px 12px;
        font-size: 0.82rem;
    }

    .mm-instruction {
        font-size: 0.83rem;
        padding: 0.6rem 0.75rem;
        margin-bottom: 0.65rem;
    }

    .mm-match-board {
        gap: 0.5rem;
        width: 100%;
    }

    .mm-col {
        gap: 0.5rem;
    }

    .mm-tile {
        min-height: 50px;
        padding: 0.65rem 0.5rem;
        font-size: 0.9rem;
        border-radius: 10px;
        word-break: normal;
        overflow-wrap: break-word;
        hyphens: none;
    }

    .mm-decision-card {
        padding: 1.45rem 0.85rem;
        margin: 0.35rem 0;
    }

    .mm-decision-en {
        font-size: 1.38rem;
    }

    .mm-decision-pl {
        font-size: 1.12rem;
    }

    .mm-decision-actions {
        gap: 0.65rem;
        margin-top: 0.45rem;
    }

    .mm-btn-wrong,
    .mm-btn-right {
        min-height: 52px;
        font-size: 0.98rem;
    }

    .mm-speller-prompt {
        padding: 1rem 0.85rem;
    }

    .mm-speller-pl {
        font-size: 1.15rem;
    }

    .mm-speller-slot {
        width: 28px;
        height: 36px;
        font-size: 1.18rem;
    }

    .mm-speller-slots.is-compact .mm-speller-slot {
        width: 21px;
        height: 32px;
        font-size: 1rem;
    }

    .mm-hint-btn {
        min-height: 44px;
        padding: 0.55rem 1.25rem;
        font-size: 0.9rem;
    }

    .mm-result-actions {
        flex-direction: column;
        max-width: 100%;
        gap: 0.55rem;
    }
}
