/* ============================================================
   PhotoCard Creator — Mobile-first styles
   ============================================================ */

:root {
    --pc-accent: #e74c3c;
    --pc-accent-light: #fce4ec;
    --pc-bg: #f5f5f5;
    --pc-card-bg: #fff;
    --pc-text: #333;
    --pc-text-light: #888;
    --pc-border: #e0e0e0;
    --pc-radius: 12px;
    --pc-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--pc-bg);
    color: var(--pc-text);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

/* ── Header ─────────────────────────────────────────────── */

.pc-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--pc-border);
    min-height: 52px;
}

.pc-header-title {
    font-size: 17px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

.pc-header-title .pc-icon { font-size: 22px; }

.pc-header-actions {
    display: flex; gap: 8px; align-items: center;
}

.pc-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px;
    border: none; border-radius: 8px;
    font-size: 14px; font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.pc-btn:active { transform: scale(0.97); }

.pc-btn--primary {
    background: var(--pc-accent); color: #fff;
}
.pc-btn--primary:hover { background: #c0392b; }

.pc-btn--ghost {
    background: transparent; color: var(--pc-text);
    border: 1px solid var(--pc-border);
}
.pc-btn--ghost:hover { background: #f0f0f0; }

.pc-btn--submit {
    background: #27ae60; color: #fff;
}
.pc-btn--submit:hover { background: #219a52; }

.pc-btn--icon {
    background: transparent;
    color: var(--pc-text);
    border: 1px solid var(--pc-border);
    padding: 8px 10px;
}
.pc-btn--icon:hover:not(:disabled) { background: #f0f0f0; }
.pc-btn--icon:disabled {
    color: #ccc; border-color: #eee;
    cursor: default;
}

/* ── Steps indicator ────────────────────────────────────── */

.pc-steps {
    display: flex; align-items: center; justify-content: center;
    gap: 4px;
    padding: 10px 16px 8px;
    background: #fff;
}

/* Klikalny krok: kropka + etykieta. Dostępne kroki są aktywne do przełączania. */
.pc-step {
    display: flex; flex-direction: column; align-items: center;
    gap: 5px;
    border: none; background: none;
    padding: 4px 6px;
    cursor: default;
    color: var(--pc-text-light);
    -webkit-tap-highlight-color: transparent;
}

.pc-step-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--pc-border);
    transition: background 0.2s, width 0.2s;
}

.pc-step-label {
    font-size: 11px; font-weight: 500;
    color: var(--pc-text-light);
    transition: color 0.2s;
    white-space: nowrap;
}

/* Linia łącząca kroki */
.pc-step-line {
    width: 28px; height: 2px;
    background: var(--pc-border);
    margin-bottom: 18px; /* wyrównanie do rzędu kropek */
    flex-shrink: 0;
}

/* Krok dostępny do kliknięcia (nie bieżący) */
.pc-step.is-available {
    cursor: pointer;
}
.pc-step.is-available:active .pc-step-dot { transform: scale(0.85); }

/* Krok niedostępny (np. Edycja bez wybranej karty) */
.pc-step.is-disabled {
    opacity: 0.4;
    cursor: default;
}

.pc-step.active .pc-step-dot {
    background: var(--pc-accent);
    width: 26px;
    border-radius: 5px;
}
.pc-step.active .pc-step-label {
    color: var(--pc-accent);
    font-weight: 600;
}

.pc-step.done .pc-step-dot {
    background: #27ae60;
}
.pc-step.done .pc-step-label {
    color: var(--pc-text);
}

/* ── Main content area ──────────────────────────────────── */

.pc-main {
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.pc-section { display: none; }
.pc-section.active { display: block; }

.pc-section-title {
    font-size: 18px; font-weight: 600;
    margin: 0 0 16px;
    text-align: center;
}

/* ── Size selector (Step 1) ─────────────────────────────── */

.pc-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.pc-size-card {
    position: relative;
    background: var(--pc-card-bg);
    border: 2px solid var(--pc-border);
    border-radius: var(--pc-radius);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.pc-size-card:hover { border-color: #bbb; }
.pc-size-card.selected {
    border-color: var(--pc-accent);
    box-shadow: 0 0 0 3px var(--pc-accent-light);
}

.pc-size-card-label {
    font-size: 16px; font-weight: 600;
    margin-bottom: 4px;
}

.pc-size-card-dim {
    font-size: 13px; color: var(--pc-text-light);
}

/* ── Overlay selector (Step 2) ──────────────────────────── */

.pc-style-toggle {
    display: flex; justify-content: center; gap: 4px;
    margin-bottom: 16px;
    background: #eee; border-radius: 8px; padding: 3px;
}

.pc-style-toggle-btn {
    flex: 1; padding: 8px 16px;
    border: none; border-radius: 6px;
    font-size: 14px; font-weight: 500;
    cursor: pointer; background: transparent;
    color: var(--pc-text-light);
    transition: background 0.15s, color 0.15s;
}
.pc-style-toggle-btn.active {
    background: #fff; color: var(--pc-text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.pc-overlays-grid {
    display: grid;
    /* Mobile-first: 1 kolumna na wąskim ekranie, tyle kolumn ile wejdzie na szerszym */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.pc-overlay-thumb {
    position: relative;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
    background: #f0f0f0;
}
.pc-overlay-thumb:hover { border-color: #ccc; }
.pc-overlay-thumb.selected {
    border-color: var(--pc-accent);
    box-shadow: 0 0 0 3px var(--pc-accent-light);
}

.pc-overlay-thumb img {
    width: 100%; height: auto;
    display: block;
}

.pc-overlay-thumb-check {
    display: none;
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: var(--pc-accent); border-radius: 50%;
    color: #fff; font-size: 14px;
    line-height: 22px; text-align: center;
}
.pc-overlay-thumb.selected .pc-overlay-thumb-check { display: block; }

.pc-overlay-gallery-badge {
    position: absolute; bottom: 4px; left: 4px;
    background: rgba(0,0,0,0.7); color: #fff;
    font-size: 11px; padding: 2px 6px;
    border-radius: 10px; cursor: pointer;
    z-index: 2; line-height: 1.4;
}
.pc-overlay-gallery-badge:hover { background: rgba(0,0,0,0.9); }

/* ── Gallery lightbox ──────────────────────────────────── */

.pc-gallery-lightbox {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.92);
    display: flex; align-items: center; justify-content: center;
    touch-action: none;
}
.pc-gallery-lightbox img {
    max-width: 90vw; max-height: 80vh;
    object-fit: contain; border-radius: 8px;
}
.pc-gallery-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; color: #fff;
    font-size: 32px; cursor: pointer; line-height: 1;
    padding: 4px 8px;
}
.pc-gallery-counter {
    position: absolute; bottom: 20px; left: 50%;
    transform: translateX(-50%);
    color: #fff; font-size: 14px; opacity: 0.7;
}
.pc-gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    font-size: 36px; cursor: pointer; padding: 8px 14px;
    border-radius: 50%;
}
.pc-gallery-nav:hover { background: rgba(255,255,255,0.3); }
.pc-gallery-prev { left: 12px; }
.pc-gallery-next { right: 12px; }

/* ── Product showcase cards (Step 2 redesign) ──────────────── */

.pc-product-card {
    background: var(--pc-card-bg);
    border-radius: var(--pc-radius);
    box-shadow: var(--pc-shadow);
    overflow: hidden;
    /* Kolumna + siatka rozciąga karty do równej wysokości → przycisk (margin-top:auto)
       ląduje przy dole każdej karty, więc przyciski są w jednej linii. */
    display: flex;
    flex-direction: column;
}

.pc-carousel {
    position: relative;
    overflow: hidden;
    background: #fafafa;
    cursor: pointer;
}

.pc-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
}

.pc-carousel-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Stała wysokość → każda karuzela ma identyczny obszar zdjęcia niezależnie
       od proporcji obrazka. Dzięki temu zdjęcia, kropki i przyciski wszystkich
       kart w rzędzie są wyrównane (różne proporcje scenek nie rozpychają karty). */
    height: 240px;
}

.pc-carousel-slide img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.pc-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
    background: #fafafa;
}

.pc-carousel-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.2s;
}

.pc-carousel-dot.active {
    background: var(--pc-accent);
}

.pc-carousel-nav {
    position: absolute;
    top: 50%; transform: translateY(-60%);
    background: rgba(0,0,0,0.3); color: #fff;
    border: none;
    width: 36px; height: 36px;
    font-size: 22px; line-height: 36px;
    text-align: center; cursor: pointer;
    border-radius: 50%;
    opacity: 0; transition: opacity 0.2s;
}

.pc-carousel:hover .pc-carousel-nav { opacity: 1; }
.pc-carousel-nav:hover { background: rgba(0,0,0,0.5); }
.pc-carousel-prev { left: 8px; }
.pc-carousel-next { right: 8px; }

.pc-product-template {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--pc-border);
    cursor: pointer;
    transition: background 0.15s;
}

