/* ============================================
   OPENING TREE PAGE — CYBER AESTHETIC
   ============================================ */

/* ── Base ── */
.openings-page {
    background: #0a0a0f;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    padding-top: 60px;
}

/* ── Ambient BG ── */
.op-ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 204, 255, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 102, 204, 0.04) 0%, transparent 55%);
}

/* ============================================
   HERO
   ============================================ */
.op-hero {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    position: relative;
    z-index: 2;
}

.op-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 22px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #00CCFF;
    background: rgba(0, 204, 255, 0.08);
    border: 1px solid rgba(0, 204, 255, 0.25);
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
    animation: fadeInDown 0.8s ease-out;
}

.op-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out;
}

.op-title .highlight {
    background: linear-gradient(135deg, #00CCFF 0%, #FF66CC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.op-subtitle {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
    animation: fadeInUp 0.8s ease-out 0.15s both;
}

/* ============================================
   IMPORT PANEL
   ============================================ */
.op-import-section {
    max-width: 700px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 2;
}

.op-import-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.op-import-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(0, 204, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
}

.op-import-header i {
    font-size: 0.9rem;
}

/* Platform buttons */
.op-platform-select {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.op-platform-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.op-platform-btn img {
    border-radius: 4px;
}

.op-platform-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.op-platform-btn.active[data-platform="chesscom"] {
    color: #81b64c;
    border-color: rgba(129, 182, 76, 0.4);
    background: rgba(129, 182, 76, 0.08);
    box-shadow: 0 0 20px rgba(129, 182, 76, 0.12);
}

.op-platform-btn.active[data-platform="lichess"] {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
}

/* Input row */
.op-input-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Color Filter ── */
.op-color-filter {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 4px;
}

.op-color-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.op-color-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

.op-color-btn.active {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.35);
    color: #c084fc;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.15);
}

.op-color-btn.active[data-color="white"] {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #e2e8f0;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
}

.op-color-btn.active[data-color="black"] {
    background: rgba(30, 30, 60, 0.4);
    border-color: rgba(100, 116, 139, 0.35);
    color: #94a3b8;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.2);
}

.op-king-white {
    color: #fff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.op-king-black {
    color: #1a1a2e;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    font-size: 0.9rem;
    -webkit-text-stroke: 0.5px #64748b;
}

.op-input-wrap {
    flex: 1;
    position: relative;
}

.op-input-wrap i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 0.85rem;
    pointer-events: none;
}

[dir="ltr"] .op-input-wrap i {
    right: auto;
    left: 14px;
}

.op-input-wrap input {
    width: 100%;
    padding: 14px 42px 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: #e2e8f0;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.op-input-wrap input::placeholder {
    color: #4a5568;
}

.op-input-wrap input:focus {
    border-color: rgba(0, 204, 255, 0.3);
    background: rgba(0, 204, 255, 0.04);
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.08);
}

/* Fetch button */
.op-fetch-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00CCFF, #0088CC);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.25);
}

.op-fetch-btn:hover {
    box-shadow: 0 0 35px rgba(0, 204, 255, 0.4);
    transform: translateY(-2px);
}

.op-fetch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.op-fetch-btn .fetch-text i {
    margin-left: 6px;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress bar */
.op-progress {
    margin-top: 16px;
}

.op-progress-track {
    height: 7px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.op-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #c084fc);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.5), 0 0 30px rgba(168, 85, 247, 0.2);
    animation: progressGlow 1.5s ease-in-out infinite;
    position: relative;
}

/* .op-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
} */

@keyframes progressGlow {

    0%,
    100% {
        box-shadow: 0 0 14px rgba(168, 85, 247, 0.5), 0 0 30px rgba(168, 85, 247, 0.2);
    }

    50% {
        box-shadow: 0 0 22px rgba(168, 85, 247, 0.7), 0 0 45px rgba(168, 85, 247, 0.35);
    }
}

@keyframes progressShimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.op-progress-text {
    font-size: 0.78rem;
    color: #c084fc;
    margin-top: 8px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Analysis Summary Banner */
.op-analysis-summary {
    background: rgba(168, 85, 247, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 14px;
    padding: 16px 24px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    color: #e2e8f0;
    font-weight: 600;
    animation: fadeInUp 0.5s ease-out;
}

.op-analysis-summary i {
    font-size: 1.1rem;
    color: #a855f7;
}

.op-analysis-summary .summary-count {
    color: #c084fc;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
}

/* Show More button in tree */
.op-tree-showmore {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    margin: 6px 0 6px 20px;
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.06);
    color: #a855f7;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.op-tree-showmore:hover {
    background: rgba(168, 85, 247, 0.12);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.15);
}

/* Error */
.op-error {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   RESULTS SECTION
   ============================================ */
.op-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
    position: relative;
    z-index: 2;
}

/* Stats overview cards */
.op-stats-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 3rem;
}

