/* ── Root & Page ─────────────────────────────────── */
.champion-detail-page {
    min-height: 100vh;
    --gold: #d4af37;
    --gold-light: rgba(212, 175, 55, .15);
    --card-bg: #111827;
    --card-border: rgba(255, 255, 255, .06);
    --text: #e5e7eb;
    --text-muted: #9ca3af;
}

/* ── Breadcrumb ───────────────────────────────────── */
.cd-breadcrumb {
    padding: 10px 0;
    background: rgba(0, 0, 0, .2);
    border-bottom: 1px solid var(--card-border);
    position: relative;
    z-index: 10;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
}

.breadcrumb-list a {
    color: var(--gold);
    text-decoration: none;
}

.breadcrumb-list span {
    color: var(--text-muted);
}

.breadcrumb-list .active {
    color: var(--text);
}

/* ── Hero Section ─────────────────────────────────── */
.cd-hero {
    background: linear-gradient(135deg, #0c111a 0%, #111827 60%, #0f1d2e 100%);
    border-bottom: 2px solid rgba(212, 175, 55, .25);
    padding: 28px 0 24px;
    position: relative;
    z-index: 20;
}

.cd-hero-inner {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.cd-hero-avatar {
    position: relative;
    flex-shrink: 0;
}

.cd-hero-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
    box-shadow: 0 0 24px rgba(212, 175, 55, .3);
}

.cd-tier-badge {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
    border: 2px solid rgba(0, 0, 0, .3);
}

.cd-hero-title {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.2;
}

.cd-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.cd-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.role-tag {
    background: rgba(99, 102, 241, .2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, .3);
}

.diff-tag {
    background: rgba(245, 158, 11, .15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, .3);
}

.damage-tag {
    background: rgba(139, 92, 246, .15);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, .3);
}

/* ── Stats Row ────────────────────────────────────── */
.cd-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.cd-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .3);
    min-width: 80px;
}

.cd-stat-box.win {
    border: 1px solid rgba(34, 197, 94, .3);
}

.cd-stat-box.pick {
    border: 1px solid rgba(212, 175, 55, .3);
}

.cd-stat-box.ban {
    border: 1px solid rgba(239, 68, 68, .3);
}

.cd-stat-box.skills-box {
    border: 1px solid rgba(212, 175, 55, .2);
    align-items: flex-start;
    padding: 8px 12px;
}

.cd-stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}

.cd-stat-box.win .cd-stat-value {
    color: #22c55e;
}

.cd-stat-box.pick .cd-stat-value {
    color: var(--gold);
}

.cd-stat-box.ban .cd-stat-value {
    color: #ef4444;
}

.cd-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.cd-skills-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.cd-skill-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, .3);
}

/* ── Sticky TOC Bar ───────────────────────────────── */
.cd-toc-bar {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(10, 13, 20, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 175, 55, .2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}

.cd-toc-scroll {
    display: flex;
    align-items: center;
    overflow-x: auto;
    gap: 0;
    padding: 0;
    scrollbar-width: none;
}

.cd-toc-scroll::-webkit-scrollbar {
    display: none;
}

.cd-toc-link {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all .2s ease;
}

.cd-toc-link:hover,
.cd-toc-link.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: var(--gold-light);
}

/* ── Main Layout ──────────────────────────────────── */
.cd-main-container {
    padding-top: 28px;
    padding-bottom: 40px;
}

.cd-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
}

/* ── Section Cards ────────────────────────────────── */
.cd-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 24px;
    scroll-margin-top: 60px;
    position: relative;
}

.cd-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1f2937, #374151);
    border-bottom: 2px solid rgba(212, 175, 55, .2);
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
}

.cd-section-icon {
    font-size: 20px;
}

.cd-section-title {
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    margin: 0 !important;
}

/* ── Guide Text ───────────────────────────────────── */
.cd-guide-text {
    padding: 20px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.8;
}

.cd-guide-text--sm {
    font-size: 13px;
    padding: 12px;
}

.cd-guide-text h2 {
    color: #fff;
    font-size: 20px;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid #374151;
    padding-bottom: 8px;
}

.cd-guide-text h3 {
    color: #f3f4f6;
    font-size: 17px;
    margin: 16px 0 8px;
}

.cd-guide-text strong {
    color: var(--gold);
}

.cd-guide-text ul,
.cd-guide-text ol {
    padding-left: 22px;
    margin: 10px 0;
}

.cd-guide-text li {
    margin-bottom: 6px;
}

.cd-guide-text p {
    margin-bottom: 12px;
}

.mt-4 {
    margin-top: 16px;
}

/* ── Strengths/Weaknesses ────────────────────────── */
.cd-strengths-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.cd-sw-card {
    padding: 16px 20px;
}

.cd-sw-card.strengths {
    border-right: 1px solid var(--card-border);
}

