/* ACHIEVO — Premium Onboarding Tutorial V2 */

.tut-overlay {
    --tut-gold: #ffc857;
    --tut-gold-rgb: 255, 200, 87;
    --tut-cyan: #4ee6ff;
    --tut-cyan-rgb: 78, 230, 255;
    --tut-ink: #05070a;
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity .45s ease;
    font-family: 'JetBrains Mono', monospace;
}

.tut-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.tut-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 12%, rgba(var(--tut-cyan-rgb), .12), transparent 38%),
        radial-gradient(circle at 82% 78%, rgba(var(--tut-gold-rgb), .08), transparent 32%),
        rgba(0, 0, 0, .72);
    backdrop-filter: none;
}

.tut-overlay.no-blur::before {
    backdrop-filter: none;
    background: rgba(0, 0, 0, .52);
}

.tut-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .06;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,.08) 2px, rgba(255,255,255,.08) 4px);
    animation: tutScanDrift 8s linear infinite;
}

@keyframes tutScanDrift {
    from { transform: translateY(0); }
    to { transform: translateY(8px); }
}

/* ── Card ── */

.tut-card {
    position: fixed;
    z-index: 12004;
    width: min(520px, calc(100vw - 28px));
    max-height: min(78vh, 640px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 2px;
    background: linear-gradient(130deg,
        rgba(var(--tut-gold-rgb), .85),
        rgba(255,255,255,.06) 28%,
        rgba(var(--tut-cyan-rgb), .7) 52%,
        rgba(255,255,255,.06) 74%,
        rgba(var(--tut-gold-rgb), .85));
    background-size: 240% 240%;
    animation: tutBorderFlow 9s linear infinite;
    clip-path: polygon(0 14px, 14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px));
    box-shadow:
        0 28px 90px rgba(0,0,0,.65),
        0 0 60px rgba(var(--tut-gold-rgb), .12);
    pointer-events: auto;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition:
        top 0.58s cubic-bezier(0.22, 1, 0.36, 1),
        left 0.58s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.42s ease,
        transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: top, left, opacity, transform;
}

.tut-card.tut-card-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.tut-card.tut-card-centered {
    transform: translate(-50%, -50%) scale(1);
}

.tut-card.tut-card-centered:not(.tut-card-visible) {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 0;
}

.tut-card::before {
    content: '';
    position: absolute;
    inset: 2px;
    background:
        linear-gradient(145deg, rgba(var(--tut-cyan-rgb), .03), transparent 42%),
        rgba(6, 9, 13, .97);
    clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px));
    z-index: 0;
}

.tut-card > * {
    position: relative;
    z-index: 1;
}

.tut-card-scan {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 0;
    height: 2px;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--tut-cyan), #fff, var(--tut-cyan), transparent);
    box-shadow: 0 0 18px rgba(var(--tut-cyan-rgb), .65);
    animation: tutCardScan 4.2s ease-in-out infinite;
}

@keyframes tutCardScan {
    0%, 8% { top: 12px; opacity: 0; }
    12% { opacity: .85; }
    88% { top: calc(100% - 18px); opacity: .35; }
    100% { top: calc(100% - 12px); opacity: 0; }
}

@keyframes tutBorderFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.tut-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--tut-gold);
    z-index: 4;
    box-shadow: 0 0 14px rgba(var(--tut-gold-rgb), .45);
    pointer-events: none;
}

.tut-corner-tl { top: 5px; left: 5px; border-right: none; border-bottom: none; }
.tut-corner-tr { top: 5px; right: 5px; border-left: none; border-bottom: none; }
.tut-corner-bl { bottom: 5px; left: 5px; border-right: none; border-top: none; }
.tut-corner-br { bottom: 5px; right: 5px; border-left: none; border-top: none; }

.tut-header {
    padding: 20px 22px 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tut-kicker {
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(var(--tut-cyan-rgb), .85);
}

.tut-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

#tut-title {
    margin: 0;
    font: 700 15px/1.35 'Orbitron', sans-serif;
    color: var(--tut-gold);
    letter-spacing: .5px;
    text-shadow: 0 0 20px rgba(var(--tut-gold-rgb), .25);
}

.tut-progress {
    flex-shrink: 0;
    font-size: 10px;
    color: rgba(255,255,255,.45);
    letter-spacing: 1px;
    padding-top: 2px;
}

