/**
 * D3 Dashboard Styles
 * Comprehensive styling for all dashboard components
 */

/* ============================================
   Sync Notification Bar
   ============================================ */

.d3-sync-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5986 100%);
    color: #fff;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease, padding 0.4s ease;
}

.d3-sync-notification.visible {
    max-height: 50px;
    opacity: 1;
    padding: 10px 20px;
}

.d3-sync-notification.hiding {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
}

.d3-sync-notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.d3gtd .d3-sync-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: d3-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes d3-spin {
    to {
        transform: rotate(360deg);
    }
}


/* Steam rate-limit warning bar — amber,
.d3gtd sits below main sync bar */
.d3-steam-rate-limit-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: linear-gradient(135deg, #5f3a00 0%, #9c6000 100%);
    color: #ffe0a0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease, padding 0.4s ease;
}

.d3-steam-rate-limit-notification.visible {
    max-height: 50px;
    opacity: 1;
    padding: 10px 20px;
}

.d3-steam-rate-limit-notification.hiding {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
}

.d3gtd .d3-steam-rl-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.d3gtd .d3-steam-rl-message {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}


/* ============================================
   Global Entrance Animations
   ============================================ */

@keyframes db-fade-up {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes db-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes db-slide-left {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes db-slide-right {
    from {
        opacity: 0;
        transform: translateX(18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes db-glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }

    50% {
        box-shadow: 0 0 14px 4px rgba(99, 102, 241, 0.35);
    }
}

@keyframes db-shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}


/* IntersectionObserver adds .is-visible / .is-above for bidirectional scroll animation */
.db-reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.db-reveal.is-above {
    transform: translateY(-32px);
}

.db-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* Slide from left */
.db-reveal.db-slide-left {
    transform: translateX(-48px);
}

.db-reveal.db-slide-left.is-above {
    transform: translateX(-48px);
}

.db-reveal.db-slide-left.is-visible {
    transform: translateX(0);
}


/* Slide from right */
.db-reveal.db-slide-right {
    transform: translateX(48px);
}

.db-reveal.db-slide-right.is-above {
    transform: translateX(48px);
}

.db-reveal.db-slide-right.is-visible {
    transform: translateX(0);
}


/* Scale in */
.db-reveal.db-scale-in {
    transform: scale(0.88);
}

.db-reveal.db-scale-in.is-above {
    transform: scale(0.88);
}

.db-reveal.db-scale-in.is-visible {
    transform: scale(1);
}


/* stagger children by 160 ms each */
.db-stagger>* {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.db-stagger.is-visible>*:nth-child(1) {
    transition-delay: 0.00s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(2) {
    transition-delay: 0.16s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(3) {
    transition-delay: 0.32s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(4) {
    transition-delay: 0.48s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(5) {
    transition-delay: 0.64s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(6) {
    transition-delay: 0.80s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(7) {
    transition-delay: 0.96s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(8) {
    transition-delay: 1.12s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(9) {
    transition-delay: 1.28s;
    opacity: 1;
    transform: none;
}

.db-stagger.is-visible>*:nth-child(n+10) {
    transition-delay: 1.44s;
    opacity: 1;
    transform: none;
}


/* ============================================
   Layout & Container; Article Style
   ============================================ */

.d3gtd {
    display: block;
    padding: 0;
    background: transparent;
    min-height: 600px;
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #cbd5e1;
    line-height: 1.7;
}

.d3gtd * {
    box-sizing: border-box;
}


/* Hide the default WP page title on the dashboard page */
body.d3-dashboard-page .wp-block-post-title,
body.d3-dashboard-page .entry-title,
body.d3-dashboard-page .wp-block-query-title {
    display: none;
}


/* ── Dark-mode page override ── */
body.d3-dashboard-page {
    background: #0f172a !important;
    color: #cbd5e1 !important;
}

body.d3-dashboard-page .wp-site-blocks,
body.d3-dashboard-page .entry-content,
body.d3-dashboard-page .wp-block-group {
    background: transparent !important;
    color: inherit !important;
}


/* ── Article Header ── */
.article-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
    grid-template-areas:
        "title title"
        "subtitle subtitle"
        "toc intro";
    column-gap: 28px;
    row-gap: 14px;
    align-items: start;
    padding: 12px 0 36px 0;
    border-bottom: 2px solid #334155;
    margin-bottom: 48px;
    width: 100%;
}

.d3gtd .article-title {
    grid-area: title;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    color: #f1f5f9;
    margin: 0 0 8px 0;
    line-height: 1.2;
    width: 100%;
    text-align: center;
    animation: db-fade-up 0.7s ease both;
}

.d3gtd .article-subtitle {
    grid-area: subtitle;
    font-size: 1.5rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #7477f2;
    margin: 0 0 6px 0;
    text-align: center;
    animation: db-fade-in 0.7s 0.15s ease both;
}

.d3gtd .article-intro {
    grid-area: intro;
    font-size: 1.35rem;
    color: #cbd5e1;
    max-width: none;
    width: 100%;
    margin: 0;
    animation: db-slide-right 0.65s 0.25s ease both;
}


/* ── Table of Contents ── */
.article-toc {
    grid-area: toc;
    background: #1e293b;
    border-left: 3px solid #7477f2;
    border-radius: 0 8px 8px 0;
    padding: 18px 24px;
    display: block;
    width: 100%;
    min-width: 0;
    align-self: start;
    animation: db-slide-left 0.65s 0.25s ease both;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.d3gtd .article-toc:hover {
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.10);
    border-color: #4f46e5;
}

.d3gtd .toc-heading {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7477f2;
    margin: 0 0 10px 0;
}

.d3gtd .toc-list {
    margin: 0;
    padding-left: 20px;
    font-size: 1rem;
    color: #cbd5e1;
}

.d3gtd .toc-list li {
    margin: 4px 0;
}

.d3gtd .toc-list ol {
    margin: 4px 0 0 0;
    padding-left: 18px;
}

.d3gtd .toc-list a {
    color: #af86f5;
    text-decoration: none;
    transition: color 0.2s ease, padding-left 0.2s ease;
    display: inline-block;
}

.d3gtd .toc-list a:hover {
    text-decoration: none;
    color: #df96ff;
    padding-left: 4px;
}


/* ── Article Sections ── */
.article-section {
    margin-bottom: 64px;
    scroll-margin-top: 80px;
}

.d3gtd .article-subsection {
    margin-bottom: 48px;
    scroll-margin-top: 80px;
}

.d3gtd .section-heading {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #334155;
    transition: color 0.2s ease;
}

.d3gtd .section-heading:hover {
    color: #aae;
}

.d3gtd .subsection-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0 0 16px 0;
    transition: color 0.2s ease;
}

.d3gtd .subsection-heading:hover {
    color: #aae;
}

.d3gtd .section-intro {
    font-size: 1.35rem;
    color: #cbd5e1;
    margin: 0 0 24px 0;
}

.d3gtd .section-intro ul {
    font-size: 1.4rem;
}

.d3gtd .section-body {
    font-size: 1.35rem;
    color: #cbd5e1;
    margin: 0 0 20px 0;
}

.d3gtd .quote {
    display: block;
    font-style: italic;
    text-align: center;
    font-size: 1.3rem;
    color: #fee;
    background: #012;
    border: 1px solid #888;
    border-radius: 10px;
    padding: 10px 20px;
    margin: 0 0 20px 0;
}


/* ── Chart Containers ── */
.chart-container {
    background: #1e293b;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    padding: 20px;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.d3gtd .chart-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
}

.d3gtd .chart-container h3 {
    margin: 0 0 14px 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #b6c5da;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.d3gtd .chart-full-width {
    width: 100%;
}

.d3gtd .success-factors-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, calc(50% - 100px)) minmax(0, calc(50% + 100px));
    grid-template-areas:
        'top baseline'
        'common baseline';
    gap: 18px;
    align-items: stretch;
    margin: 0 0 24px 0;
}

.d3gtd .success-factors-summary-card {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 18px 20px;
    min-height: 100%;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.96) 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.22);
    text-align: center;
}

.d3gtd #success-factors-live-summary {
    grid-area: top;
}

.d3gtd #success-factors-most-common {
    grid-area: common;
}

.d3gtd #success-factors-baseline {
    grid-area: baseline;
}

@media (max-width: 980px) {
    .success-factors-summary-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            'top'
            'common'
            'baseline';
    }
}


/* ── Timing two-column layout ── */
.timing-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
}

