/* Nexus Media Engine: the shared full-page layout for image, video and audio tools.
   Top bar (name, tool options, actions) · left tool rail (collapsible) · stage · right sidebar.
   Each tool keeps this skeleton and only changes its rail tools, top-bar options and sidebar sections. */
html, body.mx-page { height: 100%; }
body.mx-page { overflow: hidden; margin: 0; font-family: Inter, "Segoe UI", system-ui, sans-serif; color: #e4e4e7; }
body.mx-page .site-footer, body.mx-page .gx-footer { display: none !important; }
.mx *, .mx *::before, .mx *::after { box-sizing: border-box; }
.mx [hidden] { display: none !important; }
.mx svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mx { --rail: 88px; --rail-open: 236px; --side: 300px; --line: rgba(255,255,255,.07); --soft: rgba(255,255,255,.04); --btn: #e7e7ea;
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) var(--side); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top top" "rail stage side";
  height: calc(100dvh - 64px - var(--nxb-h, 0px)); background: #06060a; transition: opacity .38s ease, transform .38s ease, filter .38s ease; }
.mx.mx-leaving { opacity: 0; transform: scale(.985); filter: blur(4px); }
.mx.mx-entering { animation: mx-in .6s cubic-bezier(.22,1,.36,1) both; }
@keyframes mx-in { from { opacity: 0; transform: scale(.985); filter: blur(4px); } }

/* Shared controls */
.mx-icon-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: none; color: #a1a1aa; cursor: pointer; transition: background .2s, color .2s; }
.mx-icon-btn:hover:not(:disabled) { background: rgba(255,255,255,.08); color: #fff; }
.mx-icon-btn:disabled { opacity: .35; cursor: default; }
.mx-group { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--soft); }
.mx-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: #e4e4e7; font: 700 13px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; transition: background .2s, border-color .2s; }
.mx-pill:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
.mx-pill svg { width: 15px; height: 15px; color: #a1a1aa; }
.mx-primary { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--btn); color: #0b0b10; font: 800 13.5px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; box-shadow: 0 8px 22px -12px rgba(255,255,255,.35); transition: transform .2s, background .2s; }
.mx-primary:hover { background: #f4f4f5; transform: translateY(-1px); }
.mx-chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: var(--soft); color: #e4e4e7; font: 700 12.5px Inter, system-ui, sans-serif; cursor: pointer; }
.mx-chip-btn:hover { background: rgba(255,255,255,.09); color: #fff; }
.mx-chip-btn.primary { border-color: transparent; background: var(--btn); color: #0b0b10; }
.mx-chip-btn.danger { border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.12); color: #fecaca; }
.mx-pop { position: relative; }
.mx-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 270px; padding: 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: #0f1016; box-shadow: 0 24px 60px rgba(0,0,0,.65); animation: mx-drop .18s ease both; }
@keyframes mx-drop { from { opacity: 0; transform: translateY(-4px); } }
.mx-menu h4 { margin: 2px 4px 10px; color: #8a8d9b; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

/* Top bar */
.mx-top { grid-area: top; display: flex; align-items: center; gap: 14px; min-height: 66px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #0a0a0f; }
.mx-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.mx-logo-ic { width: 24px !important; height: 24px !important; color: #c4b5fd; }
.mx-title { max-width: 240px; overflow: hidden; padding: 3px 6px; margin-left: -2px; border-radius: 7px; color: #fff; font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.mx-title[contenteditable="true"] { background: rgba(255,255,255,.08); box-shadow: 0 0 0 1px rgba(167,139,250,.6); text-overflow: clip; }
.mx-rename { display: none; width: 28px; height: 28px; }
.mx-rename svg { width: 14px; height: 14px; }
.mx.has-pic .mx-rename { display: grid; }
.mx-sub { color: #71717a; font-size: 12.5px; white-space: nowrap; }
.mx.has-pic .mx-sub { display: none; }
.mx-ctx { display: flex; align-items: center; gap: 14px; margin: 0 auto; min-width: 0; }
.mx-swatches { display: flex; align-items: center; gap: 6px; }
.mx-swatches button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); cursor: pointer; transition: transform .15s; }
.mx-swatches button:hover { transform: scale(1.12); }
.mx-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px #0a0a0f, 0 0 0 4px #fff; }
.mx-custom { position: relative; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(#ef4444, #f59e0b, #22c55e, #22d3ee, #3b82f6, #a78bfa, #ec4899, #ef4444); cursor: pointer; overflow: hidden; }
.mx-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mx-slider { display: flex; align-items: center; gap: 10px; color: #8a8d9b; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mx-slider input { width: 120px; accent-color: #a78bfa; }
.mx-slider b { min-width: 26px; color: #e4e4e7; font-variant-numeric: tabular-nums; }
.mx-cropbar { display: flex; gap: 8px; }
.mx-acts { display: flex; align-items: center; gap: 10px; flex: none; }
.mx-zoom input { width: 96px; accent-color: #a78bfa; }
.mx-zoom-val { min-width: 48px; height: 28px; padding: 0 6px; border: 0; border-radius: 7px; background: none; color: #d4d4d8; font: 700 12px Inter, system-ui, sans-serif; cursor: pointer; }
.mx-zoom-val:hover { background: rgba(255,255,255,.07); color: #fff; }
.mx:not(.has-pic) .mx-ctx, .mx:not(.has-pic) .mx-acts > :not(.mx-keep) { opacity: .38; pointer-events: none; }
.mx-wh { display: flex; align-items: center; gap: 8px; }
.mx-wh label { position: relative; flex: 1; min-width: 0; }
.mx-wh label span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #71717a; font-size: 11px; font-weight: 800; }
.mx-wh input { width: 100%; height: 38px; padding: 0 8px 0 26px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.04); color: #fff; font: 700 13px Inter, system-ui, sans-serif; outline: none; }
.mx-wh input:focus { border-color: rgba(167,139,250,.6); }
.mx-lock { display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: none; color: #71717a; cursor: pointer; }
.mx-lock[aria-pressed="true"] { border-color: rgba(167,139,250,.5); background: rgba(167,139,250,.12); color: #c4b5fd; }
.mx-lock svg { width: 15px; height: 15px; }
.mx-menu .mx-chip-btn.primary { width: 100%; justify-content: center; margin-top: 10px; height: 38px; }
.mx-types { display: grid; gap: 6px; }
.mx-types button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 11px; background: none; color: #e4e4e7; font: 800 13.5px Inter, system-ui, sans-serif; text-align: left; cursor: pointer; }
.mx-types button small { color: #8a8d9b; font-size: 11.5px; font-weight: 600; }
.mx-types button:hover { background: rgba(255,255,255,.05); }
.mx-types button[aria-checked="true"] { border-color: rgba(167,139,250,.5); background: rgba(167,139,250,.1); }
.mx-saves { margin: 10px 4px 2px; color: #8a8d9b; font-size: 12px; }
.mx-saves b { color: #e4e4e7; word-break: break-all; }

/* Left rail */
.mx-rail { grid-area: rail; display: flex; flex-direction: column; gap: 8px; width: var(--rail); padding: 12px; overflow: hidden auto; border-right: 1px solid var(--line); background: #030305; scrollbar-width: none; transition: width .3s cubic-bezier(.22,1,.36,1); }
.mx-rail::-webkit-scrollbar { display: none; }
.mx-rail.open { width: var(--rail-open); }
.mx-rail-toggle, .mx-tool { display: flex; align-items: center; gap: 14px; flex: none; width: 100%; min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 16px; background: none; color: #a1a1aa; font: 700 14px Inter, system-ui, sans-serif; text-align: left; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s; }
.mx-rail-toggle { min-height: 50px; justify-content: center; padding: 0; border-color: rgba(255,255,255,.1); background: var(--soft); color: #e4e4e7; }
.mx-rail.open .mx-rail-toggle { justify-content: flex-start; padding: 0 16px; }
.mx-rail-toggle:hover, .mx-tool:hover { background: rgba(255,255,255,.07); color: #fff; }
.mx-rail svg { width: 24px; height: 24px; }
.mx-rail-toggle svg { transition: transform .3s; }
.mx-rail.open .mx-rail-toggle svg { transform: scaleX(-1); }
.mx-rail:not(.open) .mx-rail-toggle span, .mx-rail:not(.open) .mx-tool span, .mx-rail:not(.open) .mx-tool kbd { display: none; }
.mx-tool kbd { margin-left: auto; padding: 2px 6px; border: 1px solid rgba(255,255,255,.12); border-radius: 5px; color: #71717a; font: 700 10px Inter, system-ui, sans-serif; }
.mx-tool[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, rgba(34,211,238,.18), rgba(167,139,250,.22)); box-shadow: inset 0 0 0 1px rgba(167,139,250,.5), 0 10px 26px -12px rgba(139,92,246,.75); }
.mx-tools { display: flex; flex-direction: column; gap: 2px; }
.mx-rail hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.mx-rail-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: auto; padding: 14px 6px 4px; color: #52525b; font-size: 11.5px; line-height: 1.7; white-space: nowrap; text-align: center; }
.mx-rail:not(.open) .mx-rail-foot { display: none; }
.mx-rail-foot nav { display: flex; justify-content: center; gap: 12px; }
.mx-rail-foot a { color: #8a8d9b !important; text-decoration: none; }
.mx-rail-foot a:hover { color: #fff !important; }
/* Fonts sub-menu (Text tool) */
.mx-fonts { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.mx-fonts-back { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--soft); color: #e4e4e7; font: 800 13px Inter, system-ui, sans-serif; cursor: pointer; }
.mx-fonts-back svg { width: 18px; height: 18px; }
.mx-fonts-back:hover { background: rgba(255,255,255,.08); }
.mx-fonts > p { margin: 4px 4px 0; color: #71717a; font-size: 11.5px; }
.mx-font-list { display: grid; gap: 6px; }
.mx-font-list button { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.02); color: #f4f4f5; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.mx-font-list button span { overflow: hidden; font-size: 19px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.mx-font-list button small { color: #71717a; font: 600 10.5px Inter, system-ui, sans-serif; }
.mx-font-list button:hover { background: rgba(255,255,255,.06); }
.mx-font-list button[aria-pressed="true"] { border-color: rgba(167,139,250,.6); background: rgba(167,139,250,.12); }

/* Stage */
.mx-stage { grid-area: stage; position: relative; display: grid; place-items: center; min-height: 0; padding: 24px; overflow: auto; background: repeating-conic-gradient(#121216 0 25%, #0b0b0e 0 50%) 0 0/20px 20px; }
.mx-empty { display: grid; justify-items: center; gap: 10px; width: min(760px, 100%); padding: 72px 40px; position: relative; border: 0; border-radius: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' rx='26' ry='26' fill='none' stroke='rgba(255,255,255,.2)' stroke-width='3.5' stroke-dasharray='16 14' stroke-linecap='round'/%3E%3C/svg%3E"); background-color: rgba(8,8,12,.85); text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.mx-empty:hover, .mx-stage.drag .mx-empty { background-color: rgba(13,11,20,.92); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' rx='26' ry='26' fill='none' stroke='rgba(167,139,250,.6)' stroke-width='3.5' stroke-dasharray='16 14' stroke-linecap='round'/%3E%3C/svg%3E"); }
.mx-empty > svg { width: 44px; height: 44px; margin-bottom: 6px; color: #c4b5fd; stroke-width: 1.6; }
.mx-empty b { color: #fafafa; font-size: 20px; }
.mx-empty p { margin: 0; color: #8a8d9b; font-size: 14px; }
.mx-empty-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.mx-empty-btns .mx-primary, .mx-empty-btns .mx-pill { height: 46px; padding: 0 20px; font-size: 14px; }
.mx-empty small { margin-top: 10px; color: #52525b; font-size: 12px; }
.mx-board { position: relative; flex: none; box-shadow: 0 30px 80px -30px rgba(0,0,0,.9); }
.mx-board canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
#mx-over { touch-action: none; }
.mx-cursor { position: absolute; z-index: 5; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.35); transform: translate(-50%, -50%); pointer-events: none; }
.mx-texted { position: absolute; z-index: 6; min-width: 4px; margin: 0; padding: 0; white-space: pre; outline: 1.5px dashed rgba(167,139,250,.9); outline-offset: 4px; caret-color: #fff; }
/* Saving */
.mx-done { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(4,4,8,.74); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transition: opacity .25s ease; }
.mx-done.show { opacity: 1; }
.mx-busy { display: grid; justify-items: center; gap: 18px; color: #e4e4e7; font-size: 15px; }
.mx-loader { position: relative; display: grid; place-items: center; width: 112px; height: 112px; }
.mx-loader::before, .mx-loader::after { content: ""; position: absolute; inset: 0; border: 3px solid transparent; border-radius: 50%; }
.mx-loader::before { border-top-color: #22d3ee; border-right-color: rgba(34,211,238,.25); animation: mx-spin 1.1s linear infinite; box-shadow: 0 0 30px rgba(34,211,238,.18); }
.mx-loader::after { inset: 12px; border-bottom-color: #a78bfa; border-left-color: rgba(167,139,250,.25); animation: mx-spin 1.7s linear infinite reverse; }
.mx-loader img { width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 0 16px rgba(139,92,246,.6)); animation: mx-pulse 1.6s ease-in-out infinite; }
@keyframes mx-spin { to { transform: rotate(360deg); } }
@keyframes mx-pulse { 50% { transform: scale(.92); } }
.mx-ready { position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; width: min(660px, 100%); padding: 26px; border: 1px solid rgba(255,255,255,.1); border-radius: 24px; background: #0d0d14; box-shadow: 0 40px 90px -30px rgba(0,0,0,.9); animation: mx-pop .45s cubic-bezier(.22,1,.36,1) both; }
@keyframes mx-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.mx-prev { display: grid; place-items: center; aspect-ratio: 1; border-radius: 16px; background: repeating-conic-gradient(#16161c 0 25%, #0f0f14 0 50%) 0 0/16px 16px; overflow: hidden; }
.mx-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mx-ready-main { display: flex; flex-direction: column; min-width: 0; }
.mx-ready h2 { display: flex; align-items: center; gap: 10px; margin: 4px 0 4px; color: #fff; font-size: 24px; font-weight: 800; }
.mx-ok { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(34,197,94,.16); color: #4ade80; }
.mx-ok svg { width: 17px; height: 17px; stroke-width: 2.8; }
.mx-out { margin: 0 0 16px; color: #a1a1aa; font-size: 13.5px; }
.mx-out b { color: #e4e4e7; word-break: break-all; }
.mx-ready-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mx-ready-btns .mx-primary, .mx-ready-btns .mx-pill { justify-content: center; height: 42px; }
.mx-share-out { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: #a1a1aa; font-size: 12.5px; line-height: 1.5; }
.mx-share-out a { color: #c4b5fd !important; }
.mx-share-out input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(255,255,255,.04); color: #fff; font: 600 12.5px Inter, system-ui, sans-serif; }
.mx-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: mx-spin .8s linear infinite; vertical-align: -2px; }
.mx-plug { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.mx-plug p { margin: 0 0 8px; color: #a1a1aa; font-size: 12.5px; }
.mx-plug p a { color: #c4b5fd !important; font-weight: 700; text-decoration: none; }
.mx-plug div { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-plug div a { padding: 5px 10px; border: 1px solid rgba(255,255,255,.09); border-radius: 99px; color: #a1a1aa !important; font-size: 11.5px; font-weight: 600; text-decoration: none; }
.mx-plug div a:hover { border-color: rgba(167,139,250,.5); color: #fff !important; }
/* New image dialog */
.mx-dialog { width: min(460px, calc(100% - 32px)); padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; background: #0d0d14; color: #e4e4e7; box-shadow: 0 40px 90px rgba(0,0,0,.7); }
.mx-dialog::backdrop { background: rgba(4,4,8,.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.mx-dialog form, .mx-dialog > div { display: grid; gap: 14px; padding: 24px; }
.mx-dialog h2 { margin: 0; color: #fff; font-size: 19px; }
.mx-dialog h4 { margin: 4px 0 0; color: #8a8d9b; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.mx-presets, .mx-bgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mx-bgs { grid-template-columns: repeat(3, 1fr); }
.mx-presets button, .mx-bgs button { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.02); color: #e4e4e7; font: 700 13px Inter, system-ui, sans-serif; text-align: left; cursor: pointer; }
.mx-presets button small { color: #71717a; font-size: 11px; font-weight: 600; }
.mx-presets button[aria-pressed="true"], .mx-bgs button[aria-pressed="true"] { border-color: rgba(167,139,250,.6); background: rgba(167,139,250,.12); }
.mx-bgs button { display: flex; align-items: center; gap: 8px; }
.mx-bgs i { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); background: var(--b); }
.mx-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Right sidebar */
.mx-side { grid-area: side; display: flex; flex-direction: column; min-width: 0; overflow: hidden auto; border-left: 1px solid var(--line); background: #08080c; scrollbar-width: thin; scrollbar-color: #27272a transparent; transition: background .2s; }
.mx-side.drag { background: #0e0c16; }
.mx-sec { padding: 18px 16px 18px 18px; border-bottom: 1px solid var(--line); }
.mx-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.mx-sec h3 { margin: 0; color: #8a8d9b; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.mx-mini { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: var(--soft); color: #e4e4e7; font: 700 12px Inter, system-ui, sans-serif; cursor: pointer; }
.mx-mini:hover { background: rgba(255,255,255,.09); color: #fff; }
.mx-mini svg { width: 14px; height: 14px; }
.mx-lib { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mx-thumb { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: repeating-conic-gradient(#16161c 0 25%, #0f0f14 0 50%) 0 0/14px 14px; cursor: grab; transition: border-color .2s, transform .2s; }
.mx-thumb:hover { border-color: rgba(255,255,255,.22); }
.mx-thumb:active { cursor: grabbing; transform: scale(.97); }
.mx-thumb img { width: 100%; height: 100%; padding: 8px; object-fit: contain; pointer-events: none; }
.mx-bin { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: rgba(220,38,38,.92); color: #fff; opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; cursor: pointer; }
.mx-thumb:hover .mx-bin { opacity: 1; transform: none; }
.mx-bin svg { width: 15px; height: 15px; }
.mx-hint { margin: 0; color: #71717a; font-size: 12.5px; line-height: 1.55; }
.mx-layers { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mx-layer { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 1px solid rgba(255,255,255,.06); border-radius: 12px; background: rgba(255,255,255,.02); cursor: pointer; transition: border-color .2s, background .2s; }
.mx-layer:hover { background: rgba(255,255,255,.05); }
.mx-layer.on { border-color: rgba(167,139,250,.6); background: rgba(167,139,250,.1); }
.mx-layer.off .mx-lthumb, .mx-layer.off .mx-lname { opacity: .45; }
.mx-lthumb { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 8px; background: repeating-conic-gradient(#1b1b22 0 25%, #111117 0 50%) 0 0/10px 10px; overflow: hidden; color: #c4b5fd; }
.mx-lthumb canvas { width: 36px; height: 36px; }
.mx-lname { flex: 1; min-width: 0; overflow: hidden; color: #e4e4e7; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mx-lacts { display: flex; flex: none; opacity: .65; transition: opacity .2s; }
.mx-layer:hover .mx-lacts, .mx-layer.on .mx-lacts { opacity: 1; }
.mx-lacts button { display: grid; place-items: center; width: 24px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; color: #a1a1aa; cursor: pointer; }
.mx-lacts button:hover { background: rgba(255,255,255,.08); color: #fff; }
.mx-lacts button[data-act="del"]:hover { color: #fca5a5; }
.mx-lacts svg { width: 14px; height: 14px; }
.mx-toast { position: fixed; left: 50%; bottom: 28px; z-index: 3000; max-width: calc(100% - 32px); padding: 11px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: #111118; color: #f4f4f5; font: 600 13.5px Inter, system-ui, sans-serif; box-shadow: 0 20px 50px rgba(0,0,0,.6); opacity: 0; transform: translate(-50%, 10px); transition: opacity .25s, transform .25s; pointer-events: none; }
.mx-toast.on { opacity: 1; transform: translate(-50%, 0); }
.mx-toast.bad { border-color: rgba(239,68,68,.5); }
@media (max-width: 1280px) { .mx { --side: 270px; } .mx-slider input { width: 90px; } .mx-zoom input { width: 70px; } .mx-sub { display: none; } }
@media (prefers-reduced-motion: reduce) { .mx, .mx-rail, .mx-loader::before, .mx-loader::after, .mx-loader img, .mx-ready, .mx-done { animation: none !important; transition: none !important; } }
.mx-id { flex: none; }
.mx-ctx { overflow: hidden; }
.mx-chip-btn { white-space: nowrap; flex: none; }

/* Right sidebar tabs: Layers, Resize, Frames, Advanced */
.mx-tabs { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 10px 10px 9px; border-bottom: 1px solid var(--line); background: #08080c; }
.mx-tabs button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px 7px; border: 0; border-radius: 12px; background: none; color: #71717a; font: 700 10.5px Inter, system-ui, sans-serif; cursor: pointer; transition: background .2s, color .2s; }
.mx-tabs button svg { width: 19px; height: 19px; }
.mx-tabs button:hover { background: rgba(255,255,255,.05); color: #e4e4e7; }
.mx-tabs button[aria-selected="true"] { background: rgba(167,139,250,.12); color: #ddd6fe; }
.mx-pane { animation: mx-pane .22s ease both; }
@keyframes mx-pane { from { opacity: 0; transform: translateY(4px); } }
.mx-sec-btns { display: flex; gap: 6px; }
.mx-mini.mx-sq { width: 30px; justify-content: center; padding: 6px 0; }
.mx-mini[aria-pressed="true"] { border-color: rgba(167,139,250,.5); color: #ddd6fe; }
.mx-lib.list { grid-template-columns: 1fr; gap: 6px; }
.mx-lib.list .mx-thumb { display: flex; align-items: center; gap: 10px; aspect-ratio: auto; height: 52px; padding: 4px 8px 4px 4px; background: rgba(255,255,255,.02); }
.mx-lib.list .mx-thumb img { flex: none; width: 44px; height: 44px; padding: 3px; border-radius: 8px; background: repeating-conic-gradient(#16161c 0 25%, #0f0f14 0 50%) 0 0/10px 10px; }
.mx-lib .mx-tname { display: none; }
.mx-lib.list .mx-tname { display: block; flex: 1; min-width: 0; overflow: hidden; color: #d4d4d8; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mx-lib.list .mx-bin { position: static; flex: none; width: 26px; height: 26px; opacity: .8; transform: none; }
.mx-now { color: #a1a1aa; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mx-wide { width: 100%; justify-content: center; height: 40px; margin-top: 12px; }
.mx-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mx-presets button, .mx-frames button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 11px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.02); color: #e4e4e7; font: 700 13px Inter, system-ui, sans-serif; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.mx-presets small { color: #8a8d9b; font-size: 11px; font-weight: 600; }
.mx-presets button:hover, .mx-frames button:hover { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.05); }
.mx-frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mx-frames button { align-items: center; gap: 8px; padding: 12px 6px 10px; font-size: 11.5px; text-align: center; }
.mx-frames button[aria-pressed="true"] { border-color: rgba(167,139,250,.6); background: rgba(167,139,250,.1); }
.mx-frames i { position: relative; display: block; width: 44px; height: 34px; border-radius: 3px; background: linear-gradient(135deg, #7c3aed, #22d3ee); }
.mx-frames .fr-none { border: 1px dashed rgba(255,255,255,.35); background: none; }
.mx-frames .fr-border { box-shadow: 0 0 0 4px #e4e4e7; }
.mx-frames .fr-polaroid { border: 4px solid #e4e4e7; border-bottom-width: 11px; border-radius: 2px; }
.mx-frames .fr-gallery { border: 5px solid #e4e4e7; outline: 1px solid #52525b; outline-offset: -8px; }
.mx-frames .fr-round { box-shadow: 0 0 0 4px #e4e4e7; border-radius: 9px; }
.mx-frames .fr-film { border-block: 7px solid #18181b; box-shadow: 0 0 0 1px #3f3f46; background-clip: padding-box; }
.mx-frames .fr-film::before, .mx-frames .fr-film::after { content: ""; position: absolute; left: 3px; right: 3px; height: 3px; background: repeating-linear-gradient(90deg, #e4e4e7 0 3px, transparent 3px 7px); }
.mx-frames .fr-film::before { top: -5px; } .mx-frames .fr-film::after { bottom: -5px; }
.mx-fcols { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.mx-fcols button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); cursor: pointer; }
.mx-fcols button[aria-pressed="true"] { box-shadow: 0 0 0 2px #08080c, 0 0 0 4px #a78bfa; }
.mx-fcols .mx-custom { width: 26px; height: 26px; }
.mx-fx { display: grid; gap: 8px; margin-top: 14px; }
.mx-fx:first-of-type { margin-top: 0; }
.mx-fx span { display: flex; justify-content: space-between; color: #d4d4d8; font-size: 12.5px; font-weight: 600; }
.mx-fx b { color: #8a8d9b; font-variant-numeric: tabular-nums; }
.mx-fx input { width: 100%; accent-color: #a78bfa; }
.mx-auto { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid rgba(167,139,250,.3); border-radius: 14px; background: linear-gradient(135deg, rgba(167,139,250,.14), rgba(34,211,238,.06)); color: #fff; text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.mx-auto svg { flex: none; width: 24px; height: 24px; color: #c4b5fd; }
.mx-auto b { display: block; font: 800 14px Inter, system-ui, sans-serif; }
.mx-auto small { color: #a1a1aa; font-size: 11.5px; }
.mx-auto:hover { border-color: rgba(167,139,250,.6); }
.mx-auto[aria-pressed="true"] { border-color: #a78bfa; box-shadow: 0 0 0 1px #a78bfa, 0 10px 30px -12px rgba(167,139,250,.7); }
.mx-board.fx-pad { box-shadow: none; }
#mx-over { inset: auto; }

/* Layers tab: images on top, layers stacked from the bottom */
.mx-lpane:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mx-libsec { display: flex; flex-direction: column; flex: 1 1 50%; min-height: 0; padding: 16px; overflow: auto; scrollbar-width: thin; scrollbar-color: #27272a transparent; }
.mx-libbar { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.mx-libempty { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: auto; max-width: 220px; text-align: center; }
.mx-libempty[hidden] { display: none; }
.mx-libempty p { margin: 0; color: #8a8d9b; font-size: 13px; line-height: 1.55; }
.mx-libempty-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: rgba(167,139,250,.1); box-shadow: inset 0 0 0 1px rgba(167,139,250,.25); color: #c4b5fd; }
.mx-libempty-ic svg { width: 24px; height: 24px; }
.mx-laysec { display: flex; flex-direction: column; flex: 1 1 50%; min-height: 0; padding: 14px 16px 16px; border-top: 1px solid var(--line); overflow: hidden; }
.mx-laysec[hidden] { display: none; }
.mx-laysec .mx-layers { margin-top: auto; overflow: auto; scrollbar-width: thin; scrollbar-color: #27272a transparent; }
.mx-scale { margin-top: 16px; }
.mx-laysec h3 { margin: 0; color: #8a8d9b; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
/* Room for the selected colour's ring inside the top bar */
.mx-swatches { padding: 5px 6px; }

.mx-nd svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Ask Nexus */
.mx-ai { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border: 0; border-radius: 12px; background: linear-gradient(#0d0d14, #0d0d14) padding-box, linear-gradient(120deg, #22d3ee, #a78bfa, #ec4899) border-box; border: 1.5px solid transparent; color: #fff; font: 800 13.5px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; box-shadow: 0 0 22px -8px rgba(167,139,250,.8); transition: box-shadow .25s, transform .2s; }
.mx-ai:hover { transform: translateY(-1px); box-shadow: 0 0 28px -6px rgba(167,139,250,1); }
.mx-ai img { width: 20px; height: auto; }
.mx-aip { position: absolute; right: 0; top: calc(100% + 10px); z-index: 70; width: 380px; padding: 18px; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; background: radial-gradient(120% 80% at 100% 0, rgba(167,139,250,.14), transparent 60%), #0d0d14; box-shadow: 0 30px 80px rgba(0,0,0,.7); animation: mx-drop .2s ease both; }
.aip-head { display: flex; align-items: center; gap: 12px; }
.aip-av { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(34,211,238,.25), rgba(167,139,250,.12)); box-shadow: inset 0 0 0 1px rgba(167,139,250,.35); }
.aip-av img { width: 36px; height: 36px; object-fit: contain; animation: aipFloat 3.5s ease-in-out infinite; }
@keyframes aipFloat { 50% { transform: translateY(-3px); } }
.aip-head b { display: block; color: #fff; font-size: 16px; }
.aip-head small { color: #a78bfa; font-size: 11.5px; font-weight: 700; }
.aip-head > div { flex: 1; }
.aip-x { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 9px; background: none; color: #71717a; cursor: pointer; }
.aip-x:hover { background: rgba(255,255,255,.06); color: #fff; }
.aip-x svg, .aip-send svg { width: 17px; height: 17px; }
.aip-bubble { position: relative; margin: 16px 0 14px; padding: 12px 14px; border-radius: 4px 16px 16px 16px; background: rgba(255,255,255,.05); color: #e4e4e7; font-size: 13.5px; line-height: 1.55; }
.aip-box { position: relative; }
.aip-box textarea { display: block; width: 100%; min-height: 86px; padding: 12px 52px 12px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(0,0,0,.35); color: #fff; font: 500 14px/1.5 Inter, system-ui, sans-serif; resize: none; outline: none; transition: border-color .2s, box-shadow .2s; }
.aip-box textarea:focus { border-color: rgba(167,139,250,.65); box-shadow: 0 0 0 3px rgba(167,139,250,.14); }
.aip-box textarea::placeholder { color: #52525b; }
.aip-send { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; background: #e7e7ea; color: #0b0b10; cursor: pointer; transition: transform .2s, opacity .2s; }
.aip-send:hover { transform: translateY(-1px); }
.aip-send:disabled { opacity: .35; cursor: default; transform: none; }
.aip-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.aip-chips button { padding: 6px 11px; border: 1px solid rgba(255,255,255,.09); border-radius: 999px; background: none; color: #a1a1aa; font: 600 12px Inter, system-ui, sans-serif; cursor: pointer; transition: color .2s, border-color .2s; }
.aip-chips button:hover { border-color: rgba(167,139,250,.5); color: #fff; }
.aip-note { margin: 12px 0 0; color: #71717a; font-size: 12px; line-height: 1.5; }
.aip-note a { color: #c4b5fd; }
.mx-aip svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mx-aibusy { position: absolute; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(4,4,8,.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: mx-pane .3s ease both; }
.mx-aibusy[hidden] { display: none; }
.mx-aibusy small { color: #71717a; font-size: 12.5px; margin-top: -8px; }
@media (max-width: 1280px) { .mx-ai span { display: none; } .mx-ai { padding: 0 11px; } }

/* New Canvas dialog */
.mx-nd { width: min(480px, calc(100% - 32px)); border: 0; border-radius: 16px; background: rgba(15,18,25,.92); -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px); box-shadow: 0 32px 64px -16px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.06); font-family: Inter, system-ui, sans-serif; }
.mx-nd::backdrop { background: rgba(4,5,8,.72); }
.mx-nd > div { display: block; padding: 26px 28px; }
.nd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.nd-head h2 { margin: 0; color: #fff; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.nd-head p { margin: 2px 0 0; color: #94a3b8; font-size: 12px; }
.nd-x { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: #94a3b8; cursor: pointer; transition: background .2s, color .2s; }
.nd-x:hover { background: rgba(255,255,255,.05); color: #fff; }
.nd-x svg { width: 16px; height: 16px; }
.nd-sec { margin-top: 22px; }
.nd-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nd-lbl { display: block; margin-bottom: 10px; color: #94a3b8; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nd-row .nd-lbl { margin: 0; }
.nd-ratio { padding: 2px 8px; border: 1px solid rgba(255,255,255,.05); border-radius: 5px; background: rgba(255,255,255,.05); color: #94a3b8; font: 500 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.nd-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nd-sizes button { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 86px; padding: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(21,26,36,.5); color: #94a3b8; font: 500 12px Inter, system-ui, sans-serif; cursor: pointer; transition: all .2s; }
.nd-sizes button:hover { border-color: rgba(255,255,255,.18); background: #1b2230; color: #e2e8f0; }
.nd-sizes i { display: block; margin: auto 0 10px; border: 1px solid #475569; border-radius: 4px; background: rgba(30,41,59,.4); transition: border-color .2s, transform .2s; }
.nd-sizes button:hover i { border-color: #94a3b8; transform: scale(1.05); }
.nd-sizes small { margin-top: 2px; color: #64748b; font: 500 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.nd-sizes button[aria-pressed="true"] { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; box-shadow: 0 0 20px -3px rgba(255,255,255,.12); }
.nd-sizes button[aria-pressed="true"] i { border-color: rgba(255,255,255,.8); background: rgba(255,255,255,.2); }
.nd-sizes button[aria-pressed="true"] small { color: #94a3b8; }
.nd-wh { display: flex; align-items: center; gap: 8px; }
.nd-in { position: relative; flex: 1; }
.nd-in input { width: 100%; padding: 10px 30px 10px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: #08090c; color: #fff; font: 500 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; outline: none; -moz-appearance: textfield; transition: border-color .2s, box-shadow .2s; }
.nd-in input::-webkit-outer-spin-button, .nd-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.nd-in input:focus { border-color: rgba(255,255,255,.4); box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.nd-in em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 11px; font-style: normal; pointer-events: none; }
.nd-swap { display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(21,26,36,.5); color: #94a3b8; cursor: pointer; transition: all .2s; }
.nd-swap:hover { border-color: rgba(255,255,255,.18); background: #1b2230; color: #fff; }
.nd-swap:active { transform: scale(.95); }
.nd-swap svg { width: 14px; height: 14px; }
.nd-bgs { display: flex; align-items: center; gap: 8px; }
.nd-bgs button { display: flex; flex: 1; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(21,26,36,.5); color: #94a3b8; font: 500 12px Inter, system-ui, sans-serif; cursor: pointer; transition: all .2s; }
.nd-bgs button:hover { border-color: rgba(255,255,255,.18); color: #e2e8f0; }
.nd-bgs button[aria-pressed="true"] { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; }
.nd-bgs i { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--b); box-shadow: inset 0 0 0 1px rgba(148,163,184,.6); }
.nd-bgs i.nd-grid { background: repeating-conic-gradient(rgba(255,255,255,.35) 0 25%, transparent 0 50%) 0 0/7px 7px; }
.nd-custom { position: relative; display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(21,26,36,.5); color: #94a3b8; cursor: pointer; transition: border-color .2s; }
.nd-custom:hover { border-color: #64748b; }
.nd-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.nd-custom svg { width: 14px; height: 14px; }
.nd-custom.set { border-color: rgba(255,255,255,.4); }
.nd-custom.set span { display: none; }
.nd-custom[aria-pressed="true"] { box-shadow: 0 0 0 2px #0f1219, 0 0 0 3px rgba(255,255,255,.6); }
.nd-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.08); }
.nd-cancel { height: 38px; padding: 0 16px; border: 0; border-radius: 12px; background: none; color: #94a3b8; font: 500 12.5px Inter, system-ui, sans-serif; cursor: pointer; transition: all .2s; }
.nd-cancel:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nd-go { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 20px; border: 0; border-radius: 12px; background: #fff; color: #020617; font: 600 12.5px Inter, system-ui, sans-serif; cursor: pointer; box-shadow: 0 10px 25px -5px rgba(255,255,255,.25); transition: all .2s; }
.nd-go:hover { background: #f1f5f9; box-shadow: 0 10px 28px -4px rgba(255,255,255,.32); }
.nd-go:active { transform: scale(.98); }
.nd-go svg { width: 14px; height: 14px; }
.mx-nd svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 440px) { .mx-nd > div { padding: 22px 18px; } .nd-sizes { grid-template-columns: repeat(2, 1fr); } .nd-bgs button { font-size: 11px; padding: 0 6px; } }
/* The studio fills the window exactly: nothing can poke out and make the page scroll */
html:has(> body.mx-page), body.mx-page { overflow: hidden; overscroll-behavior: none; }
.mx { width: 100%; max-width: 100vw; overflow: hidden; }
/* New Canvas: smooth open and close */
.mx-nd[open] { animation: ndIn .32s cubic-bezier(.16, 1, .3, 1) both; }
.mx-nd[open]::backdrop { animation: ndFade .3s ease both; }
.mx-nd.closing { animation: ndOut .18s ease both; }
.mx-nd.closing::backdrop { animation: ndFade .18s ease reverse both; }
@keyframes ndIn { from { opacity: 0; transform: translateY(14px) scale(.96); filter: blur(4px); } }
@keyframes ndOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes ndFade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mx-nd[open], .mx-nd.closing, .mx-nd[open]::backdrop { animation: none; } }

/* Rotate and flip group (Move tool) */
.mx-xform { display: flex; align-items: center; gap: 4px; }
.mx-xform[hidden] { display: none; }
.mx-xform .mx-icon-btn { width: 34px; height: 34px; }
.mx-rot-reset { height: 32px; margin-left: 4px; }

/* Layers list: neat rows, newest at the top */
.mx-laysec .mx-layers { margin-top: 0; }
.mx-layers { gap: 2px; }
.mx-layer { position: relative; gap: 10px; padding: 7px 8px 7px 10px; border: 0; border-radius: 10px; background: none; }
.mx-layer:hover { background: rgba(255,255,255,.045); }
.mx-layer.on { background: rgba(167,139,250,.13); }
.mx-layer.on::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: #a78bfa; }
.mx-lthumb { width: 36px; height: 36px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.mx-lname { font-size: 13px; line-height: 1.25; }
.mx-lname small { display: block; margin-top: 1px; color: #71717a; font-size: 11px; font-weight: 500; }
.mx-layer.on .mx-lname small { color: #a1a1aa; }
.mx-lacts { opacity: 0; }
.mx-layer:hover .mx-lacts, .mx-layer.on .mx-lacts { opacity: 1; }

/* ---------- Phones: picture on top, tools and panels underneath ---------- */
@media (max-width: 760px) {
  .mx { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto 40%; grid-template-areas: "top" "stage" "rail" "side"; }
  /* Top bar: name and actions on one line, colours and brush in a swipeable row under it */
  .mx-top { flex-wrap: wrap; gap: 8px 6px; min-height: 0; padding: 8px 10px; }
  .mx-id { order: 1; flex: 1 1 auto; min-width: 0; gap: 8px; }
  .mx-title { max-width: 34vw; font-size: 14px; }
  .mx-rename, .mx.has-pic .mx-rename, .mx-sub { display: none; }
  .mx-acts { order: 2; gap: 4px; }
  .mx-acts .mx-zoom { display: none; }
  .mx-acts .mx-icon-btn { width: 34px; height: 34px; }
  .mx-pill { height: 34px; padding: 0 9px; }
  .mx-ai { height: 34px; padding: 0 9px; }
  #mx-export { height: 34px; padding: 0 11px; }
  #mx-export span { display: none; }
  .mx-ctx { order: 3; flex: 1 1 100%; justify-content: flex-start; gap: 10px; margin: 0; padding: 2px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .mx-ctx::-webkit-scrollbar { display: none; }
  .mx-ctx > * { flex: none; }
  .mx-slider input { width: 96px; }
  /* Picture */
  .mx-stage { padding: 12px; }
  .mx-empty { padding: 30px 18px; border-radius: 20px; }
  .mx-empty b { font-size: 17px; }
  /* Tools: a swipeable strip under the picture */
  .mx-rail, .mx-rail.open { flex-direction: row; align-items: stretch; width: auto; padding: 6px 8px; gap: 0; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid var(--line); scrollbar-width: none; }
  .mx-rail::-webkit-scrollbar { display: none; }
  .mx-rail-toggle, .mx-rail > hr, .mx-rail-foot { display: none !important; }
  .mx-tools { flex-direction: row; gap: 2px; }
  .mx-tool, .mx-rail:not(.open) .mx-tool { flex-direction: column; justify-content: center; gap: 4px; width: 58px; min-height: 54px; padding: 6px 2px; border-radius: 12px; font-size: 10.5px; }
  .mx-rail .mx-tool span { display: block !important; white-space: nowrap; }
  .mx-rail .mx-tool kbd { display: none !important; }
  .mx-tool svg { width: 20px; height: 20px; }
  .mx-fonts { flex-direction: row; align-items: center; gap: 8px; }
  .mx-fonts > p { display: none; }
  .mx-fonts-back { flex: none; }
  .mx-font-list { display: flex; flex-direction: row; gap: 6px; }
  .mx-font-list button { flex: none; width: 150px; }
  /* Panels: tabs and their contents fill the bottom */
  .mx-side { border-left: 0; border-top: 1px solid var(--line); }
  .mx-tabs { padding: 6px 8px; }
  .mx-tabs button { flex-direction: row; justify-content: center; gap: 6px; padding: 8px 4px; }
  .mx-tabs button svg { width: 16px; height: 16px; }
  .mx-libsec { padding: 12px; }
  .mx-laysec { padding: 10px 12px 12px; }
  .mx-lacts { opacity: 1; }
  .mx-lacts button { width: 30px; height: 32px; }
  .mx-lib { grid-template-columns: repeat(3, 1fr); }
  /* Pop-ups become sheets */
  .mx-aip { position: fixed; left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 80dvh; overflow: auto; }
  .mx-menu { position: fixed; left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; }
  .mx-ready { grid-template-columns: 1fr; max-height: calc(100% - 20px); overflow: auto; padding: 18px; }
}
@media (max-width: 400px) {
  .mx-tabs button span { font-size: 10px; }
  .mx-title { max-width: 26vw; }
}
/* Phones, round 2: one-line top bar, compact empty states, roomier layers */
@media (max-width: 760px) {
  .mx-title { display: none; }
  .mx-id { flex: 0 0 auto; }
  .mx-acts { margin-left: auto; }
  .mx-empty { gap: 8px; padding: 22px 16px; }
  .mx-empty > svg { width: 34px; height: 34px; margin-bottom: 0; }
  .mx-empty p, .mx-empty small { display: none; }
  .mx-empty-btns { margin-top: 8px; gap: 8px; }
  .mx-empty-btns .mx-primary, .mx-empty-btns .mx-pill { height: 42px; padding: 0 14px; font-size: 13px; }
  .mx-libsec { flex: 0 1 auto; max-height: 55%; }
  .mx-libempty { flex-direction: row; gap: 10px; max-width: none; margin: 0; text-align: left; }
  .mx-libempty-ic { display: none; }
  .mx-libempty p { flex: 1; font-size: 12px; }
  .mx-libempty .mx-mini { flex: none; }
  .mx-laysec { flex: 1 1 auto; }
}

/* Zoomed pictures can scroll to every edge */
.mx-stage { place-items: safe center; }
/* Save confirmation: matches the New Canvas card */
.mx-done { z-index: 60; grid-area: 1 / 1 / -1 / -1; }
.mx-ready { display: flex; flex-direction: column; gap: 18px; width: min(520px, 100%); max-height: calc(100% - 8px); overflow: auto; padding: 24px 26px; border: 0; border-radius: 16px; background: rgba(15,18,25,.94); -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px); box-shadow: 0 32px 64px -16px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.06); font-family: Inter, system-ui, sans-serif; animation: ndIn .34s cubic-bezier(.16,1,.3,1) both; }
.mx-ready[hidden] { display: none; }
.rd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.rd-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; color: #fff; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.rd-head p { margin: 4px 0 0; color: #94a3b8; font-size: 12px; }
.rd-head p b { color: #e2e8f0; font-weight: 600; word-break: break-all; }
.rd-ok { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #22c55e; color: #052e16; }
.rd-ok svg { width: 14px; height: 14px; }
.mx-ready svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.mx-ready .nd-x svg { width: 16px; height: 16px; }
.mx-ready .mx-prev { aspect-ratio: auto; height: min(42vh, 340px); border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.rd-btns { display: grid; gap: 8px; }
.rd-dl { justify-content: center; width: 100%; height: 46px; font-size: 14px; }
.rd-dl svg { width: 16px; height: 16px; }
.rd-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rd-sec { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(21,26,36,.5); color: #cbd5e1; font: 500 12.5px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; transition: all .2s; }
.rd-sec:hover { border-color: rgba(255,255,255,.18); background: #1b2230; color: #fff; }
.rd-sec svg { width: 14px; height: 14px; flex: none; }
.mx-ready .mx-share-out { margin-top: 0; }
.mx-ready .mx-plug { margin-top: 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
/* Ask Nexus: a centred card with a backdrop */
.mx-aiscrim { position: fixed; inset: 0; z-index: 1990; background: rgba(4,5,8,.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: ndFade .25s ease both; }
.mx-aiscrim[hidden] { display: none; }
.mx-aip, .mx-aip[hidden] { position: fixed; left: 50%; top: 50%; right: auto; bottom: auto; z-index: 2000; width: min(440px, calc(100% - 28px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 22px; border: 0; border-radius: 16px; background: radial-gradient(120% 70% at 100% 0, rgba(167,139,250,.14), transparent 60%), rgba(15,18,25,.96); box-shadow: 0 32px 64px -16px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.06); transform: translate(-50%, -50%); animation: aipIn .32s cubic-bezier(.16,1,.3,1) both; }
.mx-aip[hidden] { display: none; }
@keyframes aipIn { from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(.96); } }
.mx-aip .aip-head { padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.mx-aip .aip-bubble { margin-top: 14px; }

/* ---------- Phones, round 3 ---------- */
.mx-tabs .mx-tabs-min { display: none; }
@media (max-width: 760px) {
  /* Top bar splits: actions on top, tools under them, the picture, colours under the picture, then the panel */
  .mx { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto 38%; grid-template-areas: "id acts" "rail rail" "stage stage" "ctx ctx" "side side"; }
  .mx.side-min { grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
  .mx-top { display: contents; }
  .mx-id { grid-area: id; align-self: stretch; display: flex; align-items: center; padding: 8px 4px 8px 12px; background: #0a0a0f; border-bottom: 1px solid var(--line); }
  .mx-acts { grid-area: acts; align-self: stretch; justify-content: flex-end; margin: 0; padding: 8px 10px 8px 0; background: #0a0a0f; border-bottom: 1px solid var(--line); }
  .mx-ctx { grid-area: ctx; padding: 8px 12px; background: #0a0a0f; border-top: 1px solid var(--line); }
  .mx-rail, .mx-rail.open { border-top: 0; border-bottom: 1px solid var(--line); }
  .mx-stage { touch-action: none; }
  /* Panel: the arrow hides it */
  .mx-tabs { grid-template-columns: repeat(5, 1fr) 40px; }
  .mx-tabs .mx-tabs-min { display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: rgba(255,255,255,.04); color: #a1a1aa; cursor: pointer; transition: transform .25s, background .2s; }
  .mx-tabs-min svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
  .mx.side-min .mx-tabs-min svg { transform: rotate(180deg); }
  .mx.side-min .mx-pane { display: none !important; }
  .mx.side-min .mx-tabs { border-bottom: 0; }
  .mx.side-min .mx-tabs [aria-selected="true"] { background: none; color: #71717a; }
  /* Save confirmation fills the studio */
  .mx-done { padding: 0; }
  .mx-ready { width: 100%; height: 100%; max-height: none; border-radius: 0; padding: 18px 16px 22px; box-shadow: none; }
  .mx-ready .mx-prev { flex: 1; height: auto; min-height: 180px; }
  .rd-row { grid-template-columns: 1fr 1fr 1fr; }
  .rd-sec { flex-direction: column; gap: 4px; height: 58px; font-size: 11.5px; }
  .rd-sec svg { width: 18px; height: 18px; }
  /* Ask Nexus */
  .mx-aip, .mx-aip[hidden] { padding: 18px; }
  .aip-chips button { font-size: 12.5px; padding: 7px 12px; }
}

/* Backdrop behind the picture: checkered, white or black (view only) */
.mx-board[data-bd="check"] { background: repeating-conic-gradient(#121216 0 25%, #0b0b0e 0 50%) 0 0/20px 20px; }
.mx-board[data-bd="white"] { background: #fff; }
.mx-board[data-bd="black"] { background: #000; }
.mx-bgpick { position: absolute; right: 14px; bottom: 14px; z-index: 30; display: flex; align-items: center; gap: 7px; padding: 6px 8px 6px 12px; border-radius: 999px; background: rgba(10,10,15,.85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 10px 30px -10px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.08); }
.mx-bgpick[hidden] { display: none; }
.mx-bgpick span { margin-right: 2px; color: #a1a1aa; font: 600 11.5px Inter, system-ui, sans-serif; }
.mx-bgpick button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); transition: transform .15s; }
.mx-bgpick button:hover { transform: scale(1.1); }
.mx-bgpick [data-bd="check"] { background: repeating-conic-gradient(#3f3f46 0 25%, #18181b 0 50%) 0 0/8px 8px; }
.mx-bgpick [data-bd="white"] { background: #fff; }
.mx-bgpick [data-bd="black"] { background: #000; }
.mx-bgpick [aria-pressed="true"] { box-shadow: 0 0 0 2px #0a0a0f, 0 0 0 4px #a78bfa; }
.mx-stage { position: relative; }
@media (max-width: 760px) { .mx-bgpick { right: 8px; bottom: 8px; padding: 5px 7px; } .mx-bgpick span { display: none; } }

/* Filters */
.mx-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mx-filters button { display: flex; flex-direction: column; gap: 6px; padding: 5px 5px 7px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.02); color: #d4d4d8; font: 600 11px Inter, system-ui, sans-serif; cursor: pointer; transition: border-color .2s, background .2s, transform .15s; }
.mx-filters button:hover { border-color: rgba(255,255,255,.2); transform: translateY(-1px); }
.mx-filters canvas { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 8px; background: repeating-conic-gradient(#1b1b22 0 25%, #111117 0 50%) 0 0/10px 10px; }
.mx-filters span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-filters [aria-pressed="true"] { border-color: rgba(167,139,250,.7); background: rgba(167,139,250,.12); color: #fff; }
.mx-tabs button span { white-space: nowrap; }
/* Area round the picture follows the backdrop too */
.mx-stage[data-bd="white"] { background: #e9e9ee; }
.mx-stage[data-bd="black"] { background: #000; }
.mx-acts .mx-bgpick { position: static; padding: 0 4px 0 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; gap: 6px; }
.mx-acts .mx-bgpick button { width: 24px; height: 24px; }

@media (max-width: 760px) {
  /* Bottom drawer slides open and shut, and the picture grows and shrinks with it */
  .mx { grid-template-rows: auto auto minmax(0, 1fr) auto 46%; transition: grid-template-rows .42s cubic-bezier(.32, .72, 0, 1); }
  .mx.side-min { grid-template-rows: auto auto minmax(0, 1fr) auto 78px; }
  .mx-side { overflow: hidden; }
  .mx-side .mx-pane { transition: opacity .25s; }
  .mx.side-min .mx-pane { display: block !important; opacity: 0; pointer-events: none; }
  .mx.side-min .mx-tabs { border-bottom: 1px solid transparent; }
  /* Bigger tabs: icon above the name */
  .mx-tabs { padding: 8px 8px; gap: 4px; }
  .mx-tabs button { flex-direction: column; justify-content: center; gap: 5px; min-height: 60px; padding: 8px 2px; font-size: 11.5px; }
  .mx-tabs button svg { width: 22px; height: 22px; }
  .mx-tabs .mx-tabs-min { min-height: 60px; }
  .mx-filters { grid-template-columns: repeat(4, 1fr); }
  .mx-bgpick[hidden] { display: none !important; }
}
@media (max-width: 400px) { .mx-filters { grid-template-columns: repeat(3, 1fr); } .mx-tabs button { font-size: 10.5px; } }
@media (max-width: 760px) { #mx-again { display: none; } .mx-acts { gap: 3px; } }

/* File type on the save card */
.rd-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.rd-types button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 6px; border: 0; border-radius: 10px; background: none; color: #94a3b8; font-family: Inter, system-ui, sans-serif; cursor: pointer; transition: background .2s, color .2s; }
.rd-types b { font-size: 13px; font-weight: 700; color: #cbd5e1; }
.rd-types small { font-size: 10.5px; }
.rd-types [aria-checked="true"] { background: rgba(255,255,255,.1); box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.rd-types [aria-checked="true"] b { color: #fff; }
.mx-typepop[hidden] { display: none !important; }
#mx-export span { display: inline; }
/* More tools arrow: phones only */
.mx-railmore { display: none; }
@media (max-width: 760px) {
  #mx-export span { display: inline !important; }
  #mx-export { padding: 0 12px; gap: 6px; }
  /* The drawer's panels scroll with a swipe */
  .mx-side { display: flex; flex-direction: column; min-height: 0; }
  .mx-side .mx-pane:not(.mx-lpane) { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
  .mx-libsec, .mx-laysec .mx-layers { touch-action: pan-y; overscroll-behavior: contain; }
  .mx-railmore { grid-area: rail; justify-self: end; align-self: stretch; z-index: 5; display: grid; place-items: center; width: 46px; margin: 0; padding: 0 0 0 10px; border: 0; background: linear-gradient(90deg, rgba(6,6,10,0), #06060a 55%); color: #e4e4e7; cursor: pointer; transition: opacity .25s; }
  .mx-railmore svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; animation: railNudge 1.6s ease-in-out infinite; }
  @keyframes railNudge { 50% { transform: translateX(4px); } }
  .mx-railmore.done { opacity: 0; pointer-events: none; }
  .mx-rail { touch-action: pan-x; }
}

/* Phone-only controls are hidden on bigger screens */
.mx-acc, .mx-swbtn { display: none; }
.mx-ghost { position: fixed; z-index: 3000; width: 84px; height: 84px; object-fit: contain; margin: -42px 0 0 -42px; border-radius: 12px; background: rgba(15,18,25,.7); box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 2px #a78bfa; pointer-events: none; opacity: .92; }
@media (max-width: 760px) {
  /* Images / Layers accordion */
  .mx-acc { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line); background: #0b0b10; color: #e4e4e7; font: 700 14px Inter, system-ui, sans-serif; cursor: pointer; flex: none; }
  .mx-acc i { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.08); color: #a1a1aa; font-style: normal; font-size: 11.5px; }
  .mx-acc i:empty { display: none; }
  .mx-acc svg { width: 18px; height: 18px; fill: none; stroke: #a1a1aa; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
  .mx-acc[aria-expanded="true"] svg { transform: rotate(180deg); }
  .mx-lpane .mx-libsec, .mx-lpane .mx-laysec { padding: 0; max-height: none; transition: flex-grow .3s; }
  .mx-lpane .mx-laysec .mx-sec-h { display: none; }
  .mx-lpane[data-open="img"] .mx-libsec { flex: 1 1 auto; } .mx-lpane[data-open="img"] .mx-laysec { flex: 0 0 auto; }
  .mx-lpane[data-open="lay"] .mx-laysec { flex: 1 1 auto; } .mx-lpane[data-open="lay"] .mx-libsec { flex: 0 0 auto; }
  .mx-lpane[data-open="lay"] .mx-libsec > :not(.mx-acc), .mx-lpane[data-open="img"] .mx-laysec > :not(.mx-acc) { display: none !important; }
  .mx-lpane .mx-libsec > :not(.mx-acc) { margin: 10px 12px 0; }
  .mx-lpane .mx-libsec { overflow-y: auto; }
  .mx-lpane .mx-laysec .mx-layers { padding: 8px 10px 12px; overflow-y: auto; }
  .mx-laysec { border-top: 0; }
  /* Colour button that slides the colours out */
  .mx-swbtn { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 34px; padding: 0 6px 0 4px; border: 1px solid rgba(255,255,255,.1); border-radius: 99px; background: rgba(255,255,255,.04); cursor: pointer; }
  .mx-swbtn i { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
  .mx-swbtn svg { width: 16px; height: 16px; fill: none; stroke: #a1a1aa; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
  .mx-ctx.sw-open .mx-swbtn svg { transform: rotate(180deg); }
  .mx-ctx .mx-swatches { max-width: 0; padding: 5px 0; overflow: hidden; opacity: 0; transition: max-width .35s cubic-bezier(.32,.72,0,1), opacity .25s, padding .35s; }
  .mx-ctx.sw-open .mx-swatches { max-width: 420px; padding: 5px 6px; opacity: 1; }
  /* Backdrop switch on the left */
  .mx-id .mx-bgpick { position: static; padding: 0 0 0 8px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; gap: 6px; }
  .mx-id .mx-bgpick button { width: 24px; height: 24px; }
}

/* Locked base picture */
.mx-lacts.mx-locked { opacity: 1; }
.mx-lockic { display: grid; place-items: center; width: 28px; height: 26px; color: #71717a; }
.mx-lockic svg { width: 14px; height: 14px; }
/* Pinch: the picture moves with the fingers, so no scrolling or sideways rubber-banding */
.mx-board { will-change: transform; }
@media (max-width: 760px) { .mx-stage { overflow: hidden; } }

/* Straighten is gone; quick crop/blur only on phones */
#mx-rot-reset { display: none !important; }
.mx-qtools { display: none; }
/* Emoji picker */
.mx-emoscrim { position: fixed; inset: 0; z-index: 2490; background: rgba(4,5,8,.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: ndFade .25s ease both; }
.mx-emoscrim[hidden], .mx-emo[hidden] { display: none; }
.mx-emo { position: fixed; left: 50%; top: 50%; z-index: 2500; display: flex; flex-direction: column; width: min(620px, calc(100% - 28px)); height: min(640px, calc(100dvh - 60px)); border-radius: 16px; background: rgba(15,18,25,.97); box-shadow: 0 32px 64px -16px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.06); transform: translate(-50%, -50%); animation: aipIn .32s cubic-bezier(.16,1,.3,1) both; font-family: Inter, system-ui, sans-serif; overflow: hidden; }
.mx-emo svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.emo-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.emo-head h2 { margin: 0; color: #fff; font-size: 18px; font-weight: 600; }
.emo-head .nd-x svg { width: 16px; height: 16px; }
.emo-search { display: flex; align-items: center; gap: 10px; margin: 0 20px; padding: 0 14px; height: 46px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: #08090c; color: #64748b; }
.emo-search:focus-within { border-color: rgba(167,139,250,.6); box-shadow: 0 0 0 3px rgba(167,139,250,.14); }
.emo-search svg { width: 18px; height: 18px; flex: none; }
.emo-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: #fff; font: 500 15px Inter, system-ui, sans-serif; outline: none; }
.emo-cats { display: flex; gap: 4px; padding: 12px 16px 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(255,255,255,.07); }
.emo-cats::-webkit-scrollbar { display: none; }
.emo-cats button { flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; font-size: 22px; cursor: pointer; transition: background .15s; }
.emo-cats button:hover { background: rgba(255,255,255,.07); }
.emo-grid { flex: 1; overflow-y: auto; padding: 6px 14px 20px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #27272a transparent; }
.emo-grid h3 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 12px 6px 8px; background: rgba(15,18,25,.97); color: #94a3b8; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.emo-grid section > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 2px; }
.emo-grid button { aspect-ratio: 1; border: 0; border-radius: 10px; background: none; font-size: 28px; line-height: 1; cursor: pointer; transition: background .15s, transform .15s; }
.emo-grid button:hover { background: rgba(255,255,255,.08); transform: scale(1.12); }
.emo-wait { margin: 30px 0; color: #94a3b8; text-align: center; font-size: 14px; }
@media (max-width: 760px) {
  .mx-logo-ic { display: none !important; }
  .mx-rail [data-tool="crop"], .mx-rail [data-tool="blur"] { display: none !important; }
  .mx-qtools { display: flex; gap: 2px; margin-left: auto; }
  .mx-qtools .mx-icon-btn { width: 34px; height: 34px; }
  .mx-qtools [aria-pressed="true"] { background: rgba(167,139,250,.18); color: #ddd6fe; }
  .mx-qtools + .mx-xform { margin-left: 0; }
  .mx-ctx .mx-cropbar { margin-left: 8px; }
  /* Emoji picker fills the screen */
  .mx-emo { left: 0; top: 0; width: 100%; height: 100dvh; border-radius: 0; transform: none; animation: emoUp .32s cubic-bezier(.16,1,.3,1) both; }
  @keyframes emoUp { from { opacity: 0; transform: translateY(24px); } }
  .emo-grid section > div { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}

/* Emoji: a sidebar tab on desktop, the tool-strip button on phones */
.mx-tabs { grid-template-columns: repeat(6, 1fr); gap: 2px; padding-left: 6px; padding-right: 6px; }
.mx-tabs button { font-size: 10px; }
.mx-rail .mx-emoji-btn { display: none; }
.mx-emopane:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mx-emopane .mx-emo { position: static; transform: none; width: auto; height: auto; flex: 1; min-height: 0; border-radius: 0; background: none; box-shadow: none; animation: none; }
.mx-emopane .emo-head { display: none; }
.mx-emopane .emo-search { margin: 14px 14px 0; height: 40px; }
.mx-emopane .emo-cats { padding: 10px 10px 6px; }
.mx-emopane .emo-cats button { width: 34px; height: 34px; font-size: 19px; }
.mx-emopane .emo-grid { padding: 4px 10px 16px; }
.mx-emopane .emo-grid h3 { background: #08080c; }
.mx-emopane .emo-grid section > div { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.mx-emopane .emo-grid button { font-size: 23px; cursor: grab; }
@media (max-width: 760px) {
  .mx-tabs .mx-tab-emoji { display: none; }
  .mx-tabs { grid-template-columns: repeat(5, 1fr) 40px; }
  .mx-rail .mx-emoji-btn { display: flex; }
}

/* =====================================================================
   October polish: Gallery / Layers bars, Stickers, top bar, backdrop, fonts, filters, quick sizes
   ===================================================================== */
/* Collapse sidebar: no box, just the icon and words */
.mx-rail-toggle { border-color: transparent; background: none; color: #71717a; }
.mx-rail-toggle:hover { background: rgba(255,255,255,.05); color: #e4e4e7; }
/* Colours sit on the right, so a long picture name never pushes them about */
@media (min-width: 761px) { .mx-ctx { margin: 0 0 0 auto; } }
/* Backdrop switch: top-left of the picture area on computers */
@media (min-width: 761px) { .mx-stage > .mx-bgpick { left: 14px; top: 14px; right: auto; bottom: auto; } }
/* See-through parts (rounded corners, erased areas) show the backdrop you picked, the same as round the picture */
.mx-board[data-bd] { background: none; }
.mx-stage, .mx-stage[data-bd="check"] { background: repeating-conic-gradient(#121216 0 25%, #0b0b0e 0 50%) 0 0/20px 20px; }
.mx-stage[data-bd="white"] { background: #fff; }
.mx-stage[data-bd="black"] { background: #000; }
.mx-bgpick [data-bd="check"] { background: repeating-conic-gradient(#3f3f46 0 25%, #18181b 0 50%) 0 0/8px 8px; }

/* Bars that open one section and close the other (Gallery / Layers, Stickers / Emojis) */
.mx-accpane .mx-acc { display: flex; align-items: center; justify-content: space-between; flex: none; width: 100%; min-height: 46px; padding: 0 14px 0 16px; border: 0; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0e0e14, #0a0a0f); color: #a1a1aa; font: 700 13px Inter, system-ui, sans-serif; letter-spacing: .01em; cursor: pointer; transition: color .2s, background .2s; }
.mx-accpane .mx-acc > span { display: inline-flex; align-items: center; gap: 10px; }
.mx-accpane .mx-acc .mx-acc-ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; color: #71717a; transition: color .2s; transform: none !important; }
.mx-accpane .mx-acc:hover { color: #e4e4e7; background: linear-gradient(180deg, #121219, #0c0c12); }
.mx-accpane .mx-acc[aria-expanded="true"] { color: #fff; box-shadow: inset 2px 0 0 #a78bfa; }
.mx-accpane .mx-acc[aria-expanded="true"] .mx-acc-ic { color: #c4b5fd; }
.mx-accpane .mx-acc i { margin-left: 2px; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.07); color: #a1a1aa; font: 700 11px Inter, system-ui, sans-serif; font-style: normal; }
.mx-accpane .mx-acc i:empty { display: none; }
.mx-accpane .mx-acc > svg { width: 17px; height: 17px; fill: none; stroke: #71717a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s cubic-bezier(.22,1,.36,1); }
.mx-accpane .mx-acc[aria-expanded="true"] > svg { transform: rotate(180deg); stroke: #c4b5fd; }
.mx-lpane .mx-libsec, .mx-lpane .mx-laysec { padding: 0; border-top: 0; max-height: none; }
.mx-lpane .mx-laysec .mx-sec-h { display: none; }
.mx-lpane[data-open="img"] .mx-libsec { flex: 1 1 auto; } .mx-lpane[data-open="img"] .mx-laysec { flex: 0 0 auto; }
.mx-lpane[data-open="lay"] .mx-laysec { flex: 1 1 auto; } .mx-lpane[data-open="lay"] .mx-libsec { flex: 0 0 auto; }
.mx-lpane[data-open="lay"] .mx-libsec > :not(.mx-acc), .mx-lpane[data-open="img"] .mx-laysec > :not(.mx-acc) { display: none !important; }
.mx-lpane .mx-libsec > :not(.mx-acc) { margin: 14px 14px 0; }
.mx-lpane .mx-libsec > .mx-libempty { margin: auto; padding: 24px 0; }
.mx-lpane .mx-libsec { overflow-y: auto; }
.mx-lpane .mx-laysec .mx-layers { margin-top: 0; padding: 10px 10px 14px; overflow-y: auto; }
.mx-lpane[data-open="img"] .mx-laysec { border-top: 0; }
.mx-lpane .mx-laysec:not([hidden]) .mx-acc { border-top: 1px solid var(--line); }
/* Stickers / Emojis */
.mx-emopane:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mx-accsec { display: flex; flex-direction: column; min-height: 0; }
.mx-emopane[data-open="stk"] [data-sec="stk"], .mx-emopane[data-open="emo"] [data-sec="emo"] { flex: 1 1 auto; }
.mx-emopane[data-open="stk"] [data-sec="emo"] .mx-accbody, .mx-emopane[data-open="emo"] [data-sec="stk"] .mx-accbody { display: none; }
.mx-emopane [data-sec="emo"] .mx-acc { border-top: 1px solid var(--line); }
.mx-accbody { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #27272a transparent; animation: mxAccIn .35s cubic-bezier(.22,1,.36,1) both; }
@keyframes mxAccIn { from { opacity: 0; transform: translateY(6px); } }
.mx-stk-tip { margin: 14px 16px 0; color: #71717a; font-size: 11.5px; line-height: 1.5; }
.mx-stk { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 14px 18px; }
.mx-stk button { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.06), rgba(255,255,255,.015)); color: inherit; cursor: grab; transition: transform .2s cubic-bezier(.22,1,.36,1), border-color .2s, background .2s, box-shadow .2s; }
.mx-stk button svg { width: 54%; height: 54%; filter: drop-shadow(0 3px 6px rgba(0,0,0,.45)); transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.mx-stk button:hover { border-color: rgba(167,139,250,.45); background: radial-gradient(120% 120% at 30% 20%, rgba(167,139,250,.16), rgba(255,255,255,.02)); box-shadow: 0 10px 24px -14px rgba(139,92,246,.8); }
.mx-stk button:hover svg { transform: scale(1.12) rotate(-4deg); }
.mx-stk button:active { transform: scale(.94); }
.mx-stk.dark button { background: radial-gradient(120% 120% at 30% 20%, #f4f4f5, #d4d4d8); border-color: rgba(255,255,255,.2); }
.mx-emopane .mx-emohost .mx-emo { flex: 1; min-height: 0; }
.mx-emo > .mx-stk { display: flex; gap: 6px; padding: 12px 16px 2px; overflow-x: auto; scrollbar-width: none; }
.mx-emo > .mx-stk::-webkit-scrollbar { display: none; }
.mx-emo > .mx-stk button { flex: none; width: 52px; }

/* Filters: shimmer while the previews are made */
.mx-filters canvas { transition: opacity .35s ease; }
.mx-filters button.sk canvas { opacity: 0; }
.mx-filters button.sk { position: relative; pointer-events: none; }
.mx-filters button.sk::before { content: ""; position: absolute; left: 5px; right: 5px; top: 5px; aspect-ratio: 4 / 3; border-radius: 8px; background: linear-gradient(100deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.04) 70%) 0 0 / 200% 100%; animation: mxShimmer 1.2s linear infinite; }
.mx-filters button.sk span { color: transparent; border-radius: 4px; background: rgba(255,255,255,.05); }
@keyframes mxShimmer { to { background-position: -200% 0; } }

/* Quick sizes: centred tiles with a little shape of each size */
.mx-presets { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mx-presets button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 92px; padding: 12px 6px 10px; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)); color: #e4e4e7; font: 700 12px Inter, system-ui, sans-serif; text-align: center; cursor: pointer; transition: border-color .2s, background .2s, transform .2s cubic-bezier(.22,1,.36,1), box-shadow .2s; }
.mx-presets button i { display: grid; place-items: center; width: 34px; height: 30px; margin-bottom: 5px; }
.mx-presets button em { display: block; width: var(--w); height: var(--h); border: 1.6px solid #a1a1aa; border-radius: 3px; background: rgba(255,255,255,.04); transition: border-color .2s, background .2s; }
.mx-presets .qs-scale em { border-style: dashed; }
.mx-presets button b { font-size: 12px; font-weight: 700; }
.mx-presets button small { color: #71717a; font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mx-presets button:hover { border-color: rgba(167,139,250,.45); background: linear-gradient(180deg, rgba(167,139,250,.12), rgba(167,139,250,.03)); transform: translateY(-2px); box-shadow: 0 12px 26px -16px rgba(139,92,246,.9); }
.mx-presets button:hover em { border-color: #c4b5fd; background: rgba(167,139,250,.18); }
.mx-presets button.on { border-color: rgba(167,139,250,.65); background: linear-gradient(180deg, rgba(167,139,250,.18), rgba(167,139,250,.05)); }
.mx-presets button.on em { border-color: #ddd6fe; background: rgba(167,139,250,.3); }
.mx-hint-c { margin-top: 12px; text-align: center; }

/* Fonts panel (Text tool) */
.mx-fonts { gap: 10px; }
.mx-fonts-back { height: 38px; padding: 0 10px; border-radius: 10px; background: none; color: #a1a1aa; font-size: 12.5px; }
.mx-fonts-back:hover { background: rgba(255,255,255,.05); color: #fff; }
.mx-fonts-h { display: grid; gap: 2px; padding: 2px 4px 0; }
.mx-fonts-h b { color: #fff; font: 800 15px Inter, system-ui, sans-serif; }
.mx-fonts-h small { color: #71717a; font-size: 11px; line-height: 1.4; white-space: normal; }
.mx-font-q { display: flex; align-items: center; gap: 8px; flex: none; height: 40px; padding: 0 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: #0b0b10; color: #71717a; transition: border-color .2s, box-shadow .2s; }
.mx-font-q:focus-within { border-color: rgba(167,139,250,.55); box-shadow: 0 0 0 3px rgba(167,139,250,.14); }
.mx-font-q svg { width: 16px !important; height: 16px !important; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mx-font-q input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: #fff; font: 500 13px Inter, system-ui, sans-serif; outline: none; }
.mx-font-list { gap: 16px; padding-bottom: 8px; }
.mx-fgroup[hidden] { display: none; }
.mx-fgroup h4 { margin: 0 4px 7px; color: #52525b; font: 800 10px Inter, system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.mx-fgroup > div { display: grid; gap: 6px; }
.mx-font-list button { position: relative; gap: 3px; padding: 11px 38px 10px 14px; border: 1px solid rgba(255,255,255,.06); border-radius: 13px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)); transition: border-color .2s, background .2s, transform .2s cubic-bezier(.22,1,.36,1); }
.mx-font-list button[hidden] { display: none; }
.mx-font-list button span { color: #f4f4f5; font-size: 20px; }
.mx-font-list button small { color: #71717a; letter-spacing: .02em; }
.mx-font-list button:hover { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.05); transform: translateX(2px); }
.mx-font-list button::after { content: ""; position: absolute; top: 50%; right: 12px; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.14); transition: all .2s; }
.mx-font-list button[aria-pressed="true"] { border-color: rgba(167,139,250,.6); background: linear-gradient(135deg, rgba(167,139,250,.18), rgba(34,211,238,.05)); box-shadow: 0 10px 26px -16px rgba(139,92,246,.9); }
.mx-font-list button[aria-pressed="true"]::after { border-color: #a78bfa; background: #a78bfa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0b10' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/11px no-repeat; }
@media (max-width: 760px) {
  .mx-fonts-h, .mx-font-q, .mx-fgroup h4 { display: none !important; }
  .mx-font-list { display: flex; flex-direction: row; gap: 6px; padding: 0; }
  .mx-fgroup, .mx-fgroup > div { display: contents; }
  .mx-font-list button { flex: none; width: 136px; padding: 8px 30px 8px 12px; border-radius: 12px; }
  .mx-font-list button span { font-size: 17px; }
  .mx-font-list button::after { right: 9px; width: 15px; height: 15px; margin-top: -7.5px; }
  .mx-font-list button:hover { transform: none; }
  .mx-fonts-back { height: 54px; padding: 0 12px; }
}
@media (min-width: 761px) {
  .mx-rail:has(.mx-fonts:not([hidden])) .mx-rail-foot { display: none; }
  .mx-fonts:not([hidden]) { flex: 1 1 auto; min-height: 0; }
  .mx-font-list { flex: 1; min-height: 0; overflow-y: auto; margin-right: -6px; padding-right: 6px; scrollbar-width: thin; scrollbar-color: #27272a transparent; }
}

/* More frames */
.mx-frames { grid-template-columns: repeat(3, 1fr); }
.mx-frames button { min-height: 84px; justify-content: center; border-radius: 14px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)); transition: border-color .2s, background .2s, transform .2s cubic-bezier(.22,1,.36,1); }
.mx-frames button:hover { transform: translateY(-2px); }
.mx-frames button[aria-pressed="true"] { border-color: rgba(167,139,250,.65); background: linear-gradient(180deg, rgba(167,139,250,.16), rgba(167,139,250,.04)); }
.mx-frames .fr-double { box-shadow: 0 0 0 2px #e4e4e7, 0 0 0 3px #52525b, 0 0 0 6px #e4e4e7; }
.mx-frames .fr-neon { box-shadow: 0 0 0 3px #07070b, 0 0 0 4.5px #22d3ee, 0 0 12px 4px rgba(34,211,238,.6); }
.mx-frames .fr-gradient { border: 4px solid transparent; border-radius: 5px; background: linear-gradient(135deg, #7c3aed, #22d3ee) padding-box, linear-gradient(135deg, #f472b6, #fbbf24) border-box; }
.mx-frames .fr-stamp { border: 4px dotted #e4e4e7; border-radius: 1px; }
.mx-frames .fr-float { box-shadow: 0 5px 7px rgba(0,0,0,.6), 0 0 0 7px #e4e4e7; }
.mx-frames .fr-tape { box-shadow: 0 0 0 3px #e4e4e7; }
.mx-frames .fr-tape::before, .mx-frames .fr-tape::after { content: ""; position: absolute; top: -6px; width: 18px; height: 7px; background: rgba(246,238,214,.85); }
.mx-frames .fr-tape::before { left: -8px; transform: rotate(-38deg); }
.mx-frames .fr-tape::after { right: -8px; transform: rotate(38deg); }

/* Select tool: shape picker and actions in the top bar */
.mx-selshape { display: flex; gap: 2px; padding: 3px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.03); }
.mx-selshape[hidden], .mx-selacts[hidden] { display: none; }
.mx-selshape button { display: grid; place-items: center; width: 34px; height: 30px; padding: 0; border: 0; border-radius: 9px; background: none; color: #a1a1aa; cursor: pointer; transition: background .2s, color .2s; }
.mx-selshape button:hover { background: rgba(255,255,255,.06); color: #fff; }
.mx-selshape button[aria-pressed="true"] { background: rgba(167,139,250,.2); color: #ddd6fe; box-shadow: inset 0 0 0 1px rgba(167,139,250,.45); }
.mx-selshape svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mx-selacts { display: flex; gap: 6px; animation: mxAccIn .3s cubic-bezier(.22,1,.36,1) both; }
.mx-selacts .mx-chip-btn { display: inline-flex; align-items: center; gap: 6px; }
.mx-selacts svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Panning with the middle button or Space */
.mx-stage.panning, .mx-stage.panning #mx-over { cursor: grab !important; }
/* Colours don't apply while selecting, so the selection buttons get the room */
.mx[data-tool="select"] .mx-swatches, .mx[data-tool="wand"] .mx-swatches, .mx[data-tool="select"] .mx-swbtn, .mx[data-tool="wand"] .mx-swbtn { display: none !important; }

/* Seven sidebar tabs on computers: Layers, Filters, Resize, Shapes, Emojis, Frames, Advanced */
@media (min-width: 761px) {
  .mx-tabs { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; padding-left: 4px; padding-right: 4px; }
  .mx-tabs button { min-width: 0; padding-left: 0; padding-right: 0; font-size: 9.5px; letter-spacing: -.01em; }
  .mx-tabs button span { overflow: hidden; max-width: 100%; text-overflow: clip; }
}
@media (max-width: 760px) { .mx-tabs .mx-tab-shapes, .mx-tabs .mx-tab-emoji { display: none; } }
.mx-shapepane .mx-stk { padding: 4px 0 6px; }
.mx-shapepane .mx-stk-tip { margin: -4px 0 12px; }
/* Gallery / Layers: both can be folded away */
.mx-lpane[data-open="none"] .mx-libsec > :not(.mx-acc), .mx-lpane[data-open="none"] .mx-laysec > :not(.mx-acc) { display: none !important; }
.mx-lpane[data-open="none"] .mx-libsec, .mx-lpane[data-open="none"] .mx-laysec { flex: 0 0 auto; }

/* Templates dropdown (Resize tab and New Canvas) */
.mx-tpl { margin: 0 0 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)); overflow: hidden; transition: border-color .25s, box-shadow .25s; }
.mx-tpl.open { border-color: rgba(167,139,250,.45); box-shadow: 0 16px 40px -24px rgba(139,92,246,.9); }
.mx-tpl svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mx-tpl-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px 11px 11px; border: 0; background: none; color: #e4e4e7; font: inherit; text-align: left; cursor: pointer; }
.mx-tpl-btn > svg { width: 17px; height: 17px; flex: none; color: #71717a; transition: transform .3s cubic-bezier(.22,1,.36,1); }
.mx-tpl.open .mx-tpl-btn > svg { transform: rotate(180deg); color: #c4b5fd; }
.mx-tpl-ic { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, rgba(167,139,250,.25), rgba(56,189,248,.15)); color: #ddd6fe; box-shadow: inset 0 0 0 1px rgba(167,139,250,.35); }
.mx-tpl-ic svg { width: 18px; height: 18px; }
.mx-tpl-t { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.mx-tpl-t b { color: #fff; font: 800 13.5px Inter, system-ui, sans-serif; }
.mx-tpl-t small { overflow: hidden; color: #8a8d9b; font: 600 11px Inter, system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.mx-tpl-list { display: grid; gap: 12px; max-height: 0; padding: 0 10px; overflow-y: auto; opacity: 0; scrollbar-width: thin; scrollbar-color: #27272a transparent; transition: max-height .4s cubic-bezier(.22,1,.36,1), opacity .25s, padding .3s; }
.mx-tpl.open .mx-tpl-list { max-height: 340px; padding: 4px 10px 12px; opacity: 1; }
.mx-tpl-list h4 { display: flex; align-items: center; gap: 8px; margin: 4px 4px 6px; color: #a1a1aa; font: 800 10.5px Inter, system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.mx-tpl-list h4 i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.mx-tpl-list section > div { display: grid; gap: 4px; }
.mx-tpl-list button { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: rgba(255,255,255,.02); color: #e4e4e7; font: 600 12.5px Inter, system-ui, sans-serif; text-align: left; cursor: pointer; transition: background .2s, border-color .2s; }
.mx-tpl-list button:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); }
.mx-tpl-list button.on { border-color: rgba(167,139,250,.55); background: rgba(167,139,250,.14); }
.mx-tpl-list em { justify-self: center; display: block; width: var(--w); height: var(--h); border: 1.5px solid #a1a1aa; border-radius: 2px; }
.mx-tpl-list button.on em, .mx-tpl-list button:hover em { border-color: #c4b5fd; }
.mx-tpl-list small { color: #71717a; font-size: 11px; font-variant-numeric: tabular-nums; }
.nd-tpl { margin: 10px 0 0; }
.nd-tpl.open .mx-tpl-list { max-height: 240px; }
.mx-presets button { padding-left: 4px; padding-right: 4px; }
.mx-presets button b { font-size: 11.5px; white-space: nowrap; }
.mx-presets button small { font-size: 10px; white-space: nowrap; }
/* Select tool: a tighter top bar so the selection buttons fit */
.mx[data-tool="select"] .mx-ctx, .mx[data-tool="wand"] .mx-ctx { gap: 8px; }
.mx[data-tool="select"] .mx-slider input, .mx[data-tool="wand"] .mx-slider input { width: 64px; }
.mx[data-tool="select"] .mx-selacts .mx-chip-btn, .mx[data-tool="wand"] .mx-selacts .mx-chip-btn, .mx[data-tool="select"] #mx-sel-del, .mx[data-tool="select"] #mx-sel-clear { padding: 0 9px; }
@media (max-width: 1500px) and (min-width: 761px) { .mx-selacts .mx-chip-btn { font-size: 0; gap: 0; width: 34px; justify-content: center; } .mx-selacts .mx-chip-btn svg { width: 16px; height: 16px; } }
.mx-selbtn { display: inline-flex; align-items: center; gap: 6px; }
.mx-selbtn[hidden] { display: none; }
.mx-selbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 1500px) and (min-width: 761px) { .mx-selbtn { font-size: 0; gap: 0; width: 34px; padding: 0 !important; justify-content: center; } .mx-selbtn svg { width: 16px; height: 16px; } }
@media (max-width: 1500px) and (min-width: 761px) {
  .mx[data-tool="select"] .mx-ctx, .mx[data-tool="wand"] .mx-ctx { gap: 6px; }
  .mx[data-tool="select"] .mx-slider b, .mx[data-tool="wand"] .mx-slider b { display: none; }
  .mx[data-tool="select"] .mx-slider input, .mx[data-tool="wand"] .mx-slider input { width: 56px; }
  .mx-selacts { gap: 4px; }
}