.tut-step-dots {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tut-step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.04);
    transition: all .28s ease;
}

.tut-step-dot.done {
    background: rgba(var(--tut-cyan-rgb), .35);
    border-color: rgba(var(--tut-cyan-rgb), .5);
}

.tut-step-dot.active {
    background: var(--tut-gold);
    border-color: var(--tut-gold);
    box-shadow: 0 0 12px rgba(var(--tut-gold-rgb), .55);
    transform: scale(1.15);
}

.tut-body {
    padding: 18px 22px;
    color: #dce8ec;
    font-size: 13px;
    line-height: 1.72;
    min-height: 110px;
    max-height: 38vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--tut-gold-rgb), .35) transparent;
}

.tut-body b {
    color: var(--tut-gold);
    font-weight: 600;
}

.tut-body .tut-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 8px;
    font-size: 9px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    border: 1px solid rgba(var(--tut-cyan-rgb), .35);
    color: var(--tut-cyan);
    background: rgba(var(--tut-cyan-rgb), .06);
}

.tut-footer {
    padding: 14px 22px 18px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tut-actions {
    display: flex;
    gap: 8px;
}

.tut-btn {
    background: rgba(0,0,0,.35);
    border: 1px solid rgba(var(--tut-gold-rgb), .65);
    color: var(--tut-gold);
    padding: 9px 16px;
    font: 700 10px/1 'Orbitron', sans-serif;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: .8px;
    transition: all .22s ease;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.tut-btn:hover {
    background: rgba(var(--tut-gold-rgb), .14);
    box-shadow: 0 0 22px rgba(var(--tut-gold-rgb), .22);
}

.tut-btn-primary {
    border-color: var(--tut-cyan);
    color: var(--tut-cyan);
}

.tut-btn-primary:hover {
    background: rgba(var(--tut-cyan-rgb), .12);
    box-shadow: 0 0 22px rgba(var(--tut-cyan-rgb), .22);
}

.tut-btn-secondary {
    border-color: rgba(255,255,255,.18);
    color: rgba(255,255,255,.55);
}

.tut-btn-secondary:hover {
    color: #fff;
    border-color: rgba(255,255,255,.35);
    box-shadow: none;
}

/* ── Highlight ── */

.tut-highlighted {
    position: relative !important;
    z-index: 12001 !important;
    outline: 2px solid var(--tut-gold) !important;
    outline-offset: 3px;
    box-shadow:
        0 0 0 6px rgba(var(--tut-gold-rgb), .12),
        0 0 40px rgba(var(--tut-gold-rgb), .35),
        inset 0 0 24px rgba(var(--tut-gold-rgb), .08) !important;
    animation: tutHighlightPulse 1.8s ease-in-out infinite alternate !important;
    pointer-events: auto !important;
}

@keyframes tutHighlightPulse {
    from {
        outline-color: rgba(var(--tut-gold-rgb), .75);
        box-shadow: 0 0 0 4px rgba(var(--tut-gold-rgb), .08), 0 0 28px rgba(var(--tut-gold-rgb), .22), inset 0 0 16px rgba(var(--tut-gold-rgb), .05);
    }
    to {
        outline-color: var(--tut-gold);
        box-shadow: 0 0 0 8px rgba(var(--tut-gold-rgb), .16), 0 0 55px rgba(var(--tut-gold-rgb), .42), inset 0 0 28px rgba(var(--tut-gold-rgb), .1);
    }
}

/* ── Proposal boot ── */

#tut-proposal-overlay .tut-card {
    width: min(480px, calc(100vw - 28px));
    opacity: 1;
    transform: translate(-50%, -50%);
}

#tut-proposal-overlay .tut-card:not(.tut-card-visible) {
    opacity: 1;
}

.tut-boot-log {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(0,0,0,.35);
    border: 1px solid rgba(var(--tut-cyan-rgb), .18);
    font-size: 10px;
    line-height: 1.65;
    color: rgba(var(--tut-cyan-rgb), .85);
    min-height: 72px;
}

.tut-boot-log .line-active {
    color: var(--tut-gold);
    text-shadow: 0 0 8px rgba(var(--tut-gold-rgb), .3);
}

