.croqui-test-view[hidden] {
    display: none !important;
}

.croqui-test-view {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-width: 0;
    min-height: 0;
    background: #07131d;
    color: #f7fafc;
    font-family: inherit;
    overflow: hidden;
}

body.is-croqui-test-open {
    overflow: hidden;
}

body.is-croqui-test-open .croqui-test-swal-container {
    z-index: 14000;
}

body.is-croqui-test-open .croqui-test-swal-field {
    display: grid;
    gap: 7px;
    margin: 12px 0;
    text-align: left;
}

body.is-croqui-test-open .croqui-test-swal-field span {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

body.is-croqui-test-open .croqui-test-swal-field .swal2-input,
body.is-croqui-test-open .croqui-test-swal-field .swal2-select {
    width: 100%;
    height: 44px;
    margin: 0;
    border: 1px solid rgba(148, 163, 184, 0.36);
    border-radius: 12px;
    background: #1f3344;
    color: #f8fafc;
    font-weight: 800;
}

.croqui-test-view .map-custom-draw-label {
    background: transparent;
    border: 0;
}

.croqui-test-view .map-custom-draw-label span {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid rgba(139, 233, 253, 0.72);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.86);
    color: #8be9fd;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.croqui-test-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
    background: linear-gradient(180deg, rgba(9, 24, 36, 0.98), rgba(9, 24, 36, 0.9));
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.croqui-test-title {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.croqui-test-title strong {
    overflow: hidden;
    color: #f8fafc;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.croqui-test-title span,
.croqui-test-status {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.croqui-test-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(56, 189, 248, 0.38);
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.14);
    color: #bae6fd;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.croqui-test-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    background: rgba(71, 85, 105, 0.72);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 950;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.croqui-test-button.is-primary {
    border-color: rgba(34, 197, 94, 0.55);
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #052e16;
}

.croqui-test-button.is-danger {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(127, 29, 29, 0.72);
}

.croqui-test-button.is-active {
    border-color: rgba(56, 189, 248, 0.8);
    background: rgba(14, 165, 233, 0.72);
}

.croqui-test-button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.croqui-test-editor-toolbar {
    position: absolute;
    top: calc(max(12px, env(safe-area-inset-top)) + 78px);
    right: 12px;
    z-index: 12002;
}

.croqui-test-editor-toolbar .map-edit-group-panel {
    right: calc(100% + 0.18rem);
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    align-items: stretch;
    justify-items: end;
    max-height: min(70vh, 32rem);
    overflow-y: auto;
    overflow-x: visible;
    padding-right: 0.08rem;
}

.croqui-test-editor-toolbar .map-edit-group-panel .map-edit-button {
    justify-self: end;
}

.croqui-test-editor-toolbar .map-edit-button::before,
.croqui-test-editor-toolbar .map-edit-button::after {
    display: none !important;
    content: none !important;
}

.croqui-test-editor-toolbar .map-edit-button:hover,
.croqui-test-editor-toolbar .map-edit-button:focus-visible,
.croqui-test-editor-toolbar .map-edit-group-toggle:hover,
.croqui-test-editor-toolbar .map-edit-group-toggle:focus-visible,
.croqui-test-editor-toolbar .map-edit-group-toggle.is-open {
    background: rgba(71, 85, 105, 0.82);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.35);
}

.croqui-test-editor-toolbar .map-orientation-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    display: block;
    transform: translate(-50%, -50%);
    z-index: 13000;
}

.croqui-test-editor-toolbar .map-orientation-panel[hidden] {
    display: none !important;
}

.croqui-test-editor-toolbar .map-edit-button.is-active,
.croqui-test-editor-toolbar .map-edit-group-toggle.is-active,
.croqui-test-editor-toolbar .map-edit-button.is-active:hover,
.croqui-test-editor-toolbar .map-edit-button.is-active:focus-visible,
.croqui-test-editor-toolbar .map-edit-group-toggle.is-active:hover,
.croqui-test-editor-toolbar .map-edit-group-toggle.is-active:focus-visible {
    background: rgba(37, 99, 235, 0.96);
    color: #f8fafc;
    border-color: rgba(147, 197, 253, 0.98);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28), 0 12px 24px rgba(15, 23, 42, 0.25);
}

.croqui-test-orientation-indicator {
    top: calc(max(12px, env(safe-area-inset-top)) + 66px);
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
    z-index: 12004;
}

.croqui-test-orientation-step {
    display: none !important;
    top: calc(max(12px, env(safe-area-inset-top)) + 80px);
    right: auto;
    bottom: auto;
    z-index: 12004;
}

.croqui-test-orientation-step-prev {
    left: calc(50% - 92px);
}

.croqui-test-orientation-step-next {
    left: calc(50% + 52px);
}

.croqui-test-snap-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 13020;
    display: grid;
    gap: 0.58rem;
    width: min(23rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 1rem;
    background: rgba(15, 26, 35, 0.96);
    color: #f8fafc;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
    transform: translate(-50%, -50%);
    backdrop-filter: blur(14px);
}

.croqui-test-snap-panel[hidden] {
    display: none !important;
}

