:root {
    color-scheme: dark;
    --panel: rgba(28, 28, 30, 0.95);
    --border: #38383a;
    --blue: #007aff;
    --green: #30d158;
    --red: #ff453a;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a1a;
    color: #d1d5db;
    font-family: -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

#viewer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.viewer-buffer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    background: #1a1a1a;
}

.viewer-buffer.front {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

.viewer-buffer .openseadragon-canvas > canvas {
    filter: var(--slide-image-filter, none);
}

.toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 24px);
    padding: 6px;
    box-sizing: border-box;
    overflow-x: auto;
    white-space: nowrap;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.toolbar::-webkit-scrollbar {
    display: none;
}

.btn-group {
    display: flex;
    flex-shrink: 0;
    gap: 2px;
    padding: 2px;
    background: #252528;
    border: 1px solid #333336;
    border-radius: 4px;
}

button {
    flex-shrink: 0;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #c7c7cc;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

button:hover:not(:disabled) {
    background: #3a3a3c;
    color: #fff;
}

button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

button.active {
    background: var(--blue);
    color: #fff;
}

.btn-action {
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
}

.btn-action.active {
    background: var(--green);
    color: #000;
    font-weight: 600;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    padding: 0;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.divider {
    flex-shrink: 0;
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--border);
}

#status-msg {
    flex-shrink: 0;
    margin: 0 4px 0 6px;
    color: #a0a0a5;
    font-size: 11px;
    white-space: nowrap;
}

#status-msg.error {
    color: #ff8078;
}

.z-controller {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 42px;
    padding: 10px 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.z-title {
    color: #8e8e93;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.z-label-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 22px;
}

.z-label {
    min-width: 26px;
    padding: 2px 4px;
    border-radius: 4px;
    background: #2c2c2e;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.z-label.pending {
    color: #ffcc00;
}

.z-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 204, 0, 0.25);
    border-top-color: #ffcc00;
    border-radius: 50%;
    animation: z-spin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes z-spin {
    to {
        transform: rotate(360deg);
    }
}

.z-step-btn {
    width: 28px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    border-radius: 5px;
    color: #e5e7eb;
}

#z-state {
    max-width: 100px;
    color: #aaa;
    font-size: 10px;
    text-align: center;
    white-space: pre-line;
}

input[type="range"].z-slider {
    appearance: none;
    -webkit-appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 8px;
    height: 160px;
    margin: 5px 10px;
    padding: 0;
    outline: none;
    border-radius: 4px;
    background: #3a3a3c;
    touch-action: none;
}

input[type="range"].z-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--blue);
    cursor: pointer;
}

input[type="range"].z-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    background: var(--blue);
    border-radius: 50%;
    cursor: pointer;
}

#z-retry {
    padding: 4px 6px;
    font-size: 10px;
}

.draw-split {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    border-radius: 4px;
    overflow: hidden;
}

.draw-split > button {
    border: none;
    border-radius: 0;
}

.draw-split > .btn-draw-main.active {
    background: var(--green);
    color: #000;
    font-weight: 600;
}

.draw-split > .btn-draw-caret {
    width: 18px;
    height: 30px;
    padding: 0;
    font-size: 10px;
    border-left: 1px solid #3a3a3c;
    color: #a0a0a5;
}

.draw-palette-menu {
    position: fixed;
    top: 54px;
    left: 12px;
    z-index: 1150;
    width: 248px;
    padding: 8px;
    box-sizing: border-box;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.palette-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8e8e93;
    padding: 4px 6px 2px;
}

.palette-tool-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    text-align: left;
    color: #e5e7eb;
    background: transparent;
}

.palette-tool-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.palette-tool-btn.active {
    background: rgba(48, 209, 88, 0.2);
    border: 1px solid var(--green);
    color: #fff;
}

.palette-colors {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 6px 2px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.color-swatch {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.color-swatch.active {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

#annotations-badges {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

.ann-badge-wrap {
    position: absolute;
    transform: translate(0, -100%);
    pointer-events: auto;
    z-index: 2;
    max-width: 310px;
}

.ann-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(20, 20, 24, 0.92);
    border: 1.5px solid var(--ann-color, #ff453a);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
    font-variant-numeric: tabular-nums;
}

.ann-badge-pill:hover {
    background: rgba(38, 38, 44, 0.98);
}

.ann-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ann-color, #ff453a);
    flex-shrink: 0;
}

.ann-badge-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    margin-left: 2px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 10px;
}

.ann-desc-box {
    margin-top: 4px;
    padding: 7px 9px;
    border-radius: 6px;
    background: rgba(22, 22, 26, 0.96);
    border: 1px solid var(--ann-color, #ff453a);
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
    max-width: 280px;
}

.btn-with-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 8px;
}

.btn-with-badge svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.btn-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    color: #e5e7eb;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.btn-with-badge.active .btn-badge {
    background: rgba(0, 0, 0, 0.25);
    color: #000;
}