.d3gtd .timing-layout-reverse {
    direction: ltr;
    /* reset */
}

.d3gtd .timing-chart-wide {
    grid-template-columns: 2fr 1fr;
}

.d3gtd .timing-layout-reverse.timing-chart-wide {
    grid-template-columns: 1fr 2fr;
}

.d3gtd .timing-chart-half {
    margin-bottom: 0;
}

.d3gtd .timing-text-half {
    font-size: 1.3rem;
    color: #cbd5e1;
    margin: 0;
    align-self: center;
}


/* ── Algorithm formula block ── */
.algo-formula-block {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 24px 28px;
    margin: 0 0 24px 0;
    color: #e2e8f0;
}

.d3gtd .algo-formula-block .formula-display {
    font-size: 1.5rem;
    font-family: "Cambria Math", Cambria, Georgia, "Times New Roman", serif;
    margin-bottom: 16px;
    color: #f8fafc;
    line-height: 1.8;
    text-align: center;
}

.d3gtd .algo-formula-block .fw {
    font-weight: 700;
}

.d3gtd .algo-formula-block .frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 0 0.08em;
    line-height: 1;
}

.d3gtd .algo-formula-block .frac .num {
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
    font-size: 0.82em;
    line-height: 1.1;
}

.d3gtd .algo-formula-block .frac .den {
    padding-top: 2px;
    font-size: 0.82em;
    line-height: 1.1;
}

.d3gtd .formula-legend {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
    font-size: 1.1rem;
    margin: 0 auto 16px;
    width: fit-content;
    color: #cbd5e1;
}

.d3gtd .formula-legend dt {
    font-weight: 700;
    color: #a5b4fc;
    font-family: "Cambria Math", Cambria, Georgia, serif;
    font-style: italic;
}

.d3gtd .formula-legend dd {
    margin: 0;
}

.d3gtd .formula-info-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 6px;
}

.d3gtd .formula-info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
}

.d3gtd .formula-info-popover {
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    min-width: 360px;
    text-align: center;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.97);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.45);
    color: #dbeafe;
    font-size: 0.95rem;
    line-height: 1.45;
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    z-index: 20;
    white-space: normal;
}

.d3gtd .formula-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    vertical-align: middle;
    margin: 0 0.2em;
}

.d3gtd .formula-frac-top,
.d3gtd .formula-frac-bottom {
    display: block;
    padding: 0 0.24em;
    text-align: center;
    white-space: nowrap;
}

.d3gtd .formula-frac-bar {
    display: block;
    border-top: 1.5px solid currentColor;
    margin: 0.08em 0;
}

.d3gtd .formula-info-wrap:hover .formula-info-popover,
.d3gtd .formula-info-wrap:focus-within .formula-info-popover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.d3gtd .formula-info-title,
.d3gtd .formula-info-math,
.d3gtd .formula-info-detail,
.d3gtd .formula-info-result {
    display: block;
}

.d3gtd .formula-info-title {
    color: #f8fafc;
    font-weight: 700;
    margin-bottom: 4px;
}

