.page-main {
    background: #000 !important;
}

[x-cloak] {
    display: none !important;
}

.page-main .columns,
.page-main .column.main,
.page-main .main.content,
.page-main .page-title-wrapper {
    background: #000 !important;
}

.wiremaster-workspace {
    position: relative;
}

.wiremaster-palette {
    max-height: 1000px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem;
    background: rgba(39, 24, 80, 0.45);
}

.wiremaster-palette-item {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(93, 47, 148, 0.45);
    color: #fff;
    text-align: left;
}

.wiremaster-palette-item:last-child {
    margin-bottom: 0;
}

.wiremaster-palette-item[draggable="true"] {
    cursor: grab;
}

.wiremaster-palette-item.is-placed {
    border-color: rgba(34, 197, 94, 0.4);
}

.wiremaster-wifi-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
}

.wiremaster-thumb,
.wiremaster-thumb-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 0.35rem;
    flex: 0 0 auto;
}

.wiremaster-thumb {
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.wiremaster-thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    font-size: 0.65rem;
    text-transform: uppercase;
    border: 1px dashed rgba(255, 255, 255, 0.35);
}

.wiremaster-canvas-section {
    position: relative;
}

.wiremaster-canvas-shell {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.5rem;
    background: rgba(39, 24, 80, 0.35);
}

.wiremaster-canvas-shell--full {
    grid-column: 1 / -1;
}

.wiremaster-canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.25rem;
}

.wiremaster-toolbar-label {
    flex: 0 1 auto;
    min-width: 0;
}

.wiremaster-label-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: block;
    text-align: left;
}

.wiremaster-label-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.wm-ico {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    vertical-align: middle;
}

.wm-ico--zoom {
    width: 14px;
    height: 14px;
}

.wiremaster-bottom-toolbar {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.25rem;
}

.wiremaster-bottom-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    opacity: 0.7;
    transition: opacity 0.15s ease, background-color 0.2s ease;
}

.wiremaster-bottom-btn:hover,
.wiremaster-bottom-btn.is-active {
    opacity: 1;
}

.wiremaster-palette-popup {
    position: fixed;
    right: 1rem;
    top: 5.5rem;
    width: min(360px, calc(100vw - 2rem));
    max-height: calc(100vh - 7rem);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    background: rgba(22, 11, 44, 0.95);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wiremaster-palette-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    cursor: move;
    user-select: none;
}

.wiremaster-palette-popup-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}

.wiremaster-palette-popup-close {
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(120, 0, 0, 0.8);
    color: #fff;
    width: 22px;
    height: 22px;
    line-height: 1;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}

.wiremaster-palette-popup-close:hover {
    background: rgba(180, 0, 0, 1);
}

.wiremaster-palette-popup-close-text {
    width: auto;
    min-width: 56px;
    height: 24px;
    padding: 0 0.55rem;
    border-radius: 0.4rem;
    font-size: 11px;
    line-height: 1;
    background: rgba(107, 114, 128, 0.85);
    border-color: rgba(209, 213, 219, 0.55);
    color: #fff;
}

.wiremaster-palette-popup-close-text:hover {
    background: rgba(75, 85, 99, 1);
}

.wiremaster-palette-popup-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0.75rem;
}

.wiremaster-palette-popup .wiremaster-palette {
    max-height: none;
}

.wiremaster-palette-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: 0;
    padding: 0 0 0.35rem;
    margin-bottom: 0.35rem;
    cursor: pointer;
}

.wiremaster-palette-section-toggle > span:first-child {
    flex: 1 1 auto;
    text-align: left;
}