.ann-list-drawer {
    position: fixed;
    top: 56px;
    left: 12px;
    z-index: 1140;
    width: min(92vw, 330px);
    max-height: calc(100vh - 130px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
    overflow: hidden;
}

.more-popover-menu {
    position: fixed;
    top: 56px;
    left: 12px;
    z-index: 1145;
    width: min(92vw, 310px);
    max-height: calc(100vh - 96px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
    overflow: hidden;
}

.more-panel-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 12px;
    overflow-y: auto;
}

.more-full-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.more-full-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.more-rot-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.more-rot-buttons > button {
    padding: 6px 4px;
    font-size: 12px;
    text-align: center;
}

.more-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.more-mini-reset {
    padding: 2px 7px;
    font-size: 11px;
    border-radius: 4px;
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    color: #9ca3af;
}

.more-color-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.more-color-modes > button {
    padding: 5px 6px;
    font-size: 11px;
    text-align: center;
}

.btn-action.has-active-fx {
    border-color: var(--blue);
    color: #66b2ff;
}

.ann-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.ann-list-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.ann-list-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    max-height: calc(100vh - 185px);
}

.ann-list-empty {
    padding: 16px 8px;
    text-align: center;
    color: #8e8e93;
    font-size: 12px;
}

.ann-list-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 7px;
    background: #252528;
    border: 1px solid #333336;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.ann-list-row:hover {
    background: #2f2f34;
    border-color: #48484d;
}