.d3gtd .formula-info-math {
    color: #bfdbfe;
    font-family: Consolas, "SFMono-Regular", Monaco, monospace;
    font-size: 0.88rem;
    margin-bottom: 4px;
    white-space: nowrap;
}

.d3gtd .sf-tooltip .formula-info-popover {
    display: none;
}

.d3gtd .formula-info-detail {
    color: #cbd5e1;
}

.d3gtd .formula-info-result {
    color: #fcd34d;
    font-weight: 700;
    margin-top: 4px;
}

.d3gtd .formula-examples {
    font-size: 0.9rem;
    color: #b6c5da;
    border-top: 1px solid #334155;
    padding-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.d3gtd .formula-examples strong {
    color: #f8fafc;
}

.d3gtd .formula-example {
    flex: 1 1 340px;
    min-width: 280px;
}

.d3gtd .formula-example-divided {
    border-left: 1px solid #334155;
    padding-left: 20px;
}

.d3gtd .formula-example-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.d3gtd .formula-example-title {
    display: block;
    margin-bottom: 0;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 700;
}

.d3gtd .formula-example-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.d3gtd .formula-example-jump-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.18);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.d3gtd .formula-example-jump:hover .formula-example-jump-dot,
.d3gtd .formula-example-jump:focus-visible .formula-example-jump-dot {
    transform: scale(1.12);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.28);
}

.d3gtd .formula-example-jump:focus-visible {
    outline: none;
}

.d3gtd .formula-example-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.d3gtd .formula-example-table thead tr {
    border-bottom: 1px solid #334155;
}

.d3gtd .formula-example-table th {
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 6px 6px 0;
}

.d3gtd .formula-example-table td {
    padding: 4px 6px 4px 0;
    vertical-align: middle;
    border-bottom: 1px solid rgba(51, 65, 85, 0.45);
    font-variant-numeric: tabular-nums;
}

.d3gtd .formula-example-table tr:last-child td {
    border-bottom: none;
}

.d3gtd .formula-example-result {
    font-size: 1.1rem;
    color: #9cf;
    padding-top: 6px;
    border-top: 1px solid #334155;
}

.d3gtd .formula-example-result strong {
    color: #fcd34d;
    font-size: 1rem;
}


/* ── Conclusion ── */
.conclusion-body {
    background: linear-gradient(135deg, #1e293b 0%, #1a2744 100%);
    border-radius: 10px;
    padding: 24px 28px;
    border: 1px solid #334155;
    border-left: 4px solid #7477f2;
    line-height: 1.75;
}

.d3gtd .conclusion-body p+p {
    margin-top: 12px;
}


/* ── Sandbox ── */
.sandbox-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #1e293b;
    border-radius: 12px;
    padding: 28px;
    transition: box-shadow 0.3s ease;
}

.d3gtd .sandbox-panel:hover {
    box-shadow: 0 8px 36px rgba(99, 102, 241, 0.12);
}

.d3gtd .sandbox-panel.sandbox-disabled {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.3);
}

.d3gtd .sandbox-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.d3gtd .sandbox-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    align-content: start;
    min-width: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.d3gtd .sandbox-row:hover {
    border-color: #7477f2;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
    transform: translateY(-1px);
}

.d3gtd .sandbox-row-wide {
    grid-column: span 2;
}

.d3gtd .sandbox-label {
    font-size: 1rem;
    font-weight: 600;
    color: #b6c5da;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.d3gtd .sandbox-select,
.d3gtd .sandbox-input,
.d3gtd .sandbox-hint {
    grid-column: 1 / -1;
}

.d3gtd .sandbox-select,
.d3gtd .sandbox-input {
    background: #111827;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 0.92rem;
    color: #e2e8f0;
    width: 100%;
    min-width: 0;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.d3gtd .sandbox-select:hover,
.d3gtd .sandbox-input:hover {
    border-color: #7477f2;
    background: #1a2235;
}

.d3gtd .sandbox-select:focus,
.d3gtd .sandbox-input:focus {
    border-color: #7477f2;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}


/* ── Tag autocomplete drop-up ── */
.sb-tag-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    top: auto;
    z-index: 50;
    max-height: 220px;
    overflow-y: auto;
    background: #0f172a;
    border: 1.5px solid #7477f2;
    border-radius: 8px;
    margin-bottom: 6px;
    box-shadow: 0 -6px 24px rgba(99, 102, 241, 0.25), 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.d3gtd .sb-tag-dropdown[hidden] {
    display: none;
}

.d3gtd .sb-tag-option {
    padding: 8px 14px;
    font-size: 0.84rem;
    color: #e2e8f0;
    cursor: pointer;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    transition: background 0.15s;
}

.d3gtd .sb-tag-option:last-child {
    border-bottom: none;
}

.d3gtd .sb-tag-option:hover,
.d3gtd .sb-tag-option.active {
    background: #1e293b;
    color: #fff;
}


/* ── Custom range slider ── */
.sandbox-range-input {
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    width: 100%;
    height: 22px;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    display: block;
}

.d3gtd .sandbox-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: relative;
    top: -5px;
    background: #7477f2;
    border: 2px solid #a5b4fc;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.d3gtd .sandbox-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7477f2;
    border: 2px solid #a5b4fc;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.d3gtd .sandbox-range-input:hover::-webkit-slider-thumb,
.d3gtd .sandbox-range-input:focus::-webkit-slider-thumb {
    background: #818cf8;
    transform: scale(1.25);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.20);
}

.d3gtd .sandbox-range-input:hover::-moz-range-thumb,
.d3gtd .sandbox-range-input:focus::-moz-range-thumb {
    background: #818cf8;
    transform: scale(1.25);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.20);
}

.d3gtd .sandbox-range-input:active::-webkit-slider-thumb {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(99, 102, 241, 0.15);
}

.d3gtd .sandbox-range-input::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #7477f2 var(--pct, 50%), #1e3a5f var(--pct, 50%));
    transition: background 0.1s ease;
}

