.tiko-cd-customize-cta {
    margin: 16px 0;
}

.tiko-cd-customize-cta .tiko-cd-open-designer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.tiko-cd-customize-hint {
    margin: 8px 0 0;
    font-size: 0.85em;
    color: #666;
}

.tiko-cd-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #fafafa;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
        "chrome"
        "props"
        "canvas"
        "toolbar";
}

.tiko-cd-modal__chrome   { grid-area: chrome; }
.tiko-cd-modal__props    { grid-area: props; }
.tiko-cd-modal__canvas   { grid-area: canvas; }
.tiko-cd-modal__toolbar  { grid-area: toolbar; }

.tiko-cd-modal[hidden] {
    display: none;
}

.tiko-cd-fork-banner {
    background: #eef2ff;
    color: #3730a3;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #c7d2fe;
}

.tiko-cd-modal__chrome {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
}

.tiko-cd-modal__history {
    display: flex;
    gap: 4px;
}

.tiko-cd-modal__history button {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    color: #333;
    line-height: 1;
}

.tiko-cd-modal__history button:hover:not([disabled]) {
    background: #f0f0f0;
    border-color: #e0e0e0;
}

.tiko-cd-modal__history button[disabled] {
    color: #ccc;
    cursor: not-allowed;
}

.tiko-cd-modal__back {
    appearance: none;
    background: transparent;
    border: 0;
    font-size: 24px;
    line-height: 1;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
}

.tiko-cd-modal__back:hover {
    background: #f0f0f0;
}

.tiko-cd-modal__title {
    text-align: center;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.1;
}

.tcd-product-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.tcd-save-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #666;
    transition: opacity 0.2s ease;
    min-height: 14px;
}

.tcd-save-status[data-state="idle"] {
    opacity: 0;
    pointer-events: none;
}

.tcd-save-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    flex-shrink: 0;
}

.tcd-save-status[data-state="dirty"] .tcd-save-status__dot {
    background: #f59e0b;
}

.tcd-save-status[data-state="saving"] .tcd-save-status__dot {
    background: #3b82f6;
    animation: tcd-pulse 1s ease-in-out infinite;
}

.tcd-save-status[data-state="saved"] .tcd-save-status__dot {
    background: #10b981;
}

.tcd-save-status[data-state="error"] .tcd-save-status__dot {
    background: #ef4444;
}

.tcd-save-status[data-state="error"] {
    color: #b91c1c;
}

@keyframes tcd-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.tiko-cd-modal__add-to-cart {
    appearance: none;
    border: 0;
    background: #111;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.tiko-cd-modal__add-to-cart[disabled] {
    background: #ccc;
    cursor: not-allowed;
}

.tiko-cd-modal__canvas {
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: auto;
}

.tiko-cd-canvas-placeholder {
    width: min(100%, 720px);
    aspect-ratio: 3 / 2;
    background: #fff;
    border: 2px dashed #d0d0d0;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

.tiko-cd-canvas-placeholder__inner {
    text-align: center;
    color: #666;
    padding: 24px;
}

.tiko-cd-canvas-placeholder__inner strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #333;
}

.tiko-cd-modal__props {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    min-height: 48px;
}

.tiko-cd-modal__props[hidden] {
    display: none;
}

.tcd-props-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.tcd-props-row[hidden] {
    display: none;
}

.tcd-prop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #333;
}

.tcd-prop__label {
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tcd-prop select,
.tcd-prop input[type="number"] {
    appearance: none;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: #111;
    font-family: inherit;
}

.tcd-prop select {
    min-width: 140px;
}

.tcd-prop input[type="number"] {
    width: 64px;
    text-align: right;
}

.tcd-prop input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
}

.tcd-prop--align,
.tcd-prop--style {
    display: inline-flex;
    background: #f4f4f4;
    border-radius: 6px;
    padding: 2px;
    gap: 0;
}

.tcd-align-btn,
.tcd-style-btn {
    appearance: none;
    background: transparent;
    border: 0;
    color: #555;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    min-width: 28px;
}

.tcd-align-btn:hover,
.tcd-style-btn:hover {
    background: #e8e8e8;
}

.tcd-align-btn[aria-pressed="true"],
.tcd-style-btn[aria-pressed="true"] {
    background: #111;
    color: #fff;
}

