/* ========================================
   Wear Custom Designer - Frontend Styles
   Phase B: Simple White-Based UI (Canva/Figma inspired)
   Fullwidth Layout + Top Bar Actions
   ======================================== */

/* ---- CSS Variables (white-based palette) ---- */
:root {
    --wcd-primary: #3b82f6;
    --wcd-primary-dark: #2563eb;
    --wcd-primary-soft: #eff6ff;
    --wcd-text: #111827;
    --wcd-text-muted: #6b7280;
    --wcd-text-light: #9ca3af;
    --wcd-border: #e5e7eb;
    --wcd-border-light: #f3f4f6;
    --wcd-bg: #ffffff;
    --wcd-bg-light: #f9fafb;
    --wcd-bg-canvas: #f9fafb;
    --wcd-danger: #ef4444;
    --wcd-danger-dark: #dc2626;
    --wcd-success: #10b981;
    --wcd-success-dark: #059669;
    --wcd-radius: 6px;
    --wcd-radius-lg: 10px;
    --wcd-radius-xl: 12px;
    --wcd-shadow: 0 1px 2px rgba(0,0,0,0.04);
    --wcd-shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --wcd-shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --wcd-font: inherit;
}

/* =========================================================
 * First-use operation guide (Print-kun)
 * ========================================================= */
.wcd-onboarding-trigger {
    color: #0f6f9f;
}

.wcd-onboarding-trigger:hover,
.wcd-onboarding-trigger:focus-visible {
    background: #e8f6fb;
    color: #075985;
}

.wcd-onboarding {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

.wcd-onboarding-highlight {
    position: fixed;
    z-index: 0;
    border: 3px solid #22a9d6;
    border-radius: 8px;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(17, 24, 39, 0.68), 0 0 0 3px rgba(255, 255, 255, 0.92);
    pointer-events: none;
    transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease;
}

.wcd-onboarding-popover {
    position: fixed;
    z-index: 2;
    box-sizing: border-box;
    width: min(370px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: 18px;
    border: 1px solid #d8e1e8;
    border-top: 4px solid #22a9d6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
    color: #1f2937;
    outline: none;
}

.wcd-onboarding-popover::after {
    content: "";
    position: absolute;
    top: 0;
    right: 46px;
    width: 54px;
    height: 4px;
    background: #ef3e82;
    box-shadow: 54px 0 0 #f6c514, 108px 0 0 #222;
}

.wcd-onboarding-close {
    position: absolute;
    top: 9px;
    right: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #667085;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.wcd-onboarding-close:hover,
.wcd-onboarding-close:focus-visible {
    background: #eef2f5;
    color: #111827;
    outline: 2px solid #22a9d6;
    outline-offset: 1px;
}

.wcd-onboarding-main {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding-right: 24px;
}

.wcd-onboarding-mascot {
    width: 72px;
    height: 72px;
    opacity: 1;
    transition: opacity 180ms ease;
}

.wcd-onboarding.is-welcome .wcd-onboarding-main {
    grid-template-columns: 100px minmax(0, 1fr);
}

.wcd-onboarding.is-welcome .wcd-onboarding-mascot {
    width: 96px;
    height: 96px;
}

.wcd-onboarding-mascot.is-switching {
    opacity: 0;
}

.wcd-onboarding-mascot-image {
    --wcd-guide-flip: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    animation: wcd-guide-float 3.2s ease-in-out infinite;
}

.wcd-onboarding-mascot.is-mirrored .wcd-onboarding-mascot-image {
    --wcd-guide-flip: -1;
}

.wcd-onboarding-mascot.is-celebrating {
    animation: wcd-guide-hop 680ms ease-out 1;
}

.wcd-onboarding-copy {
    min-width: 0;
}

.wcd-onboarding-name {
    display: block;
    margin: 0 0 3px;
    color: #0f6f9f;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.wcd-onboarding-copy h2 {
    margin: 0 0 7px;
    color: #172033;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0;
}

.wcd-onboarding-copy p {
    margin: 0;
    color: #475467;
    font-size: 14px;
    line-height: 1.7;
    letter-spacing: 0;
}

.wcd-onboarding-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 13px;
    border-top: 1px solid #e5e9ee;
}

.wcd-onboarding-progress {
    flex: 0 0 auto;
    color: #667085;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.wcd-onboarding-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.wcd-onboarding-actions button {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #cfd8e1;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
}

.wcd-onboarding-actions button:hover,
.wcd-onboarding-actions button:focus-visible {
    border-color: #22a9d6;
    outline: 2px solid rgba(34, 169, 214, 0.25);
    outline-offset: 1px;
}

.wcd-onboarding-actions .wcd-onboarding-next {
    min-width: 64px;
    border-color: #087fb5;
    background: #087fb5;
    color: #fff;
}

.wcd-onboarding-actions .wcd-onboarding-next:hover,
.wcd-onboarding-actions .wcd-onboarding-next:focus-visible {
    border-color: #075985;
    background: #075985;
}

.wcd-onboarding-actions .wcd-onboarding-skip {
    padding-right: 7px;
    padding-left: 7px;
    border-color: transparent;
    background: transparent;
    color: #667085;
}

.wcd-onboarding-actions button:disabled {
    opacity: 0.42;
    cursor: default;
}

.wcd-onboarding-text-only .wcd-onboarding-main,
.wcd-onboarding-text-only.is-welcome .wcd-onboarding-main {
    grid-template-columns: minmax(0, 1fr);
}

.wcd-onboarding-text-only .wcd-onboarding-mascot {
    display: none;
}

@keyframes wcd-guide-float {
    0%, 100% { transform: translateY(0) scaleX(var(--wcd-guide-flip)); }
    50% { transform: translateY(-3px) scaleX(var(--wcd-guide-flip)); }
}

@keyframes wcd-guide-hop {
    0%, 100% { transform: translateY(0) rotate(0); }
    42% { transform: translateY(-8px) rotate(-2deg); }
    68% { transform: translateY(1px) rotate(1deg); }
}

@media (max-width: 767.98px) {
    .wcd-onboarding-popover {
        width: calc(100vw - 24px);
        padding: 14px;
    }

    .wcd-onboarding-main,
    .wcd-onboarding.is-welcome .wcd-onboarding-main {
        grid-template-columns: 60px minmax(0, 1fr);
        gap: 9px;
        padding-right: 22px;
    }

    .wcd-onboarding-mascot,
    .wcd-onboarding.is-welcome .wcd-onboarding-mascot {
        width: 56px;
        height: 56px;
    }

    .wcd-onboarding-copy h2 {
        font-size: 16px;
    }

    .wcd-onboarding-copy p {
        font-size: 13px;
        line-height: 1.6;
    }

    .wcd-onboarding-footer {
        gap: 8px;
        margin-top: 12px;
        padding-top: 11px;
    }

    .wcd-onboarding-actions {
        gap: 5px;
    }

    .wcd-onboarding-actions button {
        min-height: 34px;
        padding: 6px 9px;
        font-size: 12px;
    }
}

@media (max-width: 350px) {
    .wcd-onboarding-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .wcd-onboarding-actions {
        width: 100%;
    }

    .wcd-onboarding-actions .wcd-onboarding-next {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wcd-onboarding-highlight,
    .wcd-onboarding-mascot,
    .wcd-onboarding-mascot-image {
        animation: none !important;
        transition: none !important;
    }
}

/* AI personalization module */
.wcd-ai-panel {
    position: relative;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid #b9d3ff;
    border-radius: 8px;
    background: #f8fbff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .10);
    overflow: hidden;
}

.wcd-ai-panel-featured::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #f97316;
}

.wcd-ai-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.wcd-ai-panel h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: #182230;
}

.wcd-ai-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.wcd-ai-lead {
    margin: 0 0 8px;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.wcd-ai-status {
    margin: 0 0 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font-size: 12px;
    line-height: 1.4;
}

.wcd-ai-pattern,
.wcd-ai-prompt {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.wcd-ai-dropzone {
    display: grid;
    gap: 4px;
    align-items: center;
    justify-items: center;
    width: 100%;
    min-height: 96px;
    box-sizing: border-box;
    margin: 8px 0;
    padding: 14px 10px;
    border: 2px dashed #8bb7ff;
    border-radius: 8px;
    background: #fff;
    color: #182230;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.wcd-ai-dropzone.has-preview {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    min-height: 104px;
    padding: 10px;
    text-align: left;
}

.wcd-ai-dropzone:hover,
.wcd-ai-dropzone:focus,
.wcd-ai-dropzone.is-dragover {
    border-color: #1a73e8;
    background: #e3f0ff;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
    outline: none;
}

.wcd-ai-dropzone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.wcd-ai-dropzone-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    justify-items: center;
}

.wcd-ai-dropzone.has-preview .wcd-ai-dropzone-copy {
    justify-items: start;
}

.wcd-ai-file-preview {
    display: none;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border: 1px solid #cfd6df;
    border-radius: 6px;
    background: #f3f4f6;
}

.wcd-ai-dropzone.has-preview .wcd-ai-file-preview {
    display: block;
}

.wcd-ai-file-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcd-ai-dropzone-main {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.wcd-ai-dropzone-sub {
    font-size: 12px;
    color: #667085;
    line-height: 1.35;
}

.wcd-ai-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.wcd-ai-file-name {
    display: block;
    max-width: 100%;
    padding-top: 2px;
    overflow: hidden;
    color: #344054;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcd-ai-file-name.is-error {
    color: #b42318;
}

.wcd-ai-prompt {
    min-height: 68px;
    padding: 8px;
    border: 1px solid #cfd6df;
    border-radius: 6px;
    resize: vertical;
    font-size: 12px;
}

.wcd-ai-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.wcd-ai-generate {
    min-height: 42px;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 8px 16px rgba(37, 99, 235, .18);
}

.wcd-left-panel-image--ai-enabled > .wcd-left-menu-title {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wcd-border-light);
    color: var(--wcd-text-muted);
    font-size: 12px;
}

.wcd-left-panel-image--ai-enabled .wcd-upload-area {
    padding: 12px 8px;
    border-width: 1px;
    background: #fff;
}

.wcd-left-panel-image--ai-enabled .wcd-upload-area .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.wcd-ai-result {
    margin-top: 10px;
}

.wcd-ai-message {
    margin: 0;
    font-size: 12px;
    color: #344054;
}

.wcd-ai-message-error {
    color: #b42318;
}

.wcd-ai-retry {
    display: grid;
    gap: 10px;
}

.wcd-ai-retry .wcd-btn {
    width: 100%;
}

.wcd-ai-generating {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #b9d3ff;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
    color: #182230;
    text-align: center;
}

.wcd-ai-generating-orbit {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border: 2px solid rgba(26, 115, 232, .18);
    border-top-color: #1a73e8;
    border-radius: 999px;
    animation: wcd-ai-spin 1.1s linear infinite;
}

.wcd-ai-generating-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #1a73e8;
    box-shadow: 0 0 10px rgba(26, 115, 232, .35);
}

.wcd-ai-generating-dot--a {
    top: -4px;
    left: 20px;
}

.wcd-ai-generating-dot--b {
    right: 2px;
    bottom: 7px;
    animation: wcd-ai-pulse .9s ease-in-out infinite;
}

.wcd-ai-generating-dot--c {
    bottom: 7px;
    left: 2px;
    animation: wcd-ai-pulse .9s ease-in-out .18s infinite;
}

.wcd-ai-generating-copy {
    display: grid;
    gap: 4px;
}

.wcd-ai-generating-copy strong {
    font-size: 13px;
}

.wcd-ai-generating-copy span,
.wcd-ai-generating-copy small {
    color: #475467;
    font-size: 12px;
    line-height: 1.45;
}

.wcd-ai-generating-bar {
    position: relative;
    overflow: hidden;
    height: 6px;
    border-radius: 999px;
    background: #dbeafe;
}

.wcd-ai-generating-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1a73e8, #62a4ff);
    animation: wcd-ai-bar 1.45s ease-in-out infinite;
}

@keyframes wcd-ai-spin {
    to { transform: rotate(360deg); }
}

@keyframes wcd-ai-pulse {
    0%, 100% { transform: scale(.75); opacity: .65; }
    50% { transform: scale(1.15); opacity: 1; }
}

@keyframes wcd-ai-bar {
    0% { left: -45%; }
    55% { left: 45%; }
    100% { left: 105%; }
}

.wcd-ai-preview {
    display: grid;
    gap: 8px;
}

.wcd-ai-preview img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
}
.wcd-ai-preview img,
.wcd-saved-design-thumb,
.wcd-canvas-container canvas {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    user-select: none;
}

.wcd-ai-checkout-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .48);
}

.wcd-ai-checkout-dialog {
    position: relative;
    width: min(460px, 100%);
    padding: 20px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .24);
}

.wcd-ai-checkout-dialog h3 {
    margin: 0 36px 8px 0;
    color: var(--wcd-text);
    font-size: 18px;
    line-height: 1.35;
}

.wcd-ai-checkout-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: #f3f4f6;
    color: #475467;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.wcd-ai-checkout-copy,
.wcd-ai-checkout-status {
    margin: 0 0 12px;
    color: #475467;
    font-size: 13px;
    line-height: 1.55;
}

.wcd-ai-checkout-status {
    padding: 9px 10px;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
}

.wcd-ai-checkout-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

/* ---- Customize Button (product page) ---- */
.wcd-customize-wrap {
    margin: 1.5em 0;
}

.wcd-customize-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: calc(0.667em + 2px) calc(1.333em + 2px);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    background: var(--wcd-primary);
    border: none;
    border-radius: var(--wcd-radius);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: var(--wcd-font);
}

.wcd-customize-btn:hover,
.wcd-customize-btn:focus {
    background: var(--wcd-primary-dark);
    color: #fff;
    box-shadow: var(--wcd-shadow-md);
    outline: none;
}

/* ---- Designer Section (page-swap mode) ---- */
.wcd-designer-section {
    margin: 0;
    padding: 0;
}

/* "商品ページに戻る" button placed inside toolbar-left by the page-swap script */
.wcd-close-btn {
    gap: 4px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--wcd-text-muted);
    background: transparent;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    height: 38px;
    white-space: nowrap;
}
.wcd-close-btn:hover {
    background: var(--wcd-bg-light);
    color: var(--wcd-text);
    border-color: var(--wcd-text-light);
}

/* ---- Designer Wrapper (fullwidth breakout) ---- */
.wcd-designer-wrapper {
    /* Breakout from theme container (.container, .site-main etc.) but leave
       a 24px gutter on each side so the designer doesn't hit the viewport
       edge — previously it felt too cramped / edge-to-edge on desktop. */
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
    position: relative;
    left: 50%;
    margin-left: calc(-50vw + 24px);
    margin-right: calc(-50vw + 24px);
    font-family: var(--wcd-font);
    background: var(--wcd-bg);
    border-radius: var(--wcd-radius-lg);
    box-shadow: var(--wcd-shadow);
    overflow-x: clip;
    touch-action: manipulation; /* disable double-tap zoom on iOS */
}

