/* =========================================================================
   Nextrader Tutorial pages — styles that match the main app's theme:
   flat & light, bg-gray-50, white cards with rounded-lg + shadow-sm, the
   gray-800/600/500 text palette, brand blue #3b82f6, flat green/red, and
   light badges. NO gradients (the app uses none). Font Awesome icons.
   ========================================================================= */

:root {
    --nx-blue: #3b82f6;       /* blue-500 (brand fill) */
    --nx-blue-dark: #2563eb;  /* blue-600 (hover) */
    --nx-blue-text: #1d4ed8;  /* blue-700 */
    --nx-green: #22c55e;      /* green-500 */
    --nx-red: #ef4444;        /* red-500 */
    --nx-ink: #1f2937;        /* gray-800 */
    --nx-text: #4b5563;       /* gray-600 */
    --nx-muted: #6b7280;      /* gray-500 */
    --nx-border: #e5e7eb;     /* gray-200 */
    --nx-bg: #f9fafb;         /* gray-50 */
    --nx-bg-soft: #f3f4f6;    /* gray-100 */
}

body[data-tutorial-page] {
    color: var(--nx-text);
    -webkit-font-smoothing: antialiased;
}
body[data-tutorial-page] h1,
body[data-tutorial-page] h2,
body[data-tutorial-page] h3 {
    color: var(--nx-ink);
}

/* Hide content until the first translation pass completes. */
body:not(.tut-ready) .tut-i18n-guard {
    visibility: hidden;
}

html { scroll-behavior: smooth; }
.tut-anchor { scroll-margin-top: 86px; }

/* One cohesive, compact reading column on large screens (~1024px). */
@media (min-width: 1024px) {
    body[data-tutorial-page] .container {
        max-width: 64rem;
    }
}

/* ===================== Header (matches app nav: white, shadow-sm, border-b) */
.tut-header {
    background: #fff;
}

/* ===================== Hero (flat brand blue + side preview card) ========= */
.tut-hero {
    background: var(--nx-blue);
    color: #fff;
    position: relative;
    overflow: hidden;
}
/* very subtle same-hue depth on the right — flat, not a rainbow gradient */
.tut-hero::before {
    content: "";
    position: absolute;
    top: -30%;
    right: -8%;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.10), transparent 62%);
    pointer-events: none;
}
.tut-hero > .container { position: relative; z-index: 1; }
.tut-hero__inner {
    display: flex;
    align-items: center;
    gap: 36px;
    justify-content: space-between;
}
.tut-hero__left { flex: 1 1 auto; min-width: 0; max-width: 600px; }
.tut-hero__right { display: none; flex: 0 0 auto; }
@media (min-width: 1024px) {
    .tut-hero__right { display: block; width: 290px; }
}
.tut-hero h1 { color: #fff; line-height: 1.14; }
.tut-hero__breadcrumb {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
}
.tut-hero__breadcrumb a { color: #fff; }
.tut-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.tut-hero__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color .15s, color .15s;
}
.tut-hero__btn--solid { background: #fff; color: var(--nx-blue-dark); }
.tut-hero__btn--solid:hover { background: #eff6ff; }
.tut-hero__btn--ghost { border: 1px solid rgba(255, 255, 255, 0.5); color: #fff; }
.tut-hero__btn--ghost:hover { background: rgba(255, 255, 255, 0.12); }
.tut-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 18px;
}
.tut-hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.92);
}
.tut-hero__meta i { opacity: 0.85; }
/* floating preview card on the right */
.tut-hero__preview {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 48px -24px rgba(15, 23, 42, 0.6);
    padding: 14px;
    color: var(--nx-ink);
    transform: rotate(-1.5deg);
}
.tut-hero__preview-cap {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===================== Table of contents ===================== */
.tut-toc__inner { position: sticky; top: 86px; }
.tut-toc__eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9ca3af;
}
.tut-toc__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--nx-muted);
    border-left: 2px solid transparent;
    transition: background-color .15s, color .15s, border-color .15s;
}
.tut-toc__link::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 9999px;
    background: #d1d5db;
    flex-shrink: 0;
    transition: background-color .15s;
}
.tut-toc__link:hover { background: var(--nx-bg-soft); color: var(--nx-ink); }
.tut-toc__link.is-active {
    color: var(--nx-blue-text);
    border-left-color: var(--nx-blue);
    background: #eff6ff;
    font-weight: 600;
}
.tut-toc__link.is-active::before { background: var(--nx-blue); }
@media (max-width: 1023px) {
    .tut-toc__body { display: none; }
    .tut-toc--open .tut-toc__body { display: block; }
}