/* Classic dashboard variant */
html[data-dashboard="classic"] .tut-card,
body:not(.linux-desktop-mode):not(.vos-entry-active) .tut-overlay.tut-mode-classic .tut-card {
    --tut-gold: var(--hack-gold, #ffd700);
    --tut-gold-rgb: 255, 215, 0;
    --tut-cyan: var(--hack-cyan, #0ff);
    --tut-cyan-rgb: 0, 255, 255;
}

body:not(.linux-desktop-mode):not(.vos-entry-active) .tut-overlay.tut-mode-command {
    --tut-gold: #ffc857;
    --tut-gold-rgb: 255, 200, 87;
    --tut-cyan: #4ee6ff;
    --tut-cyan-rgb: 78, 230, 255;
}

.tut-overlay.tut-spotlight-mode .directive-widget.tut-highlighted,
.tut-overlay.tut-spotlight-mode #quest-widget.tut-highlighted,
.tut-overlay.tut-spotlight-mode .system-tile.tut-highlighted,
.tut-overlay.tut-spotlight-mode .btn-hack.tut-highlighted {
    position: relative;
    z-index: 12003 !important;
}

.tut-overlay.tut-spotlight-mode .directive-widget.tut-highlighted {
    position: fixed !important;
}

.tut-overlay.tut-spotlight-mode::before {
    opacity: 0;
}

.tut-overlay.tut-spotlight-mode::after {
    opacity: .04;
}

/* ── Spotlight cutout ── */

.tut-spotlight {
    position: fixed;
    inset: 0;
    z-index: 12001;
    pointer-events: none;
}

.tut-spotlight[hidden] {
    display: none !important;
}

.tut-shade {
    position: fixed;
    background: rgba(2, 5, 10, .84);
    pointer-events: auto;
    transition: all .38s cubic-bezier(.2, .82, .2, 1);
}

.tut-spotlight-ring {
    position: fixed;
    border: 2px solid var(--tut-gold);
    border-radius: 10px;
    box-shadow:
        0 0 0 4px rgba(var(--tut-gold-rgb), .14),
        0 0 36px rgba(var(--tut-gold-rgb), .42),
        inset 0 0 24px rgba(var(--tut-gold-rgb), .08);
    pointer-events: none;
    transition: all .38s cubic-bezier(.2, .82, .2, 1);
    animation: tutRingPulse 1.6s ease-in-out infinite alternate;
}

.tut-spotlight-ring::before,
.tut-spotlight-ring::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--tut-cyan);
}

.tut-spotlight-ring::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.tut-spotlight-ring::after {
    right: -2px;
    bottom: -2px;
    border-left: none;
    border-top: none;
}

@keyframes tutRingPulse {
    from {
        box-shadow: 0 0 0 3px rgba(var(--tut-gold-rgb), .1), 0 0 24px rgba(var(--tut-gold-rgb), .28), inset 0 0 16px rgba(var(--tut-gold-rgb), .05);
    }
    to {
        box-shadow: 0 0 0 7px rgba(var(--tut-gold-rgb), .18), 0 0 52px rgba(var(--tut-gold-rgb), .48), inset 0 0 30px rgba(var(--tut-gold-rgb), .1);
    }
}