.croqui-test-snap-panel .map-snap-priority-title {
    margin: 0 2.2rem 0.08rem 0;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.croqui-test-snap-panel .map-snap-priority-close {
    position: absolute;
    top: 0.62rem;
    right: 0.62rem;
    width: 2rem;
    height: 2rem;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    cursor: pointer;
}

.croqui-test-snap-panel .map-snap-priority-list {
    display: grid;
    gap: 0.32rem;
}

.croqui-test-snap-panel .map-snap-tolerance-label {
    display: grid;
    grid-template-columns: 1fr 5.2rem;
    gap: 0.42rem;
    align-items: center;
    padding: 0.42rem 0.48rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.68rem;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.76rem;
    font-weight: 900;
}

.croqui-test-snap-panel .map-snap-tolerance-label input {
    width: 100%;
    min-height: 1.85rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
}

.croqui-test-snap-panel .map-snap-priority-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.34rem;
    align-items: center;
    min-height: 2.12rem;
    padding: 0.38rem 0.48rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.68rem;
    background: rgba(255, 255, 255, 0.08);
}

.croqui-test-snap-panel .map-snap-priority-index {
    min-width: 1.25rem;
    height: 1.25rem;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 211, 91, 0.18);
    color: #ffd35b;
    font-size: 0.68rem;
    font-weight: 900;
}

.croqui-test-snap-panel .map-snap-priority-name {
    font-size: 0.78rem;
    font-weight: 900;
}

.croqui-test-snap-panel .map-snap-priority-move {
    width: 1.85rem;
    height: 1.85rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.58rem;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    cursor: pointer;
}

.croqui-test-snap-panel .map-snap-priority-move:disabled {
    opacity: 0.36;
    cursor: not-allowed;
}

.croqui-test-map {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 0;
    background: #f8fafc;
}

.croqui-test-map .leaflet-container {
    width: 100%;
    height: 100%;
}

.croqui-test-view.is-edit-touch-locked,
.croqui-test-view.is-edit-touch-locked .croqui-test-map,
.croqui-test-view.is-edit-touch-locked .leaflet-container,
.croqui-test-view.is-edit-touch-locked .leaflet-pane,
.croqui-test-view.is-edit-touch-locked .leaflet-marker-icon {
    overscroll-behavior: none !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.croqui-test-status {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: calc(26px + env(safe-area-inset-bottom));
    z-index: 12001;
    width: max-content;
    max-width: min(390px, calc(100vw - 34px));
    padding: 7px 10px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
    text-align: center;
    transform: translateX(-50%);
}

.croqui-test-selection-panel {
    position: absolute;
    left: 50%;
    bottom: calc(104px + env(safe-area-inset-bottom));
    z-index: 12003;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    align-items: end;
    gap: 8px;
    width: min(360px, calc(100vw - 42px));
    padding: 7px 8px 9px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.86);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
}

.croqui-test-selection-panel[hidden] {
    display: none !important;
}

.croqui-test-selection-title,
.croqui-test-selection-panel label {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.croqui-test-selection-title {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
}

.croqui-test-selection-title strong,
.croqui-test-selection-panel label span {
    color: #cbd5e1;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.croqui-test-selection-title span {
    overflow: hidden;
    color: #f8fafc;
    font-size: 10px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.croqui-test-selection-panel select,
.croqui-test-selection-panel input {
    width: 100%;
    height: 34px;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 9px;
    background: rgba(30, 47, 61, 0.94);
    color: #f8fafc;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
}

.croqui-test-selection-panel input {
    padding: 0 8px;
}

.croqui-test-dirty-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}

@media (max-width: 700px) {
    .leaflet-touch .leaflet-pm-icon-vertex,
    .leaflet-touch .leaflet-pm-icon-middle,
    .leaflet-touch .marker-icon.leaflet-pm-draggable {
        width: 48px !important;
        height: 48px !important;
        margin-left: -24px !important;
        margin-top: -24px !important;
        border-radius: 999px !important;
        touch-action: none;
        z-index: 1300 !important;
    }

    .croqui-test-header {
        align-items: flex-start;
        padding-left: 10px;
        padding-right: 10px;
    }

    .croqui-test-title strong {
        font-size: 13px;
    }

    .croqui-test-badge {
        display: none;
    }

    .croqui-test-button {
        min-width: 46px;
        min-height: 46px;
        padding: 0 12px;
    }

    .croqui-test-button span {
        display: none;
    }

    .croqui-test-editor-toolbar {
        top: calc(max(12px, env(safe-area-inset-top)) + 76px);
        right: 10px;
        bottom: auto;
    }

    .croqui-test-selection-panel {
        grid-template-columns: minmax(0, 1fr) 82px;
        bottom: calc(106px + env(safe-area-inset-bottom));
    }
}

/* Croqui toolbar container: keep only visible buttons, no backing panel. */
.croqui-test-editor-toolbar,
.croqui-test-view .croqui-test-editor-toolbar,
.croqui-test-editor-toolbar .map-edit-group,
.croqui-test-editor-toolbar .map-edit-group-panel,
.croqui-test-view .croqui-test-editor-toolbar .map-edit-group,
.croqui-test-view .croqui-test-editor-toolbar .map-edit-group-panel {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.croqui-test-editor-toolbar,
.croqui-test-view .croqui-test-editor-toolbar {
    padding: 0 !important;
}