.cd-sw-header {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.cd-sw-card.strengths .cd-sw-header {
    color: #22c55e;
}

.cd-sw-card.weaknesses .cd-sw-header {
    color: #ef4444;
}

.cd-sw-card .cd-guide-text {
    padding: 0;
    font-size: 14px;
}

/* ── Matchup Grid ─────────────────────────────────── */
.cd-matchup-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
}

.cd-matchup-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--card-border);
    transition: all .2s;
    width: 80px;
}

.cd-matchup-item img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #333;
    transition: border-color .2s;
}

.cd-matchup-item span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.cd-matchup-item.counter-item:hover {
    border-color: rgba(239, 68, 68, .4);
}

.cd-matchup-item.counter-item:hover img {
    border-color: #ef4444;
}

.cd-matchup-item.teammate-item:hover {
    border-color: rgba(34, 197, 94, .4);
}

.cd-matchup-item.teammate-item:hover img {
    border-color: #22c55e;
}

/* ── Sidebar ──────────────────────────────────────── */
.cd-sidebar {
    position: sticky;
    top: 60px;
}

.cd-sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.cd-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    padding: 12px 16px;
    background: rgba(31, 41, 55, .8);
    border-bottom: 1px solid var(--card-border);
}

.cd-spells-row {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    flex-wrap: wrap;
}

.cd-spell-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, .3);
    cursor: pointer;
}

.cd-sidebar-champ-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cd-sidebar-champ-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    transition: background .2s;
}

.cd-sidebar-champ-item:hover {
    background: rgba(255, 255, 255, .04);
}

.cd-sidebar-champ-item img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #333;
}

.cd-sidebar-champ-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.cd-sidebar-tier {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
}

/* ── Related Guides ───────────────────────────────── */
.cd-related-guides {
    background: linear-gradient(135deg, #0c111a, #111827);
    border-top: 1px solid var(--card-border);
    padding: 36px 0 40px;
    margin-top: 12px;
}

.cd-related-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 20px;
}

.cd-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.cd-related-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    text-decoration: none;
    transition: all .25s;
}

.cd-related-card:hover {
    border-color: rgba(212, 175, 55, .4);
    background: var(--gold-light);
    transform: translateY(-2px);
}

.cd-related-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.cd-related-info strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
}

.cd-related-info span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Light Mode ───────────────────────────────────── */
html.light-mode .cd-hero {
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border-color: rgba(212, 175, 55, .3);
}

html.light-mode .cd-hero-title {
    color: #1e293b;
}

html.light-mode .cd-toc-bar {
    background: rgba(255, 255, 255, .95);
    border-color: rgba(212, 175, 55, .2);
}

html.light-mode .cd-toc-link {
    color: #475569;
}

html.light-mode .cd-section {
    background: #fff;
    border-color: rgba(0, 0, 0, .08);
}

html.light-mode .cd-section-header {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

html.light-mode .cd-section-title {
    color: #1e293b !important;
}

html.light-mode .cd-guide-text {
    color: #374151;
}

html.light-mode .cd-sidebar-card {
    background: #fff;
    border-color: rgba(0, 0, 0, .08);
}

html.light-mode .cd-related-guides {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, .06);
}

html.light-mode .cd-related-card {
    background: #fff;
    border-color: rgba(0, 0, 0, .08);
}

html.light-mode .cd-related-info strong {
    color: #1e293b;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1024px) {
    .cd-layout {
        grid-template-columns: 1fr;
    }

    .cd-sidebar {
        position: static;
    }

    .cd-hero-avatar img {
        width: 90px;
        height: 90px;
    }

    .cd-hero-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .cd-hero-inner {
        flex-direction: column;
        gap: 16px;
    }

    .cd-hero-avatar img {
        width: 80px;
        height: 80px;
    }

    .cd-hero-title {
        font-size: 18px;
    }

    .cd-strengths-grid {
        grid-template-columns: 1fr;
    }

    .cd-sw-card.strengths {
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }

    .cd-matchup-item {
        width: 70px;
        padding: 6px;
    }

    .cd-stat-value {
        font-size: 16px;
    }

    .cd-stat-box {
        min-width: 65px;
        padding: 8px 10px;
    }
}

/* ── Tooltips ────────────────────────────────────── */
.rune-tooltip-wrapper,
.item-tooltip-wrapper,
.skill-tooltip-wrapper,
.spell-tooltip-wrapper {
    position: relative !important;
    display: inline-block !important;
    overflow: visible !important;
}

.rune-tooltip,
.item-tooltip,
.skill-tooltip,
.spell-tooltip {
    position: absolute !important;
    bottom: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-bottom: 12px !important;
    background: rgba(15, 23, 42, 0.98) !important;
    color: #fff !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    min-width: 250px !important;
    max-width: 350px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: all 0.2s ease !important;
    z-index: 99999 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 175, 55, 0.3) !important;
    border: 1px solid rgba(212, 175, 55, 0.4) !important;
    white-space: normal !important;
    word-wrap: break-word !important;
}

