/* Shared styles for all individual plan pages */
body { padding-top: 110px; }
body:has(.rules-page-wrap) {
    background: var(--theme);
}

/* ── Sticky TOC ──────────────────────────────────────────────────────────────
   Moves sticky from .rules-toc-inner (broken by body overflow-x:hidden) to
   the flex item itself. Works reliably across all browsers.
   Add this file to any future plan/FAQ detail page to get the same behaviour.
   ──────────────────────────────────────────────────────────────────────────── */
.rules-toc {
    position: sticky;
    top: 7.5rem;          /* clears the fixed nav + announcement bar */
    align-self: flex-start;
    max-height: calc(100vh - 8.5rem);
    overflow-y: auto;
    scrollbar-width: none; /* hide scrollbar on the TOC itself */
}
.rules-toc::-webkit-scrollbar { display: none; }
/* Inner card no longer needs its own sticky */
.rules-toc-inner { position: static; }

.plan-breadcrumb { font-size: 0.85rem; color: var(--text-on-theme-dim); margin-bottom: 0.75rem; }
.plan-breadcrumb a { color: var(--text-on-theme-dim); text-decoration: none; transition: color 0.2s; }
.plan-breadcrumb a:hover { color: var(--text-on-theme); }

/* Mobile layout fixes */
@media(max-width:720px) {
    /* Align page-level header text with section card content */
    .rules-content .plan-breadcrumb,
    .rules-content .rules-badge,
    .rules-content .rules-title,
    .rules-content .rules-meta,
    .rules-content .plan-size-row {
        padding-left: 1.5rem;
    }

    /* On mobile the section card h2 + phase grid share one container.
       Remove section's horizontal padding so the phase-grid fills the full
       inner width, then pad only the h2 and text content. */
    .rules-section {
        padding-left: 0;
        padding-right: 0;
    }
    .rules-section h2 {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        margin-bottom: 0.75rem;
    }
    /* Text content inside rules-card stays readable */
    .rules-section .rules-card > p,
    .rules-section .rules-card > ul,
    .rules-section .rules-step-list,
    .rules-section > p {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    /* Phase grid fills full section width — let phase-cards breathe on sides */
    .phase-grid {
        padding: 0.75rem 1rem 0.25rem;
    }
}

/* Size selector + % / $ toggle row */
.plan-size-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2.5rem; }
.size-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.plan-size-btn { padding: 0.3rem 0.9rem; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 999px; font-size: 0.8rem; color: var(--text-on-theme-dim); cursor: pointer; transition: all 0.2s; }
.plan-size-btn.active { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); color: var(--text-on-theme); }
.plan-size-btn:hover:not(.active) { border-color: rgba(255,255,255,0.35); color: var(--text-on-theme); }

.plan-mode-toggle { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.plan-mode-toggle > span { font-size: 0.78rem; color: var(--text-on-theme-dim); }
#mode-label { font-size: 0.78rem; font-weight: 600; color: var(--text-on-dark); min-width: 7rem; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 52px; height: 28px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #CBD5E1; transition: .3s; border-radius: 9999px; border: 1px solid rgba(0,0,0,0.1); }
.toggle-switch .slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; transition: .3s; border-radius: 50%; }
.toggle-switch input:checked + .slider { background: #4282cb; border-color: #4282cb; }
.toggle-switch input:checked + .slider:before { transform: translateX(24px); }

/* Prevent layout shift when switching to dollar amounts */
.phase-stat-val { min-width: 5.5rem; }

/* Phase cards */
.phase-grid { display: grid; gap: 1.25rem; }
.phase-grid.cols-1 { grid-template-columns: 1fr; max-width: 380px; }
.phase-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.phase-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media(max-width: 700px) { .phase-grid.cols-2, .phase-grid.cols-3 { grid-template-columns: 1fr; } }

.phase-card { background: var(--theme-light); border: 1px solid rgba(0,0,0,0.08); border-radius: 1rem; padding: 1.5rem; }
.phase-card-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 0.35rem; }
.phase-card-name { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1.2rem; }
.phase-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.phase-stat-lbl { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.phase-stat-val { font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.phase-stat-val.gold { color: #4ade80; }
.phase-stat-val.red { color: #f87171; }
.phase-card-meta { font-size: 0.82rem; color: var(--text-secondary); border-top: 1px solid rgba(0,0,0,0.06); padding-top: 0.85rem; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.phase-card-meta strong { color: var(--text-primary); }

/* Reward cycle mini cards */
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media(max-width: 500px) { .rc-grid { grid-template-columns: 1fr; } }
.rc-mini { background: var(--theme-light); border: 1px solid rgba(0,0,0,0.08); border-radius: 1rem; padding: 1.4rem; display: flex; flex-direction: column; gap: 0.3rem; }
.rc-mini-period { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 0.5rem; }
.rc-mini-pct { font-size: 2.8rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.rc-mini-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 1rem; }
.rc-mini-details { display: flex; flex-direction: column; gap: 0.5rem; border-top: 1px solid rgba(0,0,0,0.06); padding-top: 0.9rem; margin-top: auto; }
.rc-mini-row { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-secondary); }
.rc-mini-row span:last-child { color: var(--text-primary); font-weight: 500; }

/* Highlight cards (first payout, fee refund) */
.highlight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width: 560px) { .highlight-grid { grid-template-columns: 1fr; } }
.highlight-card { display: flex; align-items: flex-start; gap: 0.9rem; background: var(--accent-tint-6); border: 1px solid var(--accent-soft); border-radius: 0.85rem; padding: 1.1rem 1.2rem; }
.hc-icon { flex-shrink: 0; width: 2.1rem; height: 2.1rem; background: var(--accent-tint-8); border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; color: var(--theme-accent); font-size: 0.88rem; margin-top: 0.1rem; }
.highlight-card p { margin: 0; font-size: 0.84rem; line-height: 1.55; color: var(--text-secondary); }
.highlight-card p strong { color: var(--theme-accent); }

/* ── Simulation disclaimer banner ── */
.rules-meta + .sim-disclaimer {
    margin-top: -1.5rem;
}
.sim-disclaimer {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.4);
    border-radius: 10px;
    padding: 0.9rem 1.25rem;
    margin: 0.25rem 0 1.5rem;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-on-dark);
}
.sim-disclaimer strong {
    display: block;
    color: #fca5a5;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

/* ── Drawdown tooltip icon (clickable ⓘ on red drawdown labels) ── */
.dd-info-icon {
    display: inline-block;
    color: rgba(248, 113, 113, 0.55);
    font-size: 0.72em;
    vertical-align: middle;
    margin-left: 0.25rem;
    cursor: pointer;
    transition: color 0.15s;
}
.phase-stat-lbl.dd-clickable,
.dd-clickable { cursor: pointer; }
.phase-stat-lbl.dd-clickable:hover .dd-info-icon,
.dd-clickable:hover .dd-info-icon { color: #f87171; }
