/* ═══════════════════════════════════════════════
   RESULTS — Responsive (media queries)
   ═══════════════════════════════════════════════ */

/* ═══ RESPONSIVE ═══ */

/* ── Tablet landscape / small desktop ── */
@media (max-width: 1100px) {
    .bench-grid { grid-template-columns: repeat(3, 1fr); }
    .trades-metrics-strip { gap: 20px; }
    .trades-metric-val { font-size: 20px; }
    .strat-grid { grid-template-columns: 1fr; }
    .usage-grid { grid-template-columns: repeat(2, 1fr); }

    /* Trades table — enable scroll early */
    .trades-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .trades-table { min-width: 560px; }
}

/* ── Tablet portrait ── */
@media (max-width: 1024px) {
    /* Global layout token — reduces padding on all elements using var(--section-px) */
    :root { --section-px: 32px; }

    .hero { padding: 100px var(--section-px) 60px; padding-top: calc(var(--header-h) + 28px); }
    .hero-compact { padding: calc(var(--header-h) + 32px) var(--section-px) 48px; }
    .section { padding: 80px var(--section-px); }
    .topbar, .tabbar { padding: 0 24px; }
    .hero-grid { grid-template-columns: 1fr; gap: 40px; }
    .hero-title { font-size: 36px; }
    .section-title { font-size: 32px; }
    .resilience-section { padding: 28px var(--section-px) 64px; }
    .resilience-inner { grid-template-columns: 1fr; gap: 20px; }
    .rob-upsell-grid { grid-template-columns: 1fr; }
    .eff-tab-hero { padding: calc(var(--header-h) + 28px) var(--section-px) 48px; }
    .eff-tab-hero-title { font-size: 38px; }
    .eff-chart-full { height: 400px; padding: 0 16px 16px; }
    .eff-compare-section { padding: 40px var(--section-px) 64px; }
    .eff-rebal-section { padding: 60px var(--section-px); }
    .eff-rebal-card { grid-template-columns: 1fr; }
    .eff-rebal-delta { flex-direction: row; border-left: none; border-right: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 16px 24px; }
    .eff-rebal-delta svg { transform: rotate(90deg); }
    .eff-narrative-section { padding: 60px var(--section-px); }
    .expect-grid { grid-template-columns: repeat(2, 1fr); }
    .verdict-hero { padding: calc(var(--header-h) + 28px) var(--section-px) 48px; }
    .verdict-statement { font-size: 22px; }
    .verdict-takeaways-stack { margin-top: 40px; }
    .verdict-takeaway-num { font-size: 19px; }
    .verdict-hero-actions { margin-top: 36px; }
    .trades-chart-full { padding: 0 16px 16px; height: 340px; }
    .trades-log-section { padding: 64px var(--section-px) 80px; }
    .dist-section { padding: 80px 0; }
    .spag-section { padding: 80px 0; }
    .bp-h-track-label { width: 50px; font-size: 9px; }
    .bp-howto { padding: 16px 20px; }
    .spag-stats { grid-template-columns: repeat(2, 1fr); }
    .rob-card { max-width: 380px; margin: 0 auto; }
    .tabbar-user { padding: 0 24px; }
    .strat-grid { grid-template-columns: 1fr; }
    .settings-input { width: 180px; }
    .bench-grid { grid-template-columns: repeat(2, 1fr); }
    .bench-ab-strip { flex-direction: column; padding: 24px; }
    .ab-divider { width: 100%; height: 1px; margin: 20px 0; }
    .rob-cta-strip { flex-direction: column; text-align: center; padding: 24px; }
    .rob-cta-btn { width: 100%; justify-content: center; }
    .hyp-grid { grid-template-columns: 1fr; }

    /* Dark hero sections */
    .dark-hero-section { padding: calc(var(--header-h) + 40px) var(--section-px) 60px; }
    .dark-hero-title { font-size: 38px; }

    /* Verdict radar — shrink for tablet */
    .verdict-radar-wrap { width: 380px; height: 380px; }
    .verdict-radar-wrap canvas { width: 220px !important; height: 220px !important; }
}

/* ── Large phone / small tablet ── */
@media (max-width: 768px) {
    :root { --section-px: 20px; }

    .dark-hero-section { min-height: auto; padding-top: calc(var(--header-h) + 48px); padding-bottom: 56px; }
    .dark-hero-title { font-size: 32px; }

    .evo-chart-wrap { height: 340px; }
    .bench-evo-stats { flex-wrap: wrap; gap: 24px; }
    .bench-evo-chart { height: 300px; }

    .rob-mini-verdict { flex-direction: column; gap: 12px; }
    .rob-mini-verdict-cta { align-self: flex-start; }

    .bench-conclusion { flex-direction: column; padding: 24px; }
    .bench-conclusion-cta { align-self: flex-start; }

    .bench-summary-text { font-size: 17px; padding-left: 18px; }

    .ab-value { font-size: 28px; }
    .ab-desc { font-size: 13px; }

    /* Settings — full-width inputs on tablet */
    .settings-input { width: 100%; margin-top: 8px; }
    .settings-row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .settings-row-val { margin-left: 0; }

    /* Strategy search — fluid on tablet */
    .strat-search { max-width: 100%; }

    /* Avatar dropdown — prevent overflow */
    .avatar-dropdown { width: 240px; right: 20px; }

    /* Inline 3-col glass grid → 2 cols */
    .rob-glass-grid[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }

    /* Verdict radar — smaller */
    .verdict-radar-wrap { width: 340px; height: 340px; }
    .verdict-radar-wrap canvas { width: 200px !important; height: 200px !important; }

    /* Spag chart — reduce height */
    .spag-chart-full { height: 360px; }

    /* Ncm tiers — single column */
    .ncm-tiers { grid-template-columns: 1fr; }
}

