:root {
    --amuz-red: #E63946;
    --amuz-red-dark: #C1121F;
    --ink: #3a3a3c;
    --ink-soft: #475569;
    --muted: #94A3B8;
    --line: #E2E8F0;
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, .05), 0 2px 4px -2px rgba(0, 0, 0, .05);
    --radius-md: 16px;
    --radius-sm: 10px;
    --font-main: 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; height: 100%; }

body {
    font-family: var(--font-main);
    color: var(--ink);
    background-color: var(--bg);
    min-height: 100%;
    overflow-y: scroll;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.wrap {
    max-width: 1760px;
    margin: 0 auto;
    padding: 24px 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.brand-title {
    font-size: clamp(20px, 2vw, 24px);
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo { height: clamp(34px, 4vw, 46px); width: auto; display: block; flex: 0 0 auto; }
.brand-title span { display: block; line-height: 1.05; }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.bg-gallery {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 12px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.bg-gallery.hidden { display: none; }

.bg-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
    transition: all .2s ease;
    text-align: left;
}

.bg-tile:hover { border-color: var(--amuz-red); background: var(--card); transform: translateY(-2px); }
.bg-tile.active { border-color: var(--amuz-red); box-shadow: 0 0 0 3px rgba(230, 57, 70, .14); background: var(--card); }

.bg-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: var(--line);
    overflow: hidden;
    position: relative;
}

.bg-thumb.empty::before {
    content: "Brak pliku";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: linear-gradient(135deg, transparent 0 46%, rgba(148, 163, 184, .18) 46% 54%, transparent 54% 100%), var(--bg);
}

.bg-tile-label { font-size: 12px; font-weight: 800; color: var(--ink-soft); line-height: 1.25; }

@keyframes bgShimmer { to { background-position: -200% 0; } }

@media (max-width: 900px) {
    .bg-gallery { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

.layout { display: grid; grid-template-columns: 2.7fr 2.3fr; gap: 24px; align-items: start; }

.sidebar { min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    z-index: 2;
    position: relative;
}

.panel-title { margin: 0 0 16px; font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }

.form-group label {
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    display: block;
    margin-bottom: 6px;
}

.form-control, select, input, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--ink);
    font-weight: 500;
    font-family: inherit;
    transition: all .2s ease;
    line-height: 1.5;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-control:focus {
    border-color: var(--amuz-red);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
    outline: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .01em;
    transition: all .2s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary { background: var(--ink); color: #fff; }

.btn-primary:hover:not(:disabled) {
    background: var(--amuz-red);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(230, 57, 70, .35);
}

.btn-ghost { background: var(--bg); color: var(--ink-soft); border-color: var(--line); }

.btn-ghost:hover:not(:disabled) { border-color: var(--amuz-red); color: var(--amuz-red); background: var(--card); }

.btn svg { flex-shrink: 0; margin-right: 4px; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }

.theme-selector { display: flex; gap: 12px; align-items: center; }

.theme-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--line);
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}

.theme-btn.active {
    border-color: var(--amuz-red);
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.2);
    transform: scale(1.1);
}

.theme-btn.custom-color-btn {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-color: var(--line);
    color: var(--ink);
}

.theme-btn.custom-color-btn svg { pointer-events: none; display: block; }

@font-face { font-family: 'Basier Square'; src: url('BasierSquare-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-RegularItalic.woff2') format('woff2'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-MediumItalic.woff2') format('woff2'); font-weight: 500; font-style: italic; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-SemiBold.woff') format('woff'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-SemiBoldItalic.woff2') format('woff2'); font-weight: 600; font-style: italic; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; }
@font-face { font-family: 'Basier Square'; src: url('BasierSquare-BoldItalic.woff2') format('woff2'); font-weight: 700; font-style: italic; }

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.editor-toolbar.is-hidden, .toolbar-size.is-hidden { display: none; }

.toolbar-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    transition: all .18s ease;
}

.toolbar-btn:hover { border-color: var(--amuz-red); color: var(--amuz-red); }
.toolbar-btn.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.toolbar-sep { width: 1px; height: 22px; background: var(--line); display: inline-block; }
.toolbar-size { display: inline-flex; align-items: center; gap: 6px; }
.toolbar-size-value { min-width: 34px; text-align: center; font-size: 13px; font-weight: 800; color: var(--ink-soft); }

.topbar-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: auto;
    min-width: 140px;
    height: 48px;
    padding: 0 44px 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23707585' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 14px center;
    color: var(--ink-soft);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .01em;
    box-shadow: var(--shadow-sm);
    transition: all .2s ease;
    cursor: pointer;
}

.topbar-select:hover { border-color: var(--amuz-red); background-color: var(--card); color: var(--ink); }

.topbar-select:focus {
    outline: none;
    border-color: var(--amuz-red);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1), var(--shadow-sm);
    background-color: var(--card);
}

.topbar-select option { color: var(--ink); }

.rich-input {
    min-height: 64px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    outline: none;
    cursor: text;
}

.rich-input:focus {
    border-color: var(--amuz-red);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.rich-input.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }

.kv-title, .kv-subtitle, .kv-desc, .kv-free, .kv-value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.kv-details {
    margin-top: auto;
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 6px;
    row-gap: 4px;
    align-items: baseline;
    align-content: end;
    line-height: 1.15;
    padding-bottom: 2px;
}

.kv-label {
    font-weight: 800;
    font-size: 0.76em;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    opacity: 0.7;
    line-height: 1.15;
    white-space: normal;
    margin: 0;
    padding: 0;
    align-self: baseline;
    text-wrap: balance;
}

.kv-value { font-weight: 600; font-size: 1em; line-height: 1.15; margin: 0; padding: 0; align-self: baseline; text-wrap: balance; }
.kv-url { grid-column: 1 / -1; padding-top: 8px; }
.kv-title strong, .kv-subtitle strong, .kv-desc strong, .kv-free strong, .kv-value strong { font-weight: 700; }
.kv-title em, .kv-subtitle em, .kv-desc em, .kv-free em, .kv-value em { font-style: italic; }

.content { display: flex; flex-direction: column; justify-content: flex-start; position: sticky; top: 24px; align-items: stretch; }

.preview-box {
    background: var(--card);
    border: 1px dashed var(--muted);
    border-radius: var(--radius-md);
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 80vh;
    max-height: 90vh;
}

.poster-scale-wrapper { position: relative; }

.poster {
    width: 595px;
    height: 842px;
    background: #fff;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 15px rgba(0, 0, 0, 0.05);
    font-family: 'Basier Square', sans-serif;
}

.poster-bg { position: absolute; inset: -1px; background-size: cover; background-position: center; background-repeat: no-repeat; z-index: 1; transition: transform 0.1s ease; }

.poster-bg-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 3;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-family: var(--font-main);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    white-space: nowrap;
}