/* ===================== Section cards (bg-white rounded-lg shadow-sm) ======= */
.tut-section {
    background: #fff;
    border: 1px solid var(--nx-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.tut-section__head {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 16px;
}
.tut-section__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--nx-blue-text);
    font-weight: 700;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.tut-prose p { line-height: 1.65; }
.tut-prose strong { color: var(--nx-ink); font-weight: 600; }

/* ===================== Tour items ===================== */
.tut-item + .tut-item {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--nx-border);
}
.tut-item__title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    color: var(--nx-ink);
    margin-bottom: 4px;
}
.tut-item__lead {
    color: var(--nx-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 13px;
}

/* numbered pin marker (flat blue, like the app) */
.tut-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    background: var(--nx-blue);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.tut-pin--ghost { background: #eff6ff; color: var(--nx-blue-text); }

/* ===================== Numbered steps (timeline) ===================== */
.tut-step { position: relative; padding-left: 42px; min-height: 28px; }
.tut-step__dot {
    position: absolute;
    left: 0; top: -2px;
    width: 28px; height: 28px;
    border-radius: 9999px;
    background: var(--nx-blue);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem;
    box-shadow: 0 0 0 4px #eff6ff;
}
.tut-step:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 13px; top: 28px; bottom: -20px;
    width: 2px;
    background: var(--nx-border);
}
.tut-step p { margin: 0; line-height: 1.55; }

/* =========================================================================
   MOCKUPS — recreations of the app UI in a light app-window frame.
   ========================================================================= */
.tut-mock {
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    max-width: 540px;
}
.tut-mock__bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--nx-bg-soft);
    border-bottom: 1px solid var(--nx-border);
}
.tut-mock__dot { width: 10px; height: 10px; border-radius: 9999px; background: #d1d5db; }
.tut-mock__dot--r { background: #f87171; }
.tut-mock__dot--y { background: #fbbf24; }
.tut-mock__dot--g { background: #34d399; }
.tut-mock__title {
    margin-left: 8px;
    font-size: 0.72rem;
    color: #9ca3af;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tut-mock__body { padding: 14px; background: #fff; }
.tut-cap {
    font-size: 0.74rem;
    color: #9ca3af;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* annotation legend mapping numbered markers to explanations */
.tut-anno { margin-top: 12px; display: grid; gap: 8px; }
@media (min-width: 480px) { .tut-anno--2 { grid-template-columns: 1fr 1fr; } }
.tut-anno__item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 0.82rem;
    color: var(--nx-text);
    line-height: 1.45;
}
.tut-anno__num {
    flex-shrink: 0;
    width: 19px; height: 19px;
    margin-top: 1px;
    border-radius: 9999px;
    background: #dbeafe;
    color: var(--nx-blue-text);
    font-size: 0.68rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* ---- form controls inside mockups (match .market-select: border rounded-md) */
.tut-ui-select,
.tut-ui-input {
    border: 1px solid var(--nx-border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.82rem;
    color: var(--nx-text);
    background: #fff;
    width: 100%;
}
.tut-ui-input--lg { font-size: 0.95rem; font-weight: 600; color: var(--nx-ink); }
.tut-ui-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--nx-muted);
    margin-bottom: 5px;
}
/* buttons — flat solid like the app (bg-green-500 / bg-red-500 / bg-blue-500) */
.tut-ui-btn {
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.86rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    border: none;
    color: #fff;
}
.tut-ui-btn--up   { background: var(--nx-green); }
.tut-ui-btn--down { background: var(--nx-red); }
.tut-ui-btn--blue { background: var(--nx-blue); }
.tut-ui-btn--ghost { background: var(--nx-bg-soft); color: #4b5563; }
.tut-ui-pill {
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--nx-bg-soft);
    color: #4b5563;
    border: none;
}
.tut-ui-pill--active { background: var(--nx-blue); color: #fff; }

/* ---- chart frame ---- */
.tut-chart {
    border-radius: 8px;
    background: #fbfcfe;
    border: 1px solid var(--nx-border);
    overflow: hidden;
}
.tut-chart svg { display: block; width: 100%; height: auto; }

/* ---- toggle switch ---- */
.tut-switch {
    position: relative;
    display: inline-block;
    width: 42px; height: 24px;
    border-radius: 9999px;
    background: #d1d5db;
    flex-shrink: 0;
    transition: background-color .2s;
}
.tut-switch::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: left .2s;
}
.tut-switch--on { background: var(--nx-blue); }
.tut-switch--on::after { left: 20px; }

/* ---- signal card ---- */
.tut-sigcard {
    border: 1px solid var(--nx-border);
    border-left: 4px solid var(--nx-green);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    padding: 13px 15px;
}
.tut-badge {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 9px;
    border-radius: 9999px;
}
.tut-badge--strong { background: #dcfce7; color: #15803d; }
.tut-chip {
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--nx-bg-soft);
    color: #4b5563;
    padding: 3px 8px;
    border-radius: 6px;
}

/* ---- digit chips (even = blue, odd = indigo — both app signal colours) ---- */
.tut-digit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--nx-bg-soft);
    color: #4b5563;
    flex-shrink: 0;
}
.tut-digit--even { background: #dbeafe; color: var(--nx-blue-text); }
.tut-digit--odd  { background: #e0e7ff; color: #4338ca; }
.tut-digit--last { box-shadow: 0 0 0 2px var(--nx-blue); }

/* ---- distribution bar chart ---- */
.tut-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 132px;
    padding-top: 16px;
}
.tut-bars__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.tut-bars__track { width: 100%; flex: 1; display: flex; align-items: flex-end; }
.tut-bars__bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: #60a5fa;          /* blue-400 (even) */
    position: relative;
}
.tut-bars__bar--odd { background: #818cf8; }   /* indigo-400 (odd) */
.tut-bars__val {
    position: absolute;
    top: -15px; left: 0; right: 0;
    text-align: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--nx-muted);
}
.tut-bars__lbl {
    font-size: 0.72rem;
    font-weight: 600;
    color: #9ca3af;
    margin-top: 6px;
}

/* ---- split confidence meter ---- */
.tut-meter {
    height: 12px;
    border-radius: 9999px;
    overflow: hidden;
    display: flex;
    background: var(--nx-bg-soft);
}
.tut-meter > span { display: block; height: 100%; }

/* ===================== Strategy cards ===================== */
.tut-strat {
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    transition: box-shadow .2s, border-color .2s;
}
.tut-strat:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); border-color: #d8e2f0; }
.tut-strat__tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 9999px;
}
.tut-strat__tag--beginner { background: #dcfce7; color: #15803d; }
.tut-strat__tag--inter    { background: #fef9c3; color: #a16207; }
.tut-strat__tag--advanced { background: #fee2e2; color: #b91c1c; }

/* ===================== Notes ===================== */
.tut-note {
    border-radius: 8px;
    border: 1px solid;
    padding: 12px 14px;
    display: flex;
    gap: 11px;
    font-size: 0.9rem;
    line-height: 1.55;
}
.tut-note i { margin-top: 2px; flex-shrink: 0; }
.tut-note--tip  { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.tut-note--warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.tut-note--risk { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.tut-note--info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ===================== Header nav links ===================== */
.tut-navlink {
    padding: 6px 11px;
    border-radius: 8px;
    color: var(--nx-muted);
    font-weight: 500;
    transition: background-color .15s, color .15s;
    white-space: nowrap;
}
.tut-navlink:hover { background: var(--nx-bg-soft); color: var(--nx-ink); }
.tut-navlink.is-active { background: #eff6ff; color: var(--nx-blue-text); font-weight: 600; }

/* ===================== Cross-link cards ===================== */
.tut-xlink {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--nx-border);
    border-radius: 8px;
    padding: 13px 14px;
    transition: background-color .15s, border-color .15s;
}
.tut-xlink:hover { background: var(--nx-bg); border-color: #d8e2f0; }

/* ===================== Back-to-top FAB (flat blue) ===================== */
.tut-fab {
    position: fixed;
    right: 18px; bottom: 18px;
    width: 44px; height: 44px;
    border-radius: 9999px;
    background: var(--nx-blue);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .4);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .2s, transform .2s, background-color .15s;
    z-index: 50;
    border: none;
    cursor: pointer;
}
.tut-fab:hover { background: var(--nx-blue-dark); }
.tut-fab--show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ===================== Language select ===================== */
.tut-lang {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

/* ===================== Flag language picker ===================== */
.tut-langpicker { position: relative; }
.tut-langpicker__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--nx-blue-text);
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.tut-langpicker__btn:hover { background: #dbeafe; border-color: #93c5fd; }
.tut-langpicker__flag {
    width: 20px;
    height: 15px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    display: block;
}
.tut-langpicker__btn .fa-chevron-down { transition: transform .2s; font-size: 0.6rem; opacity: .7; }
.tut-langpicker--open .tut-langpicker__btn .fa-chevron-down { transform: rotate(180deg); }
.tut-langpicker__label-full { display: none; }
@media (min-width: 480px) { .tut-langpicker__label-full { display: inline; } }
.tut-langpicker__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.22);
    padding: 6px;
    z-index: 60;
    list-style: none;
    margin: 0;
    display: none;
}
.tut-langpicker--open .tut-langpicker__menu { display: block; }
.tut-langpicker__menu li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
}
.tut-langpicker__menu li:hover { background: var(--nx-bg-soft); }
.tut-langpicker__menu li.is-active { background: #eff6ff; color: var(--nx-blue-text); font-weight: 600; }
.tut-langpicker__menu li .tut-langpicker__check { margin-left: auto; color: var(--nx-blue); opacity: 0; font-size: 0.75rem; }
.tut-langpicker__menu li.is-active .tut-langpicker__check { opacity: 1; }

/* ===================== Data tables ===================== */
.tut-table__wrap {
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    overflow: hidden;
    overflow-x: auto;
}
.tut-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 460px;
}
.tut-table thead th {
    text-align: left;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--nx-muted);
    font-weight: 600;
    padding: 10px 13px;
    background: var(--nx-bg);
    border-bottom: 1px solid var(--nx-border);
    white-space: nowrap;
}
.tut-table td {
    padding: 11px 13px;
    border-bottom: 1px solid #f1f3f6;
    color: var(--nx-text);
    vertical-align: top;
    line-height: 1.45;
}
.tut-table tbody tr:last-child td { border-bottom: none; }
.tut-table tbody tr:hover { background: #fafbfc; }
.tut-table td strong { color: var(--nx-ink); font-weight: 600; }
.tut-pillbadge {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    white-space: nowrap;
}
.tut-pillbadge--low  { background: #dcfce7; color: #15803d; }
.tut-pillbadge--med  { background: #fef9c3; color: #a16207; }
.tut-pillbadge--high { background: #fee2e2; color: #b91c1c; }

/* ===================== FAQ accordion (native <details>) ===================== */
.tut-faq details {
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    background: #fff;
    margin-bottom: 10px;
    overflow: hidden;
}
.tut-faq details[open] { border-color: #bfdbfe; }
.tut-faq summary {
    cursor: pointer;
    padding: 13px 16px;
    font-weight: 600;
    color: var(--nx-ink);
    font-size: 0.9rem;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tut-faq summary::-webkit-details-marker { display: none; }
.tut-faq summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.68rem;
    color: #9ca3af;
    transition: transform .2s;
    flex-shrink: 0;
}
.tut-faq details[open] summary::after { transform: rotate(180deg); color: var(--nx-blue); }
.tut-faq__a {
    padding: 0 16px 14px;
    color: var(--nx-text);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ===================== Responsive ===================== */
@media (max-width: 640px) {
    .tut-step { padding-left: 40px; }
    .tut-mock { max-width: 100%; }
    .tut-hero__inner { gap: 0; }
}
