.tutorial-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    pointer-events: none;
}

.tutorial-backdrop.active {
    display: block;
}

.tutorial-popup {
    display: none;
    position: fixed;
    z-index: 200;
    background: #313244;
    border: 2px solid #89b4fa;
    border-radius: 10px;
    padding: 18px 22px;
    width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: top 0.3s ease, left 0.3s ease;
}

.tutorial-popup.active {
    display: block;
}

.tutorial-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #6c7086;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.tutorial-close:hover {
    color: #cdd6f4;
    background: rgba(205, 214, 244, 0.1);
}

/* Arrow pointing at the target */
.tutorial-popup::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #313244;
    border: 2px solid #89b4fa;
    transform: rotate(45deg);
}

.tutorial-popup.arrow-left::before {
    left: -8px;
    top: 20px;
    border-right: none;
    border-top: none;
}

.tutorial-popup.arrow-right::before {
    right: -8px;
    top: 20px;
    border-left: none;
    border-bottom: none;
}

.tutorial-popup.arrow-top::before {
    top: -8px;
    left: 30px;
    border-bottom: none;
    border-right: none;
}

.tutorial-popup.arrow-bottom::before {
    bottom: -8px;
    left: 30px;
    border-top: none;
    border-left: none;
}

.tutorial-popup.arrow-none::before {
    display: none;
}

.tutorial-step-label {
    font-size: 10px;
    color: #6c7086;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.tutorial-step-label.complete {
    font-size: 15px;
    color: #a6e3a1;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    margin-bottom: 12px;
}

.tutorial-body {
    font-size: 13px;
    line-height: 1.6;
    color: #cdd6f4;
    margin-bottom: 14px;
}

.tutorial-body strong { color: #89b4fa; }
.tutorial-body code {
    background: #1e1e2e;
    color: #a6e3a1;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}
.tutorial-body .denied { color: #f38ba8; font-weight: 600; }
.tutorial-body .allowed { color: #a6e3a1; font-weight: 600; }

.tutorial-actions {
    display: flex;
    justify-content: flex-end;
}

.tutorial-btn {
    background: #89b4fa;
    color: #1e1e2e;
    border: none;
    padding: 6px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.tutorial-btn:hover { background: #74c7ec; }

/* Highlight ring on the target element */
.tutorial-highlight {
    position: relative;
    z-index: 150;
    outline: 3px solid #89b4fa;
    outline-offset: -1px;
    box-shadow: 0 0 16px rgba(137, 180, 250, 0.3) !important;
}

/* Tutorial completion popup */
.tut-complete-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tut-complete-links-label {
    font-size: 11px;
    color: #585b70;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tut-complete-links a {
    color: #cdd6f4;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #313244;
    background: #1e1e2e;
    transition: background 0.15s, border-color 0.15s;
    display: block;
}

.tut-complete-links a:hover {
    background: rgba(137, 180, 250, 0.08);
    border-color: #89b4fa;
}

.tut-complete-links a strong {
    color: #89b4fa;
}

.tut-complete-links a span {
    color: #6c7086;
    font-size: 12px;
}

/* Policy diff in tutorial popup */
.tutorial-popup-wide {
    width: 520px !important;
}

.tut-diff {
    margin-top: 12px;
    background: #11111b;
    border: 1px solid #313244;
    border-radius: 6px;
    padding: 8px 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    line-height: 1.7;
}

.tut-diff-ctx {
    padding: 0 12px;
    color: #585b70;
    white-space: pre;
}

.tut-diff-add {
    padding: 0 12px;
    color: #a6e3a1;
    background: rgba(166, 227, 161, 0.1);
    white-space: pre;
}

.tut-diff-del {
    padding: 0 12px;
    color: #f38ba8;
    background: rgba(243, 139, 168, 0.08);
    white-space: pre;
    text-decoration: line-through;
    text-decoration-color: rgba(243, 139, 168, 0.4);
}

.tut-diff-ellipsis {
    padding: 2px 12px;
    color: #45475a;
    font-size: 10px;
    text-align: center;
}

/* Next tutorial card */
.tut-complete-next-card {
    background: rgba(137, 180, 250, 0.06);
    border: 1px solid #89b4fa;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.tut-complete-next-card strong {
    display: block;
    color: #89b4fa;
    font-size: 14px;
    margin-bottom: 4px;
}

.tut-complete-next-card span {
    color: #a6adc8;
    font-size: 12px;
    line-height: 1.5;
}

/* Secondary links (small, inline) */
.tut-complete-secondary {
    display: flex;
    gap: 12px;
    font-size: 11px;
}

.tut-complete-secondary a {
    color: #585b70;
    text-decoration: none;
    transition: color 0.15s;
}

.tut-complete-secondary a:hover {
    color: #89b4fa;
}

/* Flash animation for policy update */
.tutorial-flash {
    animation: tut-flash 0.8s ease;
}

@keyframes tut-flash {
    0% { outline: 3px solid #89b4fa; outline-offset: -1px; box-shadow: 0 0 20px rgba(137, 180, 250, 0.4); }
    100% { outline: 3px solid transparent; outline-offset: -1px; box-shadow: none; }
}

/* Hide content until tutorial is ready */
main {
    opacity: 0;
    transition: opacity 0.3s ease;
}

main.ready {
    opacity: 1;
}

/* Tutorial picker — custom dropdown matching the main nav style */
.tutorial-picker {
    margin-left: 4px;
}

.tutorial-picker-btn {
    /* Inherits .nav-dropdown-btn base style from style.css; override colors to
       match the previous select (pill-shaped, accent-colored to draw attention). */
    background: rgba(137, 180, 250, 0.08) !important;
    color: #89b4fa !important;
    border-color: rgba(137, 180, 250, 0.2) !important;
    font-weight: 600;
    font-size: 12px;
}

.tutorial-picker-btn:hover {
    background: rgba(137, 180, 250, 0.14) !important;
    color: #cdd6f4 !important;
}

.tutorial-picker-btn .nav-chevron {
    color: inherit;
}

.tutorial-picker-menu {
    left: auto;
    right: 0;
    min-width: 240px;
}

.tutorial-picker-menu a {
    font-size: 12px !important;
    padding: 8px 12px !important;
}