.poster:hover .poster-bg-hint { opacity: 1; }
.poster.edit-mode .poster-bg { cursor: default; }

.poster-grid {
    position: absolute;
    inset: -1px;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.grid-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
    transition: outline 0.2s;
    word-wrap: break-word;
    overflow: hidden;
}

.poster.edit-mode .grid-cell { outline: 1px dashed rgba(255, 255, 255, 0.4); outline-offset: -1px; }
.poster.edit-mode .grid-cell:hover { outline-color: var(--amuz-red); cursor: pointer; }

.cell-content { display: flex; flex-direction: column; height: 100%; width: 100%; overflow: hidden; padding-bottom: 8px; position: relative; z-index: 2; }

.kv-title { font-weight: 700; line-height: 1.1; margin-bottom: 8px; font-size: 1em; white-space: pre-wrap; text-wrap: balance; }
.kv-subtitle { font-weight: 500; line-height: 1.3; opacity: 0.9; font-size: 0.62em; margin-bottom: 12px; white-space: pre-wrap; text-wrap: balance; }
.kv-desc { font-weight: 400; line-height: 1.4; opacity: 0.85; font-size: 1em; margin-bottom: 12px; white-space: pre-wrap; }
.kv-free { white-space: pre-wrap; line-height: 1.4; }

.minimap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 4px;
    width: 120px;
    aspect-ratio: 0.707;
}