/* When embedded in WP admin (固定デザイン編集 page → render_template_editor
   → render_designer_html), the 100vw-based breakout above ignores the
   admin sidebar width (160px expanded / 36px collapsed) and the leftmost
   panel of the designer (画像 / テキスト / 描画 tabs + upload area) ends
   up clipped behind the sidebar. Constrain the wrapper to its admin
   parent (.wp-admin .wrap) instead of breaking out to the viewport. */
body.wp-admin .wcd-designer-wrapper {
    width: 100%;
    max-width: 100%;
    left: auto;
    margin-left: 0;
    margin-right: 0;
}

/* Prevent all browser touch handling on canvas area */
.wcd-canvas-area {
    touch-action: none;
}

/* ---- Toolbar (white, 3-section layout) ---- */
.wcd-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
    height: 56px;
    background: var(--wcd-bg);
    border-bottom: 1px solid var(--wcd-border);
    box-shadow: var(--wcd-shadow);
    position: sticky;
    top: 0;
    z-index: 20;
}

.wcd-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
}

.wcd-toolbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--wcd-text);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wcd-toolbar-center {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1 1 auto;
    justify-content: center;
    overflow-x: auto;
}

.wcd-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.wcd-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: var(--wcd-radius);
    background: transparent;
    color: var(--wcd-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.wcd-tool-btn:hover {
    background: var(--wcd-border-light);
    color: var(--wcd-text);
}

.wcd-tool-btn.active {
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary);
}

.wcd-tool-btn.wcd-guide-toggle:not(.active) {
    background: transparent;
    color: var(--wcd-text-muted);
}

/* Disabled state for action buttons (undo/redo/delete) — fades the button
   so the user can tell at a glance whether an action is currently possible.
   Hover effects are cancelled to prevent a "clickable" illusion. */
.wcd-tool-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: var(--wcd-text-muted);
}
.wcd-tool-btn:disabled:hover {
    background: transparent;
    color: var(--wcd-text-muted);
}

.wcd-toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--wcd-border);
    margin: 0 6px;
}

/* ---- 3-Column Layout ---- */
.wcd-layout {
    display: flex;
    min-height: 600px;
    max-width: 1600px;
    margin: 0 auto;
    background: var(--wcd-bg);
}

/* ---- Left Menu (image upload & gallery) ---- */
.wcd-left-menu {
    width: 200px;
    min-width: 200px;
    border-right: 1px solid var(--wcd-border);
    background: var(--wcd-bg);
    padding: 20px 14px;
    overflow-y: auto;
}

/* Strong section heading — "画像を追加" is the primary CTA of the left column,
   so it reads as a normal h-size headline rather than a faint label. */
.wcd-left-menu-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--wcd-text);
    text-transform: none;
    letter-spacing: normal;
    padding-bottom: 0;
    border-bottom: none;
}

/* Upload area styled as a prominent primary-tinted dropzone so first-time
   visitors notice it immediately. Previously the 200px-wide sidebar hosted
   a near-invisible gray dashed box that blended into the white background. */
.wcd-left-menu .wcd-upload-area {
    padding: 20px 10px;
    border: 2px dashed var(--wcd-primary);
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary-dark);
    gap: 4px;
}

.wcd-left-menu .wcd-upload-area:hover,
.wcd-left-menu .wcd-upload-area.dragover {
    border-color: var(--wcd-primary-dark);
    background: #dbeafe;
    box-shadow: var(--wcd-shadow-md);
}

.wcd-left-menu .wcd-upload-area .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: var(--wcd-primary);
    margin-bottom: 4px;
}

.wcd-left-menu .wcd-upload-area p {
    font-size: 12px;
    font-weight: 600;
    color: var(--wcd-text);
    margin: 0;
    line-height: 1.4;
}

.wcd-left-menu .wcd-upload-hint {
    text-align: center;
    margin-top: 8px;
}

.wcd-left-menu .wcd-uploaded-gallery {
    grid-template-columns: repeat(2, 1fr);
}

/* Visual separation between the upload CTA and the uploaded-image gallery
   so the two sections read as distinct areas rather than a single blob. */
.wcd-left-menu .wcd-uploaded-gallery:not(:empty) {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--wcd-border-light);
}

/* ---- Left-sidebar top tabs (画像 / テキスト / 描画) ---- */
.wcd-left-tabs {
    display: flex;
    gap: 4px;
    margin: -20px -14px 16px;   /* cancel parent padding so tabs hit the edges */
    padding: 12px 14px 0;
    border-bottom: 1px solid var(--wcd-border-light);
}
.wcd-left-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 4px 12px;
    margin-bottom: -1px;  /* overlap the border so active tab owns it */
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    border-radius: var(--wcd-radius) var(--wcd-radius) 0 0;
    background: transparent;
    cursor: pointer;
    color: var(--wcd-text-muted);
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.wcd-left-tab .dashicons,
.wcd-left-tab-icon {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.wcd-left-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex: 0 0 auto;
}

.wcd-left-tab-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wcd-left-tab-icon circle {
    fill: currentColor;
    stroke: none;
}

.wcd-left-tab-label {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}
.wcd-left-tab:hover {
    background: var(--wcd-border-light);
    color: var(--wcd-text);
}
.wcd-left-tab.active {
    color: var(--wcd-primary);
    background: var(--wcd-primary-soft);
    border-color: var(--wcd-border);
    border-bottom-color: var(--wcd-primary-soft);
}

.wcd-left-tab-purchase,
.wcd-mobile-tab-extra,
.wcd-mobile-cta,
.wcd-mobile-sheet-scrim,
.wcd-mobile-sheet-head,
.wcd-mobile-status {
    display: none;
}

/* ---- Left-sidebar Tool Panels (select/image/text/drawing) ----
 *
 * Each tool's settings live in the left sidebar and swap based on the active
 * tool. activateTool() in wcd-designer.js toggles display on these panels. */
.wcd-left-panel .wcd-form-group {
    margin-bottom: 10px;
}
.wcd-left-panel .wcd-form-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}
.wcd-left-panel .wcd-form-row label {
    font-size: 12px;
    color: var(--wcd-text-muted);
    flex: 0 0 auto;
}
.wcd-left-panel .wcd-input,
.wcd-left-panel .wcd-select {
    width: 100%;
    font-size: 13px;
    padding: 7px 9px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
}
.wcd-left-panel .wcd-input-sm {
    flex: 1 1 auto;
    min-width: 0;
}
.wcd-left-panel .wcd-color-input {
    flex: 0 0 auto;
    width: 38px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
}
.wcd-left-panel .wcd-style-btn,
.wcd-left-panel .wcd-draw-btn {
    flex: 1 1 0;
    padding: 6px 0;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
    font-size: 14px;
    color: var(--wcd-text);
}
.wcd-left-panel .wcd-style-btn:hover,
.wcd-left-panel .wcd-draw-btn:hover {
    background: var(--wcd-border-light);
}
.wcd-left-panel .wcd-style-btn.active,
.wcd-left-panel .wcd-draw-btn.active {
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary);
    border-color: var(--wcd-primary);
}
.wcd-left-panel input[type="range"] {
    flex: 1 1 auto;
}

/* ---- Text panel: extra controls (frame styles, letter spacing) ---- */
.wcd-left-panel .wcd-sub-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--wcd-text-muted);
    margin-bottom: 5px;
    letter-spacing: 0.02em;
}

.wcd-left-panel .wcd-color-input-lg {
    flex: 0 0 auto;
    width: 46px;
    height: 36px;
}

.wcd-text-frame-row {
    display: flex;
    gap: 6px;
}
.wcd-text-frame-btn {
    flex: 1 1 0;
    padding: 8px 0;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    transition: border-color 0.15s, background-color 0.15s;
}
.wcd-text-frame-btn:hover {
    background: var(--wcd-border-light);
}
.wcd-text-frame-btn.active {
    border-color: var(--wcd-primary);
    background: var(--wcd-primary-soft);
    box-shadow: 0 0 0 1px var(--wcd-primary);
}

/* Visual sample "A" inside each frame-style button */
.wcd-frame-sample {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    font-family: Arial, sans-serif;
}
.wcd-frame-sample-fill {
    color: #111827;              /* solid filled A */
}
.wcd-frame-sample-outline {
    color: transparent;
    -webkit-text-stroke: 2px #111827;  /* outline only */
}
.wcd-frame-sample-stroke {
    color: #fff;
    -webkit-text-stroke: 2px #ef4444;  /* filled with colored border */
    text-shadow:
        -1px 0 #111827, 1px 0 #111827,
        0 -1px #111827, 0 1px #111827;
}

/* Letter spacing slider group */
.wcd-slider-value {
    float: right;
    color: var(--wcd-text-muted);
    font-weight: 400;
}
.wcd-slider {
    width: 100%;
    margin: 4px 0 0;
}
.wcd-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--wcd-text-light);
    margin-top: 2px;
}

/* ---- Text warp style gallery ---- */
.wcd-warp-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.wcd-warp-style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px 4px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
    min-height: 62px;
    transition: border-color 0.15s, background-color 0.15s;
}
.wcd-warp-style-btn:hover {
    background: var(--wcd-border-light);
}
.wcd-warp-style-btn.active {
    border-color: var(--wcd-primary);
    background: var(--wcd-primary-soft);
    box-shadow: 0 0 0 1px var(--wcd-primary);
}
.wcd-warp-label {
    font-size: 10px;
    color: var(--wcd-text-muted);
    white-space: nowrap;
}
/* SVG preview of each warp shape — rendered via fabric.textPath on a path
   that matches the actual deformation formula. Uses currentColor so the
   preview inherits the active/hover text color of the button. */
.wcd-warp-svg {
    width: 100%;
    max-width: 68px;
    height: 28px;
    display: block;
    overflow: visible;
    color: var(--wcd-text);
}
.wcd-warp-style-btn.active .wcd-warp-svg {
    color: var(--wcd-primary-dark);
}

/* ---- Font dropdown with per-item preview in own face ---- */
.wcd-font-dropdown {
    position: relative;
    width: 100%;
}
.wcd-font-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 7px 9px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
    font-size: 13px;
    color: var(--wcd-text);
}
.wcd-font-dropdown-trigger:hover {
    border-color: var(--wcd-primary);
}
.wcd-font-dropdown-trigger[aria-expanded="true"] {
    border-color: var(--wcd-primary);
    box-shadow: 0 0 0 2px var(--wcd-primary-soft);
}
.wcd-font-dropdown-label {
    flex: 1 1 auto;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wcd-font-dropdown-arrow {
    flex: 0 0 auto;
    color: var(--wcd-text-muted);
    font-size: 10px;
    transition: transform 0.15s;
}
.wcd-font-dropdown-trigger[aria-expanded="true"] .wcd-font-dropdown-arrow {
    transform: rotate(180deg);
}

.wcd-font-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    box-shadow: var(--wcd-shadow-lg);
    z-index: 100;
}
.wcd-font-dropdown-item {
    padding: 8px 10px;
    border-radius: var(--wcd-radius);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    color: var(--wcd-text);
    /* font-family is set per-item via JS so each preview renders in its own face */
}
.wcd-font-dropdown-item:hover {
    background: var(--wcd-border-light);
}
.wcd-font-dropdown-item.active {
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary-dark);
}

/* ---- Canvas Column (center, flexible) ---- */
.wcd-canvas-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--wcd-bg-light);
    gap: 16px;
}

/* ---- Canvas Area ---- */
.wcd-canvas-area {
    position: relative;
    /* Full-width on the horizontal axis so the white card spans the entire
       center column (matches the wrapper's full-width breakout). Vertical
       size is content-driven — the box wraps tightly around the mockup +
       padding, eliminating the large empty bands above and below the wear
       that `flex: 1, min-height: 600px` previously created. */
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius-xl);
    box-shadow: var(--wcd-shadow);
    /* Allow zoomed mockup to overflow with scrolling */
    overflow: auto;
}

/* Mockup wrapper: contains the T-shirt img and canvas overlay.
 * max-width caps the mockup at 600px on wide layouts so the Fabric canvas
 * pxPerMm remains consistent across screen sizes (prevents saved designs
 * from appearing off-position when the layout grows wider). */
.wcd-mockup-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0; /* remove inline gap below img */
    isolation: isolate;
    background: #fff;
}

.wcd-mockup-image {
    display: block;
    background: #fff;
    /* Default sizing — works for tall sleeve images (aspect < 0.7).
       Height-bound by the viewport so tall illustrations don't push the
       page sky-high. Body images get a wider treatment via the
       .wcd-mockup-fill-width class (added by JS on image load). */
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
}

/* Body / square-ish mockups (aspect ratio > 0.7) — fill canvas-area width
   so there's zero horizontal empty space. Height grows naturally with the
   image's aspect ratio; the page allows vertical scroll if it exceeds the
   viewport (rare on desktop). Toggled by setMockupImage() in JS based on
   the loaded image's natural aspect. */
.wcd-mockup-wrap.wcd-mockup-fill-width {
    width: 100%;
}
.wcd-mockup-wrap.wcd-mockup-fill-width .wcd-mockup-image {
    width: 100%;
    height: auto;
    max-height: none;
}

.wcd-mockup-texture-image {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
    z-index: 3;
    opacity: var(--wcd-preview-depth-opacity, 0.42);
    mix-blend-mode: multiply;
    filter: grayscale(1) contrast(1.85) brightness(0.92);
}

.wcd-mockup-wrap.wcd-preview-depth-active .wcd-mockup-texture-image {
    display: block;
}

.wcd-mockup-wrap.wcd-preview-depth-active .canvas-container {
    mix-blend-mode: multiply;
    filter: contrast(0.96) saturate(0.94);
}

body:not(.wcd-admin-editing) .wcd-mockup-wrap.wcd-worn-body-preview .wcd-mockup-image,
body:not(.wcd-admin-editing) .wcd-mockup-wrap.wcd-worn-body-preview .wcd-mockup-texture-image {
    transform: scaleX(var(--wcd-worn-body-scale-x, 1));
    transform-origin: center top;
}

body:not(.wcd-admin-editing) .wcd-mockup-wrap.wcd-worn-body-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    transform: scaleX(var(--wcd-worn-body-scale-x, 1));
    transform-origin: center top;
    opacity: var(--wcd-worn-body-depth-opacity, 0.025);
    mix-blend-mode: multiply;
    background:
        linear-gradient(90deg,
            rgba(0, 0, 0, 0.32) 0%,
            rgba(255, 255, 255, 0.03) 18%,
            rgba(255, 255, 255, 0.10) 50%,
            rgba(255, 255, 255, 0.03) 82%,
            rgba(0, 0, 0, 0.30) 100%),
        radial-gradient(ellipse at 50% 38%,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.06) 36%,
            rgba(0, 0, 0, 0.18) 100%);
}