.wiremaster-palette-section-arrow {
    color: #fff !important;
    width: 18px;
    height: 18px;
    margin-left: 0.5rem;
    flex: 0 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.wiremaster-placement-notice {
    position: fixed;
    right: 1rem;
    top: 4.25rem;
    z-index: 10020;
    max-width: min(440px, calc(100vw - 2rem));
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.5rem;
    background: rgba(185, 28, 28, 0.95);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.fp-wm-voltage-warning {
    position: fixed;
    right: 1rem;
    top: 5.5rem;
    z-index: 10020;
    max-width: min(380px, calc(100vw - 2rem));
    border: 1px solid rgba(220, 38, 38, 0.6);
    border-radius: 0.5rem;
    background: rgba(127, 29, 29, 0.95);
    color: #fca5a5;
    font-size: 0.85rem;
    line-height: 1.35;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.fp-wm-voltage-warning strong {
    color: #fef2f2;
    font-size: 0.9rem;
}

.wiremaster-debug-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.wiremaster-debug-dialog {
    width: min(900px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    background: rgba(22, 11, 44, 0.98);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.wiremaster-debug-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid rgba(120, 53, 15, 0.6);
    background: #78350f;
    cursor: move;
    user-select: none;
}

.wiremaster-debug-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}

.wiremaster-debug-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem;
    background: #fff8b0;
}

.wiremaster-debug-log {
    margin: 0;
    color: #111;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.wiremaster-debug-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.wiremaster-debug-copy-btn:hover {
    background: rgba(255,255,255,0.35);
}

.wiremaster-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(17, 24, 39, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 24, 39, 0.12) 1px, transparent 1px);
    background-size: 25px 25px;
    background-color: rgb(131 129 133 / 75%);
    border: 1px solid rgba(17, 24, 39, 0.2);
    border-radius: 0.5rem;
    cursor: grab;
}

.wiremaster-canvas-viewport {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    height: min(1000px, calc(100vw - 6rem));
    min-height: 420px;
    overflow: hidden;
    border: 1px solid rgba(17, 24, 39, 0.2);
    border-radius: 0.5rem;
    background: rgb(131 129 133 / 75%);
}

.wiremaster-canvas-layer {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: top left;
    will-change: transform;
}

.wiremaster-canvas-viewport.is-panning .wiremaster-canvas {
    cursor: grabbing;
}

.wiremaster-wire-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.5rem;
    background: rgba(93, 47, 148, 0.65);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.wiremaster-wire-btn:hover {
    background: rgba(130, 70, 190, 0.75);
}

.wiremaster-wire-btn.is-active {
    background: rgba(22, 163, 74, 0.8);
}

.wiremaster-wire-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.wiremaster-zoom-btn {
    min-width: 2rem;
    padding: 0.35rem 0.55rem;
    line-height: 1;
    font-size: 1rem;
}

.wiremaster-canvas-label-input {
    min-width: 140px;
    max-width: 320px;
    border: 1px solid #2563eb !important;
    border-radius: 0.35rem;
    background: #ffffff !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    text-shadow: none !important;
    caret-color: #111827;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.2rem 0.45rem;
}

.wiremaster-wire-status {
    font-size: 0.75rem;
    line-height: 1;
    padding: 0.3rem 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
}

.wiremaster-wire-status.is-success {
    background: rgba(22, 163, 74, 0.2);
    border-color: rgba(22, 163, 74, 0.5);
}

.wiremaster-wire-status.is-warning {
    background: rgba(234, 179, 8, 0.2);
    border-color: rgba(234, 179, 8, 0.5);
}

.wiremaster-wire-status.is-error {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.5);
}

.wiremaster-wire-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.wiremaster-debug-dots-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.wiremaster-debug-copy-btn.is-active {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
}

.wiremaster-canvas-item {
    position: absolute;
    padding: 3px;
    cursor: move;
    user-select: none;
    text-align: center;
    z-index: 1;
}