.op-stat-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.op-stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 204, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.op-stat-card.win {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.1);
}
.op-stat-card.win:hover {
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}
.op-stat-card.draw {
    border-color: rgba(100, 116, 139, 0.3);
}
.op-stat-card.draw:hover {
    border-color: rgba(100, 116, 139, 0.5);
}
.op-stat-card.loss {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}
.op-stat-card.loss:hover {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.op-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    transition: all 0.3s ease;
}

.op-stat-card.win .op-stat-icon {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.op-stat-card.draw .op-stat-icon {
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.op-stat-card.loss .op-stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.op-stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 4px;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-fraction {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.op-stat-label {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
}

/* Section headers */
.op-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(0, 204, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
}

/* ============================================
   BOARD EXPLORER
   ============================================ */
.op-explorer {
    display: flex;
    gap: 20px;
    margin-bottom: 3rem;
    min-height: 420px;
}

.op-path-panel {
    width: 280px;
    min-width: 280px;
    max-height: 540px;
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.op-path-toolbar {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.op-path-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.op-path-nav-btn:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

.op-path-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.op-path-list::-webkit-scrollbar {
    width: 4px;
}

.op-path-list::-webkit-scrollbar-track {
    background: transparent;
}

.op-path-list::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 2px;
}

.op-path-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 16px;
    text-align: center;
    color: #4a5568;
    font-size: 0.82rem;
}

.op-path-empty i {
    font-size: 1.6rem;
    opacity: 0.4;
}

.op-path-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(168, 85, 247, 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 4px 8px 6px;
}

.op-path-move {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin: 2px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.82rem;
}

.op-path-move::before {
    content: '';
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.3), rgba(168, 85, 247, 0.1));
    border-radius: 1px;
}

[dir="ltr"] .op-path-move::before {
    right: auto;
    left: -2px;
}

.op-path-move:hover {
    background: rgba(255, 255, 255, 0.04);
}

.op-path-move.active {
    background: rgba(168, 85, 247, 0.1);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.12);
}

.op-path-move.active::before {
    background: rgba(168, 85, 247, 0.7);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.op-path-move-num {
    color: #4a5568;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 22px;
    font-family: 'Montserrat', sans-serif;
}

.op-path-move-san {
    font-weight: 700;
    color: #e2e8f0;
    font-family: 'Montserrat', monospace;
}

.op-path-move-pct {
    margin-right: auto;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

[dir="ltr"] .op-path-move-pct {
    margin-right: 0;
    margin-left: auto;
}

.op-path-move-pct.good {
    color: #22c55e;
}

.op-path-move-pct.neutral {
    color: #94a3b8;
}

.op-path-move-pct.bad {
    color: #ef4444;
}

.op-path-move.wr-good {
    background: rgba(34, 197, 94, 0.05);
    border-right: 2px solid rgba(34, 197, 94, 0.2);
}

.op-path-move.wr-bad {
    background: rgba(239, 68, 68, 0.05);
    border-right: 2px solid rgba(239, 68, 68, 0.2);
}

[dir="ltr"] .op-path-move.wr-good {
    border-right: none;
    border-left: 2px solid rgba(34, 197, 94, 0.2);
}

[dir="ltr"] .op-path-move.wr-bad {
    border-right: none;
    border-left: 2px solid rgba(239, 68, 68, 0.2);
}

.op-path-branch-title {
    font-size: 0.65rem;
    color: #4a5568;
    padding: 6px 10px 4px;
    font-weight: 600;
}

.op-path-branch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 20px;
    margin: 1px 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    color: #94a3b8;
    transition: all 0.2s ease;
}

[dir="rtl"] .op-path-branch {
    padding: 5px 20px 5px 10px;
}

.op-path-branch:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

.op-path-branch-san {
    font-weight: 700;
    font-family: 'Montserrat', monospace;
}

.op-path-branch-count {
    font-size: 0.68rem;
    color: #4a5568;
}

.op-path-branch-pct {
    margin-right: auto;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

[dir="ltr"] .op-path-branch-pct {
    margin-right: 0;
    margin-left: auto;
}

.op-board-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.op-board-wrap {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(168, 85, 247, 0.2);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.08), 0 8px 40px rgba(0, 0, 0, 0.3);
}

.op-board-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.op-board-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 600;
}

