/* ============================================================
   Tutorial Feature — Cortex Bot Dashboard
   ------------------------------------------------------------
   Glassmorphic overlay system used by web/tutorial/tutorial.js.
   All classes are namespaced with .tutorial- so they cannot
   collide with the existing dashboard styles.

   Reuses the design tokens defined in web/style.css:
     --accent-cyan: #00e5ff
     --accent-purple: #9d00ff
     --accent-red: #eb455f
     --bg-dark: #0e0e12
   ============================================================ */

/* ---- Root container & backdrop ----------------------------- */

.tutorial-root {
    position: fixed;
    inset: 0;
    z-index: 100000;
    /* above the sidebar */
    pointer-events: none;
    font-family: var(--font-family, 'Inter', sans-serif);
}

.tutorial-root.active {
    pointer-events: auto;
}

.tutorial-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.tutorial-root.active .tutorial-backdrop {
    opacity: 1;
}


/* ---- Welcome modal (step 0) -------------------------------- */

.tutorial-welcome-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.tutorial-welcome-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.tutorial-welcome-card {
    background: rgba(20, 20, 28, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 36px 40px;
    max-width: 520px;
    width: calc(100% - 32px);
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(0, 229, 255, 0.1);
    transform: scale(0.94);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tutorial-welcome-modal.open .tutorial-welcome-card {
    transform: scale(1);
}

.tutorial-welcome-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan, #00e5ff),
            var(--accent-purple, #9d00ff));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.35);
}

.tutorial-welcome-card h2 {
    color: #fff;
    font-size: 1.6rem;
    margin: 0 0 12px;
    background: linear-gradient(90deg, var(--accent-cyan, #00e5ff), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tutorial-welcome-card p {
    color: #d0d3da;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}

.tutorial-welcome-bullets {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0 28px;
    padding: 0;
    text-align: left;
}

.tutorial-welcome-bullets li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main, #e0e0e0);
    font-size: 0.88rem;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.tutorial-welcome-bullets li i {
    color: var(--accent-cyan, #00e5ff);
}

.tutorial-welcome-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}


/* ---- Step overlay (steps 1..9) ----------------------------- */

.tutorial-step-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    padding: 16px;
}

.tutorial-step-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.tutorial-step-card {
    position: relative;
    background: rgba(20, 20, 28, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: min(880px, calc(100% - 32px));
    max-height: min(92dvh, calc(100dvh - 24px));
    overflow: hidden;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    transform: translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}

.tutorial-step-overlay.open .tutorial-step-card {
    transform: translateY(0);
}

.tutorial-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #888899);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 2;
}

.tutorial-close-btn:hover {
    color: #fff;
    background: rgba(235, 69, 95, 0.12);
    border-color: rgba(235, 69, 95, 0.4);
}

.tutorial-close-btn:focus-visible {
    outline: 2px solid var(--accent-cyan, #00e5ff);
    outline-offset: 2px;
}


/* ---- Step header (counter + title + body) ------------------ */

.tutorial-step-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tutorial-step-counter {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-cyan, #00e5ff);
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.18);
    padding: 3px 10px;
    border-radius: 999px;
    align-self: flex-start;
}

.tutorial-step-header h2 {
    color: #fff;
    font-size: 1.4rem;
    margin: 0;
    background: linear-gradient(90deg, var(--accent-cyan, #00e5ff), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tutorial-step-header p {
    color: #d0d3da;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}


/* ---- Step body: media · demo (two‑column grid) -------------- */

.tutorial-step-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    flex: 1 1 auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 820px) {
    .tutorial-step-body {
        grid-template-columns: 1fr;
    }
}

.tutorial-step-media {
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 220px;
}

/* Live previews are taller than 16:9 videos — grow flexibly */
.tutorial-step-media.tutorial-step-media--live {
    aspect-ratio: auto;
    min-height: 260px;
    max-height: min(52vh, 480px);
    align-items: stretch;
    justify-content: stretch;
    overflow-y: auto;
    background: transparent;
    border: none;
    border-radius: 0;
}

.tutorial-step-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tutorial-step-media--placeholder {
    color: var(--text-muted, #888899);
    font-size: 0.85rem;
    text-align: center;
    padding: 16px;
    flex-direction: column;
    gap: 10px;
}

.tutorial-step-media--placeholder i {
    font-size: 2rem;
    color: var(--accent-cyan, #00e5ff);
    opacity: 0.6;
}

/* ============================================================
   Live feature previews (replace showmotions)
   ============================================================ */

.tutorial-live-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
    animation: tlpIn 0.35s ease;
}

@keyframes tlpIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.tlp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px 2px;
}

.tlp-header-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #b5bac1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tlp-header-label i {
    color: var(--accent-cyan, #00e5ff);
}

.tlp-live-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a0a0c;
    background: linear-gradient(135deg, var(--accent-cyan, #00e5ff), #7cf5ff);
    padding: 3px 8px;
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.tlp-body.sr-preview-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 14px 14px 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.tlp-channel-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #f2f3f5;
    margin: -2px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tlp-channel-bar i {
    color: #80848e;
    font-size: 0.85rem;
}

.tlp-avatar-img {
    overflow: hidden;
    padding: 0;
}

.tlp-avatar-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.tlp-btn-verify {
    background: #248046 !important;
    color: #fff !important;
    border: none;
    border-radius: 3px;
    padding: 6px 14px;
    font-size: 0.8rem;
    box-shadow: 0 0 0 0 rgba(36, 128, 70, 0.5);
    animation: tlpBtnPulse 2.4s ease-in-out infinite;
}

@keyframes tlpBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(36, 128, 70, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(36, 128, 70, 0); }
}

.tlp-disabled {
    text-align: center;
    padding: 28px 16px;
    color: #80848e;
}

.tlp-disabled-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ed4245;
}

.tlp-disabled-title {
    color: #f2f3f5;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.tlp-disabled-body {
    font-size: 0.82rem;
    line-height: 1.45;
}

.tlp-prefix-badge {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    font-size: 0.78rem;
    color: #dbdee1;
}

.tlp-prefix-badge b {
    color: #00e5ff;
}

/* Welcome layout indicator + embed polish */
.tlp-style-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 999px;
    margin: 0 0 10px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.22);
    color: #a8f0ff;
}

.tlp-style-pill--compact {
    background: rgba(88, 101, 242, 0.14);
    border-color: rgba(88, 101, 242, 0.35);
    color: #b5bffb;
}

.tlp-style-pill--card {
    background: rgba(157, 0, 255, 0.12);
    border-color: rgba(157, 0, 255, 0.3);
    color: #d4b3ff;
}

.tlp-welcome-embed {
    max-width: 100%;
}

.tlp-welcome-embed .dc-embed-inner {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.tlp-welcome-embed .dc-embed-body {
    flex: 1;
    min-width: 0;
}

.tutorial-demo-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.16);
    font-size: 0.84rem;
    color: #dbdee1;
    line-height: 1.45;
    cursor: pointer;
}

.tutorial-demo-confirm input {
    margin-top: 3px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-cyan, #00e5ff);
}

.tutorial-demo-apply {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tutorial-demo-apply-error {
    color: #ed4245;
    font-size: 0.82rem;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid rgba(237, 66, 69, 0.25);
}

.tutorial-demo-apply-ok {
    color: #23a559;
    font-size: 0.84rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tutorial-apply-btn {
    width: 100%;
    justify-content: center;
}

.tutorial-apply-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tutorial-summary-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tutorial-summary-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
    color: #dbdee1;
    line-height: 1.4;
}

.tutorial-summary-list li i {
    color: #23a559;
    margin-top: 2px;
}

.tutorial-summary-list li.skipped {
    color: #80848e;
}

.tutorial-summary-list li.skipped i {
    color: #4e5058;
}

.tlp-log-mini {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tlp-log-line {
    font-size: 0.75rem;
    color: #b5bac1;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tlp-log-line i { width: 14px; text-align: center; opacity: 0.85; }
.tlp-log-line--kick i { color: #faa61a; }
.tlp-log-line--timeout i { color: #5865f2; }

.tlp-role-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tlp-role-pill {
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(157, 0, 255, 0.12);
    border: 1px solid rgba(157, 0, 255, 0.28);
    color: #d4b3ff;
}

/* Intro hero */
.tlp-intro {
    position: relative;
    padding: 6px 2px 2px;
    overflow: hidden;
}

.tlp-intro-glow {
    position: absolute;
    inset: -40% -20% auto;
    height: 120px;
    background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.18), transparent 70%);
    pointer-events: none;
}

.tlp-intro-top {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
}

.tlp-intro-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tlp-intro-icon--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5865f2, #9d00ff);
    color: #fff;
    font-size: 1.35rem;
}

.tlp-intro-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-cyan, #00e5ff);
    margin-bottom: 2px;
}

.tlp-intro-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f2f3f5;
    line-height: 1.25;
}

.tlp-intro-sub {
    font-size: 0.8rem;
    color: #b5bac1;
    margin-top: 2px;
    line-height: 1.4;
}

.tlp-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    position: relative;
}

.tlp-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #dbdee1;
}

.tlp-chip i {
    color: var(--accent-cyan, #00e5ff);
    font-size: 0.7rem;
}

.tlp-intro-foot {
    margin-top: 14px;
    font-size: 0.75rem;
    color: #87898c;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tlp-intro-foot i {
    color: var(--accent-purple, #9d00ff);
}

/* Voice / Warteraum */
.tlp-voice {
    padding: 4px 2px;
}

.tlp-voice-header {
    font-size: 0.78rem;
    font-weight: 700;
    color: #80848e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tlp-voice-header i { color: #23a559; }

.tlp-voice-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tlp-voice-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5865f2, #00e5ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
}

.tlp-voice-name {
    font-weight: 700;
    color: #f2f3f5;
    font-size: 0.9rem;
}

.tlp-voice-status {
    font-size: 0.75rem;
    color: #b5bac1;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.tlp-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #23a559;
    box-shadow: 0 0 0 0 rgba(35, 165, 89, 0.5);
    animation: tlpPulse 1.6s ease-in-out infinite;
}

@keyframes tlpPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(35, 165, 89, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(35, 165, 89, 0); }
}

.tlp-voice-roles {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: #dbdee1;
}

.tlp-k {
    display: inline-block;
    min-width: 72px;
    color: #80848e;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tlp-voice-hint {
    margin-top: 4px;
    font-size: 0.72rem;
    color: #87898c;
    line-height: 1.35;
}

.tlp-music {
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.18);
    font-size: 0.78rem;
    color: #dbdee1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tlp-music i { color: #00e5ff; }

.tlp-music--off {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
    color: #80848e;
}

.tlp-music--off i { color: #80848e; }

/* Dashboard-style mocks (logs / ingame / security / apply) */
.tlp-dash {
    padding: 2px;
}

.tlp-dash-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f2f3f5;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tlp-dash-title i {
    color: var(--accent-cyan, #00e5ff);
}

.tlp-sys-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tlp-sys-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tlp-sys-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    color: #dbdee1;
}

.tlp-sys-row--del .tlp-sys-icon { color: #ed4245; background: rgba(237, 66, 69, 0.12); }
.tlp-sys-row--role .tlp-sys-icon { color: #5865f2; background: rgba(88, 101, 242, 0.15); }
.tlp-sys-row--join .tlp-sys-icon { color: #23a559; background: rgba(35, 165, 89, 0.12); }
.tlp-sys-row--inv .tlp-sys-icon { color: #00e5ff; background: rgba(0, 229, 255, 0.1); }

.tlp-sys-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f2f3f5;
}

.tlp-sys-detail {
    font-size: 0.72rem;
    color: #87898c;
    margin-top: 1px;
}

.tlp-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tlp-stat {
    padding: 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tlp-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}

.tlp-stat-val span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #80848e;
    margin-left: 2px;
}

.tlp-stat-val--ok {
    color: #23a559;
    font-size: 1rem;
}

.tlp-stat-lbl {
    font-size: 0.68rem;
    color: #87898c;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.tlp-ingame-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.tlp-sec-hero {
    padding: 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(35, 165, 89, 0.15), rgba(0, 229, 255, 0.08));
    border: 1px solid rgba(35, 165, 89, 0.28);
    color: #dbdee1;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.tlp-sec-hero i { color: #23a559; }

.tlp-sec-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tlp-sec-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
    color: #dbdee1;
    font-weight: 600;
}

.tlp-sec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4e5058;
}

.tlp-sec-pill.is-on .tlp-sec-dot {
    background: #23a559;
    box-shadow: 0 0 8px rgba(35, 165, 89, 0.55);
}

.tlp-sec-state {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: #80848e;
    text-transform: uppercase;
}

.tlp-sec-pill.is-on .tlp-sec-state { color: #23a559; }

.tlp-apply-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tlp-apply-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.84rem;
    color: #dbdee1;
    font-weight: 600;
}

.tlp-apply-row i { font-size: 0.95rem; }
.tlp-apply-row.is-on i { color: #23a559; }
.tlp-apply-row.is-off i { color: #4e5058; }
.tlp-apply-row.is-off { color: #80848e; }

.tlp-apply-row em {
    margin-left: auto;
    font-style: normal;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #87898c;
}

.tlp-apply-row.is-on em { color: #23a559; }

@media (prefers-reduced-motion: reduce) {
    .tutorial-live-preview,
    .tlp-btn-verify,
    .tlp-pulse {
        animation: none !important;
    }
}

/* The "Im Dashboard:" lead box is now rendered inside the demo card.
   This rule keeps the old selector valid for any external code or
   inspection tools that might still query it. */
.tutorial-step-side {
    display: none;
}

.tutorial-highlight-target {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 8px;
    color: var(--text-main, #e0e0e0);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-top: 4px;
}

.tutorial-highlight-target i {
    color: var(--accent-cyan, #00e5ff);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.tutorial-highlight-target b {
    color: #fff;
    font-weight: 600;
}

.tutorial-jump-btn {
    width: 100%;
}


/* ---- Footer (progress dots + nav buttons) ------------------ */

.tutorial-step-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 16px;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
    /* Keep nav always visible while body scrolls (esp. phones). */
    background: rgba(20, 20, 28, 0.96);
    margin: 0 -4px;
    padding-left: 4px;
    padding-right: 4px;
    z-index: 5;
}

.tutorial-step-actions {
    display: flex;
    gap: 10px;
}

.tutorial-progress-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tutorial-progress-dots .dot {
    width: 26px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.25s ease;
}

.tutorial-progress-dots .dot.done {
    background: rgba(0, 229, 255, 0.45);
}

.tutorial-progress-dots .dot.active {
    background: var(--accent-cyan, #00e5ff);
}


/* ---- Replay button (sidebar, above the search bar) ---------- */

.sidebar-tutorial-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    margin: 8px 10px 2px 10px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted, #888899);
    font-family: var(--font-family, 'Inter', 'Segoe UI', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

.sidebar-tutorial-btn i {
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--accent-cyan, #00e5ff), var(--accent-purple, #9d00ff));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-tutorial-btn:hover {
    color: #fff;
    border-color: rgba(0, 229, 255, 0.35);
    background: rgba(0, 229, 255, 0.07);
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.15);
    transform: translateY(-1px);
}

.sidebar-tutorial-btn:focus-visible {
    outline: 2px solid var(--accent-cyan, #00e5ff);
    outline-offset: 2px;
}

.tutorial-root.active .sidebar-tutorial-btn {
    pointer-events: none;
    opacity: 0.45;
}


/* ---- Accessibility: reduced motion ------------------------- */

@media (prefers-reduced-motion: reduce) {

    .tutorial-step-card,
    .tutorial-welcome-card,
    .tutorial-step-overlay,
    .tutorial-backdrop,
    .tutorial-welcome-modal {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }

    .tutorial-showmotion[data-paused="true"] {
        /* When motion is reduced, Showmotions should not auto-play.
           The controller sets data-paused="true" on the <video>. */
    }
}


/* ---- Mobile polish ----------------------------------------- */

@media (max-width: 600px) {
    .tutorial-welcome-card {
        padding: 24px 22px;
    }

    .tutorial-welcome-card h2 {
        font-size: 1.35rem;
    }

    .tutorial-welcome-bullets {
        grid-template-columns: 1fr;
    }

    .tutorial-step-card {
        padding: 20px;
        width: calc(100% - 16px);
        max-height: min(94dvh, calc(100dvh - 12px));
        border-radius: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .tutorial-step-header h2 {
        font-size: 1.2rem;
        padding-right: 40px; /* room for close btn */
    }

    .tutorial-step-media {
        max-height: 28vh;
    }

    .tutorial-step-media.tutorial-step-media--live {
        max-height: min(36vh, 320px);
        min-height: 180px;
    }

    .tutorial-step-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }

    .tutorial-progress-dots {
        justify-content: center;
    }

    .tutorial-step-actions {
        justify-content: space-between;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .tutorial-step-actions button,
    .tutorial-step-actions .btn-secondary,
    .tutorial-step-actions .btn-primary,
    .tutorial-step-actions #tutorial_next_btn,
    .tutorial-step-actions .tutorial-cta-reset,
    .tutorial-step-actions .tutorial-cta-dashboard {
        flex: 1 1 100% !important;
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .tutorial-demo-card select,
    .tutorial-demo-card input,
    .tutorial-demo-card .tutorial-demo-chip,
    .tutorial-demo-card button {
        min-height: 44px;
        font-size: 16px; /* prevent iOS zoom */
    }
}


/* ---- In-tutorial demo panel (imitates .settings-card) ----- */

.tutorial-demo-mount {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Demo card itself looks like a real settings-card on the dashboard */
.tutorial-demo-card {
    background: var(--bg-card, rgba(20, 20, 28, 0.7));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Plain h2 heading — same look as a real card title */
.tutorial-demo-card h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-demo-card h4 i {
    color: var(--accent-cyan, #00e5ff);
    font-size: 0.95rem;
}

/* Form label mirrors the global `label` style in web/style.css */
.tutorial-demo-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted, #888899);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 0 6px;
}

.tutorial-demo-card label:first-of-type {
    margin-top: 0;
}

/* Native select + text input styled exactly like .input-modern */
.tutorial-demo-card select,
.tutorial-demo-card input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--input-bg, rgba(0, 0, 0, 0.3));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    color: #fff;
    border-radius: 8px;
    font: inherit;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tutorial-demo-card select option {
    background: var(--bg-dark, #0e0e12);
    color: #fff;
}

.tutorial-demo-card select:focus,
.tutorial-demo-card input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-cyan, #00e5ff);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.15);
}

/* Chip / pill for multi-select: matches the role-chip + toggle-option look */
.tutorial-demo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.tutorial-demo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    color: var(--text-main, #e0e0e0);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tutorial-demo-chip:hover {
    border-color: rgba(0, 229, 255, 0.25);
}

.tutorial-demo-chip.active {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.5);
    color: var(--accent-cyan, #00e5ff);
}

/* Radio: mirrors the segmented control used on the dashboard */
.tutorial-demo-radios {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.tutorial-demo-radio {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    color: var(--text-muted, #888899);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-demo-radio:hover {
    border-color: rgba(0, 229, 255, 0.25);
    color: #fff;
}

.tutorial-demo-radio.active {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--accent-cyan, #00e5ff);
    color: #fff;
}

/* Live preview: calm, subtle, single coloured accent stripe on the left */
.tutorial-demo-preview {
    margin-top: 6px;
    padding: 10px 14px;
    border-left: 3px solid var(--accent-cyan, #00e5ff);
    background: rgba(0, 229, 255, 0.05);
    color: var(--text-main, #e0e0e0);
    font-size: 0.88rem;
    line-height: 1.5;
    border-radius: 0 8px 8px 0;
}

/* "Where you'll find this later" hint */
.tutorial-demo-hint {
    margin-top: 4px;
    color: var(--text-muted, #888899);
    font-size: 0.82rem;
    line-height: 1.5;
}

/* External-link button rendered inside the demo card on steps 6-8 */
.tutorial-demo-card .tutorial-jump-btn {
    margin-top: 4px;
}


/* =================================================================
   Design Optimization Layer
   -----------------------------------------------------------------
   Layered on top of the base tutorial styles above. All new
   selectors are namespaced .tutorial-… so they cannot collide with
   the existing dashboard CSS. Only additions — nothing in the rules
   above is modified, preserving the parent plan's file-list
   constraint that says: do not touch anything above this section.
   ================================================================= */


/* ---- Focus-first: demo panel as the visual hero -------------- */

/* Tilt the existing 2-column body toward the demo panel. The base
   grid already lives at .tutorial-step-body — we override its
   template so the demo column is wider than the media column, and
   we also re-flow the body on small screens. */
.tutorial-step-body {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
}

@media (max-width: 820px) {
    .tutorial-step-body {
        grid-template-columns: 1fr;
    }
}

/* When the body lead paragraph is present (it sits in the header),
   nothing extra is needed — the header already spans the full width.
   Keep this rule so future authors find a hook if they ever move
   the lead into the grid. */
.tutorial-step-lead {
    grid-column: 1 / -1;
    color: #d0d3da;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 4px 0;
}


/* ---- Hero treatment for the demo card ------------------------ */

.tutorial-demo-mount {
    /* The mount itself is the hero container; give it a tiny visual
       lift so the card reads as the primary surface. */
    align-self: stretch;
}

.tutorial-demo-card {
    background: linear-gradient(180deg,
            rgba(0, 229, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(0, 229, 255, 0.22);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    /* The base rule sets padding 22px 24px; keep that, just tighten
       the header gap. */
}

.tutorial-demo-card h4 {
    font-size: 1.05rem;
}


/* ---- Accessible, comfortable controls ------------------------ */

/* Raise label contrast from #888899 to #aeb4c0 for AA on the dark
   background, and give every tappable control a 40px+ target with
   8px gaps so touch users can hit them comfortably. */
.tutorial-demo-card label {
    color: #aeb4c0;
}

.tutorial-demo-card select,
.tutorial-demo-card input[type="text"] {
    min-height: 40px;
    border-radius: 10px;
}

.tutorial-demo-chip {
    min-height: 40px;
    padding: 9px 14px;
}

.tutorial-demo-radio {
    min-height: 40px;
    padding: 10px 14px;
}

.tutorial-demo-chips,
.tutorial-demo-radios {
    gap: 8px;
}


/* ---- "Not saved" contract — unmistakable --------------------- */

/* Markup-level flag (visible without CSS) sits below the preview. */
.tutorial-demo-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: #aeb4c0;
    letter-spacing: 0.01em;
}

.tutorial-demo-flag i {
    color: #f5b73d;
}

/* Style the preview as a labeled "Vorschau · Demo (nicht gespeichert)"
   block. The base .tutorial-demo-preview already paints the cyan stripe;
   we add the eyebrow label on top. */
.tutorial-demo-preview {
    position: relative;
    padding-top: 22px;
}

.tutorial-demo-preview::before {
    content: "Vorschau · Demo (nicht gespeichert)";
    position: absolute;
    top: 0;
    left: 12px;
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-cyan, #00e5ff);
    background: rgba(14, 14, 18, 0.85);
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0, 229, 255, 0.3);
    opacity: 0.9;
}


/* ---- Per-step completion chip ------------------------------- */

.tutorial-demo-done {
    display: none;
    /* shown via JS by adding .is-active */
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(56, 217, 130, 0.12);
    border: 1px solid rgba(56, 217, 130, 0.4);
    color: #6fe0a3;
    font-size: 0.82rem;
    font-weight: 600;
    align-self: flex-start;
}

.tutorial-demo-done.is-active {
    display: inline-flex;
}

.tutorial-demo-done i {
    color: #6fe0a3;
}


/* ---- Footer CTA bar (sticky, conversion-oriented) ----------- */

/* The base .tutorial-step-footer already flexes between dots and
   actions. We give it a touch of breathing room and reinforce the
   divider so the primary CTA group reads as a unit. */
.tutorial-step-footer {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tutorial-step-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Footer "Zurücksetzen" — always visible; restarts the guide without
   rolling back server settings already written by live save. */
.tutorial-cta-reset {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 180, 80, 0.35);
    color: #f0c674;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tutorial-cta-reset:hover:not(:disabled) {
    background: rgba(240, 180, 80, 0.12);
    border-color: rgba(240, 180, 80, 0.55);
    color: #ffd78a;
}

.tutorial-cta-reset:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tutorial-cta-reset:focus-visible {
    outline: 2px solid var(--accent-cyan, #00e5ff);
    outline-offset: 2px;
}

/* Legacy class kept for older cached HTML */
.tutorial-cta-dashboard {
    display: none;
}


/* ---- ARIA: pressed state for chips / radios ----------------- */

/* Chips are visually <span> but JS sets aria-pressed. Paint the
   active state consistently with the .active class. */
.tutorial-demo-chip[aria-pressed="true"],
.tutorial-demo-chip.active {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.5);
    color: var(--accent-cyan, #00e5ff);
}

.tutorial-demo-radio[aria-pressed="true"],
.tutorial-demo-radio.active {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--accent-cyan, #00e5ff);
    color: #fff;
}


/* ---- Summary checklist (step 9) ----------------------------- */

.tutorial-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tutorial-summary-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #d0d3da;
    font-size: 0.88rem;
    line-height: 1.45;
}

.tutorial-summary-list li i {
    color: var(--accent-cyan, #00e5ff);
    margin-top: 2px;
    flex-shrink: 0;
}

.tutorial-summary-list li.skipped {
    opacity: 0.55;
}

.tutorial-summary-list li.skipped i {
    color: var(--text-muted, #888899);
}

.tutorial-summary-list b {
    color: #fff;
    font-weight: 600;
}


/* ---- Reduced motion + high-contrast guards ------------------ */

@media (prefers-reduced-motion: reduce) {
    .tutorial-demo-card {
        box-shadow: none;
        transition: none;
    }

    .tutorial-demo-chip,
    .tutorial-demo-radio {
        transition: none;
    }

    .tutorial-demo-preview::before {
        /* no uppercase animation flicker */
        transition: none;
    }
}

@media (prefers-contrast: more) {
    .tutorial-demo-card {
        border-color: #fff;
    }

    .tutorial-demo-card label {
        color: #fff;
    }

    .tutorial-demo-preview {
        border-left-width: 4px;
    }

    .tutorial-demo-preview::before {
        color: #fff;
        border-color: #fff;
    }
}


/* ---- Dashboard CTA button (footer) -------------------------- */

/* Visually consistent with the dashboard's .btn-secondary token, but
   scoped to .tutorial-cta-dashboard so it inherits the tutorial's
   spacing. The .is-active class is toggled by the controller. */
.tutorial-cta-dashboard {
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan, #00e5ff);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.tutorial-cta-dashboard:hover:not(:disabled) {
    background: rgba(0, 229, 255, 0.16);
    border-color: rgba(0, 229, 255, 0.55);
    color: #fff;
}

.tutorial-cta-dashboard:focus-visible {
    outline: 2px solid var(--accent-cyan, #00e5ff);
    outline-offset: 2px;
}

/* At step 9 (final summary) the dashboard CTA becomes the visual
   primary — pull it ahead of the "Tour beenden" button via order:-1. */
.tutorial-step-actions[data-mode="primary-dashboard"] .tutorial-cta-dashboard {
    background: linear-gradient(135deg, var(--accent-cyan, #00e5ff), var(--accent-purple, #9d00ff));
    border-color: transparent;
    color: #0e0e12;
    box-shadow: 0 6px 18px rgba(0, 229, 255, 0.25);
}

.tutorial-step-actions[data-mode="primary-dashboard"] .tutorial-cta-dashboard:hover:not(:disabled) {
    filter: brightness(1.08);
    color: #0e0e12;
}

/* ---- Skip button (Überspringen) --------------------------------
   Subtle, secondary-coloured button that lets the user exit the
   Setup Guide at any step without resetting. Sits between the
   Reset and the primary Next/Finish button in the footer row.  */

.tutorial-skip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted, #888899);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tutorial-skip-btn:hover {
    background: rgba(235, 69, 95, 0.1);
    border-color: rgba(235, 69, 95, 0.3);
    color: #eb455f;
}

.tutorial-skip-btn:focus-visible {
    outline: 2px solid var(--accent-cyan, #00e5ff);
    outline-offset: 2px;
}


/* ---- Toast (successfully-redirected hint) -------------------- */

#tutorial_toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translate(-50%, 20px);
    padding: 12px 18px;
    background: rgba(20, 20, 28, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 229, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100010;
    max-width: calc(100% - 32px);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#tutorial_toast.tutorial-toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---- Onboarding notification toast (bottom-right, glassmorphic) ----------
   Layout:
     [top row]  icon · text · close-btn   (flex, no overlap)
     [bottom]   full-width action button
   The close button is a flex sibling — not absolute — so it can never
   overlap the text or the action button. */

.tutorial-onboarding-toast {
    position: fixed;
    bottom: max(90px, calc(76px + env(safe-area-inset-bottom, 0px)));
    right: max(16px, env(safe-area-inset-right, 0px));
    left: auto;
    width: min(340px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    background: rgba(15, 18, 25, 0.94);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #dbdee1;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(0, 229, 255, 0.15);
    z-index: 100001;
    transform: translateX(calc(100% + 24px));
    transition: transform 0.45s cubic-bezier(0.16, 1.0, 0.3, 1);
    pointer-events: auto;
    overflow: hidden;
}

.tutorial-onboarding-toast.show {
    transform: translateX(0);
}

/* Top accent line */
.tutorial-onboarding-toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan, #00e5ff), var(--accent-purple, #9d00ff));
    border-radius: 16px 16px 0 0;
}

/* Outer wrapper: stacks the header row and the action button */
.tutorial-onboarding-toast .toast-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px 14px 14px;
}

/* Header row: icon · text · close-btn */
.tutorial-onboarding-toast .toast-header-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tutorial-onboarding-toast .toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}

.tutorial-onboarding-toast .toast-text {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tutorial-onboarding-toast .toast-text strong {
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.tutorial-onboarding-toast .toast-text span {
    font-size: 12px;
    line-height: 1.45;
    color: #949ba4;
}

/* Close button: flex sibling, never overlaps content */
.tutorial-onboarding-toast .toast-close-btn {
    flex-shrink: 0;
    margin-left: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #80848e;
    font-size: 1rem;
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    line-height: 1;
    padding: 0;
}

.tutorial-onboarding-toast .toast-close-btn:hover {
    background-color: rgba(235, 69, 95, 0.15);
    border-color: rgba(235, 69, 95, 0.35);
    color: #eb455f;
}

/* Action button: full width at the bottom */
.tutorial-onboarding-toast .toast-action-btn {
    width: 100%;
    padding: 9px 16px;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(157, 0, 255, 0.12));
    border: 1px solid rgba(0, 229, 255, 0.45);
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(0, 229, 255, 0.15);
    letter-spacing: 0.01em;
}

.tutorial-onboarding-toast .toast-action-btn:hover {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.28), rgba(157, 0, 255, 0.2));
    border-color: rgba(0, 229, 255, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(0, 229, 255, 0.25);
}


/* =================================================================
   Layout Fill Layer
   -----------------------------------------------------------------
   Makes the step overlay actually use the available viewport on
   desktop (the base card caps at 880px, which leaves a lot of dead
   space on large monitors) and fixes column-height matching and the
   3-button footer on mobile. Appended last so it wins source-order
   ties against the rules above at equal specificity. Only additions.
   ================================================================= */


/* ---- Desktop: fill the available space ----------------------- */

/* Widen the step card progressively with the viewport instead of
   staying at a fixed 880px. The overlay padding (16px) plus this
   width gives a card that breathes on laptops and genuinely fills
   the screen on large monitors, without ever touching the edges. */
.tutorial-step-card {
    width: min(1120px, calc(100% - 48px));
}

@media (min-width: 1280px) {
    .tutorial-step-card {
        width: min(1280px, calc(100% - 64px));
        padding: 32px;
        gap: 24px;
    }
}

@media (min-width: 1600px) {
    .tutorial-step-card {
        width: min(1440px, calc(100% - 80px));
    }
}

/* Equal-height columns: the media and the demo card fill the same
   height so the two-column layout reads as a single balanced block
   instead of two staggered boxes. (The base rule sets 16:9 on the
   media; on desktop we let it stretch to the demo card's height and
   rely on object-fit: cover for the video, with a sensible floor.) */
.tutorial-step-body {
    align-items: stretch;
}

.tutorial-step-media {
    aspect-ratio: auto;
    min-height: 340px;
}

@media (min-width: 1280px) {
    .tutorial-step-media {
        min-height: 440px;
    }
}

/* Make the demo card fill its column height (the mount is a flex
   column; without this the card would sit centered/short while the
   media stretches). */
.tutorial-demo-mount {
    justify-content: stretch;
}

.tutorial-demo-mount .tutorial-demo-card {
    flex: 1 1 auto;
}


/* ---- Mobile: keep the displays correct ----------------------- */

/* Restore the natural 16:9 media on phones (the desktop min-height
   would waste vertical space on a narrow screen) and drop the stretch
   so single-column stacks naturally. */
@media (max-width: 820px) {
    .tutorial-step-body {
        align-items: start;
    }

    .tutorial-step-media {
        aspect-ratio: 16 / 9;
        min-height: 0;
    }

    .tutorial-demo-mount {
        justify-content: flex-start;
    }

    .tutorial-demo-mount .tutorial-demo-card {
        flex: 1 1 auto;
    }
}

/* The footer now holds up to three buttons (Zurück · Zum Dashboard ·
   Weiter). The dashboard button's nowrap + long German label would
   overflow on phones, so allow wrapping and shrink the tap padding
   while keeping the 40px min-height for touch comfort. The actions
   row wraps gracefully if it still gets tight. */
@media (max-width: 600px) {
    .tutorial-step-actions {
        flex-wrap: wrap;
        flex-direction: column;
        gap: 8px;
    }

    .tutorial-cta-dashboard {
        white-space: normal;
        font-size: 0.85rem;
        padding: 12px 14px;
        text-align: center;
        flex: 1 1 100%;
        order: 99;
        min-height: 48px;
        /* sit below Zurück/Weiter on phones */
    }

    /* On the final summary step the dashboard CTA is the hero — let it
       stay full-width and visually primary even on phones. */
    .tutorial-step-actions[data-mode="primary-dashboard"] .tutorial-cta-dashboard {
        order: -1;
    }

    .tutorial-step-actions .btn-secondary,
    .tutorial-step-actions .btn-primary,
    .tutorial-step-actions #tutorial_next_btn {
        flex: 1 1 100%;
        min-height: 48px;
        width: 100%;
    }
}

/* Very small phones: tighten the card padding so the panel and the
   footer keep usable room without horizontal scrolling. */
@media (max-width: 380px) {
    .tutorial-step-card {
        padding: 16px;
        gap: 14px;
    }

    .tutorial-demo-card {
        padding: 16px;
    }
}

/* ============================================================
   Setup-Guide specific styles (Verify quick setup)
   ------------------------------------------------------------
   These styles cover the three new pieces the rewritten tutorial
   renders: a green "wird gespeichert" flag on the apply step, a
   required-confirm checkbox, and the primary "Anwenden" write
   action. They piggy-back on the existing .tutorial-demo-* naming
   so layout/stacking/inheritance stay consistent with the rest of
   the demo card.
   ============================================================ */

/* Apply-step "saved" flag: same shape as .tutorial-demo-flag but green
   instead of the amber "not saved" hint used on demo steps. */
.tutorial-demo-flag--persisted {
    border-color: rgba(111, 224, 163, 0.35);
    background: rgba(111, 224, 163, 0.08);
    color: #d6f5e3;
}

.tutorial-demo-flag--persisted i {
    color: #6fe0a3;
}

/* Required-confirm checkbox on the apply step. Uses a stacked layout
   so the long acceptance sentence stays legible on narrow screens. */
.tutorial-demo-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 6px;
    padding: 12px;
    background: rgba(245, 183, 61, 0.06);
    border: 1px solid rgba(245, 183, 61, 0.28);
    border-radius: 8px;
    color: #e6e8ee;
    line-height: 1.45;
    cursor: pointer;
}

.tutorial-demo-confirm input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--accent-cyan, #00e5ff);
    cursor: pointer;
}

.tutorial-demo-confirm span {
    flex: 1 1 auto;
    font-size: 0.92rem;
}

/* Apply action block: the primary "Anwenden & aktivieren" button plus
   inline success/error feedback. Sits below the demo card so a tall
   screen keeps the visual order body → config → action. */
.tutorial-demo-apply {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tutorial-apply-btn {
    width: 100%;
    min-height: 48px;
    font-weight: 700;
    border-radius: 10px;
}

.tutorial-apply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tutorial-demo-apply-error {
    color: #ffd0d6;
    background: rgba(235, 69, 95, 0.12);
    border: 1px solid rgba(235, 69, 95, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.tutorial-demo-apply-ok {
    color: #d6f5e3;
    background: rgba(111, 224, 163, 0.12);
    border: 1px solid rgba(111, 224, 163, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-demo-apply-ok i {
    color: #6fe0a3;
}

/* ---- Glass Select Dropdowns -------------------------------- */
.tutorial-demo-select-trigger {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.95rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tutorial-demo-select-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}
.tutorial-demo-select-trigger.open {
    border-color: var(--accent-cyan, #00e5ff);
    box-shadow: 0 0 0 1px var(--accent-cyan, #00e5ff);
}
.tutorial-demo-select-trigger.open i {
    transform: rotate(180deg);
}
.tutorial-demo-select-trigger i {
    transition: transform 0.2s ease;
    font-size: 0.85rem;
    color: #888899;
}
.tutorial-demo-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(30, 30, 40, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
/* Portaled mobile menus (appended to body by tutorial.js) */
.tutorial-demo-select-options.is-fixed {
    right: auto;
    max-height: 40vh;
}
.tutorial-demo-select-option {
    padding: 12px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    color: #e0e0e0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    -webkit-tap-highlight-color: rgba(0, 229, 255, 0.15);
    touch-action: manipulation;
}
.tutorial-demo-select-option:hover {
    background: rgba(255, 255, 255, 0.08);
}
.tutorial-demo-select-option.selected {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-cyan, #00e5ff);
}
.tutorial-demo-select-trigger {
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.tutorial-demo-card label,
.tutorial-demo-preview-card label {
    position: relative;
    display: block;
}

/* ---- Flying-in Warning Toast for Server Selection ---- */
.tutorial-warn-toast {
    position: fixed;
    bottom: max(90px, calc(76px + env(safe-area-inset-bottom, 0px)));
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    background: rgba(15, 18, 25, 0.88);
    border: 1px solid rgba(255, 179, 0, 0.45);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #dbdee1;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 179, 0, 0.15);
    z-index: 99999;
    transform: translateX(130%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.tutorial-warn-toast.show {
    transform: translateX(0);
}

.tutorial-warn-toast .toast-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    position: relative;
}

.tutorial-warn-toast .toast-icon {
    font-size: 1.4rem;
    margin-right: 12px;
    margin-top: 2px;
}

.tutorial-warn-toast .toast-text {
    display: flex;
    flex-direction: column;
    padding-right: 20px;
}

.tutorial-warn-toast .toast-text strong {
    font-size: 14px;
    color: #fff;
    margin-bottom: 4px;
}

.tutorial-warn-toast .toast-text span {
    font-size: 12px;
    line-height: 1.4;
    color: #b5bac1;
}

.tutorial-warn-toast .toast-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #949ba4;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tutorial-warn-toast .toast-close-btn:hover {
    color: #fff;
}

/* ============================================================
   Mobile / touch hardening (phones + narrow tablets)
   ============================================================ */

.tutorial-root,
.tutorial-root * {
    -webkit-tap-highlight-color: rgba(0, 229, 255, 0.12);
}

.tutorial-close-btn,
.tutorial-welcome-actions button,
.tutorial-step-actions button,
.tutorial-demo-radio,
.tutorial-demo-chip,
.tutorial-apply-btn,
.tutorial-jump-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 820px) {
    .tutorial-step-overlay {
        padding: max(8px, env(safe-area-inset-top, 0px)) 8px max(8px, env(safe-area-inset-bottom, 0px));
        align-items: flex-end; /* card sits above home indicator */
    }

    .tutorial-step-card {
        width: 100%;
        max-width: 100%;
        max-height: min(96dvh, calc(100dvh - 8px));
        border-radius: 16px 16px 12px 12px;
    }

    /* Forms first, preview/video second — primary task is configuring */
    .tutorial-step-body {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .tutorial-demo-mount {
        order: 1;
    }

    .tutorial-step-media {
        order: 2;
        width: 100%;
        max-height: min(30vh, 240px);
        min-height: 140px;
        aspect-ratio: 16 / 9;
    }

    .tutorial-step-media.tutorial-step-media--live {
        max-height: min(34vh, 280px);
        min-height: 160px;
        aspect-ratio: auto;
    }

    .tutorial-step-header {
        flex-shrink: 0;
        padding-right: 36px; /* close button clearance */
    }

    .tutorial-demo-radios {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .tutorial-demo-radio {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 0.9rem;
    }

    .tutorial-demo-confirm {
        min-height: 48px;
    }

    .tutorial-demo-confirm input {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }

    .tutorial-welcome-actions {
        flex-direction: column;
        width: 100%;
    }

    .tutorial-welcome-actions button {
        width: 100%;
        min-height: 48px;
    }

    .tutorial-warn-toast {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        bottom: max(100px, calc(88px + env(safe-area-inset-bottom, 0px)));
        transform: translateY(140%);
    }

    .tutorial-warn-toast.show {
        transform: translateY(0);
    }

    #tutorial_toast {
        left: 50% !important;
        right: auto !important;
        width: max-content !important;
        max-width: calc(100vw - 32px) !important;
        bottom: max(90px, calc(80px + env(safe-area-inset-bottom, 0px))) !important;
        transform: translate(-50%, 20px) !important;
    }

    #tutorial_toast.tutorial-toast--visible {
        transform: translate(-50%, 0) !important;
    }
}

@media (max-width: 600px) {
    /* Reduce heavy glass blur on low-power phones inside the overlay */
    .tutorial-step-card,
    .tutorial-welcome-card {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .tutorial-step-footer {
        padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
    }

    /* Three footer actions stack full-width on narrow phones (reset always visible) */
    .tutorial-step-actions {
        flex-direction: column;
    }
}