.wiremaster-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    background: rgba(120, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.wiremaster-remove-btn:hover {
    background: rgba(180, 0, 0, 1);
}

.wiremaster-canvas-image {
    border-radius: 0.35rem;
    border: none;
    outline: 1px solid transparent;
    outline-offset: -1px;
    display: block;
    margin: 0 auto;
    transition: outline-color 0.15s ease;
}

.wiremaster-canvas-item:hover .wiremaster-remove-btn,
.wiremaster-canvas-item:focus-within .wiremaster-remove-btn {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wiremaster-canvas-item:hover .wiremaster-canvas-image,
.wiremaster-canvas-item:focus-within .wiremaster-canvas-image {
    outline-color: rgba(255, 255, 255, 0.3);
}

.wiremaster-canvas-item.is-controller .wiremaster-canvas-image {
    height: 250px;
    width: auto;
    max-width: 1000px;
}

.wiremaster-canvas-item.is-standard-item .wiremaster-canvas-image {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.wiremaster-item-label {
    margin-top: 0.2rem;
    font-size: 0.65rem;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: normal;
    word-break: break-word;
}

.wiremaster-palette-item-label {
    flex: 1 1 auto;
    min-width: 0;
}

.wiremaster-palette-item-sublabel {
    flex: 0 0 100%;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.7rem;
    line-height: 1.2;
    margin-top: -0.5rem;
    padding-left: 0.25rem;
}

.wiremaster-palette-actions {
    display: inline-flex;
    gap: 4px;
    flex: 0 0 auto;
    margin-left: auto;
}

.wiremaster-palette-action-btn {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, opacity 0.15s ease;
    padding: 0;
}

.wiremaster-palette-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.wiremaster-palette-action-btn.is-wires-hidden {
    opacity: 0.35;
    background: rgba(0, 0, 0, 0.3);
}

.wiremaster-palette-action-btn.is-notes-hidden {
    opacity: 0.35;
    background: rgba(0, 0, 0, 0.3);
}

.wiremaster-palette-action-btn.is-watts-editing {
    background: rgba(234, 179, 8, 0.45);
    border-color: rgba(234, 179, 8, 0.6);
}

.wiremaster-palette-action-btn.is-info-open {
    background: rgba(59, 130, 246, 0.45);
    border-color: rgba(59, 130, 246, 0.6);
}

.wiremaster-palette-action-btn--remove:hover {
    background: rgba(220, 38, 38, 0.7);
}

.wiremaster-watts-edit {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 0.5rem 2px;
}

.wiremaster-watts-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    white-space: nowrap;
}

.wiremaster-watts-input {
    width: 80px;
    padding: 3px 6px;
    border: 1px solid rgba(234, 179, 8, 0.5);
    border-radius: 0.3rem;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.3;
    outline: none;
}

.wiremaster-watts-input:focus {
    border-color: rgba(234, 179, 8, 0.8);
    box-shadow: 0 0 4px rgba(234, 179, 8, 0.3);
}

.wiremaster-info-popup {
    width: 100%;
    padding: 6px 0.5rem 4px;
    border-top: 1px solid rgba(59, 130, 246, 0.25);
    margin-top: 2px;
}

.wiremaster-info-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.75rem;
    color: #e2e8f0;
    line-height: 1.35;
}

.wiremaster-info-label {
    color: rgba(147, 197, 253, 0.85);
    font-weight: 600;
    margin-right: 8px;
}

.wiremaster-palette-action-btn.is-wire-colors-open {
    background: rgba(168, 85, 247, 0.45);
    border-color: rgba(168, 85, 247, 0.6);
}

.wiremaster-palette-action-btn.has-wire-color-overrides {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.5);
}

.wiremaster-wire-colors-edit {
    width: 100%;
    padding: 6px 0.5rem 6px;
    border-top: 1px solid rgba(168, 85, 247, 0.3);
    margin-top: 2px;
}

.wiremaster-wire-colors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.wiremaster-wire-colors-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(216, 180, 254, 0.9);
}

.wiremaster-wire-colors-reset-all {
    font-size: 0.65rem;
    padding: 1px 6px;
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 4px;
    background: rgba(168, 85, 247, 0.2);
    color: rgba(216, 180, 254, 0.85);
    cursor: pointer;
}