body:not(.wcd-admin-editing) .wcd-mockup-wrap.wcd-print-soft-preview .canvas-container canvas.lower-canvas {
    opacity: 0.965;
    filter: contrast(0.97) saturate(0.96) brightness(0.995);
}

/* Canvas positioned over the design area on the mockup. JS sets
   left/top/width/height as percentages of the image so the design area
   follows the image when it responsively resizes (window resize, DevTools,
   etc.). The canvas elements inside fill the wrapper at 100% — fabric's
   internal pixel resolution stays fixed (set via setWidth/setHeight) while
   the visual display scales with the wrapper. */
.wcd-mockup-wrap .canvas-container {
    position: absolute !important;
    /* top/left/width/height set dynamically by JS as percentages */
    /* overflow: visible so the selection overlay (delete / rotate / resize
       handles, size input) can float outside the canvas bounds when the
       design has been dragged near the edge — Sweat.JP-style. The image
       itself is still clipped naturally by Fabric's pixel grid, but the
       handles remain reachable. */
    overflow: visible !important;
}

.wcd-mockup-wrap .canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* HTML overlay controls — floating around the active object's bounding box.
   Lives in .wcd-mockup-wrap so it can extend beyond the canvas (design area)
   without being clipped. The container itself shows the selection border;
   the four buttons sit outside the bbox so they don't cover the design
   content. */
.wcd-object-controls {
    position: absolute;
    pointer-events: none;
    border: 1.5px solid #000;
    box-sizing: border-box;
    z-index: 8;
    --wcd-oc-size: 34px;
    --wcd-oc-gap: 5px;
}
.wcd-oc-btn {
    position: absolute;
    width: var(--wcd-oc-size);
    height: var(--wcd-oc-size);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #000;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}
.wcd-oc-btn:hover,
.wcd-oc-btn:focus {
    background: #222;
    outline: none;
}
.wcd-oc-btn:active {
    background: #444;
}
.wcd-oc-btn svg {
    display: block;
    width: 18px;
    height: 18px;
}
/* Keep the action parts outside the tight selection box. */
.wcd-oc-delete {
    top: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
    left: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
}
.wcd-oc-rotate {
    top: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
    left: 50%;
    transform: translateX(-50%);
    cursor: crosshair;
}
.wcd-oc-layer {
    bottom: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
    left: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
}
.wcd-oc-resize {
    bottom: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
    right: calc((var(--wcd-oc-size) + var(--wcd-oc-gap)) * -1);
    cursor: nwse-resize;
}

/* Layer menu popup — opens from the layer button on a selected object,
   offers bring-to-front / send-to-back ordering. */
.wcd-layer-menu {
    z-index: 100;
    background: #fff;
    border: 1px solid var(--wcd-border, #d0d5dd);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 120px;
    font-family: var(--wcd-font, inherit);
    font-size: 13px;
}
.wcd-layer-menu button {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--wcd-border-light, #f0f1f3);
    text-align: left;
    font-size: 13px;
    color: var(--wcd-text, #1f2329);
    cursor: pointer;
    font-family: inherit;
}
.wcd-layer-menu button:last-child {
    border-bottom: none;
}
.wcd-layer-menu button:hover,
.wcd-layer-menu button:focus {
    background: var(--wcd-bg-light, #f6f8fa);
    outline: none;
}

/* Dashed border to show printable area — mirrors admin setup visualization */
.wcd-design-area-border {
    position: absolute;
    display: none;
    border: 2px dashed rgba(59, 130, 246, 0.55);
    box-sizing: border-box;
    border-radius: 2px;
    pointer-events: none;
    z-index: 1; /* below Fabric canvas (z-index 2) */
    background: transparent;
}

.wcd-design-object-selected:not(.wcd-design-area-guides-off) .wcd-design-area-border {
    display: block;
}

.wcd-design-area-guides-off .wcd-design-area-border {
    display: none;
}

/* ---- Floating Tool Overlay ---- */
.wcd-tool-overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius-lg);
    box-shadow: var(--wcd-shadow-lg);
    padding: 16px;
    width: 220px;
    max-height: calc(100% - 32px);
    overflow-y: auto;
    display: none;
}

.wcd-tool-overlay.active {
    display: block;
}

.wcd-tool-overlay .wcd-panel-section h4 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--wcd-text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--wcd-primary);
}

/* ---- Canvas Controls (view tabs) ---- */
.wcd-canvas-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0;
    background: transparent;
    border-top: none;
    flex-shrink: 0;
    position: relative;
}

/* Zoom controls — anchored to the right of the canvas-controls row so the
   view tabs remain centered without shifting. */
.wcd-zoom-controls {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: 999px;
    padding: 3px 6px;
    box-shadow: var(--wcd-shadow);
}
.wcd-zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--wcd-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.wcd-zoom-btn:hover:not(:disabled) {
    background: var(--wcd-border-light);
    color: var(--wcd-text);
}
.wcd-zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.wcd-zoom-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}
.wcd-zoom-level {
    min-width: 42px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--wcd-text);
    user-select: none;
}

/* ---- View Tabs ---- */
.wcd-view-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: 999px;
    box-shadow: var(--wcd-shadow);
}

.wcd-view-tab {
    padding: 8px 20px;
    border: none;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--wcd-font);
    transition: all 0.15s;
    color: var(--wcd-text-muted);
}

.wcd-view-tab:hover {
    background: var(--wcd-border-light);
    color: var(--wcd-text);
}

.wcd-view-tab.active {
    background: var(--wcd-primary);
    color: #fff;
}

/* ---- Color Swatches ---- */
.wcd-color-swatches {
    display: flex;
    gap: 6px;
}

.wcd-color-swatch {
    width: 28px;
    height: 28px;
    border: 2px solid var(--wcd-border);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.wcd-color-swatch:hover {
    transform: scale(1.1);
}

.wcd-color-swatch.active {
    border-color: var(--wcd-text);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wcd-text);
}

/* ---- Sidebar (right) ---- */
.wcd-sidebar {
    width: 320px;
    min-width: 320px;
    border-left: 1px solid var(--wcd-border);
    background: var(--wcd-bg);
    display: flex;
    flex-direction: column;
}

.wcd-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ---- Desktop fixed 3-pane frame ----
 * Product pages add .wcd-designer-open while the designer is visible. On PC,
 * keep the whole designer pinned to the viewport and let the left tools,
 * center canvas, and right settings scroll independently. */
@media (min-width: 768px) {
    html.wcd-designer-frame-open,
    body.wcd-designer-open {
        overflow: hidden;
    }

    body.wcd-designer-open .wcd-designer-section {
        position: fixed;
        inset: 0;
        z-index: 99990;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        background: var(--wcd-bg-light);
    }

    body.admin-bar.wcd-designer-open .wcd-designer-section {
        top: 32px;
        height: calc(100vh - 32px);
        height: calc(100dvh - 32px);
    }

    body.wcd-designer-open .wcd-designer-wrapper {
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        left: auto;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    body.wcd-designer-open .wcd-toolbar {
        flex: 0 0 56px;
        position: relative;
        top: auto;
    }

    body.wcd-designer-open .wcd-layout {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        min-height: 0;
        margin: 0;
        overflow: hidden;
    }

    body.wcd-designer-open .wcd-left-menu {
        flex: 0 0 clamp(230px, 15vw, 288px);
        width: auto;
        min-width: 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 16px 14px;
    }

    body.wcd-designer-open .wcd-left-tabs {
        flex: 0 0 auto;
        margin-top: -16px;
    }

    body.wcd-designer-open .wcd-left-panel {
        min-height: 0;
        overflow-y: auto;
        padding-right: 2px;
    }

    body.wcd-designer-open .wcd-canvas-column {
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        padding: 10px 12px;
        gap: 8px;
    }

    body.wcd-designer-open .wcd-canvas-controls {
        flex: 0 0 48px;
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        z-index: 20;
        pointer-events: auto;
    }

    body.wcd-designer-open .wcd-canvas-area {
        flex: 1 1 auto;
        min-height: 0;
        padding: 8px 6px;
        overflow: hidden;
        align-items: flex-start;
        justify-content: flex-start;
    }

    body.wcd-designer-open .wcd-canvas-area.wcd-is-zoomed {
        overflow: auto;
    }

    body.wcd-designer-open .wcd-order-list {
        flex: 0 0 auto;
        max-height: 176px;
        overflow-y: auto;
        padding: 14px;
    }

    body.wcd-designer-open .wcd-sidebar {
        flex: 0 0 clamp(280px, 18vw, 340px);
        width: auto;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
    }

    body.wcd-designer-open .wcd-sidebar-scroll {
        min-height: 0;
        overflow-y: auto;
        padding: 16px;
    }

    body.wcd-designer-open .wcd-mockup-wrap {
        flex: 0 0 auto;
        margin: 0 auto;
        width: auto;
        height: 100%;
        max-width: none;
        max-height: none;
    }

    body.wcd-designer-open .wcd-mockup-image,
    body.wcd-designer-open .wcd-mockup-wrap.wcd-mockup-fill-width .wcd-mockup-image {
        width: auto;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: contain;
    }

    body.wcd-designer-open .wcd-mockup-wrap.wcd-mockup-fill-width {
        width: auto;
    }

    body.wcd-designer-open .wcd-size-warning,
    body.wcd-designer-open .wcd-dpi-warning {
        flex: 0 0 auto;
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        z-index: auto;
        margin: 0;
        pointer-events: auto;
    }
}

.wcd-sidebar .wcd-panel-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--wcd-border-light);
}

.wcd-sidebar .wcd-panel-section:last-child {
    border-bottom: none;
    margin-bottom: 12px;
}

.wcd-sidebar .wcd-panel-section h4 {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--wcd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0;
    border-bottom: none;
}

/* ---- Buttons (unified system) ---- */
.wcd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--wcd-radius);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--wcd-font);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}

.wcd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wcd-btn-primary {
    background: var(--wcd-primary);
    color: #fff;
    border-color: var(--wcd-primary);
}
.wcd-btn-primary:hover {
    background: var(--wcd-primary-dark);
    border-color: var(--wcd-primary-dark);
    color: #fff;
    text-decoration: none;
}

.wcd-btn-secondary {
    background: var(--wcd-bg);
    color: var(--wcd-text);
    border-color: var(--wcd-border);
}
.wcd-btn-secondary:hover {
    background: var(--wcd-bg-light);
    border-color: var(--wcd-text-light);
    color: var(--wcd-text);
}

.wcd-btn-ghost {
    background: transparent;
    color: var(--wcd-text-muted);
    border-color: transparent;
}
.wcd-btn-ghost:hover {
    background: var(--wcd-border-light);
    color: var(--wcd-text);
}

/* "カートに追加" big CTA in order list */
.wcd-btn-cart {
    width: 100%;
    padding: 14px 24px;
    background: var(--wcd-success);
    color: #fff;
    border-color: var(--wcd-success);
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--wcd-radius-lg);
    gap: 8px;
}
.wcd-btn-cart:hover {
    background: var(--wcd-success-dark);
    border-color: var(--wcd-success-dark);
    color: #fff;
}
.wcd-btn-cart:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--wcd-border);
    color: var(--wcd-text-light);
    border-color: var(--wcd-border);
}

/* ---- Form Controls ---- */
.wcd-form-group {
    margin-bottom: 12px;
}

.wcd-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.wcd-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    font-size: 13px;
    font-family: var(--wcd-font);
    transition: border-color 0.2s;
}

.wcd-input:focus {
    border-color: var(--wcd-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(51, 122, 183, 0.15);
}

.wcd-input-sm { width: 70px; }

/* Multi-line text input — textarea variant. Vertical resize so users
   can grow it for long text but not break the panel width. */
.wcd-textarea {
    resize: vertical;
    min-height: 56px;
    line-height: 1.4;
    font-family: inherit;
}

.wcd-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    font-size: 13px;
    font-family: var(--wcd-font);
}

.wcd-color-input {
    width: 40px;
    height: 36px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    padding: 2px;
    cursor: pointer;
}

.wcd-style-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s, border-color 0.2s;
}

.wcd-style-btn:hover {
    background: var(--wcd-bg-light);
    border-color: var(--wcd-primary);
}

/* ---- Upload Area ---- */
.wcd-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed var(--wcd-border);
    border-radius: var(--wcd-radius-lg);
    text-align: center;
    cursor: pointer;
    /* Transition the specific longhands — using the `background` shorthand
       here caused stuck animations in Chrome when the dashed border was
       simultaneously repainted, leaving hover styles visually "frozen" at
       the start frame. */
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    color: var(--wcd-text-light);
}

.wcd-upload-area:hover,
.wcd-upload-area.dragover {
    border-color: var(--wcd-primary);
    background: rgba(51, 122, 183, 0.05);
}

.wcd-upload-area .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    color: var(--wcd-primary);
}

.wcd-upload-area p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

.wcd-upload-hint {
    font-size: 11px;
    color: var(--wcd-text-light);
    margin: 6px 0 0;
    text-align: center;
}

/* Uploaded images gallery */
.wcd-uploaded-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.wcd-uploaded-gallery:empty {
    display: none;
}

.wcd-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid var(--wcd-border-light);
    border-radius: var(--wcd-radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
    background: var(--wcd-bg-canvas);
}

.wcd-gallery-item:hover {
    border-color: var(--wcd-primary);
}

.wcd-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.wcd-gallery-item-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0;
}

/* Stale (restored from localStorage) — only thumbnail is available.
 * User must re-upload to use the full resolution for print. */
.wcd-gallery-item-stale img {
    opacity: 0.45;
    filter: grayscale(0.3);
}
.wcd-gallery-item-stale {
    border-color: var(--wcd-danger);
}
.wcd-gallery-item-badge {
    position: absolute;
    left: 2px;
    bottom: 2px;
    right: 2px;
    padding: 2px 4px;
    background: var(--wcd-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    border-radius: 3px;
    line-height: 1.2;
    pointer-events: none;
}

.wcd-gallery-item:hover .wcd-gallery-item-remove {
    opacity: 1;
}

.wcd-upload-progress {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--wcd-primary);
}

/* ---- Drawing Tools ---- */
.wcd-draw-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s, border-color 0.2s;
}

.wcd-draw-btn.active {
    border-color: var(--wcd-primary);
    background: rgba(51, 122, 183, 0.08);
    color: var(--wcd-primary);
}