.d3gtd .sandbox-range-input::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #7477f2 var(--pct, 50%), #1e3a5f var(--pct, 50%));
}

.d3gtd .sandbox-range-value {
    font-size: 0.88rem;
    color: #a5b4fc;
    font-weight: 700;
    margin-top: 2px;
    justify-self: end;
    transition: color 0.15s ease, transform 0.15s ease;
    display: inline-block;
}

.d3gtd .sandbox-range-input:active~.sandbox-range-value {
    color: #818cf8;
    transform: scale(1.15);
}

.d3gtd .sandbox-hint {
    font-size: 0.78rem;
    color: #64748b;
}

.d3gtd .sandbox-hint-inline {
    font-weight: 400;
    font-size: 0.72rem;
    color: #64748b;
    text-transform: none;
    letter-spacing: normal;
    margin-left: 4px;
}

.d3gtd .sandbox-predict-btn {
    grid-column: 1 / -1;
    margin-top: 2px;
    background: linear-gradient(135deg, #7477f2 0%, #4f46e5 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.03em;
    position: relative;
    overflow: hidden;
    transition: background 200ms ease, transform 120ms ease, box-shadow 200ms ease;
}

.d3gtd .sandbox-predict-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    background-size: 200% 100%;
    background-position: -200% center;
    transition: background-position 0s;
    pointer-events: none;
}

.d3gtd .sandbox-predict-btn:hover {
    background: linear-gradient(135deg, #818cf8 0%, #7477f2 100%);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.40);
    transform: translateY(-1px);
}

.d3gtd .sandbox-predict-btn:hover::after {
    animation: db-shimmer 0.7s ease forwards;
}

.d3gtd .sandbox-predict-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}


