.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.38);
    display: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.tutorial-overlay.active {
    display: block;
    opacity: 1;
}

.tutorial-overlay.intro-mode {
    background: rgba(0, 0, 0, 0.88);
    pointer-events: all;
    opacity: 1;
}

.tutorial-content {
    position: fixed;
    z-index: 10001;
    background: rgba(8, 8, 8, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 2px solid var(--fg, #fff);
    padding: 24px 24px 20px;
    width: 310px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255,255,255,0.04);
    pointer-events: all;
    transition: top 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                left 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.3s ease;
    animation: tutorialBoxEntry 0.35s cubic-bezier(0.23, 1, 0.32, 1) both;
    color: #fff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
}

@keyframes tutorialBoxEntry {
    from {
        transform: translate(-50%, calc(-50% + 16px));
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.tutorial-progress-track {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.tutorial-progress-fill {
    height: 100%;
    background: var(--fg, #fff);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.tutorial-step-indicator {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 6px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.tutorial-header {
    font-size: 15px;
    font-weight: 900;
    margin-bottom: 12px;
    color: var(--fg, #fff);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
    line-height: 1.2;
}

.tutorial-body {
    font-size: 13.5px;
    line-height: 1.65;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Geist Pixel', system-ui;
    letter-spacing: 0.02em;
}

.tutorial-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
}

.tutorial-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.7);
    color: #fff;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 10.5px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1.5px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    position: relative;
    overflow: hidden;
    border-radius: 1px;
    font-family: 'Geist Pixel', system-ui;
    min-width: 80px;
}

.tutorial-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    transform: translateX(-101%);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: -1;
}

.tutorial-btn:hover {
    color: #000;
    border-color: #fff;
}

.tutorial-btn:hover::after {
    transform: translateX(0);
}

.tutorial-btn:active {
    transform: translateY(1px);
}

.tutorial-btn.btn-prev {
    opacity: 0.55;
    border-color: rgba(255, 255, 255, 0.25);
}

.tutorial-btn.btn-prev:hover {
    opacity: 1;
    border-color: #fff;
}

.tutorial-btn.btn-primary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.8);
}

.tutorial-skip {
    display: block;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 9.5px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color 0.2s;
    width: 100%;
    text-align: left;
    font-family: 'Geist Pixel', system-ui;
    padding: 0;
}

.tutorial-skip:hover {
    color: rgba(255, 255, 255, 0.7);
}

.tutorial-welcome-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    text-align: center;
    opacity: 0.85;
}

.tutorial-divider {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto 16px;
}

.tutorial-highlight {
    position: fixed;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.9);
    z-index: 10000;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 3px;
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(255,255,255,0);
}

.tutorial-highlight.active {
    opacity: 1;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 255, 255, 0.5);
}

.virtual-cursor {
    position: fixed;
    width: 26px;
    height: 26px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='white' stroke='black' stroke-width='1.5'%3E%3Cpath d='M5.5 3.21V20.8l5.2-5.13 3.51 8.27h2l-3.66-8.59 7.45.05L5.5 3.21z'/%3E%3C/svg%3E") no-repeat;
    pointer-events: none;
    z-index: 10002;
    transition: all 0.75s cubic-bezier(0.23, 1, 0.32, 1), transform 0.15s ease;
    opacity: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
    transform-origin: top left;
}

.virtual-cursor.active {
    opacity: 1;
}

.virtual-cursor.clicking {
    transform: scale(0.82);
}

.virtual-click-pulse {
    position: absolute;
    width: 56px;
    height: 56px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    z-index: 10003;
    animation: clickPulse 0.45s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

@keyframes clickPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0;
    }
}

/* ── Desktop default: centred (intro) ──────────────────────── */
.tutorial-content.is-intro {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .tutorial-content {
        /* Bottom-centred, always within viewport */
        left: 50%;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: auto;
        top: auto;
        transform: translateX(-50%);
        width: calc(100vw - 32px);
        max-width: 400px;
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
        padding: 20px 20px 16px;
    }

    /* Intro step: centred vertically too */
    .tutorial-content.is-intro {
        top: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        max-height: calc(100dvh - 48px);
    }

    @keyframes tutorialBoxEntry {
        from {
            transform: translateX(-50%) translateY(20px);
            opacity: 0;
        }
        to {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .tutorial-content,
    .tutorial-highlight,
    .virtual-cursor,
    .tutorial-progress-fill {
        transition: none;
        animation: none;
    }

    .tutorial-overlay {
        transition: opacity 0.1s ease;
    }
}