/* ---- Print Method Selection ---- */
.wcd-print-method-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wcd-print-method-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 2px solid var(--wcd-border-light);
    border-radius: var(--wcd-radius-lg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--wcd-bg);
}

.wcd-print-method-item:hover {
    border-color: var(--wcd-primary);
}

.wcd-print-method-item.active {
    border-color: var(--wcd-primary);
    background: rgba(51, 122, 183, 0.05);
}

.wcd-print-method-item input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--wcd-primary);
}

.wcd-print-method-info strong {
    display: block;
    font-size: 13px;
    margin-bottom: 2px;
    color: var(--wcd-text);
}

.wcd-print-method-info small {
    font-size: 11px;
    color: var(--wcd-text-muted);
    line-height: 1.3;
}

/* ---- Quantity Grid ---- */
.wcd-quantity-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wcd-qty-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wcd-qty-row label {
    width: 36px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wcd-text-muted);
}

.wcd-qty-input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    font-size: 13px;
    text-align: center;
    font-family: var(--wcd-font);
    transition: border-color 0.2s;
}

.wcd-qty-input:focus {
    border-color: var(--wcd-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(51, 122, 183, 0.15);
}

.wcd-qty-stepper {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
}

.wcd-qty-stepper .wcd-input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 6px 8px !important;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    font-size: 18px !important;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
}

.wcd-qty-stepper .wcd-input::-webkit-inner-spin-button,
.wcd-qty-stepper .wcd-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wcd-qty-step-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--wcd-border);
    border-radius: 8px;
    background: var(--wcd-bg);
    color: var(--wcd-primary);
    font-family: var(--wcd-font);
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.wcd-qty-step-btn:hover,
.wcd-qty-step-btn:focus {
    border-color: var(--wcd-primary);
    background: rgba(37, 99, 235, 0.08);
    outline: none;
}

.wcd-qty-step-btn:active {
    background: var(--wcd-primary);
    color: #fff;
}

.wcd-qty-step-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    background: var(--wcd-bg-light);
    color: var(--wcd-text-light);
}

/* Size preview buttons */
.wcd-size-preview-row {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.wcd-size-btn {
    padding: 6px 12px;
    border: 2px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--wcd-font);
    cursor: pointer;
    transition: all 0.15s;
    color: var(--wcd-text);
}

.wcd-size-btn:hover {
    border-color: var(--wcd-primary);
    color: var(--wcd-primary);
}

.wcd-size-btn.active {
    background: var(--wcd-primary);
    border-color: var(--wcd-primary);
    color: #fff;
}

/* ---- Color Grid (sweat.jp style) ---- */
.wcd-selected-color-summary {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin: 0 0 8px;
    padding: 7px 9px;
    border: 1px solid var(--wcd-border-light);
    border-radius: var(--wcd-radius);
    background: #f8fafc;
    color: var(--wcd-text);
    font-size: 12px;
    line-height: 1.35;
}

.wcd-selected-color-label {
    flex: 0 0 auto;
    color: var(--wcd-text-muted);
    font-weight: 600;
}

.wcd-selected-color-swatch {
    display: inline-flex;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 1px solid var(--wcd-border);
    border-radius: 4px;
    background: #fff;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}

.wcd-selected-color-swatch.has-image {
    background-size: 100% 100%, 220% auto;
    background-position: center, center 36%;
    background-repeat: no-repeat;
}

.wcd-selected-color-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--wcd-text);
    font-weight: 800;
}

.wcd-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 4px;
}

.wcd-color-tile {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--wcd-border);
    border-radius: 4px;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    padding: 0;
    box-sizing: border-box;
}

.wcd-color-tile.has-image {
    background-size: 100% 100%, 220% auto;
    background-position: center, center 36%;
    background-repeat: no-repeat;
}

.wcd-color-tile:hover {
    border-color: var(--wcd-primary);
    transform: scale(1.08);
}

.wcd-color-tile.active {
    border-color: var(--wcd-text);
    box-shadow: 0 0 0 2px var(--wcd-bg), 0 0 0 4px var(--wcd-text);
    transform: scale(1.05);
}

.wcd-total-qty {
    padding-top: 8px;
    border-top: 1px solid var(--wcd-border-light);
    margin-top: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--wcd-text);
}

/* ---- Price Panel ---- */
.wcd-price-panel {
    margin-top: 4px;
    padding: 16px;
    background: var(--wcd-primary-soft);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--wcd-radius-lg);
}
.wcd-sidebar .wcd-price-panel {
    padding-bottom: 16px !important;
}
.wcd-sidebar .wcd-price-panel h4 {
    color: var(--wcd-primary-dark) !important;
}

.wcd-price-breakdown {
    margin-bottom: 10px;
}

.wcd-price-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
    color: var(--wcd-text-muted);
}

.wcd-price-row.wcd-discount {
    color: var(--wcd-success-dark);
    font-weight: 500;
}

.wcd-price-row.wcd-price-sub {
    font-size: 11px;
    color: var(--wcd-text-light);
    padding: 0 0 2px;
}

.wcd-price-row.wcd-price-tax {
    color: var(--wcd-text);
    font-weight: 600;
}

.wcd-price-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 0 0;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 14px;
    color: var(--wcd-text);
    font-weight: 500;
}

.wcd-price-total strong {
    font-size: 24px;
    color: var(--wcd-primary-dark);
    font-weight: 800;
}

.wcd-hint {
    font-size: 12px;
    color: var(--wcd-text-light);
    margin: 4px 0 0;
}

/* ---- Add Size Button (ghost-outline) ---- */
.wcd-btn-add-size {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    border: 1px dashed var(--wcd-primary);
    background: transparent;
    color: var(--wcd-primary);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--wcd-radius);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 12px;
}
.wcd-btn-add-size:hover {
    background: var(--wcd-primary-soft);
    border-style: solid;
    color: var(--wcd-primary-dark);
}

/* ---- Top-bar Save & Cart Buttons (compact) ---- */
.wcd-toolbar-right .wcd-btn {
    padding: 8px 14px;
    font-size: 13px;
    height: 38px;
}
.wcd-toolbar-right .wcd-btn-save:disabled,
.wcd-toolbar-right .wcd-btn-share:disabled,
.wcd-toolbar-right .wcd-btn-new-design:disabled {
    background: var(--wcd-bg-light);
    color: var(--wcd-text-light);
    border-color: var(--wcd-border);
    cursor: not-allowed;
}
.wcd-btn-label {
    /* Keep label visible on desktop; hide on narrow screens via media query */
    display: inline;
}
.wcd-toolbar-right .wcd-btn-new-design {
    border-color: #bfdbfe;
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary-dark);
    font-weight: 700;
}
.wcd-toolbar-right .wcd-btn-new-design:hover {
    border-color: var(--wcd-primary);
    background: #dbeafe;
    color: var(--wcd-primary-dark);
}

/* ---- Order List (Bottom Bar, horizontal layout) ---- */
.wcd-order-list {
    margin-top: 0;
    padding: 20px;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius-xl);
    box-shadow: var(--wcd-shadow);
}
.wcd-order-empty-msg {
    padding: 12px 16px;
    margin-bottom: 14px;
    background: #ecfdf5;
    color: var(--wcd-success-dark);
    font-size: 14px;
    border-radius: var(--wcd-radius);
    border: 1px solid #a7f3d0;
}
.wcd-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 0 7px;
    height: 20px;
    min-width: 20px;
    background: #fff;
    color: var(--wcd-primary-dark);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.wcd-btn-primary:hover .wcd-cart-badge {
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary-dark);
}
.wcd-btn-cart-link {
    position: relative;
}
.wcd-cart-complete-overlay {
    position: fixed;
    inset: 0;
    z-index: 100020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.44);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.wcd-cart-complete-overlay.is-open {
    opacity: 1;
}
.wcd-cart-complete-dialog {
    position: relative;
    width: min(440px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 22px;
    border: 1px solid rgba(16, 185, 129, 0.24);
    border-radius: var(--wcd-radius-xl);
    background: var(--wcd-bg);
    box-shadow: var(--wcd-shadow-lg);
    color: var(--wcd-text);
    text-align: center;
}
.wcd-cart-complete-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--wcd-border);
    border-radius: 999px;
    background: #fff;
    color: var(--wcd-text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.wcd-cart-complete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: var(--wcd-success-dark);
    font-size: 28px;
    font-weight: 900;
}
.wcd-cart-complete-dialog h3 {
    margin: 0 36px 6px;
    color: var(--wcd-text);
    font-size: 20px;
    font-weight: 900;
    line-height: 1.35;
}
.wcd-cart-complete-dialog p {
    margin: 0 0 14px;
    color: var(--wcd-text-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.55;
}
.wcd-cart-complete-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    align-items: baseline;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #bbf7d0;
    border-radius: var(--wcd-radius);
    background: #f0fdf4;
    text-align: left;
}
.wcd-cart-complete-summary span {
    grid-column: 1 / -1;
    color: var(--wcd-success-dark);
    font-size: 12px;
    font-weight: 900;
}
.wcd-cart-complete-summary strong {
    font-size: 17px;
    font-weight: 900;
}
.wcd-cart-complete-summary em {
    color: var(--wcd-success-dark);
    font-size: 20px;
    font-style: normal;
    font-weight: 900;
}
.wcd-cart-complete-items {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}
.wcd-cart-complete-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--wcd-border-light);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg-light);
    font-size: 13px;
    text-align: left;
}
.wcd-cart-complete-item span {
    min-width: 0;
    overflow: hidden;
    color: var(--wcd-text);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wcd-cart-complete-item strong {
    color: var(--wcd-text-muted);
    font-weight: 900;
}
.wcd-cart-complete-item em {
    color: var(--wcd-text);
    font-style: normal;
    font-weight: 900;
}
.wcd-cart-complete-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}
.wcd-cart-complete-actions .wcd-btn {
    justify-content: center;
    min-height: 42px;
    text-align: center;
}
.wcd-cart-complete-cart {
    grid-column: 1 / -1;
    background: var(--wcd-success);
    border-color: var(--wcd-success);
}
.wcd-cart-complete-cart:hover {
    background: var(--wcd-success-dark);
    border-color: var(--wcd-success-dark);
}
@media (max-width: 640px) {
    .wcd-cart-complete-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .wcd-cart-complete-dialog {
        width: 100%;
        max-height: min(82vh, 680px);
        padding: 18px 14px 14px;
        border-radius: 18px 18px 12px 12px;
    }

    .wcd-cart-complete-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 8px;
        font-size: 24px;
    }

    .wcd-cart-complete-dialog h3 {
        margin: 0 38px 5px;
        font-size: 18px;
    }

    .wcd-cart-complete-dialog p {
        font-size: 12px;
    }

    .wcd-cart-complete-summary {
        padding: 10px;
    }

    .wcd-cart-complete-summary strong {
        font-size: 15px;
    }

    .wcd-cart-complete-summary em {
        font-size: 18px;
    }

    .wcd-cart-complete-item {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 8px;
    }

    .wcd-cart-complete-item em {
        grid-column: 1 / -1;
        color: var(--wcd-success-dark);
    }

    .wcd-cart-complete-actions {
        grid-template-columns: 1fr;
    }
}
.wcd-order-list-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wcd-border-light);
}
.wcd-order-list-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--wcd-text);
}
.wcd-order-summary {
    display: flex;
    gap: 12px;
    align-items: baseline;
    font-size: 14px;
    color: var(--wcd-text-muted);
}
.wcd-order-summary strong {
    font-size: 22px;
    color: var(--wcd-primary);
}
/* Row-based list: one row per added item, all thumbnails shown inline */
.wcd-order-sizes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.wcd-order-item-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: var(--wcd-bg-light);
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius-lg);
    padding: 12px 48px 12px 12px; /* right padding for delete button */
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}
.wcd-order-item-row:hover {
    border-color: var(--wcd-text-light);
    background: #fff;
}
.wcd-order-item-row.is-updating {
    opacity: 0.72;
}
/* All view thumbnails inline */
.wcd-order-item-thumbs {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}
.wcd-order-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.wcd-order-thumb img {
    width: 70px;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #ffffff;
}
.wcd-order-thumb span {
    font-size: 11px;
    color: var(--wcd-text-light);
}
.wcd-order-print-preview {
    flex: 1 1 100%;
    min-width: 0;
    display: grid;
    gap: 9px;
}
.wcd-order-print-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--wcd-text-muted);
    font-size: 13px;
    line-height: 1.35;
}
.wcd-order-print-summary span {
    padding: 4px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--wcd-text);
    font-weight: 700;
}
.wcd-order-print-summary strong {
    color: var(--wcd-primary);
    font-weight: 800;
}
.wcd-order-print-summary em {
    min-width: 0;
    color: var(--wcd-text);
    font-style: normal;
    font-weight: 700;
}
.wcd-order-print-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}
.wcd-order-print-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 5px 9px;
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 999px;
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary-dark, #1d4ed8);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}
button.wcd-order-print-chip {
    appearance: none;
    font: inherit;
    cursor: pointer;
}
.wcd-order-print-chip.is-active {
    border-color: rgba(37, 99, 235, 0.5);
    background: var(--wcd-primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}
.wcd-order-print-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.wcd-order-print-slide {
    position: relative;
    flex: 0 0 136px;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--wcd-border);
    border-radius: 8px;
    background: #fff;
    scroll-snap-align: start;
}
.wcd-order-print-slide.is-active {
    border-color: rgba(37, 99, 235, 0.48);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.wcd-order-print-label {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 1;
    max-width: calc(100% - 48px);
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wcd-order-print-count {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 1;
    min-width: 28px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}
.wcd-order-print-media {
    height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f8fafc;
    overflow: hidden;
}
.wcd-order-print-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.wcd-order-print-media.is-missing {
    padding: 10px;
    color: var(--wcd-text-light);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}
.wcd-order-print-caption {
    display: grid;
    gap: 2px;
    margin-top: 6px;
    text-align: center;
}
.wcd-order-print-caption strong {
    color: var(--wcd-text);
    font-size: 12px;
    font-weight: 800;
}
.wcd-order-print-caption small {
    color: var(--wcd-text-muted);
    font-size: 11px;
}
.wcd-order-print-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: -2px;
}
.wcd-order-print-dots span,
.wcd-order-print-dots button {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--wcd-border);
    cursor: pointer;
    transition: width 0.15s ease, background 0.15s ease;
}
.wcd-order-print-dots span.is-active,
.wcd-order-print-dots button.is-active {
    width: 16px;
    background: var(--wcd-primary);
}
.wcd-order-print-active-detail {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 4px 8px;
    padding: 7px 9px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 8px;
    background: linear-gradient(180deg, #eff6ff, #ffffff);
    color: var(--wcd-text);
}
.wcd-order-print-active-detail span {
    grid-row: span 2;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 6px;
    background: #dbeafe;
    color: var(--wcd-primary-dark, #1d4ed8);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}
.wcd-order-print-active-detail strong,
.wcd-order-print-active-detail em {
    min-width: 0;
    font-style: normal;
    line-height: 1.25;
}
.wcd-order-print-active-detail strong {
    font-size: 13px;
    font-weight: 800;
}
.wcd-order-print-active-detail em {
    color: var(--wcd-text-muted);
    font-size: 12px;
    font-weight: 700;
}
.wcd-order-confirm-spec {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.55fr) minmax(0, 1fr) minmax(72px, .55fr);
    gap: 8px;
    padding: 9px;
    background: #fff;
    border: 1px solid var(--wcd-border-light);
    border-radius: 8px;
}
.wcd-order-confirm-spec div {
    min-width: 0;
}
.wcd-order-confirm-spec span {
    display: block;
    margin-bottom: 2px;
    color: var(--wcd-text-light);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}
.wcd-order-confirm-spec strong {
    display: block;
    color: var(--wcd-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.wcd-color-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    vertical-align: middle;
}
.wcd-color-inline-name {
    min-width: 0;
    overflow-wrap: anywhere;
}
.wcd-fabric-swatch {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--wcd-border);
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    vertical-align: -4px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45);
}
.wcd-fabric-swatch img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 36%;
    transform: scale(2.15);
    transform-origin: center 36%;
}
.wcd-order-spec-view-list {
    display: grid !important;
    gap: 3px;
}
.wcd-order-spec-view-row {
    display: grid;
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr);
    gap: 6px;
    align-items: baseline;
    min-width: 0;
    font-style: normal;
}
.wcd-order-spec-view-row b,
.wcd-order-spec-view-row i {
    min-width: 0;
    font-style: normal;
    line-height: 1.25;
}
.wcd-order-spec-view-row b {
    color: var(--wcd-text);
    font-weight: 800;
}
.wcd-order-spec-view-row i {
    color: var(--wcd-text-muted);
    font-weight: 700;
}
/* Size/color info in the middle, flex-grow */
.wcd-order-item-info {
    flex: 1 1 auto;
    font-size: 14px;
    line-height: 1.5;
}
.wcd-order-size-big {
    font-size: 16px;
    margin-bottom: 2px;
    color: var(--wcd-text);
}
.wcd-order-size-big strong {
    font-size: 20px;
    color: var(--wcd-primary);
}
.wcd-order-color {
    font-size: 13px;
    color: var(--wcd-text-muted);
}
.wcd-order-item-details {
    display: grid;
    gap: 2px;
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--wcd-text-muted);
}
.wcd-order-item-details div {
    display: flex;
    gap: 8px;
    align-items: baseline;
}
.wcd-order-item-details dt {
    min-width: 44px;
    margin: 0;
    color: var(--wcd-text-light);
    font-weight: 600;
}
.wcd-order-item-details dd {
    margin: 0;
    color: var(--wcd-text);
    font-weight: 600;
}
.wcd-order-qty-detail {
    align-items: center;
}
.wcd-order-qty-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px;
    border: 1px solid var(--wcd-border);
    border-radius: 999px;
    background: #fff;
}
.wcd-order-qty-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--wcd-primary);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.wcd-order-qty-btn:disabled {
    background: var(--wcd-border);
    color: var(--wcd-text-light);
    cursor: not-allowed;
}
.wcd-order-qty-value {
    min-width: 38px;
    text-align: center;
    color: var(--wcd-text);
    font-weight: 700;
    white-space: nowrap;
}
/* Price column on the right */
.wcd-order-item-price-col {
    flex: 0 0 auto;
    text-align: right;
    min-width: 90px;
}
.wcd-order-item-price {
    font-weight: 700;
    color: var(--wcd-text);
    font-size: 16px;
}
.wcd-order-item-tax-note {
    display: block;
    margin-top: 2px;
    color: var(--wcd-text-light);
    font-size: 11px;
    font-weight: 700;
}
.wcd-order-item-discount {
    flex: 1 1 100%;
    display: flex;
    justify-content: flex-end;
}
.wcd-order-discount-summary {
    display: grid;
    gap: 3px;
    margin-top: 8px;
    padding: 7px 9px;
    max-width: 260px;
    background: #fff7f7;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--wcd-text-muted);
    font-size: 12px;
    line-height: 1.35;
}
.wcd-order-discount-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.wcd-order-discount-row del {
    color: var(--wcd-text-light);
    text-decoration-thickness: 1px;
}
.wcd-order-discount-row strong {
    color: var(--wcd-text);
    font-weight: 700;
    white-space: nowrap;
}
.wcd-order-discount-row--saving {
    color: #dc2626;
    font-weight: 700;
}
.wcd-order-discount-row--saving strong {
    color: #dc2626;
}
.wcd-order-size-del {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ddd;
    border-radius: 50%;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wcd-order-size-del:hover {
    background: var(--wcd-danger);
    border-color: var(--wcd-danger);
    color: #fff;
}
/* Action buttons row */
.wcd-order-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.wcd-order-actions .wcd-btn-order-print {
    flex: 0 0 auto;
    min-width: 112px;
    padding: 14px 16px;
    border-color: var(--wcd-border);
    background: #fff;
    color: var(--wcd-text);
    font-size: 15px;
    font-weight: 800;
}
.wcd-order-actions .wcd-btn-order-print:hover {
    background: var(--wcd-bg-light);
    border-color: var(--wcd-text-light);
}
.wcd-order-actions .wcd-btn-order-print .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}
.wcd-order-actions .wcd-btn-cart {
    flex: 1;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
}
.wcd-print-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 100030;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 14px;
    background: rgba(15, 23, 42, 0.58);
    opacity: 0;
    transition: opacity 0.16s ease;
}
.wcd-print-preview-overlay.is-open {
    opacity: 1;
}
.wcd-print-preview-dialog {
    width: min(1020px, 100%);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}