/* ─ Result panel ─ */
.sandbox-result {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 18px 20px;
    animation: db-fade-up 0.45s ease both;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.d3gtd .sandbox-result:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.d3gtd .sandbox-score-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.d3gtd .sandbox-result-kicker {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #b6c5da;
    margin-bottom: 4px;
}

.d3gtd .sandbox-score-readout {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.d3gtd .sandbox-score-number {
    font-size: 2rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1;
}

.d3gtd .sandbox-score-unit {
    font-size: 0.82rem;
    color: #b6c5da;
}

.d3gtd .sandbox-score-band {
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 10px;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.d3gtd .sandbox-score-band:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.d3gtd .sandbox-score-band.high {
    background: rgba(6, 214, 160, 0.15);
    color: #86efac;
}

.d3gtd .sandbox-score-band.medium {
    background: rgba(251, 191, 36, 0.16);
    color: #fde68a;
}

.d3gtd .sandbox-score-band.low {
    background: rgba(244, 63, 94, 0.14);
    color: #fda4af;
}

.d3gtd .sandbox-score-band.neutral {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
}

.d3gtd .sandbox-score-meter {
    width: 100%;
}

.d3gtd .sandbox-score-track {
    width: 100%;
    height: 14px;
    background: #1e3a5f;
    border-radius: 999px;
    overflow: hidden;
    transition: height 0.2s ease;
}

.d3gtd .sandbox-score-meter:hover .sandbox-score-track {
    height: 18px;
}

.d3gtd .sandbox-score-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 0.9s cubic-bezier(0.34, 1.10, 0.64, 1), background 0.3s ease;
}

.d3gtd .sandbox-score-fill.high {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.d3gtd .sandbox-score-fill.medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.d3gtd .sandbox-score-fill.low {
    background: linear-gradient(90deg, #e11d48, #fb7185);
}

.d3gtd .sandbox-score-fill.neutral {
    background: linear-gradient(90deg, #7477f2, #818cf8);
}

.d3gtd .sandbox-score-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.76rem;
    color: #64748b;
}

.d3gtd .sandbox-score-summary {
    margin: 0;
    font-size: 0.92rem;
    color: #cbd5e1;
}

.d3gtd .sandbox-breakdown {
    width: 100%;
    font-size: 0.88rem;
    color: #cbd5e1;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

.d3gtd .sb-factor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 12px;
    transition: background 0.15s ease, padding-left 0.15s ease;
    border-radius: 4px;
}

.d3gtd .sb-factor-row:hover {
    background: rgba(99, 102, 241, 0.06);
    padding-left: 6px;
}

.d3gtd .sb-factor-row:last-child {
    border-bottom: none;
}

.d3gtd .sb-factor-name {
    color: #b6c5da;
    font-size: 0.82rem;
}

.d3gtd .sb-factor-score {
    font-weight: 700;
    color: #a5b4fc;
    white-space: nowrap;
}

.d3gtd .sb-factor-bar-wrap {
    flex: 1;
    height: 6px;
    background: #1e3a5f;
    border-radius: 3px;
    overflow: hidden;
}

.d3gtd .sb-factor-bar {
    height: 100%;
    background: linear-gradient(90deg, #7477f2, #818cf8);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.34, 1.10, 0.64, 1);
}

.d3gtd .factor-mean-line {
    pointer-events: none;
    shape-rendering: crispEdges;
}


/* ── Responsive ── */
@media (max-width: 1100px) {
    .sandbox-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sandbox-row-wide {
        grid-column: 1 / -1;
    }

    .blueprint-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .blueprint-card,
    .blueprint-card-genre,
    .blueprint-card-tags,
    .blueprint-card-timing,
    .blueprint-card-conclusion,
    .blueprint-card-matches {
        grid-column: auto;
    }
}

@media (max-width: 900px) {
    .article-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "subtitle"
            "toc"
            "intro";
    }

    .article-title,
    .article-subtitle,
    .article-intro,
    .article-toc {
        grid-column: 1;
    }

    .article-intro {
        margin-bottom: 8px;
    }

    .blueprint-grid {
        grid-template-columns: 1fr;
    }

    .blueprint-card,
    .blueprint-card-genre,
    .blueprint-card-tags,
    .blueprint-card-timing,
    .blueprint-card-conclusion,
    .blueprint-card-matches {
        grid-column: auto;
    }
}

@media (max-width: 760px) {
    .timing-layout {
        grid-template-columns: 1fr;
    }

    .sandbox-controls {
        grid-template-columns: 1fr;
    }

    .sandbox-row,
    .sandbox-row-wide,
    .sandbox-predict-btn {
        grid-column: 1;
    }

    .sandbox-result {
        padding: 16px;
    }

    .blueprint-metrics {
        grid-template-columns: 1fr 1fr;
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .article-header {
        padding: 24px 0 20px;
    }

    .article-title {
        font-size: 1.5rem;
    }
}


/* ============================================
   SVG Charts Common
   ============================================ */

.d3-chart {
    display: block;
    max-width: 100%;
}

.d3gtd .d3-chart text {
    font-family: inherit;
    fill: #cbd5e1;
    transition: fill 0.2s ease;
}

.d3gtd .d3-chart .axis path,
.d3gtd .d3-chart .axis line {
    stroke: #334155;
}

.d3gtd .d3-chart .axis text {
    font-size: 11px;
    fill: #cbd5e1;
}

.d3gtd .d3-chart .x-axis-label,
.d3gtd .d3-chart .y-axis-label {
    fill: #b6c5da;
}


/* ============================================
   Tooltip
   ============================================ */

.d3-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.5;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
}

.d3-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.d3-tooltip strong {
    color: #fff;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

#release-timing-tooltip {
    max-width: 360px;
}


/* ============================================
   Stream Graph
   ============================================ */

.stream-layer {
    transition: opacity 0.2s ease;
}

.d3gtd .quarter-highlight {
    transition: opacity 160ms ease;
}

.stream-tooltip {
    background: linear-gradient(180deg, rgba(14, 24, 43, 0.96), rgba(9, 17, 30, 0.94));
    border: 1px solid rgba(148, 163, 184, 0.18);
    max-width: 320px;
    min-width: 240px;
    /* Slower fade-out; overrides the 180ms base transition */
    transition: opacity 420ms ease, transform 420ms ease;
}

.stream-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.stream-tooltip-header strong {
    margin-bottom: 0;
    color: #f8fafc;
}

.stream-tooltip-close {
    border: 0;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(248, 250, 252, 0.12);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 140ms ease, transform 140ms ease;
}

.stream-tooltip-close:hover {
    background: rgba(248, 250, 252, 0.22);
    transform: scale(1.06);
}

.stream-tooltip-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 4px 12px;
}

.stream-tooltip-genre {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.stream-tooltip-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.stream-tooltip-value {
    text-align: right;
    color: #fcd34d;
    font-variant-numeric: tabular-nums;
}

.stream-tooltip-hint {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(226, 232, 240, 0.8);
    font-size: 11px;
}

.d3gtd .success-factors-formula {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    line-height: 1.5;
}

.d3gtd .success-factors-formula .formula-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #b6c5da;
    margin-bottom: 6px;
}

.d3gtd .success-factors-formula .formula-display {
    font-size: 16px;
    color: #f8fafc;
    font-family: "Cambria Math", Cambria, Georgia, "Times New Roman", serif;
    letter-spacing: 0.01em;
    margin-bottom: 6px;
}

.d3gtd .success-factors-formula .formula-legend {
    font-size: 11px;
    color: #cbd5e1;
}

.d3gtd .success-factors-formula .math-var {
    font-style: italic;
}

.d3gtd .success-factors-formula .paren {
    color: #cbd5e1;
    font-weight: 700;
}

.d3gtd .success-factors-formula .frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 0 0.12em;
    min-width: 1.7em;
}

.d3gtd .success-factors-formula .frac .num {
    font-size: 0.72em;
    line-height: 1.05;
    padding-bottom: 1px;
}

.d3gtd .success-factors-formula .frac .den {
    font-size: 0.72em;
    line-height: 1.05;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    padding-top: 1px;
}

.d3gtd .y-axis text tspan {
    dominant-baseline: middle;
}

.sf-tooltip-root,
.sf-dot-hover {
    width: 100%;
}

.sf-tooltip {
    width: 336px !important;
    min-width: 336px !important;
    max-width: 336px !important;
    box-sizing: border-box;
    padding: 8px 10px;
    line-height: 1.35;
    overflow: visible;
}

.sf-tooltip strong {
    margin-bottom: 2px;
}

.sf-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    color: #e2e8f0;
    font-size: 11px;
    white-space: nowrap;
}

.sf-tooltip .sf-more {
    margin-top: 6px;
    max-height: 0px;
    overflow: hidden;
    opacity: 0;
    transform: scaleY(0.1);
    transform-origin: top;
    transition: max-height 240ms ease, opacity 200ms ease, transform 240ms ease;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 0;
}

.sf-tooltip .sf-more.expanded {
    margin-top: 8px;
    max-height: 520px;
    opacity: 1;
    transform: scaleY(1);
    padding-top: 8px;
    overflow: visible;
}

.sf-more-title {
    color: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sf-top-game {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
}

.sf-top-game:last-child {
    border-bottom: none;
}

.sf-top-game-name {
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.sf-top-game-score {
    color: #fcd34d;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}


/* Game-dot hover / pinned tooltips */
.sf-dot-hover {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.d3gtd .factor-dot.is-formula-example {
    fill: #4ade80 !important;
}

.d3gtd .sf-expanded-mode .factor-dot,
.d3gtd .sf-expanded-mode .factor-mean-line,
.d3gtd .sf-expanded-mode .factor-label,
.d3gtd .sf-expanded-mode .y-grid line,
.d3gtd .sf-expanded-mode .baseline-line,
.d3gtd .sf-expanded-mode .y-axis,
.d3gtd .sf-expanded-mode text {
    opacity: 0.3 !important;
    transition: opacity 160ms ease;
}

.d3gtd .sf-expanded-mode .factor-dot.is-expanded-active {
    opacity: 1 !important;
    stroke: #ffffff !important;
    stroke-width: 2.4px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.32));
}

.d3gtd .factor-dot.is-example-focus {
    stroke: #dcfce7 !important;
    stroke-width: 2.25px;
    filter: drop-shadow(0 0 7px rgba(74, 222, 128, 0.65));
}

.sf-dot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.sf-dot-name {
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.sf-dot-score {
    font-size: 12px;
    font-weight: 700;
    color: #fcd34d;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    text-align: right;
}

.sf-dot-hint {
    font-size: 10px;
    color: #64748b;
    font-style: italic;
}

.sf-dot-pinned .sf-dot-hint {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-calc-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 11px;
}

.sf-calc-table td {
    padding: 2px 6px 2px 0;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
    color: #cbd5e1;
    overflow-wrap: normal;
    overflow: visible;
}

.sf-calc-table .sfc-var {
    font-style: italic;
    color: #a5b4fc;
    font-weight: 700;
    white-space: nowrap;
    padding-right: 8px;
    width: 28px;
}

.sf-calc-table .sfc-val {
    color: #e2e8f0;
    min-width: 100px;
    white-space: normal;
}

.sf-tooltip .formula-info-wrap {
    z-index: 40;
}

.sf-tooltip .formula-info-popover {
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
    z-index: 50;
}

.sf-tooltip .formula-info-wrap:hover .formula-info-popover,
.sf-tooltip .formula-info-wrap:focus-within .formula-info-popover {
    transform: translateX(-50%) translateY(0);
}

.sfc-review-count,
.sfc-review-label {
    display: block;
}

.sfc-review-label {
    color: #b6c5da;
    margin-top: 2px;
}

.sf-calc-table .sfc-term {
    color: #fcd34d;
    text-align: right;
}

.sf-calc-result {
    font-size: 12px;
    color: #a5b4fc;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 6px;
    margin-top: 4px;
}

.sf-calc-result strong {
    color: #fcd34d;
    font-size: 13px;
    display: inline;
    margin-bottom: 0;
}

.sf-pinned {
    min-width: 280px;
    max-width: 340px;
    pointer-events: auto;
    overflow: visible;
}


/* ============================================
   Circular Heatmap
   ============================================ */

.heatmap-segment {
    transition: opacity 0.15s ease;
}

.d3gtd .day-label,
.d3gtd .hour-label {
    fill: #cbd5e1;
    pointer-events: none;
}

.d3gtd .center-text {
    fill: #e2e8f0;
    pointer-events: none;
}


/* ============================================
   TreeMap
   ============================================ */

.treemap-cell rect {
    transition: opacity 0.2s ease, stroke 0.15s ease;
}

.d3gtd .treemap-cell .cell-label {
    pointer-events: none;
    user-select: none;
}

.d3gtd .treemap-cell .value-label {
    pointer-events: none;
    user-select: none;
}

.d3gtd .parent-label {
    pointer-events: none;
    user-select: none;
}


/* ============================================
   Scatter Plot
   ============================================ */

.point {
    transition: opacity 0.2s ease, r 0.2s ease;
}

.d3gtd .point:hover {
    cursor: pointer;
}


/* ============================================
   Legend (HTML-based, outside chart)
   ============================================ */

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0 0 0;
    margin-top: 8px;
    border-top: 1px solid #334155;
}

.d3gtd .chart-legend .legend-entry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #cbd5e1;
    cursor: pointer;
    transition: opacity 0.2s;
}

.d3gtd .chart-legend .legend-entry:hover {
    opacity: 0.7;
}

.d3gtd .chart-legend .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.d3gtd .chart-legend .legend-label {
    white-space: nowrap;
}


/* ============================================
   Detail Panel
   ============================================ */

.detail-panel {
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
}

.d3gtd .detail-panel.has-content {
    overflow-y: auto;
}


/* Header */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    z-index: 10;
}

.d3gtd .detail-header .game-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 40px);
}