.wiremaster-wire-colors-reset-all:hover {
    background: rgba(168, 85, 247, 0.4);
}

.wiremaster-wire-color-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.wiremaster-wire-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex: 0 0 auto;
}

.wiremaster-wire-color-label {
    font-size: 0.72rem;
    color: #e2e8f0;
    flex: 1 1 auto;
    min-width: 0;
    text-transform: capitalize;
}

.wiremaster-wire-color-input {
    width: 28px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}

.wiremaster-wire-color-input::-webkit-color-swatch-wrapper {
    padding: 1px;
}

.wiremaster-wire-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.wiremaster-wire-color-reset {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 0.65rem;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiremaster-wire-color-reset:hover {
    background: rgba(239, 68, 68, 0.5);
}

.wiremaster-wire-visibility-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: rgba(226, 232, 240, 0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: color 0.15s, background 0.15s;
}

.wiremaster-wire-visibility-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.wiremaster-wire-visibility-btn.is-wire-hidden {
    color: rgba(226, 232, 240, 0.35);
}

.wiremaster-wire-visibility-btn.is-wire-hidden:hover {
    color: rgba(226, 232, 240, 0.7);
    background: rgba(255, 255, 255, 0.08);
}

.wiremaster-wire-color-row.is-wire-index-hidden .wiremaster-wire-color-swatch {
    opacity: 0.3;
}

.wiremaster-wire-color-row.is-wire-index-hidden .wiremaster-wire-color-label {
    opacity: 0.4;
}

.wiremaster-palette-action-btn.is-variant-open {
    background: rgba(34, 197, 94, 0.45);
    border-color: rgba(34, 197, 94, 0.6);
}

.wiremaster-palette-action-btn.has-variant-override {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5);
}

.wiremaster-variant-select {
    width: 100%;
    padding: 6px 0.5rem 6px;
    border-top: 1px solid rgba(34, 197, 94, 0.3);
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
}

.wiremaster-variant-select-header {
    width: 100%;
    margin-bottom: 2px;
}

.wiremaster-variant-select-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(134, 239, 172, 0.9);
}

.wiremaster-variant-option {
    padding: 3px 8px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.12);
    color: #d1d5db;
    font-size: 0.72rem;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.3;
}

.wiremaster-variant-option:hover {
    background: rgba(34, 197, 94, 0.3);
    color: #fff;
}

.wiremaster-variant-option.is-active {
    background: rgba(34, 197, 94, 0.45);
    border-color: rgba(34, 197, 94, 0.7);
    color: #fff;
    font-weight: 600;
}

/* Guide walkthrough */
.wiremaster-guide-btn {
    background: rgba(6, 182, 212, 0.7) !important;
    border-color: rgba(6, 182, 212, 0.5) !important;
    color: #fff !important;
}

.wiremaster-guide-btn:hover {
    background: rgba(6, 182, 212, 0.9) !important;
}

.wiremaster-guide-tooltip {
    pointer-events: auto;
}