.tcd-delete-btn {
    appearance: none;
    background: #fff;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tcd-delete-btn:hover {
    background: #fef2f2;
}

.tcd-image-btn {
    appearance: none;
    background: #fff;
    border: 1px solid #d0d0d0;
    color: #111;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tcd-image-btn:hover {
    border-color: #111;
}

.tcd-image-btn[aria-pressed="true"] {
    background: #111;
    color: #fff;
    border-color: #111;
}

.tcd-prop--z {
    display: inline-flex;
    background: #f4f4f4;
    border-radius: 6px;
    padding: 2px;
    gap: 0;
}

.tcd-z-btn {
    appearance: none;
    background: transparent;
    border: 0;
    color: #555;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    min-width: 28px;
}

.tcd-z-btn:hover {
    background: #e8e8e8;
}

.tiko-cd-modal__canvas {
    position: relative;
}

.tiko-cd-canvas-host {
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    position: relative;
    line-height: 0;
}

.tiko-cd-canvas-host canvas {
    display: block;
}

.tiko-cd-dpi-badge {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 2;
}

.tiko-cd-dpi-badge[hidden] {
    display: none;
}

.tiko-cd-dpi-badge[data-level="good"] {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.tiko-cd-dpi-badge[data-level="warn"] {
    color: #92400e;
    border-color: #fcd34d;
    background: #fffbeb;
}

.tiko-cd-dpi-badge[data-level="bad"] {
    color: #991b1b;
    border-color: #fca5a5;
    background: #fef2f2;
}

.tiko-cd-modal__toolbar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
}

.tiko-cd-tool {
    appearance: none;
    border: 1px solid #e5e5e5;
    background: #fff;
    color: #333;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.tiko-cd-tool[disabled] {
    color: #aaa;
    cursor: not-allowed;
}

.tiko-cd-tool--toggle[aria-pressed="true"] {
    background: #111;
    color: #fff;
    border-color: #111;
}

.tiko-cd-mockup-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
    mix-blend-mode: overlay;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
}

body.tiko-cd-modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .tiko-cd-modal__chrome {
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        gap: 6px;
        padding: 8px 10px;
    }

    .tiko-cd-modal__back {
        font-size: 22px;
        padding: 10px 12px;
        min-width: 44px;
        min-height: 44px;
    }

    .tiko-cd-modal__history button {
        min-width: 44px;
        min-height: 44px;
        padding: 8px 10px;
        font-size: 20px;
    }

    .tiko-cd-modal__title {
        min-width: 0;
        max-width: 100%;
        font-size: 11px;
    }

    .tcd-product-name {
        display: none;
    }

    .tcd-save-status {
        font-size: 10px;
    }

    .tiko-cd-modal__add-to-cart {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 44px;
        white-space: nowrap;
    }

    .tiko-cd-fork-banner {
        padding: 6px 12px;
        font-size: 12px;
    }

    .tiko-cd-modal__props {
        padding: 8px 10px;
        gap: 6px;
        min-height: 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .tcd-props-row {
        gap: 6px;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }

    .tcd-prop__label {
        display: none;
    }

    .tcd-prop select,
    .tcd-prop input[type="number"] {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 44px;
    }

    .tcd-prop select {
        min-width: 110px;
    }

    .tcd-prop input[type="number"] {
        width: 60px;
    }

    .tcd-prop input[type="color"] {
        width: 44px;
        height: 44px;
    }

    .tcd-align-btn,
    .tcd-style-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 14px;
        padding: 8px 10px;
    }

    .tcd-delete-btn {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
        white-space: nowrap;
    }

    .tcd-delete-btn span:nth-child(2) {
        display: none;
    }

    .tcd-image-btn {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px;
        white-space: nowrap;
    }

    .tcd-image-btn span:nth-child(2) {
        display: none;
    }

    .tcd-z-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 16px;
    }

    .tiko-cd-modal__toolbar {
        padding: 10px 12px;
        gap: 6px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }

    .tiko-cd-tool {
        flex: 1;
        min-height: 48px;
        padding: 12px 8px;
        justify-content: center;
        font-size: 14px;
    }

    .tiko-cd-modal__canvas {
        padding: 12px;
    }

    .tiko-cd-dpi-badge {
        font-size: 11px;
        padding: 6px 10px;
        max-width: calc(100% - 32px);
        text-align: center;
    }
}