.wcd-print-preview-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--wcd-border);
    background: #fff;
}
.wcd-print-preview-head strong {
    display: block;
    color: var(--wcd-text);
    font-size: 15px;
    font-weight: 900;
}
.wcd-print-preview-head span {
    display: block;
    margin-top: 2px;
    color: var(--wcd-text-muted);
    font-size: 12px;
    font-weight: 700;
}
.wcd-print-preview-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.wcd-print-preview-close {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--wcd-border);
    border-radius: 8px;
    background: #fff;
    color: var(--wcd-text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.wcd-print-preview-close:hover {
    background: var(--wcd-bg-light);
    color: var(--wcd-text);
}
.wcd-print-preview-frame {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #eef2f7;
}
/* Top-bar cart link highlight animation (applied to .wcd-btn-cart-link#wcd-go-to-cart) */
.wcd-btn-cart-link.wcd-highlight {
    animation: wcd-pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
}
@keyframes wcd-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); }
    70%  { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Mobile */
@media (max-width: 767.98px) {
    .wcd-order-list {
        margin-top: 12px;
        padding: 12px;
    }
    .wcd-order-item-row {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 40px 10px 10px;
    }
    .wcd-order-thumb img {
        width: 55px;
        max-height: 70px;
    }
    .wcd-order-item-info {
        flex: 1 1 100%;
        order: 3;
    }
    .wcd-order-item-price-col {
        order: 2;
        min-width: auto;
    }
    .wcd-order-discount-summary {
        max-width: none;
    }
    .wcd-order-size-big strong {
        font-size: 17px;
    }
    .wcd-order-actions {
        flex-direction: column;
    }
    .wcd-order-actions .wcd-btn-order-print {
        width: 100%;
        min-height: 44px;
    }
    .wcd-print-preview-overlay {
        padding: 0;
    }
    .wcd-print-preview-dialog {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .wcd-print-preview-head {
        align-items: flex-start;
        padding: 10px;
    }
    .wcd-print-preview-head span {
        display: none;
    }
    .wcd-print-preview-actions .wcd-btn {
        min-height: 38px;
        padding: 8px 10px;
    }
}

/* ---- Design size bar (overlay below design objects) ---- */
.wcd-design-size-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 13px;
    color: #555;
    background: rgba(255,255,255,0.85);
    border-radius: 4px;
    z-index: 5;
    pointer-events: auto;
    white-space: nowrap;
}

.wcd-design-size-bar.wcd-size-bar-above {
    box-shadow: 0 3px 12px rgba(17, 24, 39, 0.14);
}
.wcd-size-label {
    font-weight: 500;
    color: #333;
}
.wcd-size-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    background: #fff;
    -moz-appearance: textfield;
}
.wcd-size-input::-webkit-inner-spin-button,
.wcd-size-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.wcd-size-input:focus {
    border-color: var(--wcd-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.wcd-size-unit {
    color: #888;
    font-size: 13px;
}
.wcd-size-separator {
    color: #aaa;
    font-size: 16px;
    margin: 0 2px;
}

/* ---- Design size warning ---- */
.wcd-size-warning {
    text-align: center;
    padding: 6px 12px;
    margin: 0 8px 4px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    animation: wcd-warning-pulse 1s ease-in-out;
}
@keyframes wcd-warning-pulse {
    0% { opacity: 0; transform: translateY(-4px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---- DPI warning ---- */
.wcd-dpi-warning {
    text-align: center;
    padding: 6px 12px;
    margin: 0 8px 4px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* ---- Auto-save indicator ---- */
.wcd-autosave-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: 12px;
    color: #28a745;
    opacity: 0.7;
    transition: opacity 0.3s;
}
.wcd-autosave-flash {
    opacity: 1;
}
.wcd-autosave-indicator::before {
    content: '✓';
    font-size: 14px;
}
.wcd-autosave-indicator.is-saving {
    color: var(--wcd-primary, #3b82f6);
    opacity: 1;
}
.wcd-autosave-indicator.is-saving::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
    animation: wcd-autosave-pulse 0.9s ease-in-out infinite;
}

@keyframes wcd-autosave-pulse {
    0%, 100% { transform: scale(0.82); opacity: 0.55; }
    50% { transform: scale(1.18); opacity: 1; }
}

/* ---- Auto-save restoration prompt ---- */
.wcd-autosave-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin: 8px;
    font-size: 13px;
}
.wcd-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.wcd-autosave-restore {
    background: var(--wcd-primary);
    color: #fff;
}
.wcd-shared-design-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px;
    padding: 12px 14px;
    border: 1px solid rgba(37, 99, 235, 0.24);
    border-left: 4px solid var(--wcd-primary);
    border-radius: 8px;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
    color: var(--wcd-text);
    font-size: 13px;
}
.wcd-shared-design-notice-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.wcd-shared-design-notice-copy strong {
    font-size: 14px;
    font-weight: 900;
}
.wcd-shared-design-notice-copy span {
    color: var(--wcd-text-muted);
    font-weight: 700;
    line-height: 1.45;
}
.wcd-shared-design-notice-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.wcd-shared-design-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--wcd-border);
    border-radius: 999px;
    background: #fff;
    color: var(--wcd-text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.wcd-btn-ghost {
    background: transparent;
    color: var(--wcd-text-muted);
    border: 1px solid var(--wcd-border);
}
.wcd-btn-ghost:hover {
    background: var(--wcd-bg-light);
}

/* ---- Save button (base; sits in top toolbar right) ---- */
.wcd-btn-save,
.wcd-btn-share,
.wcd-btn-new-design {
    /* Styled via .wcd-btn-secondary in new layout; keep for legacy hooks */
    gap: 6px;
}

/* ---- Save dialog ---- */
.wcd-save-dialog-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 24, 39, 0.4);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
.wcd-save-dialog {
    background: var(--wcd-bg);
    border-radius: var(--wcd-radius-xl);
    padding: 24px;
    width: 380px;
    max-width: 90vw;
    box-shadow: var(--wcd-shadow-lg);
    border: 1px solid var(--wcd-border);
}
.wcd-save-dialog h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--wcd-text);
}
.wcd-save-title-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    font-size: 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
    background: var(--wcd-bg);
    color: var(--wcd-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.wcd-save-title-input:focus {
    outline: none;
    border-color: var(--wcd-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.wcd-save-dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

/* ---- Share dialog ---- */
.wcd-share-dialog-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100010;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    transition: opacity 0.16s ease;
}
.wcd-share-dialog-overlay.is-open {
    opacity: 1;
}
.wcd-share-dialog {
    width: min(460px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    background: var(--wcd-bg);
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius-xl);
    box-shadow: var(--wcd-shadow-lg);
    padding: 18px;
}
.wcd-share-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.wcd-share-dialog-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--wcd-text);
}
.wcd-share-dialog-header p {
    margin: 3px 0 0;
    color: var(--wcd-text-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}
.wcd-share-dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--wcd-border);
    border-radius: 999px;
    background: var(--wcd-bg);
    color: var(--wcd-text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.wcd-share-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.wcd-share-preview img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 6px;
}
.wcd-share-url-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 14px;
}
.wcd-share-url {
    padding: 10px 12px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg-light);
    color: var(--wcd-text-muted);
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wcd-share-copy-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 0 12px;
    border: 1px solid rgba(37, 99, 235, 0.26);
    border-radius: var(--wcd-radius);
    background: var(--wcd-primary-soft);
    color: var(--wcd-primary-dark, #1d4ed8);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}
.wcd-share-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.wcd-share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    background: var(--wcd-bg);
    color: var(--wcd-text);
    cursor: pointer;
    font-weight: 700;
    text-align: left;
}
.wcd-share-option:hover {
    border-color: var(--wcd-primary);
    background: var(--wcd-primary-soft);
}
.wcd-share-option.is-primary {
    grid-column: 1 / -1;
    border-color: rgba(14, 165, 233, 0.45);
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.12);
}
.wcd-share-option.is-primary .wcd-share-option-label::after {
    content: 'おすすめ';
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    margin-left: 7px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--wcd-primary-dark, #1d4ed8);
    font-size: 10px;
    font-weight: 900;
    vertical-align: middle;
}
.wcd-share-option-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--wcd-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}
.wcd-share-option-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}
.wcd-share-option-text small {
    color: var(--wcd-text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}
.wcd-share-option--native .wcd-share-option-mark {
    background: #0ea5e9;
}
.wcd-share-option--line .wcd-share-option-mark {
    background: #06c755;
}
.wcd-share-option--x .wcd-share-option-mark,
.wcd-share-option--threads .wcd-share-option-mark {
    background: #111827;
}
.wcd-share-option--instagram .wcd-share-option-mark {
    background: #e1306c;
}
.wcd-share-option--tiktok .wcd-share-option-mark {
    background: #111827;
}
.wcd-share-option--bluesky .wcd-share-option-mark {
    background: #1185fe;
}
.wcd-share-option--image .wcd-share-option-mark {
    background: #10b981;
}
.wcd-share-option--mail .wcd-share-option-mark {
    background: #64748b;
}
.wcd-share-option--copy .wcd-share-option-mark {
    background: #2563eb;
}
.wcd-share-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .wcd-share-dialog-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .wcd-share-dialog {
        width: 100%;
        max-height: min(86vh, 720px);
        padding: 14px;
        border-radius: 18px 18px 12px 12px;
    }

    .wcd-share-dialog-header {
        margin-bottom: 10px;
    }

    .wcd-share-dialog-header h3 {
        font-size: 16px;
    }

    .wcd-share-dialog-close {
        width: 38px;
        height: 38px;
    }

    .wcd-share-preview {
        padding: 8px;
    }

    .wcd-share-preview img {
        max-height: 180px;
    }

    .wcd-share-url-row {
        grid-template-columns: minmax(0, 1fr) 66px;
        gap: 7px;
        margin-bottom: 12px;
    }

    .wcd-share-url {
        padding: 9px 10px;
        font-size: 11px;
    }

    .wcd-share-copy-inline {
        min-width: 0;
        padding: 0 8px;
        font-size: 12px;
    }

    .wcd-share-grid {
        gap: 8px;
    }

    .wcd-share-option {
        min-height: 52px;
        padding: 10px;
        gap: 8px;
    }

    .wcd-share-option-mark {
        flex-basis: 32px;
        width: 32px;
        height: 32px;
    }

    .wcd-share-option-label {
        font-size: 13px;
    }
}