/* ── Phone ── */
@media (max-width: 640px) {
    .rob-glass-grid { grid-template-columns: repeat(2, 1fr); }
    .rob-glass-tooltip { width: 180px; right: -8px; font-size: 11px; padding: 8px 10px; }
    :root { --section-px: 16px; }

    .hero { padding-top: calc(var(--header-h) + 20px); }
    .hero-title { font-size: 28px; }
    .hero-subtitle { font-size: 14px; }
    .pnl-number { font-size: 40px; }
    .result-main { padding: 28px 24px 24px; }
    .waterfall-chart { padding: 20px 24px 18px; }
    .metric-cell { padding: 16px 20px; }

    .topbar { padding: 0 16px; }
    .tabbar, .tabbar-user { justify-content: flex-start; padding: 0 12px; }
    .tab-link, .user-tab-link { padding: 0 12px; font-size: 12px; }
    .tab-link svg, .user-tab-link svg { display: none; }

    .usage-grid { grid-template-columns: repeat(2, 1fr); }
    .strat-card-metrics { grid-template-columns: repeat(2, 1fr); }
    .settings-input { width: 100%; margin-top: 8px; }
    .settings-row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .settings-row-val { margin-left: 0; }
    .metrics-strip { grid-template-columns: 1fr; }
    .metric-cell { border-right: none; border-bottom: 1px solid var(--border); }
    .metric-cell:last-child { border-bottom: none; }
    .bench-grid { grid-template-columns: 1fr; }
    .trades-metrics-strip { flex-wrap: wrap; gap: 16px; }
    .trades-metric-val { font-size: 18px; }
    .trades-chart-full { height: 280px; }
    .trades-log-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .resilience-stats { grid-template-columns: repeat(2, 1fr); }
    .expect-grid { grid-template-columns: 1fr; }
    .eff-tab-hero { min-height: auto; padding-top: calc(var(--header-h) + 60px); padding-bottom: 60px; }
    .eff-tab-hero-title { font-size: 30px; }
    .eff-chart-full { height: 320px; }
    .eff-compare-grid { grid-template-columns: 1fr; }
    .eff-compare-row { grid-template-columns: 1fr; }
    .eff-compare-cell:nth-child(2) { border-left: none; }
    .eff-rebal-card { grid-template-columns: 1fr; }
    .eff-rebal-delta { flex-direction: row; border-left: none; border-right: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 12px 16px; }
    .eff-rebal-delta svg { transform: rotate(90deg); }
    .eff-narrative-card { padding: 24px 20px; gap: 14px; }
    .eff-narrative-section { padding: 48px var(--section-px); }
    .eff-narrative-text { font-size: 15px; }
    .verdict-hero { padding-top: calc(var(--header-h) + 40px); }
    .verdict-statement { font-size: 18px; max-width: 340px; }
    .verdict-takeaways-stack { margin-top: 32px; gap: 10px; }
    .verdict-takeaway { padding: 16px 16px; gap: 14px; }
    .verdict-takeaway-icon { width: 36px; height: 36px; border-radius: 9px; }
    .verdict-takeaway-icon svg { width: 18px; height: 18px; }
    .verdict-takeaway-num { font-size: 18px; }
    .verdict-takeaway-text { font-size: 13px; }
    .verdict-config-strip { gap: 6px; }
    .verdict-config-pill { font-size: 10px; padding: 3px 8px; }
    .verdict-hero-actions { flex-direction: column; align-items: center; gap: 8px; margin-top: 28px; }
    .verdict-ghost-btn { width: 100%; max-width: 280px; justify-content: center; font-size: 12px; padding: 9px 18px; }
    .dist-section { padding: 60px 0; }
    .dist-chart-full { height: 340px; }
    .spag-section { padding: 60px 0; }
    .spag-chart-full { height: 300px; }
    .section-title { font-size: 26px; }
    .section-text { font-size: 14px; }

    /* Dark hero sections */
    .dark-hero-section { padding-top: calc(var(--header-h) + 40px); padding-bottom: 48px; }
    .dark-hero-title { font-size: 28px; }
    .dark-hero-sub { font-size: 14px; margin-bottom: 28px; }

    /* Params panel & allocation */
    .params-panel { padding-top: 0; }
    .alloc-bar { margin-bottom: 10px; }

    /* Rob hero */
    .rob-hero-subtitle { font-size: 14px; }

    /* Bench hero responsive */
    .bench-evo-chart { height: 260px; }
    .bench-evo-stats { gap: 16px; }

    /* Calendar heatmap */
    .cal-heatmap-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Payment banner */
    .payment-banner-content { padding: 10px 16px; flex-wrap: wrap; font-size: 12px; }

    /* Topbar actions — increase touch targets */
    .topbar-btn { padding: 8px 14px; font-size: 11px; min-height: 36px; }
    .topbar-brand { font-size: 14px; }

    /* Avatar dropdown — fluid width */
    .avatar-dropdown { width: calc(100vw - 32px); max-width: 260px; right: 16px; }

    /* Rob CTA */
    .rob-cta-question { font-size: 17px; }

    /* Bench summary */
    .bench-summary-text { font-size: 16px; }

    /* Account page */
    .acct-page { padding: calc(var(--header-h) + 32px) var(--section-px) 60px; }
    .acct-usage-grid { grid-template-columns: 1fr; }
    .acct-profile-header { flex-direction: column; text-align: center; gap: 12px; }

    /* Strategy search — full width */
    .strat-search { max-width: 100%; }

    /* Portfolio positions */
    .port-row { padding: 12px 14px; gap: 10px; }
    .port-row-input-wrap { padding: 5px 10px; }
    .port-row-input { width: 52px; font-size: 13px; }

    /* Save modal — override inline max-width */
    .save-modal { max-width: 94vw !important; }
    .save-modal-header { padding: 24px 24px 0; }
    .save-modal-body { padding: 16px 24px 0; }
    .save-modal-footer { padding: 16px 24px 24px; }

    /* No-credits modal */
    .ncm-features { grid-template-columns: 1fr; }
    .ncm-plans { grid-template-columns: 1fr; }
    .ncm-hero { padding: 28px 24px 24px; }
    .ncm-features, .ncm-plans { padding: 0 24px; }

    /* Verdict radar — phone */
    .verdict-radar-wrap { width: 300px; height: 300px; }
    .verdict-radar-wrap canvas { width: 180px !important; height: 180px !important; }

    /* Trades table header — tighter padding */
    .trades-table th { padding: 12px 14px; }
    .trades-table td { padding: 10px 14px; }
}