.wiremaster-guide-tooltip-inner {
    position: relative;
    background: linear-gradient(135deg, #042f2e 0%, #064e3b 100%);
    border: 2px solid rgba(20, 184, 166, 0.7);
    border-radius: 0.75rem;
    padding: 0.85rem 1.2rem 0.75rem;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.45;
    width: 300px;
    box-shadow:
        0 0 20px rgba(20, 184, 166, 0.3),
        0 0 40px rgba(20, 184, 166, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.5);
    animation: wiremaster-guide-pulse 2.5s ease-in-out infinite;
}

.wiremaster-guide-tooltip-inner::before {
    content: '';
    position: absolute;
    left: var(--guide-arrow-left, 50%);
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
}

.wiremaster-guide-arrow-up::before {
    top: -8px;
    bottom: auto;
    border-bottom: 8px solid rgba(20, 184, 166, 0.7);
    border-top: none;
}

.wiremaster-guide-arrow-down::before {
    bottom: -8px;
    top: auto;
    border-top: 8px solid rgba(20, 184, 166, 0.7);
    border-bottom: none;
}

.wiremaster-guide-arrow-right::before {
    right: -8px;
    left: auto;
    top: var(--guide-arrow-top, 50%);
    transform: translateY(-50%);
    border-left: 8px solid rgba(20, 184, 166, 0.7);
    border-right: none;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.wiremaster-guide-arrow-left::before {
    left: -8px;
    right: auto;
    top: var(--guide-arrow-top, 50%);
    transform: translateY(-50%);
    border-right: 8px solid rgba(20, 184, 166, 0.7);
    border-left: none;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

@keyframes wiremaster-guide-pulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(20, 184, 166, 0.3),
            0 0 40px rgba(20, 184, 166, 0.1),
            0 8px 24px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 0 30px rgba(20, 184, 166, 0.5),
            0 0 60px rgba(20, 184, 166, 0.15),
            0 8px 24px rgba(0, 0, 0, 0.5);
    }
}

.wiremaster-guide-skip {
    position: absolute;
    top: 0.35rem;
    right: 0.4rem;
    background: none;
    border: none;
    color: rgba(153, 246, 228, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.1rem 0.25rem;
}

.wiremaster-guide-skip:hover {
    color: #99f6e4;
}

.wiremaster-guide-step-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(153, 246, 228, 0.7);
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.wiremaster-guide-message {
    font-weight: 600;
    color: #ccfbf1;
}

.wiremaster-guide-complete {
    text-align: center;
    background: linear-gradient(135deg, #422006 0%, #713f12 50%, #422006 100%);
    border-color: rgba(251, 191, 36, 0.7);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.35), 0 0 60px rgba(251, 191, 36, 0.1), 0 8px 28px rgba(0, 0, 0, 0.5);
    animation: wiremaster-guide-complete-glow 1.5s ease-in-out infinite;
    padding: 1.5rem 2rem;
    width: 360px;
}

.wiremaster-guide-complete .wiremaster-guide-message {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #fde68a, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wiremaster-guide-complete::before {
    display: none;
}

@keyframes wiremaster-guide-complete-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(251, 191, 36, 0.35), 0 0 60px rgba(251, 191, 36, 0.1), 0 8px 28px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 50px rgba(251, 191, 36, 0.55), 0 0 80px rgba(251, 191, 36, 0.15), 0 8px 28px rgba(0, 0, 0, 0.5); }
}

.wiremaster-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10090;
    pointer-events: none;
}

.wiremaster-mapping-comment {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    pointer-events: auto;
    width: 240px;
    margin-bottom: 6px;
}

.wiremaster-mapping-comment-inner {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.96) 0%, rgba(22, 42, 72, 0.98) 100%);
    border: 1px solid rgba(96, 165, 250, 0.45);
    border-radius: 0.625rem;
    padding: 0.625rem 0.875rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(96, 165, 250, 0.15);
    color: #e2e8f0;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.wiremaster-mapping-comment-inner::before {
    content: '';
    position: absolute;
    bottom: -6px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(96, 165, 250, 0.45);
    border-bottom: none;
}

.wiremaster-mapping-comment.is-below .wiremaster-mapping-comment-inner::before {
    bottom: auto;
    top: -6px;
    border-top: none;
    border-bottom: 6px solid rgba(96, 165, 250, 0.45);
}

.wiremaster-mapping-comment-close {
    position: absolute;
    top: 0.25rem;
    right: 0.375rem;
    background: none;
    border: none;
    color: rgba(148, 163, 184, 0.8);
    font-size: 0.875rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}

.wiremaster-mapping-comment-close:hover {
    color: #f87171;
}

.wiremaster-mapping-comment-label {
    font-weight: 700;
    font-size: 0.75rem;
    color: rgba(147, 197, 253, 0.9);
    margin-bottom: 0.25rem;
    padding-right: 1.25rem;
}