.tut-target-badge {
    position: fixed;
    z-index: 12002;
    padding: 5px 10px;
    font-size: 9px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: #05080a;
    background: linear-gradient(100deg, var(--tut-gold), #ffe6a8);
    clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
    box-shadow: 0 0 18px rgba(var(--tut-gold-rgb), .45);
    pointer-events: none;
    transition: all .38s cubic-bezier(.2, .82, .2, 1);
    max-width: min(280px, 70vw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tut-hint {
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid rgba(var(--tut-cyan-rgb), .28);
    background: rgba(var(--tut-cyan-rgb), .06);
    color: var(--tut-cyan);
    font-size: 11px;
    line-height: 1.5;
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.38s ease, transform 0.38s ease;
}

.tut-hint.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.tut-overlay.tut-activities-step::before {
    background: rgba(0, 0, 0, .52);
    backdrop-filter: none;
    pointer-events: none;
    z-index: 1;
}

.tut-apps-panel {
    position: fixed;
    inset: 0;
    z-index: 12002;
    display: none;
    padding: 72px 32px 32px;
    box-sizing: border-box;
    background: rgba(19, 17, 28, 0.92);
    pointer-events: auto;
    overflow: auto;
}

.tut-apps-panel.open {
    display: block;
    animation: tutAppsPanelIn 0.4s cubic-bezier(0.2, 0.82, 0.2, 1);
}

.tut-overlay.tut-card-layout-apps-side .tut-apps-panel.open {
    padding-right: min(440px, 40vw);
}

.tut-overlay.tut-card-layout-apps-side .tut-card {
    position: fixed !important;
    top: 50% !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    width: min(400px, 36vw) !important;
    max-height: 88vh;
    z-index: 12005 !important;
}

.tut-overlay.tut-card-layout-apps-side .tut-apps-grid {
    max-width: none;
}

.tut-apps-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 200, 87, 0.14);
    border: 1px solid rgba(255, 200, 87, 0.35);
    color: #ffc857;
    font: 600 10px/1 'JetBrains Mono', monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@keyframes tutAppsPanelIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tut-apps-title {
    font: 700 22px/1 'Ubuntu', sans-serif;
    color: #f6f5f4;
    margin-bottom: 8px;
}

.tut-apps-hint {
    font: 400 12px/1.4 'Ubuntu', sans-serif;
    color: #9b99a0;
    margin-bottom: 18px;
}

.tut-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-width: 760px;
}

.tut-apps-grid .linux-activities-app,
.tut-apps-grid .tut-apps-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: #9b99a0;
    font: 500 12px/1.2 'Ubuntu', sans-serif;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.2s;
}

.tut-apps-grid .linux-activities-app:hover,
.tut-apps-grid .tut-apps-app:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f6f5f4;
}

.tut-apps-grid .linux-activities-app .app-icon,
.tut-apps-grid .tut-apps-app .app-icon {
    font-size: 32px;
}

.tut-apps-grid .linux-activities-app.tut-highlighted,
.tut-apps-grid .tut-apps-app.tut-highlighted,
#tut-apps-panel.tut-highlighted {
    border-color: rgba(255, 200, 87, 0.55) !important;
    box-shadow: 0 0 24px rgba(255, 200, 87, 0.2);
    color: #f6f5f4 !important;
    animation: tutAppPulse 1.6s ease-in-out infinite;
}

@keyframes tutAppPulse {
    0%, 100% { box-shadow: 0 0 16px rgba(255, 200, 87, 0.18); }
    50% { box-shadow: 0 0 28px rgba(255, 200, 87, 0.38); }
}

.tut-overlay.tut-activities-step .tut-card {
    z-index: 12005 !important;
}

.tut-overlay.tut-activities-step #linux-activities-overlay.tutorial-activities-active {
    z-index: 12001 !important;
}


.tut-overlay.tut-spotlight-mode::before,
.tut-overlay.tut-spotlight-mode::after {
    pointer-events: none;
}

.tut-overlay.tut-spotlight-mode .tut-shade,
.tut-overlay.tut-spotlight-mode .tut-card,
.tut-overlay.tut-spotlight-mode .tut-hint {
    pointer-events: auto;
}

.tut-overlay.tut-spotlight-mode .tut-highlighted {
    position: relative !important;
    z-index: 12003 !important;
    outline: none !important;
    box-shadow: none !important;
    animation: none !important;
    pointer-events: auto !important;
}

.tut-overlay.tut-spotlight-mode .tut-highlighted.tutorial-terminal-active,
.tut-overlay.tut-spotlight-mode .tut-terminal-spotlight-target {
    position: fixed !important;
    z-index: 12006 !important;
}

.tut-overlay.tut-spotlight-mode .tut-card {
    box-shadow:
        0 28px 90px rgba(0,0,0,.75),
        0 0 80px rgba(var(--tut-cyan-rgb), .1);
}

/* VOS entry context */
.vos-entry-screen.active ~ .tut-overlay,
body.vos-entry-active .tut-overlay {
    z-index: 12050;
}

@media (max-width: 540px) {
    .tut-card { width: calc(100vw - 16px); }
    .tut-header, .tut-body, .tut-footer { padding-left: 16px; padding-right: 16px; }
    .tut-footer { flex-direction: column; align-items: stretch; }
    .tut-actions { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
    .tut-card,
    .tut-card-scan,
    .tut-overlay::after,
    .tut-highlighted,
    .tut-hint {
        animation: none !important;
        transition: none !important;
    }
    .linux-activities-overlay.tutorial-activities-active {
        animation: none !important;
    }
}
