/* ============================================
   CRYPTO STRATEGY TOOL
   ============================================ */
/* ── Tool layout ── */
.strategy-affiliate-layout {
    display: grid;
    grid-template-columns: minmax(0, 900px) 152px;
    gap: 1.5rem;
    align-items: start;
    justify-content: center;
}

.strategy-tool {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* ── Sidebar ── */
.strategy-ledger-sidebar {
    position: sticky;
    top: 1rem;
}

.strategy-ledger-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.75rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.strategy-ledger-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 24px rgba(var(--shadow-color-rgb), 0.22);
}

.strategy-ledger-card a {
    display: block;
    line-height: 0;
    border-radius: 6px;
    overflow: hidden;
}

.strategy-ledger-card img {
    display: block;
    width: 120px;
    height: auto;
}

/* ── Shared affiliate card elements ── */
.cc-ledger-badge {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.62rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.6;
}

.cc-ledger-badge--sm {
    font-size: 0.58rem;
    padding: 1px 6px;
}

.cc-ledger-mobile-brand {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

/* ── Mobile image ── */
.strategy-ledger-mobile a {
    display: block;
    line-height: 0;
}

.strategy-ledger-mobile img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.strategy-ledger-mobile {
    display: none;
}

.strategy-ledger-mobile[hidden] {
    display: none !important;
}

.strategy-tool .input-group {
    margin-bottom: 0;
}

.strategy-tool .input-group label {
    margin-bottom: 0.45rem;
}

.strategy-tool .label-note {
    color: var(--text-muted);
    font-weight: 400;
}

.strategy-tool .input-prefix {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    overflow: hidden;
    transition: var(--transition);
}

.strategy-tool .input-prefix:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.12);
}

.strategy-tool .prefix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0 0.9rem;
    background: var(--surface);
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 800;
    user-select: none;
}

.strategy-tool .input-prefix input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    padding: 0.75rem 0.9rem;
}

.strategy-tool .input-prefix input::placeholder {
    color: var(--text-muted);
}

/* ── Tabs ── */
.calc-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.35rem;
    margin-bottom: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    scrollbar-width: none;
}
.calc-tabs::-webkit-scrollbar { display: none; }
.calc-tab {
    flex: 1;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    text-align: center;
}
.calc-tab:hover {
    color: var(--text);
    background: rgba(var(--primary-rgb), 0.06);
}
.calc-tab.active {
    color: var(--on-primary);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 10px 24px rgba(var(--primary-rgb), 0.24);
}
.calc-tab:focus-visible,
.calc-btn:focus-visible,
.copy-btn:focus-visible,
.add-entry-btn:focus-visible,
.remove-entry-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.18);
}
.calc-section { display: none; }
.calc-section.active { display: block; animation: fadeUp 0.25s ease; }

/* ── Input grid ── */
.inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.inputs-grid-4 { grid-template-columns: repeat(4, 1fr); }

#dcaSection > .input-group {
    margin-bottom: 1.25rem;
}

.dca-current-group {
    margin-bottom: 1.25rem;
}

.dca-section-label {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Calculate button ── */
.calc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1.15rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    box-shadow: 0 14px 30px rgba(var(--primary-rgb), 0.22);
}
.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(var(--primary-rgb), 0.28);
}
.calc-btn:active { transform: translateY(0); }

.strategy-error {
    margin-top: 0.75rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(var(--danger-rgb), 0.3);
    border-radius: 8px;
    background: rgba(var(--danger-rgb), 0.1);
    color: var(--danger);
    font-weight: 700;
}

/* ── Results panel ── */
.results-panel {
    display: none;
    animation: fadeUp 0.3s ease;
}
.results-panel.visible { display: block; }

/* ── Hero result card ── */
.hero-result {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    padding: 1.75rem;
    text-align: center;
    color: var(--on-primary);
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}
.hero-result::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(var(--on-primary-rgb), 0.06);
    border-radius: 50%;
}
.hero-result-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}
.hero-result-value {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.35rem;
}
.hero-result-sub {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* ── Result cards grid ── */
.result-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem;
    text-align: center;
    transition: border-color 0.2s;
}
.result-card:hover { border-color: var(--primary); }
.result-card-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: block;
}
.result-card-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}
.result-card-value.positive { color: var(--success); }
.result-card-value.negative { color: var(--danger); }
.result-card-value.warning  { color: var(--warning); }

/* ── Feasibility gauge ── */
.gauge-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.gauge-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.gauge-bar-track {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        var(--success) 0%,
        var(--success) 20%,
        var(--lime) 20%,
        var(--lime) 40%,
        var(--warning) 40%,
        var(--warning) 60%,
        var(--danger) 60%,
        var(--danger) 80%,
        var(--purple) 80%,
        var(--purple) 100%
    );
    position: relative;
    margin-bottom: 0.5rem;
}
.gauge-needle {
    position: absolute;
    top: -4px;
    left: 10%;
    width: 4px;
    height: 20px;
    background: var(--text);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 0 2px var(--bg);
}

.gauge-needle-initial {
    left: 10%;
}
.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}
.gauge-verdict {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.85rem;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}
.gauge-verdict.easy     { background: rgba(var(--success-rgb), 0.1); color: var(--success); border: 1px solid rgba(var(--success-rgb), 0.25); }
.gauge-verdict.likely   { background: rgba(var(--lime-rgb), 0.1);  color: var(--lime); border: 1px solid rgba(var(--lime-rgb), 0.25); }
.gauge-verdict.possible { background: rgba(var(--warning-rgb), 0.1);  color: var(--warning); border: 1px solid rgba(var(--warning-rgb), 0.25); }
.gauge-verdict.hard     { background: rgba(var(--danger-rgb), 0.1);   color: var(--danger);  border: 1px solid rgba(var(--danger-rgb), 0.25); }
.gauge-verdict.moonshot { background: rgba(var(--purple-rgb), 0.12); color: var(--purple-light); border: 1px solid rgba(var(--purple-rgb), 0.3); }