.op-board-info-left i {
    color: #a855f7;
}

.op-board-info-right {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.op-board-info-right .win-tag {
    color: #22c55e;
}

.op-board-info-right .draw-tag {
    color: #64748b;
}

.op-board-info-right .loss-tag {
    color: #ef4444;
}

/* Timeline Slider */
.op-timeline {
    margin-top: 8px;
    padding: 8px 14px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.op-timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: #475569;
    font-family: 'Tajawal', sans-serif;
    margin-bottom: 4px;
}

.op-timeline-slider-wrap {
    position: relative;
    padding: 10px 0;
}

.op-timeline-tooltip {
    position: absolute;
    top: -20px;
    left: 0;
    transform: translateX(-50%);
    background: rgba(168, 85, 247, 0.95);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, left 0.1s linear;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.op-timeline-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px 4px 0;
    border-style: solid;
    border-color: rgba(168, 85, 247, 0.95) transparent transparent transparent;
}

.op-timeline-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg,
            rgba(168, 85, 247, 0.4) 0%,
            rgba(168, 85, 247, 0.25) 33%,
            rgba(100, 116, 139, 0.2) 66%,
            rgba(239, 68, 68, 0.2) 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

[dir="rtl"] .op-timeline-slider {
    background: linear-gradient(-90deg,
            rgba(168, 85, 247, 0.4) 0%,
            rgba(168, 85, 247, 0.25) 33%,
            rgba(100, 116, 139, 0.2) 66%,
            rgba(239, 68, 68, 0.2) 100%);
}

.op-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #a855f7;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.op-timeline-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.7);
}

.op-timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #a855f7;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
    cursor: pointer;
}

.op-timeline-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #64748b;
    font-family: 'Montserrat', sans-serif;
    margin-top: 4px;
}

/* Statistical Arrows — Monochromatic Green Heatmap */
.cm-chessboard .arrow-green-1 .arrow-head {
    fill: #15803d;
    fill-rule: nonzero;
}

.cm-chessboard .arrow-green-1 .arrow-line {
    stroke: #15803d;
    stroke-linecap: round;
    opacity: 0.55;
    stroke-width: 16px !important;
    filter: drop-shadow(0 0 6px rgba(21, 128, 61, 0.6));
}

.cm-chessboard .arrow-green-2 .arrow-head {
    fill: #22c55e;
    fill-rule: nonzero;
}

.cm-chessboard .arrow-green-2 .arrow-line {
    stroke: #22c55e;
    stroke-linecap: round;
    opacity: 0.42;
    stroke-width: 12px !important;
    filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.4));
}

.cm-chessboard .arrow-green-3 .arrow-head {
    fill: #4ade80;
    fill-rule: nonzero;
}

.cm-chessboard .arrow-green-3 .arrow-line {
    stroke: #4ade80;
    stroke-linecap: round;
    opacity: 0.32;
    stroke-width: 9px !important;
}

.cm-chessboard .arrow-green-4 .arrow-head {
    fill: #86efac;
    fill-rule: nonzero;
}

.cm-chessboard .arrow-green-4 .arrow-line {
    stroke: #86efac;
    stroke-linecap: round;
    opacity: 0.22;
    stroke-width: 7px !important;
}

.cm-chessboard .arrow-green-5 .arrow-head {
    fill: #bbf7d0;
    fill-rule: nonzero;
}

.cm-chessboard .arrow-green-5 .arrow-line {
    stroke: #bbf7d0;
    stroke-linecap: round;
    opacity: 0.15;
    stroke-width: 5px !important;
}

/* Keyboard focus indicator */
.op-path-branch.kb-focused {
    background: rgba(168, 85, 247, 0.12);
    outline: 1px solid rgba(168, 85, 247, 0.4);
    color: #e2e8f0;
}

