.mosaic-game {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 72px;
}

.mosaic-game__header {
    text-align: center;
    margin-bottom: 40px;
}

.mosaic-game__header h1 {
    margin-bottom: 16px;
    font-size: 48px;
    line-height: 1.1;
}

.mosaic-game__header p {
    max-width: 720px;
    margin: 8px auto;
    font-size: 18px;
}

.mosaic-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 820px;
    margin: 0 auto;
}

.mosaic-tile {
    min-height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #7a8b9b;
    border-radius: 18px;
    background: #ffffff;
    font-size: 32px;
    font-weight: 700;
}

@media (max-width: 800px) {
    .mosaic-board {
        grid-template-columns: repeat(2, 1fr);
    }

    .mosaic-game__header h1 {
        font-size: 38px;
    }
}

@media (max-width: 480px) {
    .mosaic-game {
        padding: 32px 16px 48px;
    }

    .mosaic-tile {
        min-height: 130px;
    }
}

.mosaic-library {
    max-width: 1000px;
    margin: 56px auto 0;
    padding: 0 24px 60px;
}

.mosaic-library h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 32px;
}

.mosaic-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.mosaic-category {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #8395a7;
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
    font-weight: 600;
}

.mosaic-category.is-active {
    background: #0b5f76;
    color: #ffffff;
    border-color: #0b5f76;
}

.mosaic-icons {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 16px;
}

.mosaic-icon {
    min-height: 120px;
    padding: 16px 12px;
    border: 1px solid #c8d2dc;
    border-radius: 16px;
    background: #ffffff;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font: inherit;
}

.mosaic-icon:hover,
.mosaic-icon:focus-visible {
    border-color: #0b5f76;
    outline: 3px solid rgba(11, 95, 118, 0.15);
}

.mosaic-icon__symbol {
    font-size: 40px;
}

.mosaic-tile.is-drag-over {
    border-color: #0b5f76;
    background: #eef8fa;
}

.mosaic-tile.is-filled {
    border-style: solid;
}

.mosaic-tile__symbol {
    display: block;
    font-size: 52px;
    margin-bottom: 8px;
}

.mosaic-tile__label {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .mosaic-icons {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .mosaic-icons {
        grid-template-columns: repeat(2, 1fr);
    }
}

.mosaic-dialog {
    width: min(520px, calc(100% - 32px));
    border: 0;
    border-radius: 20px;
    padding: 0;
}

.mosaic-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.mosaic-dialog__content {
    padding: 28px;
}

.mosaic-dialog__content h2 {
    margin-top: 0;
    margin-bottom: 12px;
}

.mosaic-dialog__content label {
    display: block;
    margin: 20px 0 8px;
    font-weight: 700;
}

.mosaic-dialog__content textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px;
    border: 1px solid #8395a7;
    border-radius: 10px;
    font: inherit;
    resize: vertical;
}

.mosaic-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.mosaic-dialog__actions button {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

#saveReflection {
    border: 1px solid #0b5f76;
    background: #0b5f76;
    color: #ffffff;
}

#skipReflection {
    border: 1px solid #8395a7;
    background: #ffffff;
}

.mosaic-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.mosaic-actions button {
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #0b5f76;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

#finishMosaic {
    background: #0b5f76;
    color: #ffffff;
}

#changeTile,
#resetMosaic {
    background: #ffffff;
    color: #0b5f76;
}

.mosaic-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mosaic-tile.is-selected {
    outline: 4px solid rgba(11, 95, 118, 0.3);
    outline-offset: 3px;
}

.mosaic-result {
    max-width: 820px;
    margin: 48px auto 64px;
    padding: 32px;
    background: #ffffff;
    border: 1px solid #d7e0e8;
    border-radius: 20px;
    text-align: center;
}

.mosaic-result h2 {
    margin: 0 0 28px;
    font-size: 36px;
}

.mosaic-result label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

#mosaicTitle {
    width: min(100%, 480px);
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #8395a7;
    border-radius: 10px;
    font: inherit;
}

.mosaic-result__colors {
    margin-top: 28px;
}

.mosaic-result__colors p {
    margin-bottom: 12px;
    font-weight: 700;
}

