/* ═══ Editor-Calculadora de Jardines Verticales ═══ */

/* Editor page: no footer, no scroll, tight spacing */
body.em-editor-page {
    overflow: hidden !important;
}

body.em-editor-page .site-footer,
body.em-editor-page footer.site-footer,
body.em-editor-page .ast-footer-overlay,
body.em-editor-page footer,
body.em-editor-page .site-below-footer-wrap,
body.em-editor-page #colophon,
body.em-editor-page .ast-small-footer,
body.em-editor-page .ast-footer-copyright,
body.em-editor-page .ast-builder-footer-grid-columns,
body.em-editor-page .em-footer,
body.em-editor-page [class*="footer"]:not(.em-editor-topbar):not(.em-calc-footer):not(.em-tutorial-footer) {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.em-editor-page .entry-header.ast-no-thumbnail {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0.7rem !important;
    padding-bottom: 0 !important;
}

/* Space between topbar (inside entry-header) and the step content below it.
   Step 3 has its own full-bleed editor and shouldn't get this top spacing. */
body.em-editor-page .em-editor-step-content.em-step-visible:not(.em-step-3) {
    margin-top: clamp(2rem, 5vh, 4rem);
}

body.em-editor-page .ast-desktop-header {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

body.em-editor-page #primary {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.em-editor-page .site-content > .ast-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body.em-editor-page .ast-separate-container .ast-article-single {
    padding-top: 0 !important;
}

.em-editor-wrap {
    max-width: 100%;
    padding: 0;
}

/* ─── Topbar: steps + disclaimer ─── */
.em-editor-topbar {
    display: flex;
    align-items: center;
    margin-top: clamp(1rem, 3vh, 2.5rem);
    margin-bottom: clamp(1.5rem, 4vh, 3rem);
    border-bottom: 2px solid #e0e0e0;
    position: relative;
}

.em-editor-disclaimer {
    color: #aaa;
    font-size: 0.75rem;
    font-style: normal;
    white-space: nowrap;
    padding: 0.5rem 0;
    line-height: 1.4;
    margin: 0;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* ─── Progress Steps ─── */
.em-editor-steps {
    display: flex;
    gap: 0;
    flex: 1;
    justify-content: center;
}

.em-step {
    padding: 0.8rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-step:hover { color: #2D6A4F; }

.em-step.em-step-active {
    color: #2D6A4F;
    border-bottom-color: #2D6A4F;
}

.em-step.em-step-done {
    color: #2D6A4F;
}

.em-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.3s;
}

.em-step.em-step-active .em-step-num {
    background: #2D6A4F;
    color: #fff;
}

.em-step.em-step-done .em-step-num {
    background: #2D6A4F;
    color: #fff;
}

/* ─── Step Content ─── */
.em-editor-step-content {
    display: none;
}

.em-editor-step-content.em-step-visible {
    display: block;
}

/* ─── Step 1: Shape + Frame Selector (two-column like step 2) ─── */
.em-shape-selector {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 2rem;
    align-items: stretch;
    height: var(--em-step1-h, calc(100vh - 280px));
    min-height: 380px;
}

.em-step1-sidebar {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0 var(--em-step1-bottom-pad, 1.2rem);
    /* extra left padding so the scrollbar (placed on the left via the rtl trick)
       doesn't sit flush against the controls */
    padding-left: 14px;
    gap: 1.2rem;
    height: 100%;
    overflow-y: auto;
    direction: rtl;
}
.em-step1-sidebar > * { direction: ltr; }

.em-step1-hint {
    font-size: 1.05rem;
    color: #333;
    line-height: 1.5;
    text-align: left;
}

.em-step1-hint strong { color: #2D6A4F; font-weight: 600; }
.em-step1-hint em { color: #2D6A4F; font-style: normal; font-weight: 600; }

.em-step1-warning {
    display: none;
    border: 1px solid #e0c787;
    background: #fff8e6;
    color: #6b4f0a;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    line-height: 1.4;
}
.em-step1-warning.em-warning-visible { display: block; }
.em-step1-warning strong { color: #b07b00; }
.em-step1-warning em { color: #b07b00; font-style: normal; font-weight: 600; }

.em-frame-selector {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    background: #fafafa;
}

.em-frame-selector-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1A3C2B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.7rem;
}

.em-frame-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.em-frame-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.3rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    color: #555;
    transition: all 0.2s;
    text-align: center;
}

.em-frame-btn:hover:not(:disabled) {
    border-color: #2D6A4F;
    color: #1A3C2B;
}

.em-frame-btn.em-frame-active {
    border-color: #2D6A4F;
    background: #f0f7f3;
    color: #1A3C2B;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(45,106,79,0.15);
}

.em-frame-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f5f5f5;
}

.em-frame-swatch {
    width: 100%;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.08);
}

.em-frame-swatch-none {
    background:
        repeating-linear-gradient(
            45deg,
            transparent 0 4px,
            rgba(150,150,150,0.45) 4px 5px
        ),
        #fff;
}

.em-frame-swatch-white {
    background:
        linear-gradient(to bottom,
            #1A3C2B 0, #1A3C2B 3px,
            #fff    3px, #fff    19px,
            #1A3C2B 19px, #1A3C2B 22px);
}

.em-frame-swatch-black { background: #111; }

.em-frame-swatch-wood {
    background:
        repeating-linear-gradient(90deg,
            #6b4226 0 3px, #8b5a2b 3px 8px, #6b4226 8px 11px, #a0703f 11px 18px),
        #8b5a2b;
}

.em-frame-price {
    font-size: 0.72rem;
    color: #2D6A4F;
    font-weight: 600;
}

.em-frame-note {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: #b07b00;
    line-height: 1.35;
    min-height: 0;
}

.em-frame-note:empty { display: none; }

.em-step1-next {
    margin-top: auto !important;
    width: 100%;
}

/* Disabled state for Avanzar — gray and unclickable until all required
   step-1 controls have been actively touched. */
.em-step1-next:disabled,
.em-step1-next.em-disabled {
    background: #c8d0cb !important;
    color: #6f7a73 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    box-shadow: none !important;
    opacity: 1;
}

/* Toast shown when a rigid material (mirror, glass) is dropped on a zone
   that geometrically can't accept it (rectangular sheet won't fit inside the
   garden silhouette covering the zone). */
.em-rigid-warn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #c0392b;
    color: #fff;
    padding: 14px 22px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: 0 6px 22px rgba(0,0,0,0.22);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    max-width: 520px;
    text-align: center;
    pointer-events: none;
}
.em-rigid-warn.em-rigid-warn-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Generic gold pulse used to highlight the next pending step-1 control. */
.em-shimmer-target {
    position: relative;
    border-radius: 10px;
}
.em-shimmer-target.em-shine {
    animation: emGoldPulse 1.4s ease-out;
}
@keyframes emGoldPulse {
    0%   { box-shadow: 0 0 0 0 rgba(212, 165, 70, 0); }
    25%  { box-shadow: 0 0 0 5px rgba(212, 165, 70, 0.55), 0 0 14px 3px rgba(255, 215, 130, 0.45); }
    100% { box-shadow: 0 0 0 14px rgba(212, 165, 70, 0), 0 0 24px 14px rgba(255, 215, 130, 0); }
}

.em-shapes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    place-items: center;
    gap: clamp(0.8rem, 2vw, 2rem);
    height: 100%;
    width: 100%;
    margin: 0;
}

.em-shape-btn {
    width: var(--em-shape-btn-w, auto);
    height: var(--em-shape-btn-h, auto);
    max-width: 100%;
    max-height: 100%;
}

/* Circular dim group: label on its own row, badges below */
.em-dim-circle-group {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.4rem !important;
}

.em-dim-label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

/* Circular diameter selector (replaces the free input when shape=circle) */
.em-circle-diameters {
    display: none;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
}

.em-circle-diameters.em-visible { display: flex; }

/* Hide area display (kept in DOM for legacy refs but not shown) */
.em-area-hidden { display: none !important; }

/* Custom shape group: stack everything vertically, full-width controls */
.em-dim-custom-group {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
}

/* Image-trace upload UI (Personalizada + autotrace) */
.em-trace-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1.5px dashed #aaa;
    border-radius: 8px;
    color: #444;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    width: 100%;
}
.em-trace-upload-label:hover { border-color: #2D6A4F; color: #2D6A4F; }
.em-trace-upload-label input[type="file"] { display: none; }
.em-trace-upload-label svg { flex-shrink: 0; }

.em-trace-status {
    font-size: 0.8rem;
    color: #666;
    min-height: 1em;
}
.em-trace-status.em-trace-error { color: #c00; }
.em-trace-status.em-trace-ok { color: #2D6A4F; }

.em-trace-controls {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.7rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}
.em-trace-controls.em-trace-hidden { display: none; }
.em-trace-controls label {
    font-size: 0.85rem;
    color: #333;
}
.em-trace-controls input[type="range"] {
    width: 100%;
    accent-color: #2D6A4F;
}
.em-trace-hint {
    margin: 0;
    font-size: 0.78rem;
    color: #888;
    line-height: 1.3;
    font-style: italic;
}

/* Main intro text — same look as the step-1 hint above (regular, not italic) */
.em-trace-intro {
    margin: 0;
    font-size: 1.05rem;
    color: #333;
    line-height: 1.5;
}

/* ─── Letters subsystem UI ─── */
/* Specificity override: .em-dim-group input { width: 80px } would otherwise win */
#em-dim-letters .em-letters-text-input {
    width: 100%;
}
.em-letters-text-input {
    display: block;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid #d0d0d0;
    border-radius: 10px;
    font-size: 1.05rem;
    color: #1A3C2B;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.em-letters-text-input:focus {
    outline: none;
    border-color: #2D6A4F;
}
.em-letters-font-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.em-letters-font-picker {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
.em-letters-font-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid #d0d0d0;
    border-radius: 10px;
    background: #fff;
    color: #1A3C2B;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.em-letters-font-trigger:hover,
.em-letters-font-trigger[aria-expanded="true"] {
    border-color: #2D6A4F;
}
.em-letters-font-trigger-label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.em-letters-font-trigger svg {
    flex-shrink: 0;
    color: #888;
}
.em-letters-font-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1.5px solid #d0d0d0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 4px 0;
    z-index: 50;
}
.em-letters-font-panel[hidden] { display: none; }
.em-letters-font-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.9rem;
    background: transparent;
    border: 0;
    color: #1A3C2B;
    font-size: 1.1rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.em-letters-font-item:hover { background: #f0f6f1; }
.em-letters-font-item-active {
    background: #e6efe7;
    box-shadow: inset 3px 0 0 #2D6A4F;
}
.em-letters-upload-label {
    flex: 0 0 auto;
    width: auto;
    padding: 0.5rem 0.7rem;
}

/* Locked Ancho input — visible but not editable */
.em-dim-row-locked {
    color: #666;
}
.em-dim-row-locked input[readonly] {
    background: #f5f5f5;
    color: #666;
    cursor: default;
}
.em-dim-auto-hint {
    font-size: 0.78rem;
    color: #999;
    font-style: italic;
    margin-left: 0.3rem;
}

/* Letras card — SVG vertically centered (so text doesn't drift up as it shrinks),
   "Letras" label anchored to the bottom (so it never moves vertically).
   ViewBox matches text aspect ratio so there is never letterboxing inside the SVG. */
.em-shape-btn[data-shape="letters"] {
    justify-content: center;
}
.em-shape-btn[data-shape="letters"] > span {
    position: absolute;
    bottom: clamp(0.6rem, 1.5vh, 1.4rem);
    left: 0;
    right: 0;
    text-align: center;
    margin: 0;
}
.em-shape-btn[data-shape="letters"] svg {
    width: auto;
    height: var(--em-shape-svg-h, clamp(40px, 6vmin, 75px));
    max-width: 100%;
}
.em-shape-btn[data-shape="letters"].em-shape-letters-wide {
    grid-column: span 2;
    width: 100%;
    max-width: 100%;
}
/* Wide state — let the SVG grow taller too so the wider card is actually used */
.em-shape-btn[data-shape="letters"].em-shape-letters-wide svg {
    width: 100%;
    height: auto;
    max-height: clamp(80px, 14vmin, 160px);
}


/* Autotrace section: 2-column like freehand. Both columns are constrained to
   the available step-1 height so the preview never spills below the viewport. */
#em-autotrace-section {
    display: grid;
    grid-template-columns: 265px 1fr;
    gap: 2rem;
    align-items: stretch;
    height: var(--em-step1-h, calc(100vh - 280px));
    min-height: 380px;
    max-height: calc(100vh - 200px);
}
.em-autotrace-sidebar {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    gap: 1rem;
    overflow-y: auto;
}
.em-autotrace-sidebar .em-btn-next { margin-top: auto; }
.em-autotrace-hint {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.5;
}
.em-autotrace-hint strong { color: #2D6A4F; }
.em-autotrace-preview {
    background: #e8e8e4;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    height: 100%;
    max-height: 100%;
}
.em-autotrace-preview svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

/* Thumb fine-tune popup (Step 2) */
.em-thumb-popup {
    position: absolute;
    background: #fff;
    border: 1px solid #d4ddd8;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    padding: 0.9rem 1rem;
    width: 250px;
    z-index: 99998;
    font-size: 0.85rem;
    font-family: inherit;
}
.em-thumb-popup-title {
    font-weight: 700;
    color: #1A3C2B;
    margin-bottom: 0.7rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.em-thumb-popup-row {
    margin-bottom: 0.65rem;
}
.em-thumb-popup-row label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    color: #444;
}
.em-thumb-popup-val { color: #2D6A4F; font-weight: 600; }
.em-thumb-popup-row input[type="range"] { width: 100%; accent-color: #2D6A4F; }
.em-thumb-popup-toggle label {
    display: flex; align-items: center; gap: 0.4rem; cursor: pointer; margin-bottom: 0;
}
.em-thumb-popup-btns {
    display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem;
}
.em-thumb-popup-btn {
    padding: 0.3rem 0.55rem;
    border: 1px solid #d4ddd8;
    background: #fff;
    border-radius: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #555;
    font-family: inherit;
}
.em-thumb-popup-btn:hover { border-color: #2D6A4F; color: #2D6A4F; }
.em-thumb-popup-btn.em-active {
    background: #2D6A4F; color: #fff; border-color: #2D6A4F;
}
.em-thumb-popup-regen {
    width: 100%;
    padding: 0.55rem;
    background: #f0f7f3;
    border: 1px solid #2D6A4F;
    color: #2D6A4F;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}
.em-thumb-popup-regen:hover { background: #2D6A4F; color: #fff; }

.em-circle-diam-btn {
    padding: 0.5rem 0.9rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}

.em-circle-diam-btn:hover { border-color: #2D6A4F; color: #1A3C2B; }

.em-circle-diam-btn.em-circle-diam-active {
    border-color: #2D6A4F;
    background: #f0f7f3;
    color: #1A3C2B;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(45,106,79,0.15);
}

.em-circle-diam-empty {
    font-size: 0.85rem;
    color: #b07b00;
    font-style: italic;
}

.em-shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.3rem, 1vh, 0.8rem);
    padding: clamp(0.6rem, 1.5vh, 1.4rem) clamp(0.8rem, 2vw, 2rem);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: clamp(0.8rem, 1.1vw, 1rem);
    color: #666;
}

.em-shape-btn { position: relative; overflow: hidden; }

.em-shape-btn svg {
    width: var(--em-shape-svg-w, clamp(48px, 7vmin, 90px));
    height: var(--em-shape-svg-h, clamp(40px, 6vmin, 75px));
    transition: opacity 0.5s;
}

.em-shape-btn-photos {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.em-shape-btn-photos.em-photos-visible { opacity: 1; }

.em-shape-btn-photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.7s ease-in-out;
}

.em-shape-btn-photo.em-photo-active { opacity: 1; }

.em-shape-btn.em-shape-photos-on svg { opacity: 0; }
.em-shape-btn.em-shape-photos-on > span { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6); position: relative; z-index: 2; }

.em-shape-btn:hover {
    border-color: #2D6A4F;
    color: #2D6A4F;
}

.em-shape-btn.em-shape-active {
    border-color: #2D6A4F;
    background: #f0f7f3;
    color: #1A3C2B;
    font-weight: 600;
}

.em-dimensions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
    margin: 0;
}

/* Medidas group: label on its own row, then Ancho on one row, Alto on the next */
.em-dim-rect-group,
.em-dim-arch-group {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.4rem !important;
}

.em-dim-rect-group .em-dim-row,
.em-dim-arch-group .em-dim-row,
.em-dim-custom-group .em-dim-row {
    display: grid;
    grid-template-columns: 60px 100px auto;
    align-items: center;
    column-gap: 0.5rem;
}

.em-dim-rect-group .em-dim-row input,
.em-dim-arch-group .em-dim-row input,
.em-dim-custom-group .em-dim-row input {
    width: 100%;
}

.em-dim-custom-group .em-dim-custom-msg {
    margin: 0;
    padding: 0.7rem 0.9rem;
    border: 1px dashed #d4ddd8;
    border-radius: 8px;
    background: #f8faf8;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
    font-style: italic;
}

.em-dim-group {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.em-dim-group.em-dim-hidden {
    display: none;
}

.em-dim-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: #333;
}

.em-dim-group input {
    width: 80px;
    padding: 0.4rem 0.6rem;
    border: 1.5px solid #d4ddd8;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
    font-family: inherit;
}

.em-dim-group input:focus {
    outline: none;
    border-color: #2D6A4F;
    box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}

.em-area-display {
    font-size: 1.1rem;
    color: #2D6A4F;
}

.em-area-display strong {
    font-size: 1.3rem;
}

/* ─── Step 2: Template Grid ─── */
.em-step-2 {
    text-align: center;
}

.em-step-2 h3 {
    color: #1A3C2B;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

/* Two-column layout: sidebar (toggle + hint + actions) | grid */
#em-templates-section {
    display: grid;
    grid-template-columns: 265px 1fr;
    gap: 2rem;
    align-items: stretch;
}

.em-templates-sidebar {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    gap: 1rem;
}

.em-templates-sidebar .em-draw-modes {
    max-width: none;
    margin: 0;
}

.em-templates-hint {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.6;
    text-align: left;
    flex: 1;
}

.em-templates-hint strong {
    color: #2D6A4F;
}

.em-templates-hint em {
    color: #2D6A4F;
    font-style: normal;
    font-weight: 600;
}

.em-templates-actions {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.em-templates-actions .em-btn {
    width: 100%;
    margin: 0 !important;
}

.em-templates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.6rem, 1.2vw, 1.5rem);
    width: 100%;
    margin: 0;
    align-content: start;
}

.em-template-thumb {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    aspect-ratio: 3/2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    width: 100%;
    overflow: hidden;
}

.em-template-thumb:hover {
    border-color: #2D6A4F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.em-template-thumb.em-template-active {
    border-color: #2D6A4F;
    background: #f0f7f3;
    box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
}

.em-template-thumb svg {
    width: 100%;
    height: 100%;
}

/* ─── Step 2: Mode Toggle ─── */
.em-draw-modes {
    display: flex;
    justify-content: stretch;
    gap: 0;
    margin-bottom: 1.5rem;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 3px;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.em-draw-mode-btn {
    flex: 1;
    padding: 0.45rem 0.4rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.em-draw-mode-btn.em-draw-mode-active {
    background: #fff;
    color: #1A3C2B;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.em-draw-mode-btn:hover:not(.em-draw-mode-active) {
    color: #2D6A4F;
}

/* ─── Step 2: Freehand Drawing ─── */
.em-freehand-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.em-freehand-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    border: 1.5px dashed #aaa;
    border-radius: 8px;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.em-freehand-upload-label:hover {
    border-color: #2D6A4F;
    color: #2D6A4F;
}

.em-freehand-upload-label input[type="file"] {
    display: none;
}

.em-ref-name {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* ─── Reference image fit toggle ─── */
.em-ref-fit-toggle {
    display: none;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #666;
}

.em-ref-fit-toggle.em-ref-fit-visible {
    display: inline-flex;
}

.em-ref-fit-toggle label {
    cursor: pointer;
    padding: 0.3rem 0.7rem;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.em-ref-fit-toggle label:hover {
    border-color: #2D6A4F;
    color: #2D6A4F;
}

.em-ref-fit-toggle input[type="radio"] {
    display: none;
}

.em-ref-fit-toggle input[type="radio"]:checked + span {
    background: #2D6A4F;
    color: #fff;
    border-color: #2D6A4F;
}

.em-ref-fit-label {
    padding: 0.3rem 0.7rem;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.em-ref-fit-label:hover {
    border-color: #2D6A4F;
}

.em-ref-fit-label.em-ref-fit-active {
    background: #2D6A4F;
    color: #fff;
    border-color: #2D6A4F;
}

/* em-draw-canvas styles now in #em-freehand-section context above */

/* ─── Freehand: two-column layout ─── */
#em-freehand-section {
    grid-template-columns: 265px 1fr;
    gap: 2rem;
    align-items: stretch;
}

.em-freehand-sidebar {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    justify-content: space-between;
}

.em-freehand-sidebar .em-draw-modes {
    max-width: none;
    margin: 0;
}

.em-freehand-hint {
    font-size: 1rem;
    color: #333;
    line-height: 1.75;
    text-align: left;
}

.em-freehand-hint strong {
    color: #2D6A4F;
}

#em-freehand-section #em-draw-canvas {
    width: 100%;
    height: 100%;
    background: #e8e8e4;
    border-radius: 12px;
    border: none;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.em-freehand-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.em-freehand-status {
    font-size: 1.1rem;
    color: #2D6A4F;
    font-weight: 700;
}

.em-freehand-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: center;
    width: 100%;
}

.em-freehand-actions .em-btn {
    flex: 1;
}

.em-btn-freehand-next {
    margin-top: 1.2rem !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
    width: 100%;
}

.em-btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
}

/* ─── Buttons ─── */
.em-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #2D6A4F;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.em-btn:hover {
    background: #1A3C2B;
    transform: translateY(-1px);
}

.em-btn-outline {
    background: transparent;
    border: 2px solid #2D6A4F;
    color: #2D6A4F;
    margin-right: 1rem;
}

.em-btn-outline:hover {
    background: #2D6A4F;
    color: #fff;
}

.em-btn-submit {
    width: 100%;
    padding: 0.85rem;
    font-size: 1.05rem;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

/* Subtle gold shimmer that sweeps once when the .em-shine class is toggled on */
.em-btn-submit::after {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(115deg,
        rgba(255, 215, 130, 0) 0%,
        rgba(255, 215, 130, 0) 35%,
        rgba(255, 230, 170, 0.55) 50%,
        rgba(255, 215, 130, 0) 65%,
        rgba(255, 215, 130, 0) 100%);
    pointer-events: none;
    transform: skewX(-18deg);
    opacity: 0;
}
.em-btn-submit.em-shine::after {
    animation: emGoldShine 1.4s ease-out;
}
@keyframes emGoldShine {
    0%   { left: -75%; opacity: 0; }
    15%  { opacity: 1; }
    100% { left: 125%; opacity: 0; }
}

/* ─── Step 2: Spacing + Upload tooltip ─── */
.em-step2-spacer {
    height: 2rem;
}

.em-freehand-upload-label {
    position: relative;
}

.em-freehand-upload-label[title]:hover::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1A3C2B;
    color: #fff;
    font-size: 0.75rem;
    font-style: normal;
    line-height: 1.4;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: normal;
    width: 260px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
}

.em-freehand-upload-label svg {
    vertical-align: -2px;
}

.em-draw-undo-icon {
    vertical-align: -2px;
}

/* ─── Step 3: Main Editor Layout (fixed canvas, scrollable columns) ─── */
.em-editor-main {
    display: grid;
    grid-template-columns: 242px 1fr 280px;
    gap: 0;
    min-height: 300px;
    overflow: hidden;
}

/* ─── Palette (Left) — scrolleable with fixed bottom actions ─── */
.em-palette {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid #e8e8e8;
    position: relative;
    min-height: 0;
}

.em-palette-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    direction: rtl;
}

.em-palette-scroll > * {
    direction: ltr;
}

.em-palette-fade {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, #ffffff 100%);
    pointer-events: none;
    z-index: 5;
}

.em-palette-actions { position: relative; }

.em-palette-actions {
    flex-shrink: 0;
    padding: 0.6rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.em-palette-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    margin: 0 0 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e0e0e0;
}

.em-swatches {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.em-swatch {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: grab;
    transition: all 0.2s;
    background: transparent;
    font-family: inherit;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.em-swatch:hover {
    background: #f0f7f3;
    border-color: #d4ddd8;
}


.em-swatch:active {
    cursor: grabbing;
}

.em-swatch.em-swatch-dragging {
    opacity: 0.35;
}

/* Wrapper around imgWrap + colorDot — no overflow clip */
.em-swatch-thumb-container {
    position: relative;
    flex-shrink: 0;
}

.em-swatch-img-wrap {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: default;
}

.em-swatch-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #d4ddd8;
    display: block;
}

/* Texture used as thumbnail: show at native resolution, cropped to circle */
.em-swatch-img.em-swatch-img-zoomed {
    object-fit: none;
    object-position: center;
}

/* ─── Fixed hover preview (generated by JS) ─── */
.em-thumb-preview {
    position: fixed;
    z-index: 99998;
    pointer-events: auto;
}

.em-thumb-preview-circle {
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    border: 3px solid #d4ddd8;
    width: 56px;
    height: 56px;
    transition: width 0.25s ease-out, height 0.25s ease-out;
}

.em-thumb-preview.em-thumb-expanded .em-thumb-preview-circle {
    width: 168px;
    height: 168px;
}

.em-thumb-preview-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.em-thumb-preview-circle img.em-swatch-img-zoomed {
    object-fit: none;
    object-position: center;
}

.em-thumb-preview .em-preview-color-dot {
    position: absolute;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 11;
    padding: 0;
    /* Start at palette dot size, transition to enlarged */
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    transition: width 0.25s ease-out, height 0.25s ease-out, bottom 0.25s ease-out, right 0.25s ease-out, border-width 0.25s ease-out;
}

.em-thumb-preview.em-thumb-expanded .em-preview-color-dot {
    bottom: 4px;
    right: 4px;
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.em-thumb-preview .em-preview-color-dot:hover {
    transform: scale(1.15);
}

.em-swatch-placeholder {
    background: #e8e8e8;
}

.em-swatch-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

/* ─── Flower Color Dot (inside thumb-container, not clipped) ─── */
.em-swatch-color-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s;
    z-index: 11;
}

.em-swatch-color-dot:hover {
    transform: scale(1.2);
}

/* ─── Color Picker Popup (hover-based) ─── */
.em-color-popup {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 24px;
    padding: 6px 14px 6px 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    z-index: 99999;
    animation: emPopupIn 0.15s ease-out;
}

@keyframes emPopupIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.em-color-popup-label {
    font-size: 0.72rem;
    color: #999;
    font-weight: 600;
    white-space: nowrap;
    margin-right: 2px;
}

.em-color-popup-options {
    display: flex;
    gap: 5px;
}

.em-color-popup-opt {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
    background: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

.em-color-popup-opt img {
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none; /* let mouse events bubble to the button */
}

.em-color-popup-opt span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.em-color-popup-opt:hover {
    transform: scale(1.15);
    border-color: #2D6A4F;
}

.em-color-popup-opt.em-color-popup-active {
    border-color: #2D6A4F;
    box-shadow: 0 0 0 2px rgba(45,106,79,0.25);
}

/* Enhanced popup (when triggered from hover preview) */
.em-color-popup.em-color-popup-enhanced {
    padding: 8px 16px 8px 12px;
    border-radius: 32px;
}

.em-color-popup-enhanced .em-color-popup-opt {
    width: 56px;
    height: 56px;
    overflow: hidden;
}

.em-color-popup-enhanced .em-color-popup-opt img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.em-color-popup-enhanced .em-color-popup-opt img.em-popup-tex-zoomed {
    object-fit: none;
    object-position: center;
}

/* ─── Drag Ghost ─── */
.em-drag-ghost {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    opacity: 0.9;
}

.em-drag-ghost img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.em-drag-ghost-placeholder {
    width: 100%;
    height: 100%;
    background: #ccc;
}

.em-dragging {
    cursor: grabbing !important;
}

.em-dragging * {
    cursor: grabbing !important;
}

/* ─── Clear Buttons (inside palette bottom) ─── */
.em-clear-btn {
    width: 100%;
    padding: 0.55rem 1rem;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.em-clear-btn:hover {
    border-color: #c00;
    color: #c00;
    background: #fff8f8;
}

.em-btn-auto-assign {
    width: 100%;
    padding: 0.55rem 1rem;
    background: #2D6A4F;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    margin-bottom: 6px;
}
.em-btn-auto-assign:hover { background: #1A3C2B; }

/* ─── Canvas (Center) — fijo, no scroll ─── */
.em-canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    padding: 0.5rem;
    overflow: hidden;
    min-height: 0;
}

#em-editor-canvas {
    max-width: 100%;
    max-height: 100%;
    overflow: visible;
}

.em-canvas-hint {
    position: absolute;
    bottom: 0.8rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #999;
    white-space: nowrap;
}

/* Zone styles */
.em-zone {
    stroke: #ccc;
    stroke-width: 0.5;
    cursor: pointer;
    transition: stroke 0.15s, stroke-width 0.15s;
}

.em-zone:hover {
    stroke: #2D6A4F;
    stroke-width: 1;
}

.em-zone.em-zone-selected {
    stroke: #2D6A4F;
    stroke-width: 1.25;
    stroke-dasharray: 4 2;
}

.em-zone.em-zone-droppable {
    stroke: #2D6A4F;
    stroke-width: 0.75;
    stroke-dasharray: 3 1.5;
}

.em-zone.em-zone-hover {
    stroke: #2D6A4F;
    stroke-width: 1.5;
    stroke-dasharray: none;
}

.em-zone-label {
    fill: #999;
    font-size: 14px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    user-select: none;
}

.em-zone-label.em-zone-label-hidden {
    display: none;
}

.em-garden-outline {
    fill: none;
    stroke: #1A3C2B;
    stroke-width: 2;
    pointer-events: none;
}

/* ─── Calculator (Right) — scroll body, fixed footer ─── */
.em-calculator {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid #e8e8e8;
    overflow: hidden;
}

.em-calculator h4 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1A3C2B;
    margin: 0;
    padding: 1rem 1rem 0.5rem;
    border-bottom: 2px solid #2D6A4F;
}

.em-calc-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem;
}

.em-calc-empty {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

.em-calc-zone {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
}

.em-calc-zone:last-child {
    border-bottom: none;
}

.em-calc-zone-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.3rem;
}

.em-calc-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.82rem;
    color: #333;
    padding: 0.1rem 0;
}

.em-calc-line-name {
    flex: 1;
}

.em-calc-line-detail {
    color: #999;
    font-size: 0.75rem;
    margin: 0 0.5rem;
}

.em-calc-line-price {
    font-weight: 600;
    color: #2D6A4F;
    white-space: nowrap;
}

.em-calc-line-overlay .em-calc-line-name {
    padding-left: 0.8rem;
    font-size: 0.78rem;
    color: #8B6914;
}

.em-calc-line-overlay .em-calc-line-price {
    color: #8B6914;
}

.em-calc-extras {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #ddd;
}

.em-calc-line-extra .em-calc-line-name {
    color: #666;
    font-style: italic;
}

.em-calc-footer {
    padding: 0.8rem 1rem;
    border-top: 2px solid #1A3C2B;
    background: #fff;
    flex-shrink: 0;
}

.em-calc-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}

.em-calc-total span {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1A3C2B;
}

.em-calc-total strong {
    font-size: 1.4rem;
    color: #1A3C2B;
}

.em-calc-note {
    font-size: 0.72rem;
    color: #999;
    text-align: center;
    margin: 0.3rem 0 0;
}

/* ─── Tutorial Popups ─── */
.em-tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99990;
    display: none;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.em-tutorial-overlay.em-tutorial-active {
    display: block;
}

.em-tutorial-spotlight {
    position: fixed;
    pointer-events: none;
    z-index: 99991;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.6), 0 0 15px rgba(45,106,79,0.5);
    transition: all 0.3s ease-out;
    display: none;
}

.em-tutorial-highlight {
    position: relative !important;
    z-index: 99992 !important;
    pointer-events: auto !important;
    box-shadow: 0 0 0 3px #2D6A4F !important;
    border-radius: 8px;
}

.em-tutorial-tooltip {
    position: fixed;
    z-index: 99993;
    background: #1A3C2B;
    border: 2px solid #2D6A4F;
    border-radius: 14px;
    padding: 20px 24px;
    width: 300px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: #fff;
}

.em-tutorial-tooltip.em-tutorial-visible {
    display: block;
    opacity: 1;
}

.em-tutorial-title {
    color: #a8d5ba;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.em-tutorial-text {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 16px;
    color: #dde8e0;
}

.em-tutorial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.em-tutorial-step-count {
    font-size: 0.72rem;
    color: #8aaa96;
}

.em-tutorial-actions {
    display: flex;
    gap: 8px;
}

.em-tutorial-skip {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid #4a7a5f;
    border-radius: 6px;
    color: #8aaa96;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: inherit;
    transition: all 0.2s;
}

.em-tutorial-skip:hover {
    border-color: #a8d5ba;
    color: #a8d5ba;
}

.em-tutorial-next {
    padding: 6px 14px;
    background: #2D6A4F;
    border: 1px solid #2D6A4F;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.em-tutorial-next:hover {
    background: #3a8a66;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .em-editor-main {
        grid-template-columns: 1fr;
        gap: 1rem;
        height: auto;
        min-height: auto;
    }

    .em-palette {
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
    }

    .em-palette-scroll {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        overflow-y: visible;
    }

    .em-palette-fade {
        display: none;
    }

    .em-palette-actions {
        flex-direction: row;
    }

    .em-palette-section {
        flex: 1;
        min-width: 150px;
    }

    .em-calculator {
        border-left: none;
        border-top: 1px solid #e8e8e8;
    }

    .em-canvas-wrap {
        min-height: 300px;
    }

    .em-calculator {
        order: 3;
    }
}

@media (max-width: 600px) {
    .em-editor-steps {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .em-step {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .em-shapes {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    .em-shape-btn {
        flex-direction: row;
        width: 100%;
        max-width: 200px;
    }

    .em-shape-btn svg {
        width: 40px;
        height: 35px;
    }

    .em-templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .em-dim-group {
        flex-direction: column;
        gap: 0.8rem;
    }
}