.ann-list-row.active-z {
    border-left: 3px solid var(--ann-color, #ff453a);
}

.ann-list-row-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.ann-list-row-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ann-list-row-sub {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.ann-list-row-desc {
    font-size: 11px;
    color: #d1d5db;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.ann-list-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.ann-list-action-btn {
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 4px;
    background: #323236;
    border: 1px solid #424247;
    color: #d1d5db;
}

.ann-list-action-btn:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
    font-size: 12px;
}

.form-field label {
    color: #9ca3af;
    font-weight: 600;
}

.form-field input[type="text"],
.form-field textarea {
    width: 100%;
    padding: 7px 9px;
    box-sizing: border-box;
    background: #252528;
    border: 1px solid #3a3a3c;
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.form-field input[type="text"]:focus,
.form-field textarea:focus {
    border-color: var(--blue);
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.btn-danger {
    background: rgba(255, 69, 58, 0.18);
    border: 1px solid var(--red);
    color: #ff6961;
}

.btn-danger:hover:not(:disabled) {
    background: var(--red);
    color: #fff;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
    font-weight: 600;
}

#selection-box {
    position: fixed;
    display: none;
    z-index: 999;
    border: 2px dashed var(--green);
    background: rgba(48, 209, 88, 0.1);
    box-sizing: border-box;
    pointer-events: none;
}

.message-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    display: none;
    max-width: min(90vw, 550px);
    padding: 20px;
    box-sizing: border-box;
    border-radius: 8px;
    background: var(--panel);
    color: #aaa;
    text-align: center;
}

.message-box h2 {
    margin: 0 0 8px;
    color: #fff;
    font-weight: 500;
}

.message-box p {
    margin: 0;
    overflow-wrap: anywhere;
}

.message-box button {
    margin-top: 14px;
}

.navigator {
    top: var(--nav-top-offset, 0px) !important;
    right: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.navigator .displayregion {
    border: 2px solid #ff0000 !important;
    background: rgba(255, 0, 0, 0.15) !important;
    box-sizing: border-box;
    z-index: 6;
}

.navigator .openseadragon-canvas {
    opacity: var(--nav-map-opacity, 1) !important;
    background: #1a1a1a !important;
    transition: opacity 0.1s ease;
}

.nav-track-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.nav-stats-panel {
    position: absolute;
    top: 104px;
    right: 4px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
    font-size: 11px;
    color: #d1d5db;
    white-space: nowrap;
}

.nav-stats-text {
    font-variant-numeric: tabular-nums;
    color: #e5e7eb;
    margin-right: 2px;
}

.nav-stats-text strong {
    color: var(--green);
    font-weight: 700;
}

.nav-mini-btn {
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 4px;
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    color: #c7c7cc;
}

.nav-mini-btn.active {
    background: rgba(48, 209, 88, 0.2);
    border-color: var(--green);
    color: #fff;
}

.nav-collapse-btn {
    padding: 2px 5px;
    font-size: 10px;
    color: #9ca3af;
}

.nav-expand-tab {
    position: absolute;
    top: max(6px, var(--nav-top-offset, 6px));
    right: 6px;
    z-index: 1001;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.nav-expand-tab svg {
    width: 13px;
    height: 13px;
    stroke: var(--green);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.minimap-collapsed .navigator,
body.minimap-collapsed .nav-stats-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.scalebar-box {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: 6px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.scalebar-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.scalebar-label {
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.scalebar-mag {
    color: #9ca3af;
    font-size: 11px;
}

.scalebar-line {
    height: 6px;
    width: 100px;
    box-sizing: border-box;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #fff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
    transition: width 0.06s linear;
}

.scan-info-box {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-size: 11px;
    color: #d1d5db;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.scan-info-title {
    color: #9ca3af;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.scan-info-main {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.scan-info-sub {
    color: #9ca3af;
    font-size: 11px;
}

#measure-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    pointer-events: none;
}

.settings-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.settings-modal {
    width: min(92vw, 340px);
    padding: 16px;
    box-sizing: border-box;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
    color: #e5e7eb;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.settings-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.settings-close {
    padding: 2px 7px;
    font-size: 14px;
    line-height: 1.2;
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    border-radius: 4px;
    color: #c7c7cc;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    font-size: 13px;
}

.settings-row label {
    cursor: pointer;
    color: #d1d5db;
}

.settings-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
    cursor: pointer;
}

.settings-slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0 4px;
    font-size: 13px;
}

.settings-slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #d1d5db;
}

.settings-slider-val {
    font-variant-numeric: tabular-nums;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
}

.settings-slider-group input[type="range"] {
    width: 100%;
    accent-color: var(--blue);
    cursor: pointer;
}

.settings-calibration-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.settings-calibration-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.settings-calibration-label {
    font-size: 13px;
    color: #d1d5db;
}

.settings-calibration-status {
    font-size: 11px;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

.settings-calibration-status.calibrated {
    color: var(--green);
    font-weight: 600;
}

.calibration-modal-box {
    width: min(95vw, 440px);
}

.calibration-hint {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #9ca3af;
}

.calibration-hint strong {
    color: #e5e7eb;
}

.calibration-mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.calibration-mode-tabs > button {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
}

.calibration-stage {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 106px;
    padding: 14px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #141416;
    border: 1px solid #2e2e32;
    overflow-x: auto;
}

.calibration-glass-preview {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100px;
    height: 68px;
    box-sizing: border-box;
    border: 2px solid #00e6ff;
    border-radius: 3px;
    background: linear-gradient(
        135deg,
        rgba(0, 230, 255, 0.14) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(0, 230, 255, 0.18) 100%
    );
    box-shadow: 0 0 14px rgba(0, 230, 255, 0.2);
    flex-shrink: 0;
}

.calibration-glass-preview::before,
.calibration-glass-preview::after {
    content: "";
    position: absolute;
    top: -7px;
    bottom: -7px;
    width: 2px;
    background: #ff453a;
}

.calibration-glass-preview::before {
    left: -2px;
}

.calibration-glass-preview::after {
    right: -2px;
}

.calibration-glass-frosted {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    border-right: 1px dashed rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.75);
    font-size: 9px;
    font-weight: 700;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    flex-shrink: 0;
}

.calibration-glass-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.calibration-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.calibration-controls-row input[type="range"] {
    flex: 1;
    accent-color: var(--blue);
    cursor: pointer;
}

.cal-step-btn {
    width: 32px;
    height: 30px;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
}

.calibration-meta {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

.metadata-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.metadata-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.metadata-item:last-child {
    border-bottom: none;
}

.metadata-key {
    color: #9ca3af;
}

.metadata-val {
    color: #fff;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

[hidden] {
    display: none !important;
}

@media (max-width: 768px) {
    body:not(.mobile-minimap-on) .navigator,
    body:not(.mobile-minimap-on) .nav-stats-panel,
    body:not(.mobile-minimap-on) .nav-expand-tab {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .toolbar {
        top: 8px;
        left: 8px;
        max-width: calc(100% - 16px);
        padding: 4px;
    }

    .navigator {
        top: var(--nav-top-offset, 54px) !important;
    }

    .z-controller {
        right: 6px;
        padding: 6px;
    }

    input[type="range"].z-slider {
        height: 120px;
    }

    .scalebar-box {
        right: 8px;
        bottom: 8px;
        padding: 5px 8px;
    }

    .scan-info-box {
        left: 8px;
        bottom: 8px;
        padding: 5px 8px;
    }
}
