.tutorial-dialog {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
    color: #333;
}

.tutorial-dialog::backdrop { background: transparent; }

.app-lock-message { position: relative; }
.app-lock-message h2 { padding-inline: 1.5rem; }
.app-lock-tutorial-btn {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    border-radius: 50%;
    color: #667085;
    background: rgba(102, 126, 234, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: none;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.82;
}
.app-lock-tutorial-btn:hover:where(.hover-enabled *),
.app-lock-tutorial-btn:focus-visible {
    color: #5264ba;
    background: rgba(102, 126, 234, 0.13);
    border-color: rgba(102, 126, 234, 0.42);
    opacity: 1;
}
.app-lock-tutorial-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
@media (max-width: 740px) {
    .app-lock-tutorial-btn {
        top: 0.55rem;
        right: 0.55rem;
        width: 2.5rem;
        min-width: 2.5rem;
        height: 2.5rem;
        min-height: 2.5rem;
    }
}
html[data-theme="dark"] .app-lock-tutorial-btn {
    color: #b9c2d2;
    background: rgba(176, 187, 255, 0.08);
    border-color: rgba(176, 187, 255, 0.24);
}
html[data-theme="dark"] .app-lock-tutorial-btn:hover:where(.hover-enabled *),
html[data-theme="dark"] .app-lock-tutorial-btn:focus-visible {
    color: #d9deff;
    background: rgba(176, 187, 255, 0.16);
    border-color: rgba(176, 187, 255, 0.46);
}
.tutorial-dialog.tutorial-no-target { background: rgba(12, 17, 29, 0.62); }
.tutorial-highlight {
    position: fixed;
    border: 2px solid #aab5ff;
    border-radius: 10px;
    box-shadow: 0 0 0 100vmax rgba(12, 17, 29, 0.62);
    pointer-events: none;
}
.tutorial-highlight[hidden], .tutorial-hint[hidden] { display: none; }

.tutorial-card, .tutorial-invitation {
    background: #fff;
    color: #333;
    border: 1px solid #dfe3ee;
    border-radius: 12px;
    padding: 1.1rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
    font: 0.92rem/1.55 'Segoe UI', Tahoma, sans-serif;
    overflow-wrap: anywhere;
}
.tutorial-card {
    position: fixed;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.tutorial-card h2 { font-size: 1.15rem; line-height: 1.3; margin: 0.4rem 0 0.75rem; }
.tutorial-step-picker { position: relative; }
.tutorial-progress {
    min-height: 28px;
    margin: -0.25rem 0 0 -0.4rem;
    padding: 0.2rem 0.4rem;
    color: #5264ba;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.tutorial-progress:hover:where(.hover-enabled *) { background: rgba(102, 126, 234, 0.1); }
.tutorial-progress::after { content: ' ▾'; }
.tutorial-progress:focus-visible { outline: 2px solid #667eea; outline-offset: 2px; }
.tutorial-step-menu {
    display: grid;
    max-height: min(42dvh, 280px);
    margin-top: 0.3rem;
    padding: 0.3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f7f8fc;
    border: 1px solid #dfe3ee;
    border-radius: 8px;
}
.tutorial-step-menu[hidden] { display: none; }
.tutorial-step-option {
    padding: 0.48rem 0.55rem;
    color: #394251;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 0.82rem;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}
.tutorial-step-option:hover:where(.hover-enabled *),
.tutorial-step-option[aria-current="step"] { color: #4054b2; background: rgba(102, 126, 234, 0.12); }
.tutorial-hint { margin-top: 0.8rem; font-size: 0.82rem; color: #626c7c; }
.tutorial-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; align-items: center; }
.tutorial-actions .btn { font-size: 0.82rem; padding: 0.45rem 0.65rem; min-height: 36px; }
.tutorial-actions .tutorial-exit { margin-right: auto; }
.tutorial-actions .btn:focus-visible { outline: 2px solid #667eea; outline-offset: 3px; }
.tutorial-actions .btn:disabled { opacity: 0.45; cursor: default; }
.tutorial-invitation {
    position: fixed;
    z-index: 10001;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(360px, calc(100% - 24px));
    max-height: 45dvh;
    padding: 1rem 1.05rem;
    overflow-y: auto;
    border-color: rgba(102, 126, 234, 0.24);
    box-shadow: 0 14px 38px rgba(38, 46, 77, 0.2);
    animation: tutorial-invitation-in 0.25s ease-out;
}
.tutorial-invitation-content {
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
}
.tutorial-invitation-icon {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #7483ed, #6259bd);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(81, 78, 171, 0.24);
    font-size: 1.05rem;
    font-weight: 750;
}
.tutorial-invitation h2 {
    margin: 0 0 0.18rem;
    color: #30384a;
    font-size: 1rem;
    line-height: 1.35;
}
.tutorial-invitation p {
    margin: 0;
    color: #626c7c;
    font-size: 0.84rem;
    line-height: 1.45;
}
.tutorial-invitation .tutorial-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    margin-top: 0.85rem;
}
.tutorial-invitation .tutorial-invitation-later {
    color: #626c7c;
    background: transparent;
    border-color: transparent;
}
.tutorial-invitation .tutorial-invitation-later:hover:where(.hover-enabled *) {
    color: #4054b2;
    background: rgba(102, 126, 234, 0.08);
}
@keyframes tutorial-invitation-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 740px) {
    .tutorial-invitation {
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(var(--bottom-nav-height, 60px) + env(safe-area-inset-bottom) + 10px);
        width: auto;
        padding: 0.9rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tutorial-invitation { animation: none; }
}
html[data-theme="dark"] .tutorial-card,
html[data-theme="dark"] .tutorial-invitation {
    background: var(--theme-surface, #1b202c);
    border-color: var(--theme-border, #3a4355);
    color: var(--theme-text, #eef1f7);
}
html[data-theme="dark"] .tutorial-card h2 { color: var(--theme-text, #eef1f7); }
html[data-theme="dark"] .tutorial-invitation h2 { color: var(--theme-text, #eef1f7); }
html[data-theme="dark"] .tutorial-invitation p { color: var(--theme-muted, #aeb7c7); }
html[data-theme="dark"] .tutorial-invitation-icon {
    background: linear-gradient(145deg, #7789f2, #7665cf);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .tutorial-invitation .tutorial-invitation-later {
    color: var(--theme-muted, #aeb7c7);
    background: transparent;
    border-color: transparent;
}
html[data-theme="dark"] .tutorial-invitation .tutorial-invitation-later:hover:where(.hover-enabled *) {
    color: var(--theme-text, #eef1f7);
    background: rgba(176, 187, 255, 0.1);
}
html[data-theme="dark"] .tutorial-progress { color: #b0bbff; }
html[data-theme="dark"] .tutorial-step-menu { background: #242b39; border-color: var(--theme-border, #3a4355); }
html[data-theme="dark"] .tutorial-step-option { color: var(--theme-text, #eef1f7); }
html[data-theme="dark"] .tutorial-step-option:hover:where(.hover-enabled *),
html[data-theme="dark"] .tutorial-step-option[aria-current="step"] { color: #c4ccff; background: rgba(154, 169, 255, 0.14); }
html[data-theme="dark"] .tutorial-hint { color: var(--theme-muted, #aeb7c7); }
html[data-theme="dark"] .tutorial-actions .btn-secondary:not(.tutorial-invitation-later) { background: #3a4355; color: #eef1f7; }
