/* Генератор копилок — Pinterest / TikTok стиль */
.ptg-wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 0 2.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d1d1f;
}

.ptg-panel {
    margin-bottom: 1.25rem;
    padding: 1.1rem 1.15rem 1.2rem;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.05);
}

.ptg-panel-compact {
    padding-bottom: 1rem;
}

.ptg-panel-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: #1d1d1f;
}

.ptg-goal-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.ptg-goal-preset {
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid #e5e5ea;
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ptg-goal-preset:hover {
    border-color: #8b6914;
    color: #5c4520;
}

.ptg-goal-preset.is-active {
    border-color: #5c4520;
    background: #f5f0e6;
    color: #4a3728;
}

.ptg-goal-preset:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 69, 32, 0.25);
}

.ptg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ptg-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #3a3a3c;
}

.ptg-field input {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    background: #fff;
    color: #111;
    box-sizing: border-box;
}

.ptg-field input:focus {
    outline: none;
    border-color: #8b6914;
    box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.15);
}

.ptg-field-subtitle input {
    font-size: 15px;
    font-weight: 400;
}

.ptg-optional {
    font-weight: 400;
    color: #8e8e93;
}

.ptg-type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ptg-type-option {
    display: block;
    min-width: 0;
    cursor: pointer;
}

.ptg-type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ptg-type-card {
    display: block;
    height: 100%;
    padding: 9px 10px;
    border: 2px solid #e5e5ea;
    border-radius: 12px;
    background: #fafafa;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.ptg-type-card strong {
    display: block;
    margin-bottom: 2px;
    font-size: 14px;
    line-height: 1.2;
    color: #1d1d1f;
}

.ptg-type-card small {
    display: block;
    font-size: 11px;
    line-height: 1.25;
    color: #6e6e73;
}

@media (max-width: 400px) {
    .ptg-type-toggle {
        grid-template-columns: 1fr;
    }
}

.ptg-type-option input:checked + .ptg-type-card {
    border-color: #5c4520;
    background: #faf6ef;
}

.ptg-type-option input:focus-visible + .ptg-type-card {
    box-shadow: 0 0 0 3px rgba(92, 69, 32, 0.2);
}

.ptg-themes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px 12px;
    margin-bottom: 14px;
}

