.majestic-engraving { margin: 1.5em 0; max-width: 480px; }

/* Canvas preview (its own wrapper so it can live in a separate column/card). */
.majestic-engraving-canvas { margin: 0 0 1em; }
.majestic-engraving-canvas canvas { width: 100%; height: auto; border: 1px solid #ddd; background: #fff; display: block; }

/* Controls */
.majestic-engraving label { display: block; margin: .75em 0 .25em; font-weight: 600; }
.majestic-engraving textarea,
.majestic-engraving select,
.majestic-engraving input[type="range"] { width: 100%; box-sizing: border-box; }
.majestic-engraving textarea,
.majestic-engraving select { padding: .4em; }
.majestic-engraving input[type="range"] { accent-color: #000; }
.majestic-engraving .me-autofit { font-style: italic; font-weight: 600; color: #4AADA8; }
.majestic-engraving .me-fit-error { color: #b32d2e; margin: .5em 0; display: none; }
.majestic-engraving .me-logo-note { margin: .25em 0 .6em; padding: .6em .8em; background: #fdf6e6; border: 1px solid #e7d5a8; border-radius: 4px; font-size: .9em; line-height: 1.45; color: #664d1a; }
.majestic-engraving .me-logo-note a { color: #b07a3f; font-weight: 600; }
.majestic-engraving.me-overflow .me-fit-error { display: block; }

/* Two-column reorder layout: preview left, controls right (matches rp-edit-grid). */
.majestic-engraving-reorder .majestic-engraving { max-width: none; margin: 0; }
.majestic-engraving-reorder .majestic-engraving-canvas { margin: 0; }

/* Product-page launcher (open/close) + preview that replaces the gallery. */
/* The launcher + controls are injected inside form.cart. When a page builder
   (e.g. Elementor) lays that form out as a flex row (Quantity next to Add to
   Cart), force our two blocks to full width so they wrap onto their own lines
   instead of being squeezed into the row. Harmless when the form isn't flex. */
.majestic-engraving-launch,
#majestic-engraving-controls { flex: 0 0 100% !important; width: 100%; }
.woocommerce div.product form.cart,
form.cart { flex-wrap: wrap !important; }
.majestic-engraving-launch { margin: 1em 0; }
.majestic-engraving-launch .button { margin-right: .5em; }
.majestic-engraving-gallery-canvas { width: 100%; }
.majestic-engraving-gallery-canvas .majestic-engraving-canvas { margin: 0; }
#majestic-engraving-controls { margin: 1em 0; }
#majestic-engraving-controls .majestic-engraving { max-width: none; margin: 0; }

/* Artwork confirmation popup (shown when adding an engraved item to the basket). */
.me-confirm-backdrop { display: none; position: fixed; inset: 0; z-index: 100000; background: rgba( 0, 0, 0, .6 ); padding: 1em; overflow: auto; }
.me-confirm-backdrop.is-open { display: flex; align-items: center; justify-content: center; }
.me-confirm { background: #fff; color: #222; max-width: 480px; width: 100%; max-height: 90vh; overflow: auto; padding: 1.5em; box-sizing: border-box; text-align: left; }
.me-confirm h3 { margin: 0 0 .5em; }
.me-confirm p { margin: 0 0 1em; }
.me-confirm-preview img { display: block; width: 100%; height: auto; border: 1px solid #ddd; }
.me-confirm-preview img + img { margin-top: .75em; }
.me-confirm-check { display: flex; align-items: flex-start; gap: .5em; margin: 1em 0; font-weight: 600; }
.me-confirm-check input { margin: .2em 0 0; }
.me-confirm-actions { display: flex; flex-wrap: wrap; gap: .5em; }
/* The popup is appended to <body>, outside WooCommerce's `.woocommerce .button`
   scope, so it carries its own button styling and works on any page. */
.me-confirm-actions .button { font: inherit; padding: .7em 1.2em; border: 1px solid #222; background: #fff; color: #222; cursor: pointer; }
.me-confirm-actions .button.alt { background: #222; color: #fff; }
.me-confirm-actions .button[disabled] { opacity: .5; cursor: not-allowed; }

/* Multi-engraving list (product page). */
.majestic-engraving-multi { --me-accent: #b07a3f; margin: 1em 0; padding: 1em 1.15em 1.15em; border: 1px solid #ddd; border-radius: 4px; background: #fafafa; box-sizing: border-box; }

/* "Personalising more than one glass?" promo header + how-to popover. */
.majestic-engraving-multi .me-promo { position: relative; margin: 0 0 1em; padding: 0 0 1em; border-bottom: 1px solid #e5e5e5; }
.majestic-engraving-multi .me-promo-top { display: flex; align-items: center; justify-content: space-between; gap: .5em; }
.majestic-engraving-multi .me-promo-title { margin: 0; font-size: 1.1em; font-weight: 700; line-height: 1.2; }
.majestic-engraving-multi .me-promo-intro { margin: .5em 0 .6em; color: #555; font-size: .95em; line-height: 1.45; }
.majestic-engraving-multi .me-promo-price { display: flex; align-items: center; gap: .5em; margin: 0; color: var(--me-accent); font-weight: 700; }
.majestic-engraving-multi .me-coin { flex: 0 0 auto; color: var(--me-accent); }
/* !important defeats aggressive theme <button> styling (full-width amber blocks). */
.majestic-engraving-multi .me-help-btn { flex: 0 0 auto !important; width: 26px !important; height: 26px !important; min-width: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 50% !important; background: var(--me-accent) !important; color: #fff !important; font: italic 700 14px/26px Georgia, 'Times New Roman', serif !important; text-align: center !important; box-shadow: none !important; cursor: pointer; }
.majestic-engraving-multi .me-help-btn:hover { filter: brightness(.92); }

.majestic-engraving-multi .me-help-pop { position: absolute; top: 100%; right: 0; z-index: 20; width: 300px; max-width: calc(100vw - 32px); margin-top: .5em; padding: 1em 1.1em 1.1em; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.14); text-align: left; }
.majestic-engraving-multi .me-help-pop[hidden] { display: none; }
.majestic-engraving-multi .me-help-close { position: absolute !important; top: .3em; right: .4em; width: 26px !important; height: 26px !important; min-width: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; background: none !important; color: #999 !important; font: 400 20px/26px Arial, sans-serif !important; text-align: center !important; box-shadow: none !important; cursor: pointer; }
.majestic-engraving-multi .me-help-close:hover { color: #333 !important; background: none !important; }
.majestic-engraving-multi .me-help-title { margin: 0 1.5em .8em 0; font-size: 1.02em; font-weight: 700; }
.majestic-engraving-multi .me-help-steps { list-style: none; counter-reset: me-step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7em; }
.majestic-engraving-multi .me-help-steps li { counter-increment: me-step; position: relative; padding-left: 34px; min-height: 24px; font-size: .92em; line-height: 1.4; color: #333; }
.majestic-engraving-multi .me-help-steps li::before { content: counter(me-step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--me-accent); color: #fff; font-size: .8em; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.majestic-engraving-multi .me-help-foot { display: flex; align-items: center; gap: .5em; margin: .9em 0 0; padding-top: .8em; border-top: 1px solid #eee; color: var(--me-accent); font-weight: 600; font-size: .9em; }
.majestic-engraving-multi .me-multi-head { font-weight: 700; font-size: 1.05em; margin: 0 0 .75em; }
.majestic-engraving-multi .me-add-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75em; margin: 0 0 1em; }
.majestic-engraving-multi .me-qty-field { display: flex; flex-direction: column; gap: .3em; font-weight: 600; }
.majestic-engraving-multi .me-qty-field input { width: 5em; padding: .45em; box-sizing: border-box; }
.majestic-engraving-multi .me-add { margin: 0; }
.majestic-engraving-multi .me-list { margin: 0 0 1em; }
.majestic-engraving-multi .me-empty { color: #777; font-style: italic; margin: .25em 0; }
.majestic-engraving-multi .me-row { display: flex; align-items: center; gap: .75em; padding: .55em 0; border-top: 1px solid #e5e5e5; }
.majestic-engraving-multi .me-row:first-child { border-top: 0; }
.majestic-engraving-multi .me-thumb { width: 48px; height: 48px; object-fit: contain; background: #fff; border: 1px solid #e0e0e0; flex: 0 0 auto; }
.majestic-engraving-multi .me-sum { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.majestic-engraving-multi .me-qty { color: #555; white-space: nowrap; }
.majestic-engraving-multi .me-remove { background: none; border: 0; color: #b32d2e; cursor: pointer; padding: .2em .4em; font: inherit; text-decoration: underline; }
.majestic-engraving-multi .me-add-all { display: block; width: 100%; margin: 0; }
.majestic-engraving-multi .me-add-all[disabled] { opacity: .5; cursor: not-allowed; }
.majestic-engraving-multi .me-multi-msg { color: #b32d2e; margin: .6em 0 0; }

/* Compact item list inside the multi-engraving confirmation popup. */
.me-confirm-list { margin: 0 0 1em; max-height: 40vh; overflow: auto; }
.me-confirm-list .me-crow { display: flex; align-items: center; gap: .6em; padding: .45em 0; border-top: 1px solid #eee; }
.me-confirm-list .me-crow:first-child { border-top: 0; }
.me-confirm-list .me-thumb { width: 40px; height: 40px; object-fit: contain; background: #fff; border: 1px solid #e0e0e0; flex: 0 0 auto; }
.me-confirm-list .me-sum { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.me-confirm-list .me-qty { color: #555; white-space: nowrap; }
