.mas-canvas-host {
    cursor: default;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.mas-canvas-host.is-draw {
    cursor: crosshair;
}

.mas-canvas-host.is-panning {
    cursor: grabbing;
}

.mas-canvas-host.is-preview-mobile,
.mas-canvas-host.is-preview-tablet {
    margin: 16px auto;
    border: 10px solid #111827;
    border-radius: 28px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    background: #0f172a;
}

.mas-canvas-host.is-preview-mobile {
    max-width: 420px;
}

.mas-canvas-host.is-preview-tablet {
    max-width: 820px;
}

.mas-el-qr {
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    flex: 1 1 auto;
    aspect-ratio: 1;
    object-fit: contain;
}

.mas-guide {
    position: absolute;
    z-index: 9;
    background: transparent;
    box-shadow: none;
    cursor: move;
    pointer-events: auto;
}

.mas-guide__stroke {
    position: absolute;
    pointer-events: none;
    border-radius: 1px;
}

.mas-guide.is-selected .mas-guide__stroke {
    box-shadow: none;
    outline: none;
    filter: brightness(1.25);
}

.mas-el-qr-label {
    font-size: 11px;
    font-weight: 650;
    color: #111827;
}

.mas-draw-preview {
    position: absolute;
    box-sizing: border-box;
    border: 2px dashed var(--mas-main-color);
    background: color-mix(in srgb, var(--mas-main-color) 12%, transparent);
    pointer-events: none;
    z-index: 8;
}

.mas-draw-preview.is-path {
    border: none;
    background: transparent;
    color: var(--mas-main-color);
}

.mas-canvas-world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    overflow: visible;
}

.mas-artboard {
    position: absolute;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.mas-check-bg,
.mas-artboard--clear::before {
    background-color: #f8fafc;
    background-image:
        linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
        linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
        linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.mas-artboard--clear::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.mas-artboard.is-drop-target {
    outline: 2px dashed var(--mas-main-color);
    outline-offset: 4px;
}

.mas-artboard-grid {
    position: absolute;
    inset: 0;
    pointer-events: none !important;
    z-index: 0;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.22) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.22) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
    background-size: var(--mas-grid, 32px) var(--mas-grid, 32px), var(--mas-grid, 32px) var(--mas-grid, 32px), var(--mas-grid-sub, 8px) var(--mas-grid-sub, 8px), var(--mas-grid-sub, 8px) var(--mas-grid-sub, 8px);
}

.mas-artboard-label {
    position: absolute;
    top: -22px;
    left: 0;
    font-size: 12px;
    opacity: 0.75;
    pointer-events: none;
}

.mas-el {
    position: absolute;
    box-sizing: border-box;
    user-select: none;
    z-index: 2;
    cursor: move;
    overflow: visible;
}

.mas-el-shape-fill {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    overflow: hidden;
}

.mas-el-shape-stroke {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 2;
}

.mas-el-stroke-ring {
    pointer-events: none;
    box-sizing: border-box;
}

.mas-el-hit {
    position: absolute;
    inset: 0;
    z-index: 3;
    cursor: move;
    pointer-events: auto;
}

.mas-el-glyph {
    pointer-events: none;
    width: 100%;
    height: auto;
}

.mas-el-list {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    width: 100%;
}

.mas-el-list__row {
    display: grid;
    grid-template-columns: 1.6em minmax(0, 1fr);
    align-items: start;
    column-gap: 0.35em;
}

.mas-el-list__mark {
    text-align: right;
    user-select: none;
}

.mas-el-list--bullet .mas-el-list__mark {
    text-align: center;
}

.mas-el-list__body {
    min-width: 0;
    white-space: pre-wrap;
}

.mas-el.is-dragging,
.mas-el.is-dragging .mas-el-hit,
.mas-el.is-dragging * {
    pointer-events: none !important;
}

.mas-el.is-dragging {
    z-index: 50;
}

.mas-el.is-selected {
    outline: none;
    box-shadow: none;
    z-index: 40;
}

.mas-el--text,
.mas-el--button {
    overflow: hidden;
}

.mas-sel-overlay {
    position: absolute;
    z-index: 7;
    pointer-events: none;
}

.mas-sel-overlay__frame {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border: none;
    outline: 3px solid var(--mas-main-color);
    outline-offset: -1.5px;
    pointer-events: none;
}

.mas-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--mas-main-color);
    border-radius: 1px;
    z-index: 6;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.mas-el.is-selected.mas-el--qrcode {
    overflow: visible;
}

.mas-el--qrcode {
    overflow: hidden;
    box-sizing: border-box;
}

.mas-el--path {
    overflow: visible;
    background: transparent;
    pointer-events: none;
}

.mas-el--path svg {
    pointer-events: none;
    overflow: visible;
}

.mas-el--path svg * {
    pointer-events: visiblePainted;
}

.mas-el--icon {
    overflow: hidden;
    font-size: 0;
}

.mas-el--icon .mas-el-glyph {
    display: flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1 !important;
    overflow: hidden;
}

.mas-el--icon .mas-el-glyph::before {
    font-size: inherit !important;
    line-height: 1;
}