.mosaic-result__colors button,
.mosaic-result__actions button {
    min-height: 44px;
    margin: 4px;
    padding: 10px 18px;
    border: 1px solid #0b5f76;
    border-radius: 10px;
    background: #ffffff;
    color: #0b5f76;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.mosaic-result__colors button.is-active {
    background: #0b5f76;
    color: #ffffff;
}

.mosaic-result__actions {
    margin-top: 28px;
}

#printMosaic {
    background: #0b5f76;
    color: #ffffff;
}

/* Kolorystyka mozaiki */

.mosaic-game.theme-light .mosaic-tile {
    background: #ffffff;
}

.mosaic-game.theme-pastel .mosaic-tile {
    background: #f5eef8;
    border-color: #9b83a8;
}

.mosaic-game.theme-colorful .mosaic-tile:nth-child(4n + 1) {
    background: #eaf6ff;
}

.mosaic-game.theme-colorful .mosaic-tile:nth-child(4n + 2) {
    background: #fff3df;
}

.mosaic-game.theme-colorful .mosaic-tile:nth-child(4n + 3) {
    background: #edf7ed;
}

.mosaic-game.theme-colorful .mosaic-tile:nth-child(4n + 4) {
    background: #f7edf7;
}
#savePdf {
    background: #ffffff;
    color: #0b5f76;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    .pnc-site-header,
    .pnc-site-footer,
    .pnc-skip-link,
    .site-footer,
    .pnc-footer,
    .pnc-funding,
    .pnc-footer-funding,
    footer,
    .mosaic-game__header,
    .mosaic-library,
    .mosaic-actions,
    .mosaic-result__colors,
    .mosaic-result__actions {
        display: none !important;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        height: auto !important;
    }

    #main-content,
    main {
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
    }

    .mosaic-game {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }

    .mosaic-board {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        width: 680px !important;
        max-width: 100% !important;
        margin: 20px auto !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .mosaic-tile {
        min-height: 95px !important;
        height: 95px !important;
        padding: 6px !important;
        margin: 0 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .mosaic-tile__symbol {
        font-size: 34px !important;
        margin-bottom: 2px !important;
    }

    .mosaic-tile__label {
        font-size: 13px !important;
    }

    .mosaic-result {
        display: block !important;
        width: 680px !important;
        max-width: 100% !important;
        margin: 12px auto 0 !important;
        padding: 0 !important;
        border: 0 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .mosaic-result h2 {
        margin: 0 0 8px !important;
        font-size: 24px !important;
    }

    .mosaic-result label {
        display: none !important;
    }

    #mosaicTitle {
        width: 100% !important;
        border: 0 !important;
        padding: 4px !important;
        text-align: center !important;
        font-size: 20px !important;
        font-weight: 700 !important;
    }
}

/* ========================================
   MOJA MOZAIKA – DARK MODE
   ======================================== */

html[data-theme="dark"] .mosaic-game,
html[data-theme="dark"] .mosaic-library,
html[data-theme="dark"] .mosaic-result {
    color: #f1f5f9;
}

/* Pola mozaiki 1–8 */
html[data-theme="dark"] .mosaic-tile {
    background: #243449;
    color: #ffffff;
    border: 2px dashed #7892b0;
}

html[data-theme="dark"] .mosaic-tile span {
    color: #ffffff;
}

/* Nagłówki */
html[data-theme="dark"] .mosaic-game h1,
html[data-theme="dark"] .mosaic-library h2,
html[data-theme="dark"] .mosaic-result h2 {
    color: #ffffff;
}

/* Kategorie symboli */
html[data-theme="dark"] .mosaic-category {
    background: #243449;
    color: #ffffff;
    border: 1px solid #7892b0;
}

html[data-theme="dark"] .mosaic-category:hover {
    background: #34516d;
    color: #ffffff;
}

html[data-theme="dark"] .mosaic-category.is-active {
    background: #08708a;
    color: #ffffff;
    border-color: #67d5ee;
}

/* Kafelki symboli */
html[data-theme="dark"] .mosaic-icon {
    background: #243449;
    color: #ffffff;
    border: 1px solid #7892b0;
}

html[data-theme="dark"] .mosaic-icon span {
    color: #ffffff;
}

html[data-theme="dark"] .mosaic-icon:hover {
    background: #34516d;
    border-color: #83caff;
}

/* Przyciski */
html[data-theme="dark"] .mosaic-actions button,
html[data-theme="dark"] .mosaic-result button {
    color: #ffffff;
    background: #285575;
    border-color: #7892b0;
}

html[data-theme="dark"] .mosaic-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pola tekstowe */
html[data-theme="dark"] .mosaic-result input,
html[data-theme="dark"] .mosaic-dialog input,
html[data-theme="dark"] .mosaic-dialog textarea {
    background: #243449;
    color: #ffffff;
    border: 1px solid #7892b0;
}

/* Okna dialogowe */
html[data-theme="dark"] .mosaic-dialog,
html[data-theme="dark"] .mosaic-dialog__content {
    background: #1c2b3d;
    color: #ffffff;
}

html[data-theme="dark"] .mosaic-dialog h2,
html[data-theme="dark"] .mosaic-dialog label,
html[data-theme="dark"] .mosaic-dialog p {
    color: #ffffff;
}

/* Widoczny fokus klawiatury */
html[data-theme="dark"] .mosaic-icon:focus-visible,
html[data-theme="dark"] .mosaic-category:focus-visible,
html[data-theme="dark"] .mosaic-actions button:focus-visible {
    outline: 3px solid #83caff;
    outline-offset: 3px;
}

/* MOJA MOZAIKA – poprawki dark mode */

/* Podsumowanie mozaiki */
html[data-theme="dark"] .mosaic-result {
    background: #243449 !important;
    color: #ffffff !important;
    border: 1px solid #536b88;
    border-radius: 16px;
}

html[data-theme="dark"] .mosaic-result h2,
html[data-theme="dark"] .mosaic-result label,
html[data-theme="dark"] .mosaic-result p {
    color: #ffffff !important;
}

/* Przycisk Pomiń oraz przyciski okien */
html[data-theme="dark"] .mosaic-dialog__actions button {
    background: #34516d !important;
    color: #ffffff !important;
    border: 1px solid #7892b0;
}

html[data-theme="dark"] .mosaic-dialog__actions button:hover {
    background: #456989 !important;
}

/* Czytelne napisy na jasnych kafelkach mozaiki */
html[data-theme="dark"] .mosaic-tile[style*="background"] {
    color: #172b45 !important;
}

html[data-theme="dark"] .mosaic-tile[style*="background"] span {
    color: #172b45 !important;
}

/* Przyciski podsumowania */
html[data-theme="dark"] .mosaic-result__colors button,
html[data-theme="dark"] .mosaic-result__actions button {
    background: #34516d;
    color: #ffffff;
    border: 1px solid #7892b0;
}

html[data-theme="dark"] .mosaic-result input::placeholder,
html[data-theme="dark"] .mosaic-dialog input::placeholder,
html[data-theme="dark"] .mosaic-dialog textarea::placeholder {
    color: #b9cce0;
}
/* Czytelne podpisy na jasnych polach mozaiki */
html[data-theme="dark"] .mosaic-tile[style*="background"] {
    color: #172b45 !important;
}

html[data-theme="dark"] .mosaic-tile[style*="background"] span {
    color: #172b45 !important;
}
/* Moja mozaika – czytelne podpisy na jasnych polach */

html[data-theme="dark"] .mosaic-game.theme-light .mosaic-tile,
html[data-theme="dark"] .mosaic-game.theme-pastel .mosaic-tile,
html[data-theme="dark"] .mosaic-game.theme-colorful .mosaic-tile {
    color: #172b45 !important;
}

html[data-theme="dark"] .mosaic-game.theme-light .mosaic-tile span,
html[data-theme="dark"] .mosaic-game.theme-pastel .mosaic-tile span,
html[data-theme="dark"] .mosaic-game.theme-colorful .mosaic-tile span {
    color: #172b45 !important;
}

/* Przycisk powrotu do listy gier */
.mosaic-back-link {
    position: fixed;
    top: 145px;
    right: 24px;
    z-index: 100;
    display: inline-block;
    padding: 10px 16px;
    background: #2563eb;
    color: #ffffff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.mosaic-back-link:hover {
    background: #1d4ed8;
    color: #ffffff;
}

.mosaic-back-link:focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .mosaic-back-link {
        top: 135px;
        right: 12px;
        padding: 8px 12px;
        font-size: 12px;
    }
}