.d3gtd .detail-header .close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 20px;
    color: #b6c5da;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.d3gtd .detail-header .close-btn:hover {
    background: #334155;
    color: #f1f5f9;
}


/* Sections */
.detail-section {
    border-bottom: 1px solid #334155;
}

.d3gtd .detail-section:last-child {
    border-bottom: none;
}

.d3gtd .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #162033;
}

.d3gtd .section-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #b6c5da;
}

.d3gtd .section-toggle {
    background: none;
    border: none;
    font-size: 12px;
    color: #b6c5da;
    cursor: pointer;
    padding: 4px;
}

.d3gtd .detail-section.collapsed .section-content {
    display: none;
}

.d3gtd .detail-section.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.d3gtd .section-content {
    padding: 16px;
}


/* Game Image */
.game-image {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 12px;
    object-fit: cover;
    max-height: 150px;
}


/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.d3gtd .info-item {
    display: flex;
    flex-direction: column;
}

.d3gtd .info-label {
    font-size: 11px;
    color: #b6c5da;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.d3gtd .info-value {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
}


/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.d3gtd .metric-card {
    background: #0f172a;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.d3gtd .metric-label {
    font-size: 10px;
    color: #b6c5da;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.d3gtd .metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.d3gtd .metric-bar {
    height: 4px;
    background: #334155;
    border-radius: 2px;
    overflow: hidden;
}