.wiremaster-mapping-comment-text {
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.wiremaster-shared-output-warning {
    font-size: 0.75rem;
    line-height: 1.3;
    padding: 0.35rem 0.625rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(234, 179, 8, 0.5);
    background: rgba(234, 179, 8, 0.15);
    color: #fef3c7;
    text-align: center;
}

.wiremaster-steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.92);
    border-bottom: 1px solid rgba(100, 116, 139, 0.35);
    z-index: 80;
    position: relative;
}

.wiremaster-steps-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #e2e8f0;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.wiremaster-steps-entity {
    font-size: 0.85rem;
    color: #93c5fd;
    font-style: italic;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wiremaster-steps-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 6px;
    background: rgba(51, 65, 85, 0.7);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.wiremaster-steps-nav-btn:hover:not(:disabled) {
    background: rgba(71, 85, 105, 0.9);
    border-color: rgba(148, 163, 184, 0.7);
}

.wiremaster-steps-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.wiremaster-steps-nav-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.wiremaster-steps-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 50%;
    background: rgba(51, 65, 85, 0.5);
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-left: 0.25rem;
}

.wiremaster-steps-close-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

.wiremaster-steps-close-btn svg {
    width: 14px;
    height: 14px;
}

/* Wire hover marching-dots animation */
.wire-march-overlay {
    opacity: 0;
    pointer-events: none;
    stroke-dasharray: 6 14;
}

.wire-march-active {
    opacity: 1;
    animation: wire-march 0.5s linear infinite;
}

@keyframes wire-march {
    from { stroke-dashoffset: 20; }
    to { stroke-dashoffset: 0; }
}

/* Touch add button */
.wiremaster-touch-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(34, 197, 94, 0.6);
    border-radius: 0.4rem;
    background: rgba(34, 197, 94, 0.35);
    color: #fff;
    cursor: pointer;
    flex: 0 0 auto;
    margin-left: auto;
    transition: background-color 0.15s ease;
}

.wiremaster-touch-add-btn:hover,
.wiremaster-touch-add-btn:active {
    background: rgba(34, 197, 94, 0.55);
}

/* Prevent page scroll on canvas touch */
.wiremaster-canvas-viewport {
    touch-action: none;
}

/* Touch devices: always show remove button on canvas items */
.wm-touch .wiremaster-canvas-item .wiremaster-remove-btn {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    width: 28px;
    height: 28px;
    font-size: 14px;
    top: -10px;
    right: -10px;
}

@media (max-width: 960px) {
    .wiremaster-palette-popup {
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        top: 5rem;
    }

    .wiremaster-guide-tooltip-inner {
        width: 260px;
        font-size: 0.8rem;
    }

    .wiremaster-mapping-comment {
        max-width: 220px;
    }

    .wiremaster-steps-bar {
        gap: 0.4rem;
        padding: 0.4rem 0.5rem;
        flex-wrap: wrap;
    }

    .wiremaster-steps-entity {
        max-width: 120px;
    }
}