/* "編集中: [title]" header in overwrite mode — gives the user immediate
   visual confirmation of which design they're updating. */
.wcd-save-current {
    margin: -6px 0 14px;
    padding: 8px 12px;
    background: var(--wcd-primary-soft);
    border-left: 3px solid var(--wcd-primary);
    border-radius: 4px;
    font-size: 13px;
    color: var(--wcd-text);
}
.wcd-save-current strong {
    font-weight: 700;
    color: var(--wcd-primary-dark);
}

/* Hide the title input in overwrite mode (it's irrelevant for an update);
   the "別名で保存" button toggles a class that flips it back on. */
.wcd-save-dialog-fields.wcd-save-mode-overwrite .wcd-save-title-input {
    display: none;
}
.wcd-save-dialog-fields.wcd-save-mode-as-new::before {
    content: '別名で新規保存';
    display: block;
    font-size: 12px;
    color: var(--wcd-text-muted);
    margin-bottom: 6px;
}

/* Subtle text-only "別名で保存" link variant — looks like a hyperlink so it
   reads as a secondary alternative, not a competing primary action. */
.wcd-btn.wcd-btn-link {
    background: transparent;
    border: none;
    color: var(--wcd-primary);
    text-decoration: underline;
    padding: 8px 4px;
    box-shadow: none;
    margin-right: auto; /* push primary action to the right */
}
.wcd-btn.wcd-btn-link:hover {
    background: transparent;
    color: var(--wcd-primary-dark);
}