.d3gtd .metric-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.d3gtd .metric-bar-fill.high {
    background: #28a745;
}

.d3gtd .metric-bar-fill.medium {
    background: #ffc107;
}

.d3gtd .metric-bar-fill.low {
    background: #dc3545;
}


/* Prediction Section */
.category-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.d3gtd .category-badge.high {
    background: rgba(6, 214, 160, 0.15);
    color: #86efac;
}

.d3gtd .category-badge.medium {
    background: rgba(251, 191, 36, 0.16);
    color: #fde68a;
}

.d3gtd .category-badge.low {
    background: rgba(244, 63, 94, 0.14);
    color: #fda4af;
}

.d3gtd .prediction-score {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.d3gtd .score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid;
}

.d3gtd .score-circle.high {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.d3gtd .score-circle.medium {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.d3gtd .score-circle.low {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.d3gtd .score-value {
    font-size: 24px;
    font-weight: 700;
    color: #f1f5f9;
}

.d3gtd .score-label {
    font-size: 11px;
    color: #b6c5da;
}

.d3gtd .confidence {
    font-size: 12px;
    color: #b6c5da;
}


/* Prediction Breakdown */
.prediction-breakdown h5 {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #b6c5da;
}

.d3gtd .breakdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.d3gtd .breakdown-label {
    width: 80px;
    font-size: 11px;
    color: #b6c5da;
}

.d3gtd .breakdown-bar {
    flex: 1;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.d3gtd .breakdown-fill {
    height: 100%;
    background: steelblue;
    border-radius: 4px;
}

.d3gtd .breakdown-value {
    width: 24px;
    font-size: 11px;
    color: #e2e8f0;
    font-weight: 600;
    text-align: right;
}


/* Genres */
.genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.d3gtd .genre-tag {
    background: #334155;
    color: #cbd5e1;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}


/* Mini Chart */
.mini-chart {
    width: 100%;
    min-height: 80px;
}


/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #b6c5da;
    min-height: 200px;
}

.d3gtd .empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.d3gtd .empty-state p {
    margin: 0;
    font-size: 14px;
}

.d3gtd .empty-state.error {
    color: #dc3545;
}


/* ============================================
   Loading & Error States
   ============================================ */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.d3gtd .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.d3gtd .loading-spinner-ring {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(148, 163, 184, 0.15);
    border-top-color: #64748b;
    border-radius: 50%;
    animation: d3-spin 0.8s linear infinite;
}

.d3gtd .error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.d3gtd .error-message {
    color: #dc3545;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}


/* ============================================
   Controls & Filters
   ============================================ */

/* dashboard-controls removed; layout now uses article sections */

/* ============================================
   Blueprint Cover (classified reveal)
   ============================================ */

.blueprint-cover-wrapper {
    position: relative;
}

.d3gtd .blueprint-cover-wrapper:not(.blueprint-revealed) #detail-panel {
    visibility: hidden;
    pointer-events: none;
    user-select: none;
    opacity: 0;
}

.d3gtd .blueprint-cover {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #0d1117;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #1e2d3d;
    min-height: 220px;
}

.d3gtd .blueprint-cover:hover {
    border-color: #e63946;
}

.d3gtd .blueprint-cover:hover .blueprint-cover-stamp {
    opacity: 0.95;
    transform: rotate(-8deg) scale(1.04);
}

.d3gtd .blueprint-cover-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 220px;
    padding: 32px 24px;
    gap: 10px;
    position: relative;
    z-index: 2;
}


/* Redacted lines background */
.blueprint-cover-lines {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 28px 20px;
    z-index: 1;
    opacity: 0.13;
}

.d3gtd .blueprint-cover-lines span {
    display: block;
    height: 14px;
    background: #475569;
    border-radius: 2px;
    width: 100%;
}

.d3gtd .blueprint-cover-lines span:nth-child(2) {
    width: 88%;
}

.d3gtd .blueprint-cover-lines span:nth-child(3) {
    width: 72%;
}

.d3gtd .blueprint-cover-lines span:nth-child(4) {
    width: 91%;
}

.d3gtd .blueprint-cover-lines span:nth-child(5) {
    width: 65%;
}

.d3gtd .blueprint-cover-lines span:nth-child(6) {
    width: 80%;
}

.d3gtd .blueprint-cover-lines span:nth-child(7) {
    width: 55%;
}

.d3gtd .blueprint-cover-stamp {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 0.22em;
    color: #e63946;
    border: 4px solid #e63946;
    border-radius: 4px;
    padding: 4px 18px;
    opacity: 0.82;
    transform: rotate(-8deg);
    transition: opacity 0.2s, transform 0.2s;
    text-transform: uppercase;
    line-height: 1.2;
    position: relative;
    z-index: 2;
}

.d3gtd .blueprint-cover-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #94a3b8;
    text-transform: uppercase;
    text-align: center;
    position: relative;
    z-index: 2;
    margin-top: 8px;
}

.d3gtd .blueprint-cover-sub {
    font-size: 11px;
    color: #cbd5e1;
    letter-spacing: 0.08em;
    text-align: center;
    position: relative;
    z-index: 2;
}

.d3gtd .blueprint-cover-cta {
    font-size: 13px;
    color: #f1f5f9;
    letter-spacing: 0.06em;
    margin-top: 14px;
    position: relative;
    z-index: 2;
    animation: blueprint-pulse 2s ease-in-out infinite;
}

@keyframes blueprint-pulse {

    0%,
    100% {
        opacity: 0.75;
    }

    50% {
        opacity: 1;
    }
}

@keyframes blueprint-flyaway {
    0% {
        transform: translateX(0);
        opacity: 1;
    }

    100% {
        transform: translateX(110%);
        opacity: 0;
    }
}

.d3gtd .blueprint-cover.is-dismissing {
    animation: blueprint-flyaway 0.5s cubic-bezier(0.4, 0, 1, 1) forwards;
    transition: none;
    pointer-events: none;
}

.d3gtd .blueprint-cover-wrapper:not(.blueprint-revealed) #detail-panel {
    opacity: 0;
}

.d3gtd .blueprint-cover-wrapper.blueprint-revealed #detail-panel {
    visibility: visible;
    pointer-events: auto;
    user-select: auto;
    opacity: 1;
    transition: opacity 0.4s ease 0.1s;
}