.mini-cell {
    background: var(--bg);
    border: 2px solid var(--line);
    border-radius: 4px;
    cursor: grab;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.mini-cell:hover { border-color: var(--muted); }
.mini-cell.active { border-color: var(--amuz-red); box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.2); }
.mini-cell:active { cursor: grabbing; }
.mini-cell.drag-over { border-color: var(--amuz-red); background: var(--line); border-style: dashed; }

@media print {
    body { background: transparent !important; }
    .sidebar, .topbar { display: none !important; }
    .wrap { padding: 0; }
    .layout { display: block; }
    .preview-box { padding: 0; border: none; box-shadow: none; position: static; height: auto; }
    .poster-scale-wrapper { width: 100% !important; height: auto !important; }
    .poster { width: 100%; height: 100vh; box-shadow: none; transform: none !important; position: static; }
    .poster .grid-cell { outline: none !important; box-shadow: none !important; padding: 24px !important; }
    @page { size: A3 portrait; margin: 0; }
}

.layout-presets { display: flex; gap: 10px; flex-wrap: wrap; }

.layout-preset {
    width: 92px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all .2s ease;
    text-align: center;
}

.layout-preset:hover { border-color: var(--amuz-red); background: var(--card); transform: translateY(-1px); }
.layout-preset svg { display: block; margin: 0 auto 8px; }
.layout-preset span { display: block; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.25; }
.layout-preset.random svg { width: 42px; height: 56px; }

.help-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(30, 30, 40, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.help-modal-backdrop.is-open { opacity: 1; pointer-events: all; }

.help-modal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, .28);
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(.98);
    transition: transform .22s ease;
}

.help-modal-backdrop.is-open .help-modal { transform: translateY(0) scale(1); }

.help-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.help-modal-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.help-modal-head h2 svg { color: var(--amuz-red); }

.help-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .18s ease;
}

.help-modal-close:hover { border-color: var(--amuz-red); color: var(--amuz-red); }
.help-modal-body { display: flex; flex: 1; overflow: hidden; }

.help-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    border-right: 1px solid var(--line);
    min-width: 148px;
    flex-shrink: 0;
    overflow-y: auto;
}

.help-tab {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font: 700 13px/1.2 var(--font-main);
    cursor: pointer;
    text-align: left;
    transition: all .15s ease;
    white-space: nowrap;
}