/* Game reference links */
.op-path-game-refs {
    padding: 2px 10px 6px 20px;
}

[dir="rtl"] .op-path-game-refs {
    padding: 2px 20px 6px 10px;
}

.op-path-game-ref {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 0.68rem;
    color: #64748b;
}

.op-path-game-ref a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

.op-path-game-ref a:hover {
    color: #c084fc;
    text-decoration: underline;
}

.op-path-game-ref .ref-result {
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.65rem;
}

.op-path-game-ref .ref-result.win {
    color: #22c55e;
}

.op-path-game-ref .ref-result.loss {
    color: #ef4444;
}

.op-path-game-ref .ref-result.draw {
    color: #64748b;
}

/* Settings button */
.op-path-settings-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: auto;
}

[dir="ltr"] .op-path-settings-btn {
    margin-right: 0;
    margin-left: auto;
}

.op-path-settings-btn:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.3);
    color: #c084fc;
    transform: rotate(60deg);
}

/* ============================================
   PERFORMANCE DASHBOARD
   ============================================ */
.op-perf-dashboard {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    margin-top: 24px;
    overflow: hidden;
}

.op-perf-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    font-family: 'Tajawal', sans-serif;
}

.op-perf-header i {
    color: #a855f7;
    font-size: 0.85rem;
}

.op-perf-grid {
    padding: 8px 12px 12px;
}

.op-perf-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 4px;
}

.op-perf-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.op-perf-cell:hover {
    background: rgba(255, 255, 255, 0.03);
}

.op-perf-label {
    font-size: 0.68rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Montserrat', sans-serif;
}

.op-perf-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: #cbd5e1;
    font-family: 'Montserrat', sans-serif;
}

.op-perf-highlight {
    font-size: 1.15rem;
    font-weight: 800;
    color: #e2e8f0;
}

.op-perf-highlight.neon-glow {
    color: #22c55e;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.5), 0 0 20px rgba(34, 197, 94, 0.2);
}

.op-perf-value .win-tag {
    color: #22c55e;
    font-weight: 700;
}

.op-perf-value .draw-tag {
    color: #64748b;
    font-weight: 600;
}

.op-perf-value .loss-tag {
    color: #ef4444;
    font-weight: 700;
}

.op-perf-value a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.82rem;
}

.op-perf-value a:hover {
    color: #c084fc;
    text-decoration: underline;
}

.op-perf-value a i {
    font-size: 0.6rem;
    margin-inline-start: 4px;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .op-perf-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   OPENING TREE
   ============================================ */
.op-tree-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 3rem;
    min-height: 300px;
}

.op-tree-controls {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.op-tree-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.op-tree-controls input[type="range"] {
    width: 100px;
    accent-color: #00CCFF;
}

/* Hide Depth Control */
.op-tree-controls label:first-child {
    display: none;
}

/* Tree node */
.op-tree-node {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.op-tree-node:last-child {
    border-bottom: none;
}

.op-tree-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.op-tree-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.op-tree-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.op-tree-toggle {
    width: 16px;
    color: #64748b;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.op-tree-node.expanded > .op-tree-row .op-tree-toggle {
    transform: rotate(90deg);
    color: #a855f7;
}

.op-tree-move-badge {
    font-weight: 700;
    color: #e2e8f0;
    font-family: 'Montserrat', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    direction: ltr; /* Fix Arabic text issue */
    display: inline-block;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.op-tree-name {
    color: #94a3b8;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.op-tree-stats-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
    text-align: right;
}

[dir="ltr"] .op-tree-stats-area {
    text-align: left;
}

.op-tree-stats-text {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

[dir="ltr"] .op-tree-stats-text {
    justify-content: flex-start;
}

.op-tree-bar {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    display: flex;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.op-tree-bar-win {
    background: #22c55e;
    height: 100%;
}

.op-tree-bar-draw {
    background: #64748b;
    height: 100%;
}

.op-tree-bar-loss {
    background: #ef4444;
    height: 100%;
}

.op-tree-count {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
}

.op-tree-pct {
    font-size: 0.85rem;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
}

.op-tree-pct.good {
    color: #22c55e;
}

.op-tree-pct.neutral {
    color: #94a3b8;
}

.op-tree-pct.bad {
    color: #ef4444;
}

.op-tree-children {
    padding-right: 20px;
    display: none;
}

[dir="ltr"] .op-tree-children {
    padding-right: 0;
    padding-left: 20px;
}

.op-tree-node.expanded>.op-tree-children {
    display: block;
}

/* ============================================
   CHARTS
   ============================================ */
.op-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 3rem;
}

.op-chart-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
}

.op-chart-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 14px;
}

.op-chart-card canvas {
    width: 100% !important;
    max-width: 340px;
    height: auto !important;
    margin: 0 auto;
    display: block;
}

/* ============================================
   SMART SUGGESTIONS
   ============================================ */
.op-suggestions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 2rem;
}

.op-suggestion-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.op-suggestion-card:hover {
    border-color: rgba(255, 102, 204, 0.2);
    box-shadow: 0 0 25px rgba(255, 102, 204, 0.08);
}

.op-suggestion-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
    background: rgba(255, 102, 204, 0.08);
    color: #FF66CC;
    border: 1px solid rgba(255, 102, 204, 0.2);
}

