/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background-color 0.3s, color 0.3s;
}

.hidden {
    display: none !important;
}

/* ===== Theme Variables ===== */
[data-theme="dark"] {
    --bg-primary: #0b0e14;
    --bg-secondary: #131720;
    --bg-card: #1a1f2e;
    --bg-card-hover: #212738;
    --bg-input: #161b28;
    --text-primary: #e2e8f0;
    --text-secondary: #8892a4;
    --text-muted: #5a6478;
    --accent: #6c8eef;
    --accent-hover: #8aa4f4;
    --accent-subtle: rgba(108, 142, 239, 0.12);
    --profit: #34d399;
    --profit-bg: rgba(52, 211, 153, 0.1);
    --loss: #f87171;
    --loss-bg: rgba(248, 113, 113, 0.1);
    --warning: #fbbf24;
    --border: #1f2637;
    --border-light: #2a3148;
    --shadow: rgba(0, 0, 0, 0.4);
    --chart-grid: rgba(255, 255, 255, 0.05);
    --chart-zero: rgba(255, 255, 255, 0.25);
    --scrollbar-track: #131720;
    --scrollbar-thumb: #2a3148;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #4f72d4;
    --accent-hover: #3b5ec2;
    --accent-subtle: rgba(79, 114, 212, 0.08);
    --profit: #16a34a;
    --profit-bg: rgba(22, 163, 74, 0.08);
    --loss: #dc2626;
    --loss-bg: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: rgba(0, 0, 0, 0.08);
    --chart-grid: rgba(0, 0, 0, 0.06);
    --chart-zero: rgba(0, 0, 0, 0.2);
    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 1.25rem;
}