/* ---- Saved designs grid ---- */
.wcd-left-panel-image > #wcd-saved-designs-section {
    margin: 0 0 16px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--wcd-border-light);
}
.wcd-left-panel-image > #wcd-saved-designs-section h4 {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--wcd-text);
}
.wcd-saved-designs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.wcd-saved-design-item {
    position: relative;
    border: 1px solid var(--wcd-border);
    border-radius: var(--wcd-radius);
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-align: center;
    background: var(--wcd-bg);
}
.wcd-saved-design-item:hover {
    border-color: var(--wcd-primary);
    box-shadow: var(--wcd-shadow-md);
    transform: translateY(-1px);
}
.wcd-saved-design-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--wcd-bg-light);
    border-radius: 4px;
}
.wcd-saved-design-title {
    display: block;
    font-size: 11px;
    color: var(--wcd-text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wcd-saved-design-delete {
    position: absolute;
    top: 2px; right: 2px;
    width: 20px; height: 20px;
    border: none;
    background: rgba(17, 24, 39, 0.5);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
}
.wcd-saved-design-item:hover .wcd-saved-design-delete {
    display: block;
}

@media (max-width: 768px) {
    .wcd-saved-design-delete {
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════
   Library panel (素材タブ — v1.9.91)
   Pill-shaped category tabs across the top, scrollable design
   thumbnail grid below. The grid uses CSS auto-fill so it
   reflows on narrow sidebars (mobile) without overflowing.
   ═══════════════════════════════════════════════════════════ */
.wcd-library-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    /* When categories overflow vertically (many entries on a
       narrow sidebar) we cap the height and let it scroll
       inside the panel rather than push the grid off-screen. */
    max-height: 90px;
    overflow-y: auto;
}

.wcd-library-cat-btn {
    background: #f4f4f4;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 11px;
    color: #444;
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.wcd-library-cat-btn:hover {
    background: #fff;
    border-color: var(--wcd-primary, #2271b1);
}
.wcd-library-cat-btn.is-selected {
    background: var(--wcd-primary, #2271b1);
    border-color: var(--wcd-primary, #2271b1);
    color: #fff;
    font-weight: 600;
}

.wcd-library-grid {
    display: grid;
    /* 3 columns on the typical 240px sidebar; auto-fit so the
       grid still works if the sidebar is wider/narrower. */
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    /* Scroll the grid inside the panel rather than letting the
       sidebar grow unbounded — keeps the rest of the panel
       (e.g. price card) visible without the user having to
       scroll past hundreds of cliparts. */
    max-height: 50vh;
    overflow-y: auto;
    padding: 2px; /* room for hover ring without clipping */
}

.wcd-library-thumb {
    aspect-ratio: 1;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Checkerboard hint for transparent PNGs — same trick the
       admin page uses, so the operator's "what does this clipart
       look like" mental model carries over to the customer side. */
    background-image:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.wcd-library-thumb:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    border-color: var(--wcd-primary, #2271b1);
}
.wcd-library-thumb img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    pointer-events: none; /* let the parent click bubble cleanly */
}

.wcd-library-empty {
    padding: 8px 4px;
    margin: 0;
}

/* ---- Toast notifications ---- */
.wcd-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--wcd-radius);
    font-size: 14px;
    z-index: 10001;
    animation: wcd-toast-in 0.3s ease;
    box-shadow: var(--wcd-shadow-lg);
}
.wcd-toast-success {
    background: var(--wcd-success);
    color: #fff;
}
.wcd-toast-error {
    background: var(--wcd-danger);
    color: #fff;
}
@keyframes wcd-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 767.98px) {

    /* Layout: vertical stack */
    .wcd-layout {
        flex-direction: column;
        min-height: auto;
    }

    .wcd-designer-wrapper {
        /* Edge-to-edge on mobile — the 24px desktop gutter would eat into
           precious horizontal space on narrow screens. */
        width: 100vw;
        max-width: 100vw;
        margin-left: -50vw;
        margin-right: -50vw;
        border-radius: 0;
        box-shadow: none;
    }

    /* Toolbar: stack sections vertically for narrow screens */
    .wcd-toolbar {
        height: auto;
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
        position: sticky;
    }
    .wcd-toolbar-left {
        flex: 1 1 50%;
        min-width: 0;
    }
    .wcd-toolbar-title {
        font-size: 14px;
    }
    .wcd-toolbar-right {
        flex: 0 0 auto;
        order: 2;
        gap: 6px;
    }
    .wcd-toolbar-right .wcd-btn {
        padding: 8px 10px;
        font-size: 12px;
        height: 36px;
    }
    .wcd-toolbar-right .wcd-btn-label,
    .wcd-toolbar-left .wcd-btn-label {
        display: none; /* icons only on mobile to save space */
    }
    .wcd-close-btn {
        padding: 8px 10px;
        font-size: 12px;
        height: 36px;
    }
    .wcd-toolbar-center {
        order: 3;
        flex: 1 1 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding-top: 6px;
        border-top: 1px solid var(--wcd-border-light);
    }

    .wcd-tool-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .wcd-autosave-indicator {
        font-size: 10px;
        white-space: nowrap;
    }

    /* Left menu: compact horizontal bar */
    .wcd-left-menu {
        width: 100%;
        min-width: 0;
        max-height: 120px;
        border-right: none;
        border-bottom: 1px solid var(--wcd-border);
        padding: 8px;
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wcd-left-menu h4 {
        display: none;
    }

    .wcd-upload-area {
        min-width: 80px;
        min-height: 60px;
        padding: 6px;
        flex-shrink: 0;
    }

    .wcd-upload-area .dashicons {
        font-size: 20px;
        width: 20px;
        height: 20px;
    }

    .wcd-upload-area p {
        font-size: 10px;
        margin: 2px 0 0;
    }

    .wcd-upload-hint {
        display: none;
    }

    .wcd-uploaded-gallery {
        display: flex !important;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
    }

    .wcd-gallery-item {
        width: 60px;
        min-width: 60px;
        height: 60px;
    }

    /* Canvas column: compact */
    .wcd-canvas-column {
        min-height: auto;
        padding: 10px;
        gap: 10px;
    }

    .wcd-canvas-area {
        padding: 8px;
        min-height: auto;
        border-radius: var(--wcd-radius-lg);
    }

    /* Tool overlay: bottom sheet */
    .wcd-tool-overlay {
        position: fixed !important;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        top: auto !important;
        width: 100% !important;
        max-height: 50vh;
        max-height: 50dvh; /* iOS 15.4+ dynamic viewport height */
        border-radius: 12px 12px 0 0;
        z-index: 100;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translate3d(0,0,0);
    }

    /* View tabs */
    .wcd-canvas-controls {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        padding: 4px 8px;
    }

    /* Size bar: below design, horizontal compact */
    .wcd-design-size-bar {
        font-size: 12px;
        padding: 4px 8px;
        background: rgba(255,255,255,0.95);
        border-radius: 6px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }

    .wcd-size-input {
        width: 50px;
        font-size: 16px !important; /* prevent iOS zoom */
        padding: 4px 2px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 4px;
        -webkit-appearance: none;
    }

    .wcd-size-label {
        font-size: 12px;
    }

    .wcd-size-unit {
        font-size: 11px;
    }

    .wcd-size-separator {
        font-size: 14px;
        margin: 0 1px;
    }

    /* Warnings: compact */
    .wcd-size-warning,
    .wcd-dpi-warning {
        font-size: 11px;
        padding: 4px 8px;
        margin: 2px 8px;
    }

    /* Sidebar: full width below canvas */
    .wcd-sidebar {
        width: 100%;
        min-width: 0;
        border-left: none;
        border-top: 1px solid var(--wcd-border);
    }

    .wcd-sidebar-scroll {
        padding: 12px;
    }

    .wcd-sidebar .wcd-panel-section {
        padding-bottom: 12px;
        margin-bottom: 12px;
    }

    .wcd-sidebar .wcd-panel-section h4 {
        font-size: 11px;
        margin: 2px 0 8px;
    }

    /* Size/Color buttons: touch friendly */
    .wcd-size-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 14px;
    }

    .wcd-color-tile {
        min-width: 40px;
        min-height: 40px;
    }

    /* Quantity inputs */
    .wcd-qty-row input[type="number"] {
        min-height: 40px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    /* Price panel: compact */
    .wcd-price-panel {
        padding: 12px;
    }

    .wcd-price-row {
        font-size: 13px;
    }

    .wcd-price-total strong {
        font-size: 20px;
    }

    /* Saved designs: 3 columns */
    .wcd-saved-designs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    /* Order list CTA button: compact on mobile */
    .wcd-btn-cart {
        padding: 12px 10px;
        font-size: 14px;
    }

    /* Save dialog: mobile full width */
    .wcd-save-dialog {
        width: 90vw;
        padding: 16px;
    }

    .wcd-save-title-input {
        font-size: 16px; /* prevents iOS zoom */
    }

    /* Autosave prompt: compact wrap */
    .wcd-autosave-prompt {
        flex-wrap: wrap;
        font-size: 12px;
        padding: 8px;
        gap: 6px;
        margin: 4px;
    }

    .wcd-autosave-prompt span:first-child {
        width: 100%;
    }

    .wcd-shared-design-notice {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        margin: 6px 8px;
        padding: 10px;
        font-size: 12px;
    }

    .wcd-shared-design-notice-copy strong {
        font-size: 13px;
    }

    .wcd-shared-design-notice-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 34px;
        gap: 7px;
        width: 100%;
    }

    .wcd-shared-design-notice-actions .wcd-btn {
        width: 100%;
        padding: 8px 10px;
        justify-content: center;
        font-size: 12px;
        white-space: nowrap;
    }

    .wcd-shared-design-close {
        width: 34px;
        height: 34px;
    }

    /* iOS: Prevent input zoom on focus (must be >= 16px) */
    .wcd-input,
    .wcd-select,
    .wcd-size-input,
    .wcd-design-size-bar input,
    input[type="number"],
    input[type="text"],
    select {
        font-size: 16px !important;
    }

    /* Toast: safe area */
    .wcd-toast {
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }

    /* Save dialog: iOS keyboard safe */
    .wcd-save-dialog-overlay {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* Mobile-only purchase-flow chrome: hidden on desktop, where the sidebar
   shows every section at once and the bottom tab bar / floating CTA do not
   exist. These are switched back on inside the mobile media block below. */
.wcd-mobile-stepper,
.wcd-btn-step-next,
.wcd-left-tab-purchase {
    display: none;
}

/* ---- Mobile app shell redesign (customer designer only) ---- */
@media (max-width: 767.98px) {
    body.wcd-designer-open {
        --wcd-mobile-tab-h: 58px;
        --wcd-mobile-cta-h: 64px;
        --wcd-mobile-safe: env(safe-area-inset-bottom, 0px);
        overflow: hidden;
    }

    html.wcd-designer-frame-open {
        overflow: hidden;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-designer-section {
        position: fixed;
        inset: 0;
        z-index: 99990;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        background: var(--wcd-bg-light);
    }

    body.admin-bar.wcd-designer-open:not(.wp-admin) .wcd-designer-section {
        top: 46px;
        height: calc(100vh - 46px);
        height: calc(100dvh - 46px);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-designer-wrapper {
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        left: auto;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: var(--wcd-bg-light);
    }

    body.wcd-designer-open:not(.wp-admin) #page_top,
    body.wcd-designer-open:not(.wp-admin) .page_top_btn {
        display: none !important;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar {
        flex: 0 0 48px;
        height: 48px;
        min-height: 48px;
        padding: 0 8px;
        gap: 6px;
        flex-wrap: nowrap;
        position: relative;
        top: auto;
        z-index: 90;
        box-shadow: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-left {
        flex: 1 1 auto;
        min-width: 0;
        gap: 6px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-title {
        font-size: 14px;
        max-width: 120px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-close-btn {
        width: 34px;
        height: 34px;
        padding: 0;
        justify-content: center;
        font-size: 16px;
        flex: 0 0 34px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-center {
        order: 0;
        flex: 0 0 auto;
        width: auto;
        padding: 0;
        border: 0;
        gap: 2px;
        overflow: visible;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right {
        flex: 0 0 auto;
        order: 0;
        gap: 2px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-tool-btn,
    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0;
        border-radius: 8px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-tool-btn {
        font-size: 0;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn {
        border: 1px solid var(--wcd-border);
        font-size: 16px;
        line-height: 1;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn-new-design {
        width: auto;
        min-width: 94px;
        padding: 0 9px;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
        background: var(--wcd-primary-soft);
        border-color: #bfdbfe;
        color: var(--wcd-primary-dark);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn-new-design .wcd-btn-label {
        display: inline;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn-new-design .dashicons {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn-cart-link {
        position: relative;
        overflow: visible;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .wcd-btn-cart-link .wcd-cart-badge {
        position: absolute;
        top: 1px;
        right: 1px;
        min-width: 14px;
        height: 14px;
        margin: 0;
        padding: 0 3px;
        border: 1px solid #fff;
        border-radius: 999px;
        background: #fff;
        color: var(--wcd-primary-dark);
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
        font-size: 9px;
        font-weight: 800;
        line-height: 12px;
        pointer-events: none;
        z-index: 2;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-tool-btn .dashicons,
    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-right .dashicons {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toolbar-separator,
    body.wcd-designer-open:not(.wp-admin) .wcd-tool-btn[data-tool="select"],
    body.wcd-designer-open:not(.wp-admin) .wcd-guide-toggle {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-layout {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        min-height: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: var(--wcd-bg-light);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-menu {
        width: 0;
        min-width: 0;
        max-height: none;
        padding: 0;
        border: 0;
        overflow: visible;
        display: block;
        background: transparent;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tabs {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        height: calc(var(--wcd-mobile-tab-h) + var(--wcd-mobile-safe));
        margin: 0;
        padding: 5px 4px calc(5px + var(--wcd-mobile-safe));
        gap: 1px;
        border: 0;
        border-top: 1px solid var(--wcd-border);
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 -1px 8px rgba(17, 24, 39, 0.06);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab,
    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab-purchase {
        display: flex;
        min-width: 0;
        min-height: 48px;
        margin: 0;
        padding: 5px 1px;
        border: 0;
        border-radius: 8px;
        gap: 2px;
        background: transparent;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab .dashicons,
    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab-icon {
        display: none !important;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab::before {
        content: "";
        display: block;
        width: 22px;
        height: 22px;
        flex: 0 0 auto;
        background: currentColor;
        -webkit-mask: var(--wcd-mobile-tab-icon) center / contain no-repeat;
        mask: var(--wcd-mobile-tab-icon) center / contain no-repeat;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab[data-tool="image"] {
        --wcd-mobile-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Ccircle cx='9' cy='9' r='1.5' fill='black' stroke='none'/%3E%3Cpath d='M7 17l4-4 3 3 2-2 3 3'/%3E%3C/g%3E%3C/svg%3E");
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab[data-tool="text"] {
        --wcd-mobile-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 20l6-16 6 16'/%3E%3Cpath d='M9 13h6'/%3E%3C/g%3E%3C/svg%3E");
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab[data-tool="library"] {
        --wcd-mobile-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='black'%3E%3Crect x='4' y='4' width='6' height='6' rx='1'/%3E%3Crect x='14' y='4' width='6' height='6' rx='1'/%3E%3Crect x='4' y='14' width='6' height='6' rx='1'/%3E%3Crect x='14' y='14' width='6' height='6' rx='1'/%3E%3C/g%3E%3C/svg%3E");
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab[data-tool="drawing"] {
        --wcd-mobile-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20c4 0 6-2 6-6'/%3E%3Cpath d='M10 14l8-8a2 2 0 0 1 3 3l-8 8'/%3E%3Cpath d='M9 15l-2-2'/%3E%3C/g%3E%3C/svg%3E");
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab[data-tool="purchase"] {
        --wcd-mobile-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1.4' fill='black' stroke='none'/%3E%3Ccircle cx='17' cy='20' r='1.4' fill='black' stroke='none'/%3E%3Cpath d='M3 4h2l2.2 11.2a1 1 0 0 0 1 .8h8.4a1 1 0 0 0 1-.8L20 8H6'/%3E%3C/g%3E%3C/svg%3E");
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab.active {
        color: var(--wcd-primary);
        background: var(--wcd-primary-soft);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab .dashicons,
    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab-icon {
        font-size: 20px;
        width: 20px;
        height: 20px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-tab-label {
        font-size: 10px;
        line-height: 1.1;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-column {
        flex: 1 1 auto;
        min-height: 0;
        position: relative;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 6px 8px calc(var(--wcd-mobile-tab-h) + var(--wcd-mobile-cta-h) + var(--wcd-mobile-safe) + 8px);
        gap: 6px;
        background: var(--wcd-bg-light);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-controls {
        flex: 0 0 38px;
        min-height: 38px;
        padding: 0;
        gap: 6px;
        justify-content: space-between;
        position: relative;
        z-index: 135;
        background: transparent;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-view-tabs {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 3px;
        border-radius: 999px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-view-tab {
        min-height: 30px;
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-status {
        display: block;
        align-self: center;
        max-width: calc(100vw - 32px);
        padding: 5px 10px;
        border: 1px solid var(--wcd-border);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.92);
        color: var(--wcd-text-muted);
        font-size: 11px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        z-index: 136;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-area {
        flex: 0 1 auto;
        min-height: 0;
        max-height: 100%;
        padding: 8px 6px;
        overflow: hidden;
        align-items: flex-start;
        justify-content: flex-start;
        border-radius: 10px;
        background: var(--wcd-bg);
        touch-action: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-area.wcd-is-zoomed {
        overflow: auto;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mockup-wrap {
        flex: 0 0 auto;
        width: auto !important;
        max-width: var(--wcd-mobile-mockup-width, calc(100% - 12px)) !important;
        max-height: var(--wcd-mobile-mockup-height, calc(100vh - var(--wcd-mobile-tab-h) - var(--wcd-mobile-cta-h) - var(--wcd-mobile-safe) - 146px));
        max-height: var(--wcd-mobile-mockup-height, calc(100dvh - var(--wcd-mobile-tab-h) - var(--wcd-mobile-cta-h) - var(--wcd-mobile-safe) - 146px));
        height: auto !important;
        min-height: 0;
        margin: 0 auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mockup-wrap.wcd-mockup-fill-width {
        width: var(--wcd-mobile-mockup-width, calc(100% - 12px)) !important;
        max-height: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mockup-image {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: var(--wcd-mobile-mockup-height, calc(100vh - var(--wcd-mobile-tab-h) - var(--wcd-mobile-cta-h) - var(--wcd-mobile-safe) - 146px));
        max-height: var(--wcd-mobile-mockup-height, calc(100dvh - var(--wcd-mobile-tab-h) - var(--wcd-mobile-cta-h) - var(--wcd-mobile-safe) - 146px));
        object-fit: contain;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-area.wcd-is-zoomed .wcd-mockup-wrap:not(.wcd-mockup-fill-width),
    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-area.wcd-is-zoomed .wcd-mockup-wrap:not(.wcd-mockup-fill-width) .wcd-mockup-image {
        max-width: none !important;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mockup-wrap.wcd-mockup-fill-width .wcd-mockup-image {
        width: 100% !important;
        height: auto !important;
        max-height: none;
    }

    /* 非ズーム時: body(fill-width)モックアップも利用可能高さでキャップして
       全体を表示する。--wcd-mobile-fit-height は JS(_applyMobileFitHeight)が
       canvas-area の実空き高さから算出。これが無いと横長ビューポート
       (横向きスマホ・小さめウィンドウ)で area の overflow:hidden がシャツの
       下部を切り落とし、デザインエリアが襟元にズレて見える。
       ズーム中(.wcd-is-zoomed)は従来のスクロール挙動を維持。
       wrap と画像の max-width は同じビューポート基準にする。片方だけ
       狭いと画像が wrap からはみ出し、wrap 基準の破線ガイドが左へズレる。
       28px = column 8+8 + area 6+6 の左右パディング。 */
    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-area:not(.wcd-is-zoomed) .wcd-mockup-wrap.wcd-mockup-fill-width {
        width: auto !important;
        max-width: calc(100vw - 28px) !important;
        margin-left: auto;
        margin-right: auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-canvas-area:not(.wcd-is-zoomed) .wcd-mockup-wrap.wcd-mockup-fill-width .wcd-mockup-image {
        width: auto !important;
        height: auto !important;
        max-width: calc(100vw - 28px) !important;
        max-height: var(--wcd-mobile-fit-height, none);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mockup-wrap .canvas-container,
    body.wcd-designer-open:not(.wp-admin) .wcd-mockup-wrap .canvas-container canvas {
        touch-action: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-zoom-controls {
        position: static;
        flex: 0 0 auto;
        z-index: 1;
        padding: 2px;
        gap: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: var(--wcd-shadow-md);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-zoom-reset {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-zoom-btn {
        width: 30px;
        height: 30px;
    }

    body.wcd-designer-open:not(.wp-admin) #wcd-zoom-out .dashicons,
    body.wcd-designer-open:not(.wp-admin) #wcd-zoom-in .dashicons {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) #wcd-zoom-out::before,
    body.wcd-designer-open:not(.wp-admin) #wcd-zoom-in::before {
        display: block;
        font-size: 18px;
        font-weight: 700;
        line-height: 1;
    }

    body.wcd-designer-open:not(.wp-admin) #wcd-zoom-out::before {
        content: "-";
    }

    body.wcd-designer-open:not(.wp-admin) #wcd-zoom-in::before {
        content: "+";
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-zoom-level {
        min-width: 42px;
        font-size: 11px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-object-controls {
        --wcd-oc-size: 28px;
        --wcd-oc-gap: -4px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-oc-btn svg {
        width: 15px;
        height: 15px;
    }

    /* Purchase sheets are for choosing/reviewing order details. Hide editing
       affordances behind the sheet so the confirmation flow stays visually calm. */
    body.wcd-designer-open.wcd-purchase-sheet-open:not(.wp-admin) .wcd-object-controls,
    body.wcd-designer-open.wcd-purchase-sheet-open:not(.wp-admin) .wcd-design-size-bar {
        display: none !important;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-design-size-bar {
        left: 50%;
        right: auto;
        max-width: calc(100% - 14px);
        gap: 6px;
        padding: 6px 10px;
        transform: translateX(-50%);
        box-shadow: 0 2px 10px rgba(17, 24, 39, 0.12);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-design-size-bar .wcd-size-label {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-design-size-bar .wcd-size-input {
        width: clamp(70px, 18vw, 84px) !important;
        min-width: 70px;
        height: 42px;
        padding: 4px 8px;
        box-sizing: border-box;
        font-size: 18px !important;
        line-height: 1.2;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-design-size-bar .wcd-size-unit,
    body.wcd-designer-open:not(.wp-admin) .wcd-design-size-bar .wcd-size-separator {
        font-size: 13px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-panel,
    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(var(--wcd-mobile-tab-h) + var(--wcd-mobile-cta-h) + var(--wcd-mobile-safe) + 8px);
        z-index: 140;
        width: auto;
        min-width: 0;
        max-height: min(calc(100vh - var(--wcd-mobile-tab-h) - var(--wcd-mobile-cta-h) - var(--wcd-mobile-safe) - 52px), 78vh);
        max-height: min(calc(100dvh - var(--wcd-mobile-tab-h) - var(--wcd-mobile-cta-h) - var(--wcd-mobile-safe) - 52px), 78dvh);
        overflow: hidden;
        border: 1px solid var(--wcd-border);
        border-radius: 14px 14px 10px 10px;
        background: var(--wcd-bg);
        box-shadow: 0 -10px 30px rgba(17, 24, 39, 0.18);
        transform: translateY(calc(100% + var(--wcd-mobile-cta-h) + var(--wcd-mobile-tab-h) + 40px));
        opacity: 0;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.18s ease;
        -webkit-transform: translate3d(0, calc(100% + var(--wcd-mobile-cta-h) + var(--wcd-mobile-tab-h) + 40px), 0);
        display: flex;
        flex-direction: column;
    }

    body.wcd-designer-open.wcd-sheet-open:not(.wp-admin) .wcd-left-panel.wcd-mobile-panel-active,
    body.wcd-designer-open.wcd-sheet-open:not(.wp-admin) .wcd-sidebar.wcd-mobile-panel-active {
        transform: translateY(0);
        -webkit-transform: translate3d(0, 0, 0);
        opacity: 1;
        pointer-events: auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-sheet-head {
        display: grid;
        grid-template-columns: 34px 1fr 34px;
        align-items: center;
        min-height: 44px;
        padding: 6px 10px;
        border-bottom: 1px solid var(--wcd-border-light);
        background: var(--wcd-bg);
        flex: 0 0 auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-sheet-grip {
        width: 34px;
        height: 4px;
        border-radius: 999px;
        background: var(--wcd-border);
        justify-self: start;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-sheet-head strong {
        text-align: center;
        color: var(--wcd-text);
        font-size: 14px;
        font-weight: 700;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-sheet-close {
        width: 34px;
        height: 34px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: var(--wcd-bg-light);
        color: var(--wcd-text-muted);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-panel > :not(.wcd-mobile-sheet-head) {
        flex: 0 0 auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-panel {
        padding: 0 14px 14px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-panel .wcd-mobile-sheet-head {
        margin: 0 -14px 12px;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-left-panel .wcd-left-menu-title {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar {
        padding: 0;
        border-left: 1px solid var(--wcd-border);
        border-top: 1px solid var(--wcd-border);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar-scroll {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 12px 14px calc(var(--wcd-mobile-safe) + 18px);
        -webkit-overflow-scrolling: touch;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar-scroll > .wcd-btn-add-size {
        order: 20;
        margin: 0 0 4px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar-scroll > .wcd-price-panel {
        order: 30;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar-scroll > .wcd-order-list {
        order: 40;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-panel-section {
        margin-bottom: 14px;
        padding-bottom: 14px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-panel-section h4 {
        margin-bottom: 8px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-print-method-item {
        padding: 7px 9px;
    }

    /* --- 3-step purchase flow (color / size / purchase) ---------------
       The sidebar is reused as the bottom sheet for all three steps. Hide
       every step-managed block by default, then reveal only the active
       step's sections. The stepper itself is sticky and always visible. */
    body.wcd-designer-open:not(.wp-admin).wcd-purchase-sheet-open .wcd-sidebar #wcd-saved-designs-section {
        display: none !important;
    }

    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-print-method-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-size-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-quantity-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-price-panel,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-btn-add-size,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-order-list,

    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-color-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-btn-step-next,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-order-list,

    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-color-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-btn-step-next,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-print-method-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-size-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-quantity-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-price-panel,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-btn-add-size {
        display: none !important;
    }

    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-color-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="color"] .wcd-sidebar .wcd-btn-step-next,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-print-method-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-size-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-quantity-section,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-price-panel,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="size"] .wcd-sidebar .wcd-btn-add-size,
    body.wcd-designer-open:not(.wp-admin)[data-wcd-mobile-panel="purchase"] .wcd-sidebar .wcd-order-list {
        display: block !important;
    }

    /* Stepper — sticky header inside the purchase sheet, always visible so the
       current position and the path forward/back are obvious. */
    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-stepper {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        position: sticky;
        top: 0;
        z-index: 3;
        margin: 0 0 12px;
        padding: 4px;
        background: var(--wcd-bg-light);
        border-radius: 10px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-step {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        min-height: 40px;
        padding: 4px 2px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--wcd-text-muted);
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-step-num {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--wcd-border);
        color: #fff;
        font-size: 11px;
        font-weight: 700;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-step.active {
        background: var(--wcd-bg);
        color: var(--wcd-text);
        box-shadow: 0 1px 3px rgba(17, 24, 39, 0.12);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-step.active .wcd-step-num {
        background: var(--wcd-primary);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-step:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

    /* In-sheet "next" button (color → size). Full width, tall touch target. */
    body.wcd-designer-open:not(.wp-admin) .wcd-btn-step-next {
        display: block;
        width: 100%;
        min-height: 48px;
        margin: 4px 0 0;
        border: 0;
        border-radius: 10px;
        background: var(--wcd-primary);
        color: #fff;
        font-size: 15px;
        font-weight: 700;
        cursor: pointer;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-upload-area {
        min-width: 0;
        min-height: 104px;
        padding: 16px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-upload-area .dashicons {
        font-size: 30px;
        width: 30px;
        height: 30px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-upload-area p {
        font-size: 13px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-upload-hint {
        display: block;
        margin: 8px 0 0;
        font-size: 11px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-uploaded-gallery {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
        margin-top: 12px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-gallery-item {
        width: auto;
        min-width: 0;
        height: auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-form-row {
        gap: 8px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-textarea,
    body.wcd-designer-open:not(.wp-admin) .wcd-input,
    body.wcd-designer-open:not(.wp-admin) .wcd-select {
        min-height: 42px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-style-btn,
    body.wcd-designer-open:not(.wp-admin) .wcd-draw-btn {
        min-height: 42px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-library-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-height: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-size-btn {
        min-height: 38px;
        min-width: 40px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-selected-color-summary {
        min-height: 38px;
        margin-bottom: 10px;
        padding: 8px 10px;
        font-size: 13px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-selected-color-swatch {
        width: 22px;
        height: 22px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-color-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-color-tile {
        width: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-qty-simple .wcd-input {
        min-height: 40px;
        padding: 8px !important;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-qty-stepper {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        gap: 8px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-qty-stepper .wcd-input {
        height: 48px;
        min-height: 48px;
        padding: 6px 8px !important;
        font-size: 20px !important;
        font-weight: 700;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-qty-step-btn {
        width: 48px;
        height: 48px;
        border-radius: 10px;
        font-size: 26px;
    }

    @media (max-height: 720px) {
        body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-print-method-info small {
            display: none;
        }

        body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-panel-section {
            margin-bottom: 8px;
            padding-bottom: 8px;
        }

        body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-panel-section h4 {
            margin-bottom: 6px;
        }

        body.wcd-designer-open:not(.wp-admin) .wcd-sidebar .wcd-print-method-item {
            padding: 6px 8px;
        }
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-list {
        margin-top: 12px;
        padding: 10px 10px 14px;
        border-radius: 10px;
        box-shadow: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-row {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) minmax(64px, auto);
        align-items: flex-start;
        gap: 8px;
        padding: 9px 36px 9px 9px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-thumbs {
        grid-column: 1;
        max-width: 94px;
        overflow-x: auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-preview {
        grid-column: 1 / -1;
        gap: 6px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-summary {
        font-size: 12px;
        gap: 5px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-summary span {
        padding: 4px 7px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-summary em {
        flex: 1 1 100%;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-chip {
        min-height: 22px;
        padding: 3px 7px;
        font-size: 11px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-carousel {
        gap: 6px;
        padding-bottom: 3px;
        scroll-snap-type: x mandatory;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-slide {
        flex-basis: 112px;
        padding: 6px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-media {
        height: 84px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-caption {
        margin-top: 4px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-label,
    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-count {
        top: 6px;
        font-size: 10px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-label {
        left: 6px;
        max-width: calc(100% - 44px);
        padding: 2px 6px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-count {
        right: 6px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-dots {
        margin-top: -1px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-print-active-detail {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-confirm-spec {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
        padding: 7px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-confirm-spec .wcd-order-spec-print,
    body.wcd-designer-open:not(.wp-admin) .wcd-order-confirm-spec .wcd-order-spec-dims {
        grid-column: 1 / -1;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-confirm-spec strong {
        font-size: 12px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-thumb img {
        width: 46px;
        max-height: 58px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-thumb span {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-info {
        grid-column: 1 / 3;
        order: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-size-big {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-details {
        gap: 2px;
        margin-top: 0;
        font-size: 12px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-details dt {
        min-width: 40px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-color-inline {
        gap: 4px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-fabric-swatch {
        width: 17px;
        height: 17px;
        flex-basis: 17px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-qty-control {
        gap: 4px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-qty-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-qty-value {
        min-width: 36px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-discount {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: stretch;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-discount-summary {
        max-width: none;
        width: 100%;
        margin-top: 6px;
        padding: 6px 8px;
        font-size: 12px;
        box-sizing: border-box;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-discount-row {
        gap: 6px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-item-price-col {
        grid-column: 3;
        order: 0;
        min-width: 64px;
        font-size: 13px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-actions .wcd-btn-order-print {
        width: 100%;
        min-height: 44px;
        padding: 11px 14px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-order-actions .wcd-btn-cart {
        display: none;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-sheet-scrim {
        position: fixed;
        inset: 48px 0 calc(var(--wcd-mobile-tab-h) + var(--wcd-mobile-cta-h) + var(--wcd-mobile-safe)) 0;
        z-index: 130;
        display: block;
        background: rgba(17, 24, 39, 0.16);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease;
    }

    body.wcd-designer-open.wcd-sheet-open:not(.wp-admin) .wcd-mobile-sheet-scrim {
        opacity: 1;
        pointer-events: auto;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--wcd-mobile-tab-h) + var(--wcd-mobile-safe));
        z-index: 125;
        display: flex;
        align-items: center;
        gap: 10px;
        height: var(--wcd-mobile-cta-h);
        padding: 9px 10px;
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid var(--wcd-border);
        box-shadow: 0 -2px 10px rgba(17, 24, 39, 0.06);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta-total {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 1px;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta-total span {
        font-size: 11px;
        color: var(--wcd-text-muted);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta-total strong {
        color: var(--wcd-text);
        font-size: 20px;
        font-weight: 800;
        line-height: 1.1;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta-button {
        flex: 0 0 min(58vw, 210px);
        height: 46px;
        border: 0;
        border-radius: 10px;
        background: var(--wcd-primary);
        color: #fff;
        font-size: 15px;
        font-weight: 800;
        cursor: pointer;
        white-space: nowrap;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta-button.is-cart {
        background: var(--wcd-success);
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-mobile-cta-button:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

    body.wcd-designer-open:not(.wp-admin) .wcd-toast {
        bottom: calc(var(--wcd-mobile-tab-h) + var(--wcd-mobile-cta-h) + var(--wcd-mobile-safe) + 16px);
        max-width: calc(100vw - 24px);
    }
}

/* ========================================
   Admin template editor mode
   ======================================== *
 * Used when shop owner is creating/editing a fixed-design template via
 * wp-admin → 固定デザイン → 編集. Full editing tools are available, but
 * cart/pricing UI is suppressed since nothing is being purchased. */
.wcd-admin-editing .wcd-btn-save,        /* user "デザインを保存" button */
.wcd-admin-editing .wcd-btn-share,       /* user "リンク共有" button */
.wcd-admin-editing .wcd-btn-new-design,  /* user "新規作成" button */
.wcd-admin-editing .wcd-btn-cart-link,   /* "買い物かごへ" */
.wcd-admin-editing #wcd-saved-designs-section,
.wcd-admin-editing .wcd-panel-section:has(h4:only-child),
.wcd-admin-editing .wcd-autosave-prompt,
.wcd-admin-editing .wcd-order-list,
.wcd-admin-editing #wcd-add-size,        /* + この内容を追加 */
.wcd-admin-editing #wcd-color-swatches,  /* color selection handled by template UX */
.wcd-admin-editing .wcd-panel-section.wcd-price-panel,
.wcd-admin-editing .wcd-panel-section:has(#wcd-quantity-selector),
.wcd-admin-editing .wcd-panel-section:has(#wcd-qty-input) {
    display: none !important;
}
/* Hide the whole right sidebar in admin-edit mode — color/size/qty all live in
   the customer-facing view; the admin just needs the canvas + tools + print
   method selector (if multiple methods) + view tabs. */
.wcd-admin-editing .wcd-sidebar {
    display: none;
}
.wcd-admin-editing .wcd-layout {
    /* canvas gets full remaining width */
    flex-wrap: wrap;
}

/* ========================================
   Toast notifications (replaces alert())
   ======================================== */
.wcd-toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: min(360px, calc(100vw - 32px));
}

.wcd-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: var(--wcd-bg, #fff);
    border: 1px solid var(--wcd-border, #e5e7eb);
    border-left-width: 4px;
    border-radius: var(--wcd-radius, 6px);
    box-shadow: var(--wcd-shadow-lg, 0 4px 16px rgba(0,0,0,0.12));
    font-size: 13px;
    line-height: 1.45;
    color: var(--wcd-text, #111827);
    cursor: pointer;
    animation: wcd-toast-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.wcd-toast.wcd-toast-out {
    animation: wcd-toast-out 200ms ease-in forwards;
}

.wcd-toast-msg {
    flex: 1 1 auto;
    white-space: pre-line; /* allow \n in message */
    word-break: break-word;
}

.wcd-toast-close {
    flex: 0 0 auto;
    padding: 0 4px;
    margin: -2px -4px 0 0;
    background: transparent;
    border: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--wcd-text-muted, #6b7280);
    cursor: pointer;
    border-radius: 4px;
}
.wcd-toast-close:hover {
    color: var(--wcd-text, #111827);
    background: var(--wcd-border-light, #f3f4f6);
}

/* Per-type accents: left border + subtle tinted background */
.wcd-toast-error {
    border-left-color: var(--wcd-danger, #ef4444);
    background: #fef2f2;
}
.wcd-toast-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}
.wcd-toast-info {
    border-left-color: var(--wcd-primary, #3b82f6);
    background: var(--wcd-primary-soft, #eff6ff);
}
.wcd-toast-success {
    border-left-color: var(--wcd-success, #10b981);
    background: #ecfdf5;
}

@keyframes wcd-toast-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes wcd-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(12px); }
}

/* Cute busy indicator for uploads, analysis, and print-data generation */
.wcd-busy-overlay {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 99998;
    transform: translate(-50%, 14px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.wcd-busy-overlay.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.wcd-busy-card {
    min-width: min(340px, calc(100vw - 28px));
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(147, 197, 253, 0.7);
    border-radius: 18px;
    background:
        radial-gradient(circle at 16% 20%, rgba(252, 231, 243, 0.92), transparent 28%),
        radial-gradient(circle at 84% 24%, rgba(219, 234, 254, 0.95), transparent 30%),
        rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    color: var(--wcd-text, #111827);
    backdrop-filter: blur(10px);
}

.wcd-busy-orbit {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #eff6ff, #fdf2f8);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.14);
    animation: wcd-busy-float 1.8s ease-in-out infinite;
}

.wcd-busy-orbit span {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--wcd-primary, #3b82f6);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.28);
    animation: wcd-busy-pop 1.05s ease-in-out infinite;
}

.wcd-busy-orbit span:nth-child(1) {
    left: 8px;
    top: 9px;
    background: #60a5fa;
}

.wcd-busy-orbit span:nth-child(2) {
    right: 8px;
    top: 9px;
    background: #f472b6;
    animation-delay: 0.16s;
}

.wcd-busy-orbit span:nth-child(3) {
    left: 15px;
    bottom: 8px;
    background: #34d399;
    animation-delay: 0.32s;
}

.wcd-busy-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.wcd-busy-title {
    color: var(--wcd-text, #111827);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.wcd-busy-detail {
    color: var(--wcd-text-muted, #6b7280);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcd-busy-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-right: 2px;
}

.wcd-busy-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #93c5fd;
    animation: wcd-busy-dot 1s ease-in-out infinite;
}

.wcd-busy-dots span:nth-child(2) {
    animation-delay: 0.14s;
    background: #f9a8d4;
}

.wcd-busy-dots span:nth-child(3) {
    animation-delay: 0.28s;
    background: #86efac;
}

@keyframes wcd-busy-float {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes wcd-busy-pop {
    0%, 100% { transform: scale(0.82); opacity: 0.7; }
    50% { transform: scale(1.18); opacity: 1; }
}

@keyframes wcd-busy-dot {
    0%, 100% { transform: translateY(0); opacity: 0.55; }
    50% { transform: translateY(-5px); opacity: 1; }
}

@media (max-width: 640px) {
    .wcd-toast-container {
        right: 8px;
        left: 8px;
        bottom: 8px;
        max-width: none;
    }
    .wcd-toast {
        font-size: 12px;
        padding: 10px 12px;
    }
    .wcd-busy-overlay {
        left: 10px;
        right: 10px;
        bottom: calc(var(--wcd-mobile-tab-h, 64px) + var(--wcd-mobile-cta-h, 64px) + var(--wcd-mobile-safe, 0px) + 10px);
        transform: translateY(14px) scale(0.98);
    }
    .wcd-busy-overlay.is-visible {
        transform: translateY(0) scale(1);
    }
    .wcd-busy-card {
        min-width: 0;
        width: 100%;
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 11px 12px;
        border-radius: 16px;
    }
    .wcd-busy-orbit {
        width: 36px;
        height: 36px;
    }
    .wcd-busy-title {
        font-size: 13px;
    }
    .wcd-busy-detail {
        font-size: 11px;
    }
}