@media (max-width: 640px) {
    /* Strip container and wrapper padding so canvas fills edge-to-edge */
    .wiremaster-app > .container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0 !important;
        max-width: 100% !important;
    }

    .wiremaster-app > .container > header {
        margin-bottom: 0.25rem !important;
    }

    .wiremaster-app > .container > header h1 {
        font-size: 1.75rem;
    }

    .wiremaster-app > .container > main {
        padding: 0 !important;
        border-radius: 0 !important;
        min-height: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .page-main,
    .page-main .columns,
    .page-main .column.main {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .wiremaster-canvas-shell {
        border: none;
        border-radius: 0;
    }

    .wiremaster-canvas-viewport {
        border-radius: 0;
        border: none;
    }

    .wiremaster-canvas {
        border-left: none;
        border-right: none;
        border-radius: 0;
    }

    .wiremaster-canvas-toolbar {
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0.35rem 0.25rem;
    }

    .wiremaster-toolbar-label {
        flex: 0 0 auto;
        order: 0;
    }

    .wiremaster-label-btn {
        font-size: 0.9rem;
        max-width: 120px;
    }

    .wiremaster-wire-controls {
        flex-wrap: wrap;
        gap: 0.3rem;
        order: 1;
        justify-content: center;
    }

    .wiremaster-wire-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        gap: 0.2rem;
    }

    .wiremaster-zoom-btn {
        min-width: 1.75rem;
        padding: 0.3rem 0.4rem;
    }

    .wm-ico {
        width: 13px;
        height: 13px;
    }

    /* Palette as bottom sheet */
    .wiremaster-palette-popup {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 45vh;
        border-radius: 1rem 1rem 0 0;
        border-bottom: none;
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.5);
    }

    .wiremaster-palette-popup-head {
        cursor: default;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        padding: 0.5rem 0.85rem;
    }

    .wiremaster-palette-popup-head::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.3);
        margin: 0 auto 0.4rem;
    }

    /* Canvas viewport fills available space */
    .wiremaster-canvas-viewport {
        height: calc(100vh - 14rem);
        min-height: 200px;
        max-width: 100%;
    }

    .wiremaster-canvas-section {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Scale down entity images */
    .wiremaster-canvas-item.is-controller .wiremaster-canvas-image {
        height: 150px;
    }

    .wiremaster-canvas-item.is-standard-item .wiremaster-canvas-image {
        max-width: 120px;
        max-height: 120px;
    }

    .wiremaster-item-label {
        font-size: 0.55rem;
    }

    /* Steps bar compact */
    .wiremaster-steps-bar {
        gap: 0.3rem;
        padding: 0.3rem 0.4rem;
    }

    .wiremaster-steps-label {
        font-size: 0.8rem;
    }

    .wiremaster-steps-entity {
        font-size: 0.75rem;
        max-width: 80px;
    }

    .wiremaster-steps-nav-btn {
        font-size: 0.72rem;
        padding: 0.25rem 0.5rem;
    }

    /* Bottom toolbar */
    .wiremaster-bottom-toolbar {
        padding: 0.25rem;
    }

    /* Debug dialog fixed on mobile */
    .wiremaster-debug-dialog {
        left: 0.5rem !important;
        right: 0.5rem !important;
        top: 3rem !important;
        width: auto !important;
        max-height: 50vh !important;
        border-radius: 0.75rem;
    }

    /* Mapping comments smaller */
    .wiremaster-mapping-comment {
        width: 180px;
        max-width: 180px;
    }

    .wiremaster-mapping-comment-inner {
        font-size: 0.72rem;
        padding: 0.5rem 0.65rem;
    }

    /* Guide tooltip */
    .wiremaster-guide-tooltip-inner {
        width: 220px;
        font-size: 0.75rem;
        padding: 0.65rem 0.85rem 0.55rem;
    }

    .wiremaster-guide-complete {
        width: 280px;
        padding: 1rem 1.25rem;
    }

    .wiremaster-guide-complete .wiremaster-guide-message {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .wiremaster-wire-btn {
        font-size: 0;
        padding: 0.35rem;
        min-width: 32px;
        min-height: 32px;
        justify-content: center;
    }

    .wiremaster-wire-btn .wm-ico {
        width: 16px;
        height: 16px;
    }

    .wiremaster-guide-btn {
        font-size: 0 !important;
    }

    .wiremaster-canvas-viewport {
        height: calc(100vh - 12rem);
        min-height: 180px;
    }

    .wiremaster-canvas-item.is-controller .wiremaster-canvas-image {
        height: 120px;
    }

    .wiremaster-canvas-item.is-standard-item .wiremaster-canvas-image {
        max-width: 90px;
        max-height: 90px;
    }

    .wiremaster-palette-popup {
        max-height: 50vh;
    }
}