@media (max-width: 768px) {

    .rune-tooltip,
    .item-tooltip,
    .skill-tooltip,
    .spell-tooltip {
        min-width: 200px !important;
        max-width: 260px !important;
        font-size: 12px !important;
        padding: 10px 12px !important;
    }
}

/* Specific fix for first/last items in rows on mobile to prevent overflow */
@media (max-width: 500px) {

    .rune-tooltip,
    .item-tooltip,
    .skill-tooltip,
    .spell-tooltip {
        min-width: 160px !important;
        max-width: 220px !important;
    }

    /* Shift tooltips that might be near the left edge slightly right */
    .cd-item-icons .item-tooltip-wrapper:nth-child(3n+1) .item-tooltip,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(3n+1) .rune-tooltip,
    .cd-item-icons .item-tooltip-wrapper:nth-child(4n+1) .item-tooltip,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(4n+1) .rune-tooltip {
        left: 0 !important;
        transform: translateX(0) !important;
    }

    .cd-item-icons .item-tooltip-wrapper:nth-child(3n+1) .item-tooltip::after,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(3n+1) .rune-tooltip::after,
    .cd-item-icons .item-tooltip-wrapper:nth-child(4n+1) .item-tooltip::after,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(4n+1) .rune-tooltip::after {
        left: 20px !important;
        transform: none !important;
    }

    /* Shift tooltips that might be near the right edge slightly left */
    .cd-item-icons .item-tooltip-wrapper:nth-child(3n) .item-tooltip,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(3n) .rune-tooltip,
    .cd-item-icons .item-tooltip-wrapper:nth-child(4n) .item-tooltip,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(4n) .rune-tooltip {
        left: auto !important;
        right: 0 !important;
        transform: translateX(0) !important;
    }

    .cd-item-icons .item-tooltip-wrapper:nth-child(3n) .item-tooltip::after,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(3n) .rune-tooltip::after,
    .cd-item-icons .item-tooltip-wrapper:nth-child(4n) .item-tooltip::after,
    .cd-rune-icons .rune-tooltip-wrapper:nth-child(4n) .rune-tooltip::after {
        left: auto !important;
        right: 20px !important;
        transform: none !important;
    }
}

.rune-tooltip strong,
.item-tooltip strong,
.skill-tooltip strong,
.spell-tooltip strong {
    display: block !important;
    color: #d4af37 !important;
    margin-bottom: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.rune-tooltip::after,
.item-tooltip::after,
.skill-tooltip::after,
.spell-tooltip::after {
    content: '' !important;
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border: 6px solid transparent !important;
    border-top-color: rgba(15, 23, 42, 0.98) !important;
}

.tooltip1:hover .rune-tooltip,
.tooltip1:hover .item-tooltip,
.tooltip1:hover .skill-tooltip,
.tooltip1:hover .spell-tooltip,
.rune-tooltip-wrapper:hover .rune-tooltip,
.item-tooltip-wrapper:hover .item-tooltip,
.skill-tooltip-wrapper:hover .skill-tooltip,
.spell-tooltip-wrapper:hover .spell-tooltip {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-5px) !important;
}

/* Reset the transform for the nth-child fixed tooltips */
@media (max-width: 500px) {

    .cd-item-icons .item-tooltip-wrapper:nth-child(4n+1):hover .item-tooltip,
    .cd-item-icons .item-tooltip-wrapper:nth-child(4n):hover .item-tooltip,
    .cd-rune-icons-row .rune-tooltip-wrapper:nth-child(4n+1):hover .rune-tooltip,
    .cd-rune-icons-row .rune-tooltip-wrapper:nth-child(4n):hover .rune-tooltip {
        transform: translateY(-5px) !important;
    }
}

/* ── FAQ Accordion ───────────────────────────────── */
.cd-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

.cd-faq-item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
}

.cd-faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.cd-faq-question:hover {
    background: rgba(255, 255, 255, 0.06);
}

.cd-faq-question h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #fff;
    line-height: 1.4;
}

.faq-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cd-faq-item.active {
    border-color: rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.04);
}

.cd-faq-item.active .faq-toggle-icon {
    transform: rotate(180deg);
    background: var(--gold);
    color: #000;
}

.cd-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.1);
}

.cd-faq-answer-content {
    padding: 16px 20px 20px;
    color: #a0aec0;
    line-height: 1.7;
    font-size: 14.5px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

html.light-mode .cd-faq-item {
    border-color: rgba(0, 0, 0, 0.08);
    background: #f8fafc;
}

html.light-mode .cd-faq-question h3 {
    color: #1e293b;
}

html.light-mode .cd-faq-answer-content {
    color: #475569;
}

html.light-mode .cd-faq-item.active {
    background: #fff;
}