/* Tutorial System */
.tutorial-trigger-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-text-color);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: 8px;
    flex-shrink: 0;
}

.tutorial-trigger-btn:hover {
    background: var(--primary-color);
    color: var(--primary-contrast);
}

#calibration-modal .modal-body {
    position: relative;
}

.tutorial-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
}

.tutorial-overlay.active {
    display: block;
    pointer-events: auto;
}

.tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    transition: clip-path 0.3s ease;
}

.tutorial-ring {
    position: absolute;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    pointer-events: none;
    transition: all 0.3s ease;
    animation: tutorial-pulse 2s infinite;
}

@keyframes tutorial-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-color) 60%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary-color) 0%, transparent); }
}

.tutorial-tooltip {
    position: absolute;
    width: 260px;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-color);
    z-index: 102;
    pointer-events: auto;
    animation: tutorial-tooltip-in 0.25s ease-out;
}

@keyframes tutorial-tooltip-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.tutorial-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.tutorial-step-counter {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-text-color);
}

.tutorial-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    padding: 0;
    line-height: 1;
}

.tutorial-close-btn:hover {
    color: var(--text-color);
    background: rgba(128, 128, 128, 0.15);
}

.tutorial-tooltip-text {
    margin: 0;
    padding: 12px;
    line-height: 1.5;
    color: var(--text-color);
    font-size: 0.9rem;
}

.tutorial-tooltip-nav {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
}

.tutorial-prev-btn,
.tutorial-next-btn {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.tutorial-prev-btn {
    background: var(--border-color);
    color: var(--text-color);
}

.tutorial-next-btn {
    background: var(--primary-color);
    color: var(--primary-contrast);
}

.tutorial-prev-btn:hover:not(:disabled),
.tutorial-next-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.tutorial-prev-btn:disabled,
.tutorial-next-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tutorial-target {
    position: relative;
    z-index: 101 !important;
}

/* Fixed (viewport-level) tutorial overlay for device cards */
.tutorial-overlay-fixed {
    position: fixed;
    z-index: 10000;
}

.tutorial-overlay-fixed .tutorial-backdrop {
    position: fixed;
}

.tutorial-overlay-fixed .tutorial-ring {
    position: fixed;
}

.tutorial-overlay-fixed .tutorial-tooltip {
    position: absolute;
    z-index: 10002;
    animation: none;
    opacity: 1;
}

/* target z-index for fixed overlay is set inline via JS (target is outside overlay DOM) */