/* ── Small phone ── */
@media (max-width: 400px) {
    :root { --section-px: 12px; }

    .hero-title { font-size: 24px; }
    .pnl-number { font-size: 32px; }
    .result-main { padding: 24px 18px 20px; }
    .waterfall-chart { padding: 18px 18px 16px; }
    .mk-bar { width: 80px; }
    .mk-bar-val { font-size: 12px; }
    .section-title { font-size: 22px; }

    .dark-hero-title { font-size: 24px; }
    .dark-hero-sub { font-size: 13px; }

    .tab-link, .user-tab-link { padding: 0 10px; font-size: 11px; }
    .topbar-brand { font-size: 13px; }
    .topbar-btn { padding: 6px 10px; font-size: 10px; min-height: 36px; }

    .verdict-grade-word { font-size: clamp(48px, 10vw, 80px); }
    .verdict-statement { font-size: 16px; max-width: 280px; }

    .rob-gauge-ring { width: 160px; height: 160px; }
    .rob-gauge-ring svg { width: 160px; height: 160px; }
    .rob-gauge-score { font-size: 40px; }

    .bench-multiplier { font-size: 22px; }
    .bench-bars-wrap { height: 100px; }

    .eff-chart-full { height: 280px; }

    /* Modals & slide-over */
    .no-credits-card { width: 96%; }
    .ncm-hero { padding: 24px 20px 20px; }
    .ncm-features { padding: 0 20px; grid-template-columns: 1fr; }
    .ncm-plans { padding: 0 20px; grid-template-columns: 1fr; }
    .ncm-plan-price { font-size: 22px; }
    .ncm-tiers { grid-template-columns: 1fr; padding: 0 20px; }

    /* Portfolio */
    .port-mode-bar { width: 100%; }
    .port-mode-btn { flex: 1; text-align: center; padding: 8px 12px; }
    .port-chips { gap: 6px; }
    .port-chip { padding: 5px 10px; font-size: 11px; }

    /* Account */
    .profile-avatar { width: 56px; height: 56px; font-size: 18px; }
    .profile-name { font-size: 18px; }
    .plan-card-header { padding: 24px; }
    .plan-card-body { padding: 20px 24px; }
    .plan-card-footer { padding: 0 24px 20px; }

    /* Verdict radar — small phone */
    .verdict-radar-wrap { width: 260px; height: 260px; }
    .verdict-radar-wrap canvas { width: 160px !important; height: 160px !important; }
}