.pc-product-template:hover { background: #f8f8f8; }

.pc-product-template img {
    width: 56px; height: 56px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    border: 1px solid var(--pc-border);
    flex-shrink: 0;
}

.pc-product-template-name {
    font-size: 14px; font-weight: 500;
    color: var(--pc-text);
}

.pc-product-hero {
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    /* Równa wysokość z karuzelą — karty bez galerii wyrównane z tymi z galerią. */
    height: 240px;
}

.pc-product-hero img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.pc-product-name {
    font-size: 14px; font-weight: 500;
    text-align: center;
    padding: 8px 16px;
    color: var(--pc-text);
    border-top: 1px solid var(--pc-border);
}

.pc-product-add-btn {
    display: block;
    width: calc(100% - 32px);
    margin: auto 16px 16px;   /* margin-top:auto → przycisk przy dole karty */
    padding: 12px;
    text-align: center;
    font-size: 15px;
}

/* ── Card editor (Step 2 — photo + text/clipart combined) ── */

.pc-editor {
    display: flex; flex-direction: column;
    align-items: center; gap: 16px;
}

.pc-card-preview {
    position: relative;
    background: #fff;
    box-shadow: var(--pc-shadow);
    border-radius: 4px;
    overflow: hidden;
    max-width: 100%;
    touch-action: none;
}

.pc-card-cutout {
    position: absolute;
    overflow: hidden;
    touch-action: none;
}

.pc-card-cutout img {
    position: absolute;
    max-width: none; max-height: none;
    will-change: transform;
    pointer-events: none;
}

/* Gotowy obraz karty (kadr + efekty = processedThumb) nakładany NA wycinek,
   nad interaktywnym zdjęciem, pod nakładką PNG ramki. Ukrywany podczas gestu
   (pan/zoom) przez _updateProcessedOverlay. */
.pc-cutout-processed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 2;
}