.help-tab:hover { background: var(--bg); color: var(--ink); }
.help-tab.active { background: var(--amuz-red); color: #fff; }
.help-tab svg { flex-shrink: 0; }
.help-content { flex: 1; overflow-y: auto; padding: 24px 28px; }
.help-panel { display: none; }
.help-panel.active { display: block; }
.help-panel h3 { font-size: 16px; font-weight: 800; margin: 0 0 14px; color: var(--ink); letter-spacing: -.01em; }
.help-panel h3:not(:first-child) { margin-top: 28px; }
.help-panel p { font-size: 14px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 12px; }
.help-panel ul { padding-left: 0; list-style: none; margin: 0 0 12px; display: flex; flex-direction: column; gap: 7px; }
.help-panel ul li { font-size: 14px; line-height: 1.55; color: var(--ink-soft); padding-left: 18px; position: relative; }
.help-panel ul li::before { content: "–"; position: absolute; left: 4px; color: var(--amuz-red); font-weight: 700; }
.help-panel strong { color: var(--ink); font-weight: 700; }

.help-tip {
    background: #FFF5F5;
    border: 1px solid rgba(230, 57, 70, .2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 12px 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.place-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all .15s ease;
    font-family: var(--font-main);
    white-space: nowrap;
    line-height: 1.4;
}

.place-chip:hover {
    border-color: var(--amuz-red);
    color: var(--amuz-red);
    background: var(--card);
}

.help-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 10px 0 14px; }
.help-table th { text-align: left; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.help-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--ink-soft); line-height: 1.45; vertical-align: top; }
.help-table td:first-child { color: var(--ink); font-weight: 700; white-space: nowrap; }
.help-table tr:last-child td { border-bottom: none; }
/* ============================================================
   RESPONSIVE – MOBILNE (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {

    /* --- Obramowanie i odstępy strony --- */
    .wrap {
        padding: 12px 14px 32px;
        gap: 12px;
    }

    /* --- Topbar: logo + przyciski --- */
    .topbar {
        gap: 10px;
        margin-bottom: 4px;
    }

    .brand-title {
        font-size: 16px;
        gap: 10px;
    }

    .brand-logo {
        height: 28px;
    }

    /* Przyciski topbaru: mniejsze, bez tekstu za wyjątkiem PNG/PDF */
    .topbar-right {
        gap: 6px;
        flex-wrap: wrap;
        width: 100%;
    }

    /* Ukryj etykiety tekstowe przy ghost-buttonach, zostaw ikony */
    .btn-ghost span,
    #btn-upload-trigger span,
    #btn-toggle-gallery span,
    #btn-random-image span,
    #btn-save-project span,
    #btn-load-project span {
        display: none;
    }

    /* Zmniejsz wszystkie przyciski */
    .btn {
        padding: 9px 12px;
        font-size: 12px;
        gap: 5px;
    }

    /* Selekt formatu — mniejszy */
    .topbar-select {
        min-width: 100px;
        height: 40px;
        padding: 0 32px 0 12px;
        font-size: 12px;
    }

    /* --- Galeria teł --- */
    .bg-gallery {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    /* --- Układ główny: sidebar nad podglądem --- */
    .layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* --- Panel edytora --- */
    .panel {
        padding: 16px;
    }

    /* Sekcja Kolorystyka + Układ: zawijaj w kolumny */
    .panel > div:first-child {
        flex-direction: column !important;
        gap: 16px !important;
        margin-bottom: 16px !important;
        padding-bottom: 16px !important;
    }

    /* Minimap + editor-panel obok siebie ale mniejsze */
    .panel > div:last-child > div:first-child {
        flex: 0 0 88px !important;
    }

    .minimap {
        width: 88px;
    }

    /* Presety układu: mniejsze kafelki */
    .layout-preset {
        width: 68px;
        padding: 6px;
    }

    .layout-preset svg {
        width: 34px;
        height: 45px;
    }

    .layout-preset span {
        font-size: 9px;
    }

    .layout-preset.random svg {
        width: 34px;
        height: 45px;
    }

    /* Kółka kolorów — trochę mniejsze */
    .theme-btn {
        width: 30px;
        height: 30px;
    }

    /* Formularz – jeden kolumna */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Panel tytułu modułu */
    .panel-title {
        font-size: 15px;
    }

    /* --- Podgląd plakatu --- */
    .content {
        position: static; /* nie sticky na mobile */
    }

    .preview-box {
        padding: 16px;
        min-height: unset;
        max-height: unset;
        height: auto;
    }

    /* Suwak zoom: pełna szerokość */
    .content > div:first-child {
        padding: 0;
    }

    /* --- Modal pomocy --- */
    .help-modal-backdrop {
        padding: 10px;
        align-items: flex-end;
    }

    .help-modal {
        max-height: 92vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .help-modal-body {
        flex-direction: column;
    }

    .help-tabs {
        flex-direction: row;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 10px 12px;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        flex-shrink: 0;
    }

    .help-tab {
        white-space: nowrap;
        padding: 7px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .help-tab svg {
        width: 13px;
        height: 13px;
    }

    /* Ukryj zakładkę "Autor" separator na mobile */
    .help-tab[data-tab="author"] {
        margin-top: 0 !important;
        border-top: none !important;
        padding-top: 7px !important;
    }

    .help-content {
        padding: 16px 18px;
    }

    .help-panel h3 {
        font-size: 14px;
    }

    /* --- Pasek formatowania tekstu --- */
    .editor-toolbar {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px;
    }
}

/* ============================================================
   RESPONSIVE – MAŁY TABLET (769px – 1024px)
   ============================================================ */

@media (min-width: 769px) and (max-width: 1024px) {

    .wrap {
        padding: 16px 20px 32px;
    }

    .layout {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .topbar-right {
        gap: 8px;
        flex-wrap: wrap;
    }

    .btn {
        padding: 10px 14px;
        font-size: 12px;
    }

    .preview-box {
        padding: 20px;
        min-height: 60vh;
    }
}