/* ============================================
   Blueprint Panel
   ============================================ */

.blueprint-panel {
    background: linear-gradient(135deg, #111827 0%, #1f2940 100%);
    color: #e0e0e0;
    border-radius: 10px;
    padding: 22px;
    overflow: visible;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
}

.d3gtd .blueprint-header {
    display: block;
    margin-bottom: 18px;
    text-align: center;
}

.d3gtd .blueprint-header h3 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 8px 0;
}

.d3gtd .blueprint-subtitle {
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.7;
    max-width: none;
    width: 100%;
}

.d3gtd .blueprint-card-conclusion h4 {
    font-size: 16px;
}

.d3gtd .blueprint-card-conclusion .strategy-summary {
    font-size: 15px;
}

.d3gtd .exemplars-section h4,
.d3gtd .blueprint-card-matches h4 {
    font-size: 16px;
}

.d3gtd .exemplar-chip strong {
    color: #f8fafc;
    font-size: 15px;
}

.d3gtd .exemplar-chip span {
    color: #b6c5da;
    font-size: 14px;
}

.d3gtd .exemplar-chip em {
    color: #06d6a0;
    font-style: normal;
    font-weight: 700;
    font-size: 15px;
}

.d3gtd .blueprint-header>div {
    width: 100%;
}

.d3gtd .blueprint-metrics {
    display: none !important;
}

.d3gtd .blueprint-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    align-items: stretch;
}

.d3gtd .blueprint-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px;
    min-height: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-wrap: anywhere;
    min-width: 0;
    width: 100%;
}

.d3gtd .blueprint-card-genre,
.d3gtd .blueprint-card-tags,
.d3gtd .blueprint-card-timing {
    grid-column: span 4;
}

.d3gtd .blueprint-card-highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(14, 165, 233, 0.12));
    border-color: rgba(165, 180, 252, 0.35);
}

.d3gtd .blueprint-card-conclusion {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
}

.d3gtd .blueprint-card-matches {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    padding: 16px 18px;
}

.d3gtd .blueprint-card-timing {
    justify-content: center;
}

.d3gtd .blueprint-card .card-icon {
    font-size: 20px;
    margin-bottom: 6px;
}

.d3gtd .blueprint-card h4 {
    color: #fff;
    font-size: 14px;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Recommendation list items */
.rec-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.d3gtd .rec-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.d3gtd .rec-rank {
    font-size: 16px;
}

.d3gtd .rec-name {
    flex: 1;
    font-weight: 500;
    min-width: 0;
    overflow-wrap: anywhere;
}

.d3gtd .rec-score {
    font-weight: 700;
    color: #06d6a0;
    font-size: 14px;
}


/* Tag pills */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
    align-content: center;
}

.d3gtd .tag-pill {
    background: rgba(107, 36, 206, 0.2);
    border: 1px solid rgba(131, 56, 236, 0.4);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: #c9a0ff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: normal;
    max-width: 100%;
}

.d3gtd .tag-score {
    background: rgba(131, 56, 236, 0.5);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    color: #fdd;
}


/* Timing */
.timing-rec {
    text-align: center;
}

.d3gtd .timing-best {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.d3gtd .timing-label {
    font-size: 14px;
    color: #b6c5da;
    text-transform: uppercase;
}

.d3gtd .timing-value {
    font-size: 20px;
    font-weight: 700;
    color: #06d6a0;
}

.d3gtd .timing-score {
    font-size: 14px;
    color: #b6c5da;
}


/* Strategy items */
.strategy-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.d3gtd .strategy-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    text-align: center;
}

.d3gtd .strategy-label {
    font-size: 12px;
    color: #b6c5da;
    text-transform: uppercase;
}

.d3gtd .strategy-value {
    font-size: 16px;
    font-weight: 700;
    color: #f4a261;
}

.d3gtd .strategy-summary {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.6;
    width: 100%;
    overflow-wrap: anywhere;
}

.d3gtd .strategy-value.advantage {
    color: #06d6a0;
}

.d3gtd .strategy-detail {
    font-size: 11px;
    color: #b6c5da;
}


/* Compact exemplar strip */
.exemplars-section {
    border-top: none;
    padding-top: 0;
}

.d3gtd .exemplars-section h4 {
    color: #fff;
    font-size: 20px;
    margin: 14px 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.d3gtd .exemplar-chip-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
    width: 100%;
}

.d3gtd .exemplar-chip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    text-align: center;
    flex: 1 1 180px;
    max-width: 220px;
}

.d3gtd .exemplar-chip strong {
    color: #f8fafc;
    font-size: 14px;
}

.d3gtd .exemplar-chip span {
    color: #b6c5da;
    font-size: 13px;
}

.d3gtd .exemplar-chip em {
    color: #06d6a0;
    font-style: normal;
    font-weight: 700;
    font-size: 14px;
}


/* Empty state in blueprint */
.blueprint-panel .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #b6c5da;
}

.d3gtd .blueprint-panel .empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
}