.pc-card-overlay {
    position: absolute; inset: 0;
    pointer-events: none;
}
.pc-card-overlay img {
    width: 100%; height: 100%;
    display: block;
}

.pc-card-text-area {
    position: absolute;
    pointer-events: none;
}

/* ── Action bar (editor bottom toolbar) ────────────────── */

.pc-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 10px 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: #111;
    border-top: 1px solid #333;
    margin-top: 12px;
    border-radius: 12px;
}

.pc-action-btn {
    display: flex; flex-direction: column; align-items: center;
    background: none; border: none; color: #aaa;
    font-size: 0.7rem; cursor: pointer; gap: 3px; padding: 4px 10px;
    transition: color 0.15s;
}
.pc-action-btn:active { color: #fff; }
.pc-action-btn svg { width: 22px; height: 22px; }
.pc-action-btn--done { color: #09CF91; }
.pc-action-btn--done:active { color: #0be0a0; }

@media (min-width: 601px) {
    .pc-action-btn:hover { color: #fff; }
    .pc-action-btn--done:hover { color: #0be0a0; }
}

.pc-add-photo-zone {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    border: 2px dashed var(--pc-border);
    border-radius: var(--pc-radius);
    padding: 40px 20px;
    cursor: pointer;
    color: var(--pc-text-light);
    transition: border-color 0.2s, background 0.2s;
}
.pc-add-photo-zone:hover {
    border-color: var(--pc-accent);
    background: var(--pc-accent-light);
}

.pc-add-photo-zone svg {
    width: 48px; height: 48px;
    stroke: var(--pc-text-light);
}

/* ── Gallery (Step 3 — cart view) ───────────────────────── */

.pc-main--gallery { max-width: 1200px; }

/* Mobile first — carousel visible, grid hidden (przełącznik na dole zmienia). */
.pc-gallery-grid { display: none; }
.pc-gallery-carousel { display: block; }

/* Miejsce na pływający pasek przełącznika widoku (fixed, na dole). */
#pcGallerySection.active { padding-bottom: 88px; }

.pc-gallery-card {
    transition: transform 0.2s;
}

/* Kwadratowy kafel — karta wyśrodkowana i w całości widoczna (contain).
   Ujednolica siatkę mieszanych proporcji (portret/pejzaż) jak galeria zdjęć. */
.pc-gallery-stage {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: rgba(0, 0, 0, 0.035);
    border-radius: 12px;
}
.pc-gallery-stage .pc-gallery-card-preview {
    /* max — żeby żadna orientacja nie wyszła poza kafel */
    max-width: 100%;
    max-height: 100%;
}

.pc-gallery-card-preview {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
    box-shadow: 0 3px 16px rgba(0,0,0,0.13);
    /* cqw dla font-size bloków tekstu w miniaturze (skalują się z gridem) */
    container-type: inline-size;
}

.pc-gallery-cutout {
    position: absolute;
    overflow: hidden;
}

.pc-gallery-cutout img {
    position: absolute;
    max-width: none; max-height: none;
    pointer-events: none;
}

.pc-gallery-overlay {
    position: absolute; inset: 0;
    pointer-events: none;
}
.pc-gallery-overlay img {
    width: 100%; height: 100%;
    display: block;
}

.pc-gallery-card-controls {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 2px;
}

.pc-gallery-card-label {
    font-size: 12px; font-weight: 500;
    color: var(--pc-text-light);
}
.pc-gallery-card-label small {
    color: var(--pc-text-light); font-weight: 400;
    margin-left: 2px;
}

.pc-gallery-card-price {
    font-size: 12px;
    color: var(--pc-text-light);
    margin: 2px 0 4px;
    min-height: 15px;
}
.pc-gallery-card-price strong {
    color: var(--pc-text);
    font-weight: 600;
}

/* Pasek sumy koszyka pod galerią */
.pc-gallery-summary {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    max-width: 520px;
    margin: 16px auto 4px;
    padding: 12px 16px;
    border-top: 1px solid var(--pc-border);
    font-size: 15px;
}
.pc-gallery-summary-label { color: var(--pc-text-light); }
.pc-gallery-summary-total { font-size: 20px; font-weight: 700; color: var(--pc-text); }

/* Ikona koszyka + licznik w nagłówku */
.pc-cart-btn { position: relative; }
.pc-cart-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px;
    background: #e53935; color: #fff;
    font-size: 11px; font-weight: 700; line-height: 18px;
    text-align: center; box-sizing: border-box;
}

/* Baner ostrzegawczy: in-app browser (Google/FB/IG…) — wybór zdjęć bywa zawodny */
.pc-iab-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 99999;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: #fff3cd; color: #664d03;
    border-bottom: 1px solid #ffe69c;
    font-size: 13px; line-height: 1.35;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.pc-iab-text { flex: 1 1 auto; }
.pc-iab-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pc-iab-btn {
    background: #664d03; color: #fff; border: 0; border-radius: 6px;
    padding: 6px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
    white-space: nowrap;
}
.pc-iab-close {
    background: transparent; border: 0; color: #664d03;
    font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px;
}

.pc-gallery-card-actions {
    display: flex; align-items: center; gap: 6px;
}

.pc-gallery-copies {
    display: flex; align-items: center; gap: 0;
}

.pc-gallery-copy-btn {
    width: 26px; height: 26px;
    border: 1px solid var(--pc-border);
    background: #fff; color: var(--pc-text);
    font-size: 14px; font-weight: 600;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.15s;
}
.pc-gallery-copy-btn:first-child { border-radius: 6px 0 0 6px; }
.pc-gallery-copy-btn:last-child { border-radius: 0 6px 6px 0; }
.pc-gallery-copy-btn:active { background: #eee; }

.pc-gallery-copies-val {
    width: 28px; height: 26px;
    border-top: 1px solid var(--pc-border);
    border-bottom: 1px solid var(--pc-border);
    border-left: none; border-right: none;
    text-align: center; font-size: 12px; font-weight: 600;
    background: #fff; color: var(--pc-text);
    display: flex; align-items: center; justify-content: center;
}

.pc-gallery-card-delete {
    width: 26px; height: 26px;
    border: 1px solid var(--pc-border);
    background: #fff;
    color: var(--pc-text-light);
    font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.pc-gallery-card-delete:active {
    color: var(--pc-accent); background: var(--pc-accent-light);
}

.pc-gallery-add {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px;
    border: 2px dashed var(--pc-border);
    border-radius: 4px;
    padding: 24px;
    cursor: pointer;
    color: var(--pc-text-light);
    min-height: 180px;
    transition: border-color 0.2s, color 0.2s;
}
.pc-gallery-add:active {
    border-color: var(--pc-accent);
    color: var(--pc-accent);
}
.pc-gallery-add-icon { font-size: 36px; line-height: 1; }
.pc-gallery-add-label { font-size: 14px; font-weight: 500; }

/* Gallery carousel (mobile) */
.pc-gallery-carousel {
    /* Bez tego slajdy (flex:0 0 100%) wylewają się w bok → poziomy scroll strony
       przejmuje gest zamiast przełączać karty. touch-action:pan-y pozwala na
       pionowe przewijanie strony, ale poziomy swipe zostaje dla karuzeli. */
    overflow: hidden;
    touch-action: pan-y;
}
.pc-gallery-carousel-track {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pc-gallery-carousel-slide {
    flex: 0 0 100%;
    padding: 0 4px;
}

.pc-gallery-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 12px 0;
}

/* ── Przełącznik widoku galerii (pływający pasek na dole, mobile) ── */
.pc-gallery-viewbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 200;
    display: flex;
    gap: 3px;
    padding: 4px;
    background: #111;
    border-radius: 999px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.30);
}
.pc-gallery-viewbtn {
    display: flex; align-items: center; gap: 7px;
    border: none; background: none;
    color: #aaa;
    font-size: 13px; font-weight: 500;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.pc-gallery-viewbtn svg { display: block; }
.pc-gallery-viewbtn.is-active {
    background: #fff;
    color: #111;
}

/* Widok siatki (mobile): pokaż grid, ukryj karuzelę. */
@media (max-width: 600px) {
    #pcGallerySection.view-grid .pc-gallery-grid {
        display: grid;
        /* minmax(0,1fr), NIE 1fr: samo "1fr" = minmax(auto,1fr), a to "auto" pozwala
           karcie o szerokiej zawartosci (podglad + pasek akcji) rozepchnac kolumne
           ponad rowny podzial → kolumny wychodza nierowne i siatka jest szersza niz
           ekran → poziomy scroll strony. minmax(0,…) wymusza rowne, kurczliwe kolumny. */
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding: 4px 0 8px;
    }
    #pcGallerySection.view-grid .pc-gallery-carousel { display: none; }
    #pcGallerySection.view-grid .pc-gallery-add {
        aspect-ratio: 1 / 1;
        min-height: 0;
        padding: 16px;
    }
    /* W waskiej komorce (2 kolumny) etykieta + pasek akcji (sztywne ~112px) nie mieszcza
       sie obok siebie i wylewaja w prawo. Ukladamy je pionowo: etykieta nad akcjami. */
    #pcGallerySection.view-grid .pc-gallery-card-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    #pcGallerySection.view-grid .pc-gallery-card-actions {
        justify-content: space-between;
    }
}

/* Size badge on product cards */
.pc-product-size-badge {
    display: inline-block;
    background: rgba(0,0,0,0.06);
    color: var(--pc-text-light);
    font-size: 11px; font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Desktop overrides */
@media (min-width: 601px) {
    .pc-gallery-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px; padding: 8px 0;
    }
    .pc-gallery-carousel { display: none; }
    /* Desktop ma już siatkę — pływający przełącznik zbędny, brak dolnego marginesu. */
    .pc-gallery-viewbar { display: none; }
    #pcGallerySection.active { padding-bottom: 0; }
    .pc-gallery-card:hover { transform: translateY(-2px); }
    .pc-gallery-card-preview:hover {
        box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    }
    .pc-gallery-card-delete:hover {
        color: var(--pc-accent); background: var(--pc-accent-light);
    }
    .pc-gallery-copy-btn:hover { background: #f5f5f5; }
    .pc-gallery-add:hover {
        border-color: var(--pc-accent);
        color: var(--pc-accent);
    }
}

@media (min-width: 1000px) {
    .pc-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* ── Upload progress ────────────────────────────────────── */

.pc-upload-progress {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
}

.pc-upload-progress-inner {
    background: #fff; border-radius: 16px;
    padding: 32px; text-align: center;
    min-width: 300px; max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.pc-upload-progress-bar {
    height: 6px; background: #eee;
    border-radius: 3px; overflow: hidden;
    margin: 16px 0 12px;
}

.pc-upload-progress-fill {
    height: 100%; width: 0%;
    background: var(--pc-accent);
    border-radius: 3px;
    transition: width 0.3s;
}

/* ── Responsive (mobile-first) ──────────────────────────── */

.pc-carousel-nav { opacity: 0.7; }
.pc-carousel-slide { height: 200px; }
.pc-product-hero { height: 200px; }

@media (min-width: 601px) {
    .pc-carousel-nav { opacity: 0; }
    .pc-carousel-slide { height: 240px; }
    .pc-product-hero { height: 240px; }
}

/* ── Success screen ─────────────────────────────────────── */

.pc-success {
    display: none; text-align: center; padding: 48px 24px;
}
.pc-success.active { display: block; }

.pc-success-icon {
    font-size: 64px; margin-bottom: 16px;
}

.pc-success-title {
    font-size: 22px; font-weight: 600;
    margin-bottom: 8px;
}

.pc-success-text {
    font-size: 15px; color: var(--pc-text-light);
    margin-bottom: 24px;
}

/* ── Kompaktowy panel edycji tekstu (mobile) ─────────────────────────
   Panel FZ.TextOverlay (.fz-to-*) jest współdzielony z albumem przez
   css/fz-text-overlay.css. Te reguły są w photocard.css (ładowanym TYLKO
   na stronie fotokartki), więc album pozostaje nietknięty.
   Selektory z `body ` mają wyższą specyficzność niż pojedyncza klasa w
   fz-text-overlay.css — inaczej tamten plik (ładowany PÓŹNIEJ) by wygrał.
   Cel: skrócić panel, żeby zasłaniał jak najmniej karty. */
@media (max-width: 600px) {
    /* Twardy limit wysokości + wewnętrzny scroll (overflow-y:auto już jest).
       36vh: panel zauważalnie niższy na każdym ekranie; rzadziej używane suwaki
       (Cień: Dystans/Rozmycie/Krycie) doscrollowuje się wewnątrz panelu. */
    body .fz-to-panel-inner {
        max-height: 36vh;
        padding-top: 6px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    /* Niższy topbar → kilka px odzyskane. */
    body .fz-to-panel-topbar { min-height: 48px; }

    /* Upakuj wiersze — mniejsze dolne odstępy (bez ukrywania kontrolek). */
    body .fz-to-font-picker { padding-bottom: 6px; }
    body .fz-to-controls    { padding-bottom: 6px; }
    body .fz-to-color-row   { padding-bottom: 6px; }

    /* Sekcje efektów (Obrys / Cień) — najwięksi pożeracze pionu. */
    body .fz-to-effects-wrap   { gap: 8px; padding-top: 8px; margin-top: 0; }
    body .fz-to-effect-section { padding: 6px 8px; gap: 4px; }
    body .fz-to-sliders-block  { gap: 4px; }
}

/* ── Przycisk "Kadruj" w popupie Korekty (FZ.PhotoEdit, ciemny motyw) ─── */
.pc-edit-crop-row {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
}
.fz-edit-modal > .pc-edit-crop-row { background: #1a1a1a; }
.pc-edit-crop-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.pc-edit-crop-btn:active { background: rgba(255, 255, 255, 0.16); }
.pc-edit-crop-btn svg { display: block; }