/* ── Benchmark section ── */
.benchmark-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.benchmark-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.benchmark-title-note {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
    opacity: 0.7;
}
.benchmark-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.benchmark-item:last-child { border-bottom: none; }
.benchmark-info { flex: 1; min-width: 0; }
.benchmark-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.benchmark-cap  { font-size: 0.78rem; color: var(--text-muted); }
.benchmark-bar-wrap {
    flex: 2;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.benchmark-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}
.benchmark-ratio {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    width: 80px;
    text-align: right;
    flex-shrink: 0;
}
.benchmark-warning {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(var(--danger-rgb), 0.08);
    border: 1px solid rgba(var(--danger-rgb), 0.25);
    border-radius: 8px;
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
}

/* ── Copy button ── */
.copy-btn {
    width: 100%;
    min-height: 44px;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}
.copy-btn:hover {
    border-color: rgba(var(--primary-rgb), 0.35);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    transform: translateY(-1px);
}

.dca-copy-btn {
    margin-top: 1.25rem;
}

.reset-btn {
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    margin-top: 0.5rem;
}
.reset-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ── DCA entries ── */
.dca-entries {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.dca-entry {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.85rem;
    align-items: end;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: fadeUp 0.2s ease;
}
.dca-entry-num {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
    font-weight: 800;
}
.remove-entry-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--surface);
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    padding: 0;
    align-self: flex-end;
}
.remove-entry-btn:hover {
    background: rgba(var(--danger-rgb), 0.08);
    border-color: rgba(var(--danger-rgb), 0.45);
    transform: translateY(-1px);
}
.add-entry-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px dashed rgba(var(--primary-rgb), 0.4);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.add-entry-btn:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.07);
    transform: translateY(-1px);
}

/* ── DCA results ── */
.dca-avg-result {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    color: var(--on-primary);
    margin-bottom: 1.25rem;
}
.dca-avg-result .hero-result-value { font-size: 2rem; }

.dca-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ── DCA recovery ── */
.recovery-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.recovery-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recovery-subtitle {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
}
.recovery-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.recovery-result {
    padding: 1rem;
    border-radius: 10px;
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    text-align: center;
    display: none;
}
.recovery-result.visible { display: block; }
.recovery-result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 0.25rem;
}
.recovery-result-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.recovery-impossible {
    color: var(--danger);
    font-size: 0.875rem;
    text-align: center;
    padding: 0.75rem;
    background: rgba(var(--danger-rgb), 0.08);
    border: 1px solid rgba(var(--danger-rgb), 0.2);
    border-radius: 8px;
    display: none;
}

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .calc-tabs {
        flex-direction: column;
        gap: 0.3rem;
    }
    .inputs-grid { grid-template-columns: 1fr; }
    .inputs-grid-4 { grid-template-columns: 1fr 1fr; }
    .dca-entry { grid-template-columns: 1fr; }
    .remove-entry-btn {
        width: 100%;
    }
    .result-cards { grid-template-columns: 1fr 1fr; }
    .dca-stats { grid-template-columns: 1fr; }
    .recovery-inputs { grid-template-columns: 1fr; }
    .hero-result-value { font-size: 1.75rem; }
}
@media (max-width: 860px) {
    .ledger-mobile-ad-active .tool-page {
        padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
    }

    .strategy-affiliate-layout {
        display: block;
    }

    .strategy-ledger-sidebar {
        display: none;
    }

    .strategy-ledger-mobile {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        display: grid;
        grid-template-columns: minmax(0, 320px) 44px;
        grid-template-areas:
            "label close"
            "ad close";
        justify-content: center;
        align-items: center;
        column-gap: 0.55rem;
        row-gap: 0.25rem;
        width: 100%;
        padding: 0.45rem 0.75rem calc(0.45rem + env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        background: var(--bg);
        box-shadow: 0 -14px 32px rgba(var(--shadow-color-rgb), 0.18);
        transform: translateY(0);
        transition: transform 0.18s ease, opacity 0.18s ease;
    }

    .strategy-ledger-mobile.is-near-footer {
        opacity: 0;
        pointer-events: none;
        transform: translateY(100%);
    }

    .strategy-ledger-mobile a {
        grid-area: ad;
        justify-self: center;
        min-width: 0;
        width: 100%;
        max-width: 320px;
        overflow: hidden;
        border-radius: 6px;
    }

    .strategy-ledger-mobile-label {
        grid-area: label;
        justify-self: start;
        width: 100%;
        max-width: 320px;
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .strategy-ledger-mobile img {
        width: 100%;
        max-height: 50px;
        object-fit: contain;
    }

    .strategy-ledger-mobile button {
        grid-area: close;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        border: none;
        border-radius: 8px;
        background: transparent;
        color: var(--text-muted);
        font: inherit;
        font-size: 1rem;
        line-height: 1;
        cursor: pointer;
        transition: color 0.15s;
    }

    .strategy-ledger-mobile button:hover,
    .strategy-ledger-mobile button:focus-visible {
        color: var(--text);
        outline: none;
    }
}
@media (max-width: 480px) {
    .result-cards { grid-template-columns: 1fr; }
}