.op-suggestion-icon.success {
    background: rgba(34, 197, 94, 0.08);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.2);
}

.op-suggestion-body {
    flex: 1;
}

.op-suggestion-text {
    font-size: 0.9rem;
    color: #e2e8f0;
    line-height: 1.7;
    margin-bottom: 8px;
}

.op-suggestion-text strong {
    color: #FF66CC;
}

.op-suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid rgba(0, 204, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 204, 255, 0.08);
    color: #00CCFF;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.op-suggestion-btn:hover {
    background: rgba(0, 204, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.2);
}

/* ============================================
   ADVANCED ANALYTICS UI
   ============================================ */

/* Glass Cards */
.op-chart-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.op-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.op-chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 24px;
    font-family: 'Tajawal', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
}

.op-chart-title i {
    color: #a855f7;
    font-size: 1rem;
    filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.4));
}

/* SVG Donut Charts */
.op-donut-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.op-donut-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
    overflow: visible;
}

.op-donut-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 16;
}

.op-donut-segment {
    fill: none;
    stroke-width: 16;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease-out;
    transform-origin: center;
    cursor: pointer;
}

.op-donut-segment:hover {
    transform: scale(1.05);
}

/* Donut Colors & Glows */
.op-donut-segment.win {
    stroke: #22c55e;
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.6));
}

.op-donut-segment.loss {
    stroke: #ef4444;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
}

.op-donut-segment.draw {
    stroke: #64748b;
    filter: drop-shadow(0 0 6px rgba(100, 116, 139, 0.4));
}

.op-donut-segment.bullet {
    stroke: #eab308;
    filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.6));
}

.op-donut-segment.blitz {
    stroke: #f97316;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.6));
}

.op-donut-segment.rapid {
    stroke: #22c55e;
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.6));
}

.op-donut-segment.classical {
    stroke: #3b82f6;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6));
}

.op-donut-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.op-donut-val {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.3);
    line-height: 1;
}

.op-donut-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
    font-family: 'Tajawal', sans-serif;
}

.op-donut-legend {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.op-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #cbd5e1;
    font-family: 'Tajawal', sans-serif;
}