.mas-el-edit {
    position: absolute;
    left: -36px;
    top: 0;
    z-index: 8;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #1f2937;
    color: #f8fafc;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28);
    padding: 0;
    pointer-events: auto;
}

.mas-sel-overlay .mas-el-edit {
    transform: none;
}

.mas-el.is-text-editing {
    cursor: text;
    z-index: 45;
    user-select: text;
    -webkit-user-select: text;
}

.mas-el.is-text-editing .mas-el-hit,
.mas-el.is-text-editing .mas-handle,
.mas-el.is-text-editing .mas-el-edit {
    pointer-events: none !important;
    visibility: hidden;
}

.mas-el-textedit {
    position: absolute;
    inset: 0;
    z-index: 12;
    margin: 0;
    border: none;
    outline: 2px solid var(--mas-main-color);
    outline-offset: -1px;
    resize: none;
    overflow: hidden;
    background: transparent;
    color: inherit;
    font: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    text-align: inherit;
    text-decoration: inherit;
    width: 100%;
    height: 100%;
    cursor: text;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
    box-sizing: border-box;
    padding: inherit;
    white-space: pre-wrap;
}

.mas-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.mas-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.mas-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.mas-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.mas-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }
.mas-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.mas-handle--sw { left: 0; top: 100%; cursor: nwse-resize; }
.mas-handle--w { left: 0; top: 50%; cursor: ew-resize; }
.mas-handle--rot {
    left: 50%;
    top: -18px;
    border-radius: 50%;
    cursor: grab;
}

.mas-el--table > .mas-el-hit {
    z-index: 2;
}

.mas-el--table > .mas-el {
    z-index: 4;
}

.mas-table-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.mas-table-cell {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
}

.mas-table-cell.has-right {
    border-right: 1px solid #CBD5E1;
}

.mas-table-cell.has-bottom {
    border-bottom: 1px solid #CBD5E1;
}

.mas-table-cell.is-drop {
    background: rgba(56, 189, 248, 0.32);
    box-shadow: inset 0 0 0 2px #38bdf8;
    z-index: 2;
}

.mas-table-cell.is-occupied .mas-table-hint {
    display: none;
}

.mas-table-hint {
    position: absolute;
    inset: 10px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
}

.mas-table-split {
    position: absolute;
    z-index: 9;
    pointer-events: auto;
    background: transparent;
}

.mas-table-split--col {
    top: 0;
    bottom: 0;
    width: 10px;
    transform: translateX(-5px);
    cursor: col-resize;
}

.mas-table-split--row {
    left: 0;
    right: 0;
    height: 10px;
    transform: translateY(-5px);
    cursor: row-resize;
}

.mas-table-add {
    position: absolute;
    z-index: 10;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: #38bdf8;
    color: #fff;
    font-size: 16px;
    line-height: 22px;
    padding: 0;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.mas-table-add--col {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
}

.mas-table-add--row {
    left: 50%;
    bottom: -12px;
    transform: translateX(-50%);
}

.mas-marquee {
    position: absolute;
    border: 1px dashed var(--mas-main-color);
    background: color-mix(in srgb, var(--mas-main-color) 12%, transparent);
    pointer-events: none;
    z-index: 20;
}

.mas-ruler,
.mas-ruler--corner {
    position: absolute;
    z-index: 15;
    background: var(--dark-main-bg-color, #161a22);
    color: var(--main-dark-text-color, #e5e7eb);
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.light .mas-ruler,
.light .mas-ruler--corner,
.light-theme-dark-sidebar .mas-ruler,
.light-theme-dark-sidebar .mas-ruler--corner {
    background: var(--light-main-bg-color, #fff);
    color: #334155;
}

.mas-ruler--h {
    top: 0;
    left: 24px;
    right: 0;
    height: 24px;
    border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.mas-ruler--v {
    top: 24px;
    left: 0;
    bottom: 0;
    width: 24px;
    border-right: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.mas-ruler--corner {
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: lowercase;
    border-right: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.mas-ruler-tick {
    position: absolute;
    font-size: 9px;
    line-height: 1;
    opacity: 0.85;
    pointer-events: none;
}

.mas-ruler-tick--h {
    top: 0;
    height: 24px;
}

.mas-ruler-tick--h .mas-ruler-tick__mark {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: currentColor;
}

.mas-ruler-tick--h .mas-ruler-tick__label {
    display: block;
    padding: 3px 0 0 4px;
    white-space: nowrap;
}

.mas-ruler-tick--v {
    left: 0;
    width: 24px;
}

.mas-ruler-tick--v .mas-ruler-tick__mark {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
}

.mas-ruler-tick--v .mas-ruler-tick__label {
    display: block;
    padding: 4px 0 0 2px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.mas-sel-overlay.is-path .mas-sel-overlay__frame,
.mas-sel-overlay.is-path .mas-handle {
    display: none;
}

.mas-path-pt {
    position: absolute;
    width: 11px;
    height: 11px;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    z-index: 9;
    pointer-events: auto;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28);
}

.mas-path-pt.is-anchor {
    border-radius: 50%;
    background: #22d3ee;
}

.mas-path-pt.is-ctrl {
    border-radius: 2px;
    background: #84cc16;
}