.btn-icon:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.btn-secondary {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

/* ===== Add FinansOmega Logo Styles ===== */
.navbar-brand {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.navbar-brand:hover {
    opacity: 0.85;
}

.navbar-brand .brand-omega {
    color: #00A0DF;
}

.navbar-brand .brand-sub {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.58rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-left: 1px solid var(--border);
    padding-left: 0.5rem;
    margin-left: 0.6rem;
    align-self: center;
    padding-top: 2px;
    line-height: 1.3;
}

/* === Navbar Controls === */
.navbar-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* === Metallic Toggle Section === */
.toggle-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    user-select: none;
    transition: color 0.3s;
}

.toggle-active-tr {
    color: #10b981;
}

.toggle-active-en {
    color: #60a5fa;
}

.toggle-inactive {
    color: var(--text-muted);
}

.icon-sun {
    color: #fbbf24;
    transition: color 0.3s;
}

.icon-moon {
    color: #818cf8;
    transition: color 0.3s;
}

.icon-gray {
    color: var(--text-muted);
    transition: color 0.3s;
}

/* === Metallic Switch === */
.metallic-switch {
    cursor: pointer;
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 9999px;
    padding: 2px;
    transition: all 300ms;
    user-select: none;
    background: linear-gradient(180deg, #e0e0e0 0%, #888 100%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
    border: none;
    outline: none;
}

.metallic-switch-inner {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    position: relative;
    overflow: hidden;
    background-color: #1a1a1a;
    background-image:
        radial-gradient(circle at center, #333 1px, transparent 1.5px),
        radial-gradient(circle at center, #333 1px, transparent 1.5px);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 1), inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.metallic-switch-knob {
    position: absolute;
    /* switch inner height = 28-4=24px, knob = 22px → top=(24-22)/2=1px */
    top: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    transition: transform 300ms cubic-bezier(0.4, 0.0, 0.2, 1);
    background: conic-gradient(from 180deg at 50% 50%,
            #C4C4C4 0deg, #F0F0F0 72deg, #A8A8A8 144deg,
            #D6D6D6 216deg, #F5F5F5 288deg, #C4C4C4 360deg);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 1),
        inset 0 -1px 1px rgba(0, 0, 0, 0.3),
        2px 0 5px rgba(0, 0, 0, 0.5);
}

.metallic-switch-knob.off {
    transform: translateX(2px);
}

.metallic-switch-knob.on {
    transform: translateX(26px);
}

/* ===== Layout ===== */
.app-container {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 270px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 0;
    z-index: 50;
    transition: transform 0.25s ease;
}

.sidebar-search {
    padding: 0 14px 12px;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

.nav-category {
    margin-bottom: 4px;
}

.nav-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.nav-category-header:hover {
    color: var(--text-secondary);
}

.nav-category-header .arrow {
    font-size: 0.6rem;
    transition: transform 0.2s;
    margin-left: auto;
}

.nav-category.collapsed .arrow {
    transform: rotate(-90deg);
}

.nav-category.collapsed .nav-items {
    display: none;
}

.nav-items {
    padding: 2px 0;
}

.nav-item {
    display: block;
    width: 100%;
    padding: 7px 14px 7px 28px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.87rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.12s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-subtle);
    border-left-color: var(--accent);
    font-weight: 500;
}

.nav-item.hidden {
    display: none;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 270px;
    padding: 28px 32px 60px;
    max-width: 960px;
}

.content-section {
    margin-bottom: 28px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ===== Strategy Header ===== */
.strategy-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.strategy-title-row h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-bullish {
    background: var(--profit-bg);
    color: var(--profit);
}

.badge-bearish {
    background: var(--loss-bg);
    color: var(--loss);
}

.badge-neutral {
    background: var(--accent-subtle);
    color: var(--accent);
}

.badge-beginner {
    background: var(--profit-bg);
    color: var(--profit);
}

.badge-intermediate {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
}

.badge-advanced {
    background: var(--loss-bg);
    color: var(--loss);
}

.description-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 12px;
}

.when-to-use {
    padding: 12px 16px;
    background: var(--accent-subtle);
    border-radius: 10px;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.when-to-use strong {
    color: var(--text-primary);
}

/* ===== Chart ===== */
.chart-container {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

/* ===== Parameter Controls ===== */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.control-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.control-value {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 4px var(--shadow);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    box-shadow: 0 1px 4px var(--shadow);
    cursor: pointer;
}

/* ===== Metrics Grid ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.metric-value.profit {
    color: var(--profit);
}

.metric-value.loss {
    color: var(--loss);
}

.metric-value.neutral {
    color: var(--accent);
}

/* ===== Greeks Grid ===== */
.greeks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.greek-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}

.greek-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.greek-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.greek-explanation {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Risk Grid ===== */
.risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.risk-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.risk-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.risk-value {
    font-size: 0.82rem;
    font-weight: 600;
}

.risk-value.positive {
    color: var(--profit);
}

.risk-value.negative {
    color: var(--loss);
}

.risk-value.neutral {
    color: var(--warning);
}

/* ===== Example Card ===== */
.example-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.example-scenario {
    font-size: 0.92rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.example-outcomes {
    width: 100%;
}

.example-outcome {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.87rem;
}

.example-outcome:last-child {
    border-bottom: none;
}

.outcome-label {
    min-width: 160px;
    font-weight: 600;
    color: var(--text-primary);
}

.outcome-result {
    color: var(--text-secondary);
}

.outcome-result.profit-text {
    color: var(--profit);
}

.outcome-result.loss-text {
    color: var(--loss);
}

.example-breakeven {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.87rem;
    color: var(--text-secondary);
}

.example-breakeven strong {
    color: var(--warning);
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    font-size: 1.5rem;
}

#glossary-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    margin-bottom: 16px;
}

#glossary-search:focus {
    border-color: var(--accent);
}

#glossary-search::placeholder {
    color: var(--text-muted);
}

.glossary-list {
    overflow-y: auto;
    flex: 1;
}

.glossary-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.glossary-item:last-child {
    border-bottom: none;
}

.glossary-term-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.glossary-term-def {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Tooltip ===== */
.tooltip {
    position: fixed;
    z-index: 300;
    max-width: 280px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    pointer-events: none;
}

.tooltip.hidden {
    display: none;
}

.glossary-highlight {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: help;
}

/* ===== Glossary Side Panel Overrides ===== */
#glossary-modal {
    padding: 0;
    justify-content: flex-end;
    pointer-events: none;
    /* Let clicks pass through to main page */
}

#glossary-modal .modal-backdrop {
    display: none;
    /* Hide backdrop so main page is visible and clickable */
}

#glossary-modal .modal-content {
    pointer-events: auto;
    /* Re-enable clicks on the panel itself */
    height: 100vh;
    max-height: 100vh;
    max-width: 450px;
    border-radius: 24px 0 0 24px;
    border: none;
    border-left: 1px solid var(--border);
    animation: slideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* ===== Sidebar Overlay (mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.5);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 24px 20px 60px;
    }
}

@media (max-width: 768px) {
    .app-title {
        font-size: 1rem;
    }

    .main-content {
        padding: 16px 14px 60px;
    }

    .strategy-title-row h2 {
        font-size: 1.3rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .greeks-grid {
        grid-template-columns: 1fr;
    }

    .risk-grid {
        grid-template-columns: 1fr;
    }

    .example-outcome {
        flex-direction: column;
        gap: 4px;
    }

    .outcome-label {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .header-right .btn-secondary {
        display: none;
    }

    .navbar-brand .brand-sub {
        display: none;
    }

    .toggle-section {
        transform: scale(0.9);
    }
}

/* ===== Training Module ===== */

/* Overlay — kept for JS compat, always hidden */
.training-overlay {
    display: none !important;
}

/* ── Full-Page Training ─────────────────────────────────── */
.training-panel {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 300;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.training-panel.open {
    transform: translateY(0);
}

/* Page Header */
.training-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.training-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.training-back-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.training-strategy-name {
    flex: 1;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.training-progress-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Progress Bar */
.training-progress-bar {
    height: 3px;
    background: var(--border);
    flex-shrink: 0;
}

.training-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* Step Dots */
.training-step-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px 0;
    flex-shrink: 0;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-light);
    transition: all 0.2s;
    flex-shrink: 0;
}

.step-dot.done {
    background: var(--accent);
    opacity: 0.4;
}

.step-dot.active {
    background: var(--accent);
    width: 20px;
    border-radius: 4px;
}

/* Scrollable Content Area — centered column */
.training-step-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px max(24px, calc((100% - 720px) / 2));
    scrollbar-width: thin;
}

/* Step Badge */
.training-step-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}

/* Step Title */
.training-step-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

/* Body Text */
.training-body {
    font-size: 0.93rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 18px;
}

/* Key Points List */
.training-key-points {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.training-key-points li {
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 8px 12px 8px 32px;
    background: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    position: relative;
    line-height: 1.4;
}

.training-key-points li::before {
    content: '✦';
    position: absolute;
    left: 10px;
    color: var(--accent);
    font-size: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Structure: Leg Diagram */
.training-legs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.training-leg {
    display: grid;
    grid-template-columns: 64px 64px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.83rem;
}

.training-leg.leg-buy {
    background: var(--profit-bg);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.training-leg.leg-sell {
    background: var(--loss-bg);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.training-leg.leg-own {
    background: var(--accent-subtle);
    border: 1px solid rgba(108, 142, 239, 0.2);
}

.leg-action {
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.leg-buy .leg-action {
    color: var(--profit);
}

.leg-sell .leg-action {
    color: var(--loss);
}

.leg-own .leg-action {
    color: var(--accent);
}

.leg-type {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.leg-note {
    color: var(--text-secondary);
    font-size: 0.79rem;
    line-height: 1.3;
}

/* Note Box */
.training-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    line-height: 1.5;
}

/* Interactive Step — Exercise Cards */
.training-exercises {
    margin-top: 20px;
}

.exercises-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 10px;
}

.exercise-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.exercise-card:last-child {
    margin-bottom: 0;
}

.exercise-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.exercise-card p {
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.65;
    margin: 0;
    padding-top: 2px;
}

.training-hint {
    font-size: 0.79rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Worked Example Box */
.training-example-box {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 14px;
}

.training-example-header {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.training-example-scenario {
    font-size: 0.84rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    font-weight: 500;
    line-height: 1.5;
}

.training-outcomes {
    margin: 0;
    padding-left: 16px;
}

.training-outcomes li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    line-height: 1.5;
}

.training-outcomes li:last-child {
    margin-bottom: 0;
}

/* Quiz */
.quiz-score-banner {
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    color: var(--accent);
}

.quiz-question {
    margin-bottom: 20px;
}

.quiz-question.unanswered {
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.quiz-q-text {
    font-size: 0.87rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.45;
    font-weight: 600;
}

.quiz-q-num {
    color: var(--accent);
    margin-right: 4px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    color: var(--text-secondary);
    font-size: 0.83rem;
    line-height: 1.35;
}

.quiz-option:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

.quiz-option.selected {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--text-primary);
}

.quiz-option.correct {
    background: var(--profit-bg);
    border-color: var(--profit);
    color: var(--text-primary);
}

.quiz-option.wrong {
    background: var(--loss-bg);
    border-color: var(--loss);
    color: var(--text-secondary);
    text-decoration: line-through;
}

.option-letter {
    font-weight: 800;
    font-size: 0.75rem;
    color: var(--accent);
    flex-shrink: 0;
    width: 16px;
    padding-top: 1px;
}

.quiz-option.correct .option-letter {
    color: var(--profit);
}

.quiz-option.wrong .option-letter {
    color: var(--loss);
}

.option-text {
    flex: 1;
}

.quiz-explanation {
    margin-top: 10px;
    font-size: 0.81rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    line-height: 1.5;
}

/* Summary */
.training-takeaways {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.training-takeaways li {
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid var(--profit);
    line-height: 1.4;
}

.training-completed-badge {
    text-align: center;
    padding: 10px;
    color: var(--profit);
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid var(--profit);
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--profit-bg);
}

.training-next-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.training-next-row span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.btn-next-strategy {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-next-strategy:hover {
    background: var(--accent);
    color: #fff;
}

/* Page Footer / Navigation */
.training-page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px max(24px, calc((100% - 720px) / 2));
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

#training-prev,
#training-next {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid var(--border);
}

#training-prev {
    background: var(--bg-card);
    color: var(--text-secondary);
}

#training-prev:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

#training-next {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

#training-next:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Learn Button (in strategy header) */
.strategy-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-learn {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    margin-left: auto;
}

.btn-learn:hover {
    background: var(--accent);
    color: #fff;
}

/* Sidebar progress badge */
.nav-item {
    position: relative;
}

.progress-badge {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--profit);
    background: var(--profit-bg);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .training-page-header {
        padding: 10px 14px;
    }

    .training-back-btn span {
        display: none;
    }

    .training-step-content {
        padding: 20px 16px;
    }

    .training-page-footer {
        padding: 12px 16px;
    }

    .btn-learn {
        margin-left: 0;
    }
}

/* ── Training Calculator ───────────────────────────────────── */
.training-calculator {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Scenario buttons */
.calc-scenarios {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.calc-scenario-btn {
    flex: 1;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    padding: 12px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color 0.18s, background 0.18s, color 0.18s, transform 0.12s;
}

.calc-scenario-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.calc-scenario-btn.active {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.scenario-label {
    font-size: 0.87rem;
    font-weight: 600;
    white-space: nowrap;
}

.scenario-price {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(108, 142, 239, 0.12);
    padding: 2px 8px;
    border-radius: 20px;
}

.calc-scenario-btn.active .scenario-price {
    background: rgba(108, 142, 239, 0.25);
}

/* Price display */
.calc-price-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.calc-price-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.calc-price-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    min-width: 90px;
    text-align: right;
}

/* Slider */
.calc-slider-section {
    margin-bottom: 16px;
}

.training-price-slider {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
    height: 6px;
    margin-bottom: 4px;
}

.calc-slider-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.71rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Result card */
.calc-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.22s, color 0.22s, border-color 0.22s;
    border: 1px solid transparent;
}

.calc-result.pnl-profit {
    background: var(--profit-bg);
    border-color: var(--profit);
    color: var(--profit);
}

.calc-result.pnl-loss {
    background: var(--loss-bg);
    border-color: var(--loss);
    color: var(--loss);
}

.calc-result-label {
    font-size: 0.82rem;
    opacity: 0.9;
    font-weight: 500;
}

.calc-result-value {
    font-size: 1.4rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}