.op-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.op-legend-dot.win {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.op-legend-dot.loss {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.op-legend-dot.draw {
    background: #64748b;
}

.op-legend-dot.bullet {
    background: #eab308;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.5);
}

.op-legend-dot.blitz {
    background: #f97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.5);
}

.op-legend-dot.rapid {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.op-legend-dot.classical {
    background: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

/* Horizontal Progress Bars */
.op-bars-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.op-progress-row {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

/* Stats on the Left */
.op-progress-stats-left {
    width: 85px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
    line-height: 1.2;
}

[dir="rtl"] .op-progress-stats-left {
    align-items: flex-end; /* In RTL, numbers should align to the edge? Or keep standard? */
    text-align: left; /* Prompt says Left (Shamal) */
    align-items: flex-start;
}

.op-progress-pct {
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
}

.op-progress-count {
    font-size: 0.65rem;
    color: #64748b;
    font-family: 'Montserrat', sans-serif;
}

/* Bar in the Middle */
.op-progress-bar-wrap {
    flex: 1;
    height: 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 7px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.op-progress-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.op-progress-fill.win {
    background: linear-gradient(90deg, #16a34a, #4ade80);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.op-progress-fill.loss {
    background: linear-gradient(90deg, #dc2626, #f87171);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Name on the Right */
.op-progress-label-right {
    width: 140px;
    text-align: right;
    flex-shrink: 0;
}

[dir="ltr"] .op-progress-label-right {
    text-align: left;
    order: -1; /* Move name to left in English */
}

[dir="ltr"] .op-progress-stats-left {
    order: 1; /* Move stats to right in English */
    align-items: flex-end;
}

.op-progress-name {
    font-size: 0.8rem;
    color: #e2e8f0;
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

@keyframes fadeInPct {
    to {
        opacity: 1;
    }
}

/* Tooltip */
.op-chart-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 16px rgba(168, 85, 247, 0.15);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: 'Tajawal', sans-serif;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
}

.op-chart-tooltip.visible {
    opacity: 1;
}

/* ============================================
   FOOTER
   ============================================ */
.op-footer {
    background: #000;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 40px 0;
    position: relative;
    z-index: 2;
}

.op-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.op-footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.op-footer-links a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.op-footer-links a:hover {
    color: #00CCFF;
}

.op-footer-copy {
    color: #3f3f46;
    font-size: 0.85rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .op-stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .op-charts-grid {
        grid-template-columns: 1fr;
    }

    .op-explorer {
        flex-direction: column;
    }

    .op-path-panel {
        width: 100%;
        min-width: unset;
        max-height: 300px;
    }

    .op-board-wrap {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .op-hero {
        padding: 2rem 1rem 1.5rem;
    }

    .op-import-panel {
        padding: 20px;
    }

    .op-input-row {
        flex-direction: column;
    }

    .op-color-filter {
        width: 100%;
        justify-content: center;
    }

    .op-platform-select {
        flex-direction: column;
    }

    .op-stats-overview {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .op-tree-controls {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .op-title {
        font-size: 1.6rem;
    }

    .op-stats-overview {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   GEAR BUTTON — Premium Aura Style
   ============================================ */
.op-path-settings-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 10px;
    background: rgba(168, 85, 247, 0.08);
    color: #c084fc;
    font-size: 0.85rem;
    cursor: pointer;
    transition:
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.3s ease,
        box-shadow 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

.op-path-settings-btn:hover {
    transform: rotate(90deg);
    background: rgba(168, 85, 247, 0.15);
    color: #e9d5ff;
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow:
        0 0 18px rgba(168, 85, 247, 0.35),
        0 0 6px rgba(168, 85, 247, 0.2) inset;
}

.op-path-settings-btn:active {
    transform: rotate(90deg) scale(0.9);
}

.op-path-settings-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 13px;
    border: 1px solid rgba(168, 85, 247, 0);
    transition: border-color 0.3s ease;
    pointer-events: none;
}

.op-path-settings-btn:hover::before {
    border-color: rgba(168, 85, 247, 0.2);
}

/* ============================================
   SETTINGS MODAL — Fullscreen Overlay
   ============================================ */
.op-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.op-settings-overlay.active {
    opacity: 1;
    visibility: visible;
}

.op-settings-modal {
    width: 90%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(15, 18, 25, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 20px;
    padding: 0;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(168, 85, 247, 0.08);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.op-settings-overlay.active .op-settings-modal {
    transform: scale(1) translateY(0);
}

/* Scrollbar */
.op-settings-modal::-webkit-scrollbar {
    width: 5px;
}

.op-settings-modal::-webkit-scrollbar-track {
    background: transparent;
}

.op-settings-modal::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.25);
    border-radius: 3px;
}

/* Header */
.op-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.op-settings-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #e2e8f0;
}

.op-settings-title i {
    color: #a855f7;
    font-size: 1rem;
}

.op-settings-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #64748b;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.op-settings-close:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Section */
.op-settings-section {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.op-settings-section:last-child {
    border-bottom: none;
    padding-bottom: 24px;
}

.op-settings-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(168, 85, 247, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 14px;
}

.op-settings-section-title i {
    font-size: 0.75rem;
}

/* Toggle Switch */
.op-settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.op-settings-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.op-toggle-label {
    font-size: 0.88rem;
    color: #cbd5e1;
    font-weight: 500;
}

.op-toggle-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.op-toggle-switch.checked {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.op-toggle-knob {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.op-toggle-switch.checked .op-toggle-knob {
    transform: translateX(20px);
}

/* Piece Set Grid */
.op-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.op-settings-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.op-settings-option:hover {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.25);
    color: #c084fc;
}

.op-settings-option.active {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.45);
    color: #e9d5ff;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.15);
}

.op-settings-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.55rem;
    color: #a855f7;
}

[dir="ltr"] .op-settings-option.active::after {
    right: auto;
    left: 4px;
}

/* Theme Swatches */
.op-settings-themes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.op-theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.op-theme-swatch:hover {
    background: rgba(168, 85, 247, 0.06);
    border-color: rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

.op-theme-swatch.active {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.12);
}

.op-theme-preview {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.op-theme-swatch:hover .op-theme-preview {
    transform: scale(1.08);
}

.op-theme-swatch.active .op-theme-preview {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.op-theme-name {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    transition: color 0.2s ease;
}

.op-theme-swatch.active .op-theme-name {
    color: #c084fc;
}

.op-theme-swatch:hover .op-theme-name {
    color: #94a3b8;
}

/* ── Modal Responsive ── */
@media (max-width: 480px) {
    .op-settings-modal {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }

    .op-settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .op-settings-themes {
        grid-template-columns: repeat(2, 1fr);
    }

    .op-settings-section {
        padding: 14px 18px;
    }

    .op-settings-header {
        padding: 16px 18px 14px;
    }

    .op-settings-option {
        padding: 14px 10px;
        min-height: 48px;
    }
}

/* ── 3-Column Progress Bars ── */
.op-progress-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.op-progress-stats-left {
    min-width: 95px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

[dir="rtl"] .op-progress-stats-left {
    align-items: flex-end;
}

.op-progress-pct {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
}

.op-progress-count {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
}

.op-progress-bar-wrap {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.op-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.op-progress-fill.win {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.op-progress-fill.loss {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.op-progress-label-right {
    min-width: 140px;
    max-width: 200px;
}

.op-progress-name {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ── New Move Badge ── */
.op-new-move-badge {
    background: rgba(168, 85, 247, 0.15);
    color: #e2e8f0;
    border: 1px solid rgba(168, 85, 247, 0.4);
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
    animation: neonPulse 2s infinite alternate;
}

.op-new-move-badge i {
    color: #fbbf24; /* Golden star */
    font-size: 0.65rem;
}

@keyframes neonPulse {
    from {
        box-shadow: 0 0 8px rgba(168, 85, 247, 0.2);
        border-color: rgba(168, 85, 247, 0.4);
    }
    to {
        box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
        border-color: rgba(168, 85, 247, 0.6);
    }
}

/* ── Enhanced Stat Cards ── */
.op-stat-card.win {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}
.op-stat-card.draw {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}
.op-stat-card.loss {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

/* ── Dynamic Match Info Bar ── */
.op-match-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: -15px; /* Pull it slightly into the gap before timeline */
    margin-top: 15px;
    z-index: 5;
    position: relative;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.op-match-details {
    flex-grow: 1;
    text-align: center;
    font-size: 0.8rem;
    color: #cbd5e1;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
}

.op-match-details strong {
    color: #e2e8f0;
    font-weight: 700;
}

.op-match-result-win { color: #10b981; font-weight: 700; }
.op-match-result-loss { color: #ef4444; font-weight: 700; }
.op-match-result-draw { color: #94a3b8; font-weight: 700; }

.op-analyzer-bridge-btn {
    background: rgba(6, 182, 212, 0.15); /* Neon Cyan */
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.op-analyzer-bridge-btn:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: rgba(6, 182, 212, 0.6);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
    transform: translateY(-1px);
}

.op-analyzer-bridge-btn i {
    font-size: 0.85rem;
}

/* ── Player Color Badges ── */
.op-player-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

.op-player-white {
    background: #e2e8f0; /* Light gray / White */
    color: #0f172a; /* Dark almost black text */
    box-shadow: 0 0 8px rgba(226, 232, 240, 0.2);
}

.op-player-black {
    background: #0f172a; /* Deep black/navy */
    color: #f8fafc; /* White text */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.op-match-vs-text {
    margin: 0 8px;
    font-size: 0.7rem;
    color: #94a3b8;
}

.op-match-divider {
    margin: 0 10px;
    color: rgba(255, 255, 255, 0.15);
}