.ptg-theme-swatch {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ptg-theme-swatch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ptg-swatch {
    display: block;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    min-height: 40px;
    max-height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
    transition: transform 0.15s, border-color 0.15s;
}

.ptg-theme-swatch input:checked + .ptg-swatch {
    border-color: #4e73df;
    transform: scale(1.08);
}

.ptg-swatch-coral { background: #f5b5a8; }
.ptg-swatch-mint { background: #9ee8c8; }
.ptg-swatch-lemon { background: #f5e6a0; }
.ptg-swatch-peach { background: #ffd4bc; }
.ptg-swatch-sky { background: #b8dcf5; }
.ptg-swatch-lavender { background: #d8c8f8; }
.ptg-swatch-blush { background: #f8c0d8; }
.ptg-swatch-aqua { background: #b0e8f0; }

.ptg-preview-wrap {
    margin-bottom: 1.25rem;
}

.ptg-preview {
    padding: 12px 8px 16px;
    background: #e8e8ed;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    overflow-x: auto;
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.ptg-preview:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ptg-preview:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.35);
}

.ptg-export {
    padding: 1.15rem 1.15rem;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    scroll-margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ptg-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.ptg-action {
    min-height: 46px;
    padding: 10px 18px;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    background: #fff;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.ptg-action:hover {
    border-color: #4e73df;
    color: #4e73df;
}

.ptg-action:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ——— Лист A4 + карточка-копилка ——— */
.ptg-a4-document {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
}

.ptg-a4-page {
    width: 210mm;
    height: 297mm;
    max-width: 100%;
    padding: 10mm 12mm 12mm;
    box-sizing: border-box;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
}

.ptg-card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 8mm 8mm 7mm;
    border-radius: 6mm;
    box-sizing: border-box;
    --ptg-card-bg: #f5b5a8;
    --ptg-card-cell: #fff9f7;
    --ptg-card-title: #6b3d32;
    --ptg-card-sub: rgba(107, 61, 50, 0.85);
    --ptg-card-num: #7a4538;
    background: var(--ptg-card-bg);
    overflow: visible;
}

.ptg-theme-coral {
    --ptg-card-bg: #f5b5a8;
    --ptg-card-cell: #fff9f7;
    --ptg-card-title: #6b3d32;
    --ptg-card-sub: rgba(107, 61, 50, 0.85);
    --ptg-card-num: #7a4538;
}

.ptg-theme-mint {
    --ptg-card-bg: #9ee8c8;
    --ptg-card-cell: #f6fffa;
    --ptg-card-title: #2a6b52;
    --ptg-card-sub: rgba(42, 107, 82, 0.85);
    --ptg-card-num: #358564;
}

.ptg-theme-lemon {
    --ptg-card-bg: #f5e6a0;
    --ptg-card-cell: #fffef5;
    --ptg-card-title: #6b5c20;
    --ptg-card-sub: rgba(107, 92, 32, 0.85);
    --ptg-card-num: #7a6828;
}

.ptg-theme-peach {
    --ptg-card-bg: #ffd4bc;
    --ptg-card-cell: #fffaf5;
    --ptg-card-title: #7a4a30;
    --ptg-card-sub: rgba(122, 74, 48, 0.85);
    --ptg-card-num: #8a5538;
}

.ptg-theme-sky {
    --ptg-card-bg: #b8dcf5;
    --ptg-card-cell: #f5fbff;
    --ptg-card-title: #2a5570;
    --ptg-card-sub: rgba(42, 85, 112, 0.85);
    --ptg-card-num: #3a6580;
}

.ptg-theme-lavender {
    --ptg-card-bg: #d8c8f8;
    --ptg-card-cell: #faf8ff;
    --ptg-card-title: #524070;
    --ptg-card-sub: rgba(82, 64, 112, 0.85);
    --ptg-card-num: #5c4880;
}

.ptg-theme-blush {
    --ptg-card-bg: #f8c0d8;
    --ptg-card-cell: #fff5f9;
    --ptg-card-title: #7a3858;
    --ptg-card-sub: rgba(122, 56, 88, 0.85);
    --ptg-card-num: #8a4568;
}

.ptg-theme-aqua {
    --ptg-card-bg: #b0e8f0;
    --ptg-card-cell: #f2fcfe;
    --ptg-card-title: #2a6870;
    --ptg-card-sub: rgba(42, 104, 112, 0.85);
    --ptg-card-num: #3a7880;
}

.ptg-grid-wrap {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 0;
    overflow: visible;
}

.ptg-card-goal {
    flex: 0 0 auto;
    margin: 5mm 0 3mm;
    padding: 0 4mm;
    text-align: center;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 26pt;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--ptg-card-title);
}

.ptg-card-sub {
    flex: 0 0 auto;
    margin: 0 0 6mm;
    padding: 0 6mm;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11pt;
    font-weight: 400;
    line-height: 1.35;
    color: var(--ptg-card-sub);
}

.ptg-grid {
    display: grid;
    gap: var(--ptg-gap, 1.2mm);
    box-sizing: border-box;
    margin: 0 auto;
    flex-shrink: 0;
}

.ptg-grid-square {
    grid-template-columns: repeat(var(--ptg-cols, 10), minmax(0, 1fr));
    grid-template-rows: repeat(var(--ptg-rows, 10), minmax(0, 1fr));
}

.ptg-cell {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 2mm;
    background: var(--ptg-card-cell);
    color: var(--ptg-card-num);
    font-size: var(--ptg-cell-font, 8px);
    font-weight: 700;
    line-height: 1.05;
    text-align: center;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.ptg-checked {
    background: #a8d5a2 !important;
    color: #2d4a28 !important;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    opacity: 0.92;
}

@media (max-width: 800px) {
    .ptg-preview {
        overflow-x: auto;
        padding-left: 10px;
        padding-right: 10px;
    }

    .ptg-a4-page {
        width: 210mm;
        height: 297mm;
        max-width: none;
        transform-origin: top center;
    }
}

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

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

    .ptg-a4-document {
        padding: 0;
    }

    .ptg-a4-page {
        width: 100%;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 8mm 10mm 10mm;
        box-shadow: none !important;
        page-break-after: avoid;
        break-after: avoid;
    }

    .ptg-card {
        border-radius: 4mm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .ptg-card-goal {
        font-size: 24pt;
    }

    .ptg-checked {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
