/* --- Theme Tokens --- */
:root {
    --fm-surface-card: rgba(9, 12, 20, 0.82);
    --fm-surface-card-strong: linear-gradient(160deg, rgba(12, 17, 27, 0.96), rgba(9, 14, 24, 0.9));
    --fm-surface-border: rgba(148, 163, 184, 0.16);
    --fm-section-surface: rgba(12, 18, 30, 0.65);
    --fm-section-border: rgba(71, 85, 105, 0.24);
    --fm-input-bg: rgba(18, 26, 42, 0.88);
    --fm-input-bg-hover: rgba(26, 34, 52, 0.9);
    --fm-input-border: rgba(148, 163, 184, 0.2);
    --fm-input-border-focus: #60a5fa;
    --fm-text-primary: #f3f4f6;
    --fm-text-secondary: #cbd5e1;
    --fm-accent: #3b7dd8;
    --fm-accent-hover: #4b8fe2;
    --fm-accent-shadow: rgba(74, 125, 207, 0.2);
    --fm-focus-ring: rgba(92, 145, 217, 0.3);
    --fm-disabled-opacity: 0.62;
    --fm-accent-gradient: linear-gradient(135deg, #4f8efc, #3a7bd5 70%);

    /*
     * Layer tokens
     * The host layer must outrank the result panel so form tooltips are not
     * clipped when a sticky result container is present on the page.
     */
    --fm-layer-tooltip-topmost: 1400;
    --fm-layer-tooltip-host: 1470;
    --fm-layer-tooltip-base: 1450;
    --fm-layer-tooltip-panel: 1460;

    /* Tooltip tokens */
    --fm-tooltip-bg: #111827; /* gray-900 */
    --fm-tooltip-text: #f3f4f6; /* gray-100 */
    --fm-tooltip-border: #334155; /* gray-700 */
    --fm-tooltip-shadow: 0 20px 25px -5px rgb(15 23 42 / 0.45),
        0 10px 10px -5px rgb(15 23 42 / 0.35);

    /* Typography tokens */
    --fm-font-size-page-title: clamp(2.5rem, 2.1rem + 1vw, 3.5rem);
    --fm-font-size-form-control: 0.95rem;
    --fm-font-size-math: clamp(1rem, 0.92rem + 0.55vw, 1.35rem);

    /* Layout tokens */
    --fm-layout-result-height-default: clamp(22rem, 68vh, 28rem);
    --fm-layout-result-height-compact: clamp(20rem, 64vh, 24rem);
    --fm-layout-result-height-tall: clamp(24rem, 72vh, 32rem);
    --fm-chart-height-base: 20rem;
    --fm-chart-height-responsive: clamp(20rem, 32vw, 28rem);
    --fm-chart-height-responsive-xl: clamp(22rem, 28vw, 32rem);
    --fm-chart-height-tall: clamp(24rem, 40vw, 34rem);
    --fm-chart-height-tall-xl: clamp(28rem, 32vw, 38rem);
}

/* --- Global Shell --- */
.app-shell {
    position: relative;
    isolation: isolate;
    background: linear-gradient(135deg, #0a1525 0%, #08101d 55%, #03060d 100%);
    background-attachment: fixed;
}

.app-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.app-background__glow {
    position: absolute;
    filter: blur(72px);
    opacity: 0.3;
    border-radius: 50%;
    mix-blend-mode: screen;
    animation: floatGlow 16s ease-in-out infinite;
}

.app-background__glow--primary {
    width: 48rem;
    height: 48rem;
    background: radial-gradient(circle, rgba(65, 123, 210, 0.14), transparent 52%);
    top: -8rem;
    left: -10rem;
    animation-delay: 0.6s;
}

.app-background__glow--secondary {
    width: 42rem;
    height: 42rem;
    background: radial-gradient(circle, rgba(54, 118, 194, 0.12), transparent 52%);
    bottom: -8rem;
    right: -12rem;
    animation-delay: 3.6s;
}

.app-background__mesh {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
    background-size: 32px 32px;
    opacity: 0.22;
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.42), transparent 70%);
}

/* --- Typography Utilities --- */
.result-heading {
    font-family: 'Noto Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.page-title {
    font-size: var(--fm-font-size-page-title);
    line-height: 1.2;
    background: linear-gradient(118deg, #f8fafc 0%, #e5ecf5 52%, #dbe5f0 100%);
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.18));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.numeric-output {
    font-family: 'Noto Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
    font-variant-numeric: lining-nums tabular-nums;
    letter-spacing: 0.005em;
}

.math-callout,
.math-notation {
    font-variant-numeric: lining-nums;
}

.math-notation {
    font-size: var(--fm-font-size-math);
    line-height: 1.5;
}

.math-callout mjx-container,
.math-notation mjx-container {
    font-variant-numeric: normal;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: visible;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
}

.math-callout {
    font-size: var(--fm-font-size-math);
    line-height: 1.6;
    letter-spacing: 0.01em;
    display: grid;
    justify-content: center;
    justify-items: center;
    text-align: center;
    gap: 0.35rem;
}

.math-callout--compact {
    font-size: clamp(0.95rem, 0.9rem + 0.45vw, 1.2rem);
}

.math-callout--compact mjx-container {
    font-size: 0.98em;
}

.math-callout mjx-container {
    text-align: center;
    display: block;
    margin-inline: auto;
    max-width: min(100%, 960px);
    width: fit-content;
}

.math-callout mjx-container svg,
.math-notation mjx-container svg {
    max-width: 100%;
    height: auto;
    display: block;
}

code,
kbd,
samp,
pre {
    font-family: 'Noto Sans Math', 'Noto Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-variant-numeric: lining-nums tabular-nums;
}

.panel-card {
    position: relative;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)) padding-box,
        var(--fm-surface-card-strong);
    border-radius: 1.25rem;
    border: 1px solid var(--fm-surface-border);
    box-shadow: 0 18px 30px -24px rgba(15, 23, 42, 0.85), 0 1px 0 0 rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(12px) saturate(112%);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, filter 0.25s ease;
    will-change: transform, box-shadow, filter, border-color;
    backface-visibility: hidden;
}

.panel-card::before {
    content: '';
    position: absolute;
    inset: 0.08rem;
    border-radius: 1.1rem;
    background: linear-gradient(135deg, rgba(63, 124, 216, 0.06), rgba(65, 138, 205, 0.05));
    opacity: 0.2;
    transition: opacity 0.25s ease, filter 0.25s ease;
    pointer-events: none;
    z-index: 0;
}

.panel-card:hover {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.24);
    filter: brightness(1.02);
    box-shadow: 0 16px 30px -26px rgba(74, 125, 207, 0.28), 0 14px 20px -26px rgba(65, 138, 205, 0.22);
}

.panel-card:hover::before {
    opacity: 0.7;
    filter: brightness(1.08);
}

.panel-card,
.result-container,
.tab-panel,
.mobile-landscape-form,
.mobile-landscape-result {
    min-width: 0;
    max-width: 100%;
}

.panel-card > * {
    position: relative;
    z-index: 1;
}

.panel-card,
.section-card,
.result-container {
    overflow-wrap: break-word;
    word-break: break-word;
}

.result-container[data-result-present="true"] {
    position: relative;
    z-index: var(--fm-layer-tooltip-topmost);
}

.result-container[data-result-present="true"] .panel-card--result {
    position: relative;
    z-index: calc(var(--fm-layer-tooltip-topmost) + 1);
    background:
        linear-gradient(#1e293b, #1e293b) padding-box,
        linear-gradient(145deg, var(--fm-accent), rgba(148, 163, 184, 0.18) 60%, rgba(148, 163, 184, 0.18)) border-box;
    border: 1.5px solid transparent;
    box-shadow: none;
}

.panel-card--muted {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.48), rgba(12, 19, 38, 0.55));
    border-color: rgba(148, 163, 184, 0.2);
}

.result-container {
    min-height: auto;
}

.result-container--compact {
    min-height: auto;
}

.result-container--tall {
    min-height: auto;
}

[data-calculator-layout] {
    --calculator-note-offset: 0px;
}

[data-calculator-layout] .result-container {
    display: flex;
    flex-direction: column;
    align-self: start;
    position: relative;
    padding-top: var(--calculator-note-offset, 0px);
}

.result-container[data-loading="true"] > :not(.result-loading-overlay) {
    opacity: 0.45;
    filter: blur(1px);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.result-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    border-radius: inherit;
    z-index: 5;
    pointer-events: none;
}

.result-loading-overlay .loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: 9999px;
    background: rgba(30, 41, 59, 0.85);
    color: var(--fm-text-primary, #e2e8f0);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 18px 35px -28px rgba(15, 23, 42, 0.8);
}

.result-loading-overlay .loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    border: 3px solid rgba(148, 163, 184, 0.35);
    border-top-color: var(--fm-accent, #6366f1);
    animation: fm-spin 0.9s linear infinite;
}

.result-loading-overlay .loading-text {
    font-size: 0.95rem;
}

@keyframes fm-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

[data-calculator-layout] .result-container > .panel-card {
    flex: 0 0 auto;
}

[data-calculator-layout] .result-container [data-calculator-note] {
    flex: 0 0 auto;
}

[data-calculator-layout][data-note-active] .result-container [data-calculator-note] {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

[data-calculator-layout] > [data-calculator-form] {
    transition: margin-top 0.3s ease;
    margin-top: 0;
}

[data-calculator-explanation] {
    --calculator-note-offset: 0px;
    --calculator-explanation-base-offset: 2rem;
    transition: margin-top 0.3s ease;
    margin-top: calc(var(--calculator-explanation-base-offset) + var(--calculator-note-offset));
}

.section-card {
    border-radius: 0.75rem;
    border: 1px solid var(--fm-section-border);
    background: var(--fm-section-surface);
    box-shadow: 0 12px 30px -22px rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(5px);
}

.input-field {
    display: block;
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 0.65rem;
    background: var(--fm-input-bg);
    border: 1px solid var(--fm-input-border);
    color: var(--fm-text-primary);
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.24);
    font-size: var(--fm-font-size-form-control);
    line-height: 1.5;
}

.input-field:hover {
    background: var(--fm-input-bg-hover);
}

.input-field:focus {
    outline: none;
    border-color: var(--fm-input-border-focus);
    box-shadow: 0 14px 28px -24px rgba(148, 163, 184, 0.7);
    background: rgba(54, 69, 92, 0.78);
}

.form-label {
    font-size: var(--fm-font-size-form-control);
    font-weight: 500;
    line-height: 1.45;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
}

.form-label .label-text {
    flex: 1 1 auto;
    min-width: 0;
}

.form-label .tooltip {
    flex: 0 0 auto;
}

.option-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.45;
    font-style: italic;
    color: #9ca3af;
}

.input-field:disabled,
.input-field[readonly] {
    opacity: var(--fm-disabled-opacity);
    cursor: not-allowed;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-radius: 0.85rem;
    font-weight: 600;
    color: var(--fm-text-primary);
    background: var(--fm-accent-gradient);
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border 0.2s ease;
    box-shadow: 0 16px 28px -18px var(--fm-accent-shadow);
}

.primary-button:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #4a86e6, #3b7dd8);
    box-shadow: 0 18px 34px -18px rgba(74, 125, 207, 0.26);
}

.primary-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--fm-focus-ring);
}

.primary-button:disabled {
    opacity: var(--fm-disabled-opacity);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Global Animations & Utilities --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(0.625rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes floatGlow {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(1.5rem, -1rem, 0) scale(1.05); }
}

.fade-in, .fade-in-delay {
    opacity: 0;
    will-change: opacity, transform;
    animation: fadeIn 0.5s ease-out both;
}

.fade-in-delay {
    animation-delay: 0.2s;
}

.no-tap-highlight {
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Chart Containers --- */
.chart-box {
    position: relative;
    height: var(--chart-box-height, var(--fm-chart-height-base));
    flex: 0 0 auto;
    z-index: 0;
}

.chart-box canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.chart-box--responsive {
    --chart-box-height: var(--fm-chart-height-responsive);
}

.chart-box--tall {
    --chart-box-height: var(--fm-chart-height-tall);
}

@media (min-width: 1280px) {
    .chart-box--responsive {
        --chart-box-height: var(--fm-chart-height-responsive-xl);
    }

    .chart-box--tall {
        --chart-box-height: var(--fm-chart-height-tall-xl);
    }
}

/* --- Advanced Tooltip Styles (from options.html) --- */
[data-tooltip-layer-root] {
    position: relative;
    overflow: visible;
}

/* Ensure dynamic result panels don't clip inline tooltips (e.g., Greeks) */
.result-container,
.result-container .panel-card--result,
.greek-tooltip-layer {
    overflow: visible;
}

.result-container .panel-card--result {
    /* Reset stacking context properties to allow tooltips to escape */
    transform: none;
    will-change: auto;
    backface-visibility: visible;
    perspective: none;
}

.greek-tooltip-layer {
    position: relative;
    overflow: visible;
    z-index: calc(var(--fm-layer-tooltip-topmost) + 2);
    /* Keep Greek tooltips on their original relative stack so they render above
     * inline charts and panels without competing with the elevated form
     * tooltips that need to outrank sticky result containers.
     */
    --fm-layer-tooltip-base: calc(var(--fm-layer-tooltip-topmost) + 2);
    --fm-layer-tooltip-panel: calc(var(--fm-layer-tooltip-topmost) + 3);
    --fm-layer-tooltip-host: calc(var(--fm-layer-tooltip-topmost) + 4);
}

.greek-tooltip-layer .greek-metrics-grid {
    position: relative;
    overflow: visible;
}

.greek-tooltip-layer .tooltip.tooltip-active {
    z-index: calc(var(--fm-layer-tooltip-topmost) + 3);
}

.greek-tooltip-layer .tooltip .tooltiptext {
    z-index: calc(var(--fm-layer-tooltip-topmost) + 4);
}

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    z-index: var(--fm-layer-tooltip-base);
    isolation: isolate;
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
}

.tooltip.tooltip-active {
    z-index: var(--fm-layer-tooltip-panel);
}

.tooltip-host-active,
.result-container[data-result-present="true"] .tooltip-host-active {
    position: relative;
    z-index: var(--fm-layer-tooltip-host);
    isolation: isolate;
}

.tooltip .tooltiptext {
    --tooltip-inline-shift: 0px;
    visibility: hidden;
    opacity: 0;
    width: min(280px, calc(100vw - 2.5rem)); /* Shrink gracefully when the viewport is narrow */
    background-color: var(--fm-tooltip-bg);
    color: var(--fm-tooltip-text);
    font-size: var(--fm-font-size-form-control);
    line-height: 1.5;
    text-align: left;
    border-radius: 0.5rem; /* rounded-lg */
    padding: 1rem; /* p-4 */
    position: absolute;
    z-index: var(--fm-layer-tooltip-panel);
    bottom: 125%; /* Start by appearing above */
    left: 50%;
    transform: translateX(calc(-50% + var(--tooltip-inline-shift)));
    transition: opacity 0.3s ease;
    box-shadow: var(--fm-tooltip-shadow);
    border: 1px solid var(--fm-tooltip-border);
    backdrop-filter: none;
}

/* Allow tooltips and other overlays to render outside collapsible cards */
details.section-card[data-collapsible-section] {
    overflow: visible;
}

/* Arrow for the tooltip */
.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    left: calc(50% - var(--tooltip-inline-shift));
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
}

/* Logic for positioning arrow (JS will add/remove these classes) */
.tooltip .tooltiptext.show-top::after {
    top: 100%; /* Arrow at the bottom */
    border-color: var(--fm-tooltip-bg) transparent transparent transparent;
}
.tooltip .tooltiptext.show-bottom::after {
    bottom: 100%; /* Arrow at the top */
    border-color: transparent transparent var(--fm-tooltip-bg) transparent;
}
.tooltip .tooltiptext.show-left {
    left: 0;
    transform: translateX(0);
}
.tooltip .tooltiptext.show-right {
    left: auto;
    right: 0;
    transform: translateX(0);
}
.tooltip .tooltiptext.show-left::after {
    left: 1.5rem;
    margin-left: 0;
}
.tooltip .tooltiptext.show-right::after {
    left: auto;
    right: 1.5rem;
    margin-left: 0;
}

/* A class that our JavaScript will add to show the tooltip */
.tooltip .tooltiptext.tooltip-visible {
    visibility: visible;
    opacity: 1;
}

.tooltip:focus {
    outline: none;
}

.tooltip:focus-visible {
    outline: 2px solid rgba(129, 140, 248, 0.9); /* indigo-400 */
    outline-offset: 2px;
}

/* --- Scrollbar Utilities --- */
.scrollbar-none::-webkit-scrollbar {
    display: none;
}

.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Mobile Landscape Layout --- */
@media (orientation: landscape) and (max-width: 1024px) {
    .mobile-landscape-grid {
        display: grid;
        grid-template-columns: 1fr 1.25fr;
        gap: 1.5rem;
    }
    .mobile-landscape-form,
    .mobile-landscape-result {
        min-height: 0;
    }
    .mobile-landscape-sticky {
        position: sticky;
        top: 0.75rem;
        align-self: start;
    }
    .chart-box {
        height: 65vh;
        max-height: 500px;
    }
}

/* --- Currency Switcher Styles --- */
#currency-tooltip {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#currency-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.currency-option[aria-selected="true"] {
    background-color: rgba(79, 70, 229, 0.15);
    color: #e5e7eb;
}

.currency-option[aria-selected="true"]:hover {
    background-color: rgba(79, 70, 229, 0.25);
}

/* --- Footnote Styles --- */
.footnote-ref {
    font-size: 0.7em; /* Slightly smaller than default sup */
    vertical-align: super;
    margin-left: 2px;
    padding: 0.1em 0.3em;
    background-color: rgba(55, 65, 81, 0.5); /* gray-700/50 */
    border-radius: 4px;
    color: #d1d5db; /* gray-300 */
    font-weight: 600;
    line-height: 1; /* Prevent affecting line height */
    text-decoration: none; /* Remove underline from links if any */
}

.footnote-box {
    background-color: rgba(17, 24, 39, 0.5); /* gray-900/50 */
    border: 1px solid rgba(55, 65, 81, 0.3); /* gray-700/30 */
    border-radius: 0.75rem; /* rounded-xl */
    padding: 1.25rem; /* p-5 */
    margin-top: 1.5rem; /* mt-6 */
    font-style: normal; /* Override parent's italic if needed */
}

.footnote-box .footnote-title {
    font-weight: 600;
    color: #9ca3af; /* gray-400 */
    font-size: 1.125rem; /* text-lg */
    margin-bottom: 0.75rem; /* mb-3 */
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    padding-bottom: 0.75rem;
}

.footnote-box p, .footnote-box ol, .footnote-box ul {
    color: #9ca3af; /* gray-400 */
}

.footnote-box strong {
    color: #e5e7eb; /* gray-200 */
    font-weight: 600;
}

/* --- Header Layout Helpers --- */
.floating-nav {
    position: relative;
    border-radius: 0;
    border: none;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}

.floating-nav::after {
    content: none;
}

.floating-nav > * {
    position: relative;
    z-index: 1;
}

.header-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    row-gap: 1rem;
}

.header-bar__logo {
    flex: 0 0 auto;
    min-width: 0;
}

.header-bar__primary {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    row-gap: 0.75rem;
    min-width: 0;
}

.header-links {
    flex: 1 1 auto;
    min-width: 0;
    column-gap: 1rem;
    row-gap: 0.5rem;
    flex-wrap: nowrap;
}

.header-controls {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem 0.75rem;
    flex: 0 1 auto;
    min-width: 0;
}

.header-controls > * {
    flex-shrink: 0;
}

.header-controls__currency {
    flex: 0 0 auto;
}

@media (max-width: 1350px) and (min-width: 1024px) {
    .header-bar__logo {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem;
        text-align: center;
    }

    .header-bar__brand {
        line-height: 1.2;
        margin-top: -0.1rem;
        text-align: center;
    }
}

.nav-link {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .header-bar {
        gap: 0.6rem;
    }

    .header-bar__logo {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        text-align: center;
    }

    .header-bar__logo img {
        transform: translateY(0.15rem);
    }

    .header-bar__brand {
        font-size: 1.25rem !important;
        line-height: 1.1;
        text-align: center;
        margin-top: -0.05rem;
    }
}

@media (max-width: 1023px) {
    .header-bar__logo {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.75rem;
        text-align: left;
    }

    .header-bar__brand {
        margin-top: 0;
        text-align: left;
    }
}

@media (max-width: 760px) {
    .header-bar__logo {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        text-align: center;
    }

    .header-bar__brand {
        line-height: 1.12;
        text-align: center;
        margin-top: -0.05rem;
    }
}

@media (max-width: 540px) {
    .header-controls {
        gap: 0.3rem 0.45rem;
    }
}

@media (max-width: 420px) {
    .header-bar {
        gap: 0.45rem;
    }

    .header-controls {
        gap: 0.25rem 0.35rem;
    }

    #mobile-menu-button svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .language-toggle--compact .language-track {
        min-width: 4.4rem;
    }

    .language-toggle--compact .language-option {
        padding: 0.32rem 0.5rem;
    }

    #currency-button {
        font-size: 0.95rem;
    }

    #currency-button svg {
        width: 1rem;
        height: 1rem;
    }
}

@media (min-width: 640px) {
    .header-controls {
        gap: 0.75rem 1rem;
    }
}

@media (min-width: 1024px) {
    .header-bar {
        flex-wrap: nowrap;
    }

    .header-links {
        justify-content: flex-end;
    }

    .header-bar__primary {
        flex-wrap: nowrap;
        align-items: center;
    }
}

@media (min-width: 1024px) {
    .header-links {
        column-gap: 1.25rem;
    }

    .header-controls {
        gap: 1rem 1.25rem;
        margin-left: 1rem;
    }
}

@media (max-width: 1350px) {
    .header-links {
        column-gap: 0.75rem;
    }
}

@media (max-width: 1120px) {
    .nav-link {
        white-space: normal;
    }
}

/* --- Navigation Tabs --- */
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: 0.7rem;
    border: 1px solid transparent;
    transition: color 0.25s ease, transform 0.25s ease;
    text-decoration: none;
    font-weight: 500;
    min-width: 0;
    max-width: 100%;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
    position: relative;
    overflow: hidden;
    color: #e2e8f0;
    background: transparent;
    box-shadow: none;
}

.nav-link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(96, 165, 250, 0.12));
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}


.nav-link:hover {
    color: #f8fafc;
    transform: translateY(-1px);
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
    opacity: 1;
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(8, 24, 48, 0.78));
    color: #f8fafc;
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: 0 12px 26px -20px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-link:focus-visible {
    color: #f8fafc;
}

.nav-link.active::after {
    opacity: 1;
}

.mobile-nav-link {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* --- Scrolling Tab Controls --- */
.scrolling-tabs-container {
    margin-block: 0;
    padding-block: 0.75rem;
}

.scrolling-tabs-container nav {
    padding-block: 0.2rem;
    overflow-y: visible;
}

.scroll-button {
    display: none;
}

@media (max-width: 767px) {
    .scrolling-tabs-container {
        position: relative;
    }

    .scrolling-tabs-container nav {
        padding-block: 0.4rem;
    }

    .scrolling-tabs-container::before,
    .scrolling-tabs-container::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 3rem;
        pointer-events: none;
        transition: opacity 0.3s ease;
        opacity: 0;
        z-index: 5;
    }

    .scrolling-tabs-container::before {
        left: 0;
        background: linear-gradient(to right, rgb(31 41 55), transparent);
    }

    .scrolling-tabs-container::after {
        right: 0;
        background: linear-gradient(to left, rgb(31 41 55), transparent);
    }

    .scrolling-tabs-container.show-scroll-start::before {
        opacity: 1;
    }

    .scrolling-tabs-container.show-scroll-end::after {
        opacity: 1;
    }

    .scroll-button {
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        background-color: transparent;
        border: none;
        color: #9ca3af;
        cursor: pointer;
        transition: opacity 0.3s ease, color 0.2s ease;
        opacity: 0;
        pointer-events: none;
    }

    .scroll-button:hover {
        color: #fff;
    }

    .scroll-button.left-0 {
        left: 0;
    }

    .scroll-button.right-0 {
        right: 0;
    }

    .scrolling-tabs-container.show-scroll-start [data-scroll-button="left"],
    .scrolling-tabs-container.show-scroll-end [data-scroll-button="right"] {
        opacity: 1;
        pointer-events: auto;
    }
}

/* --- Tab & Panel Animations --- */
.tab-button {
    position: relative;
    transition: all 0.22s ease-in-out;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 0.5rem;
    border-radius: 0.9rem;
    border: 1px solid transparent;
    background: transparent;
    color: #e2e8f0;
    box-shadow: none;
}

.tab-button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(96, 165, 250, 0.1));
    opacity: 0;
    transition: opacity 0.22s ease-in-out;
    pointer-events: none;
}

.tab-button svg {
    flex-shrink: 0;
    margin-top: 0.05rem;
    color: inherit;
}


.tab-button:hover {
    color: #f8fafc;
    transform: translateY(-1px);
}

.tab-button[aria-selected="true"] {
    border-color: rgba(96, 165, 250, 0.55);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(8, 24, 48, 0.82));
    color: #f8fafc;
    box-shadow: 0 12px 26px -20px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.tab-button:focus-visible {
    color: #f8fafc;
}

.tab-button[aria-selected="true"]::after {
    opacity: 1;
}

@media (min-width: 768px) {
    .tab-button {
        text-align: center;
        justify-content: center;
        align-items: center;
    }

    .tab-button svg {
        margin-top: 0;
    }
}

.tab-panel {
    animation: fadeIn 0.3s ease-out forwards;
}

/* --- Options Form Enhancements --- */
.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(75, 85, 99, 0.5);
    background: rgba(17, 24, 39, 0.55);
    cursor: pointer;
    transition: border 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.radio-card:hover {
    border-color: rgba(129, 140, 248, 0.7);
    background: rgba(79, 70, 229, 0.15);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.35);
}

.radio-card--active {
    border-color: rgba(99, 102, 241, 0.9);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35), 0 18px 30px rgba(30, 64, 175, 0.35);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(17, 24, 39, 0.7));
}

.radio-card-title {
    display: block;
    font-weight: 600;
    color: #e5e7eb;
}

.radio-card-description {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #94a3b8;
}

.radio-card-input {
    margin-top: 0.25rem;
    flex-shrink: 0;
    accent-color: #6366f1;
}

.breakeven-mode-toggle,
.segmented-toggle {
    display: inline-flex;
    padding: 0.25rem;
    background: rgba(31, 41, 55, 0.75);
    border-radius: 9999px;
    gap: 0.25rem;
    border: 1px solid rgba(75, 85, 99, 0.6);
}

.mode-toggle-button,
.segmented-toggle-button {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.55rem 1.35rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.mode-toggle-button:not(.is-active):hover,
.segmented-toggle-button:not(.is-active):hover {
    color: #e5e7eb;
    background: rgba(59, 130, 246, 0.08);
}

.mode-toggle-button.is-active,
.segmented-toggle-button.is-active {
    color: #f9fafb;
    background: rgba(79, 70, 229, 0.78);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.6);
    transform: translateY(-1px);
}

.mode-toggle-button[data-breakeven-mode="pro"].is-active,
.segmented-toggle-button[data-toggle-theme="teal"].is-active {
    background: rgba(16, 185, 129, 0.75);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.55);
}

.breakeven-mode-toggle {
    position: relative;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgba(31, 41, 55, 0.85);
    border: 1px solid rgba(75, 85, 99, 0.6);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.breakeven-mode-toggle .mode-toggle-button {
    position: relative;
    color: #9ca3af;
    background: transparent;
    border: none;
    box-shadow: none;
}

.breakeven-mode-toggle .mode-toggle-button:not(.is-active):hover {
    color: #e5e7eb;
    background: rgba(59, 130, 246, 0.08);
}

.breakeven-mode-toggle .mode-toggle-button.is-active {
    color: #f9fafb;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.35), rgba(59, 130, 246, 0.35));
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.35);
    transform: translateY(-1px);
}

.breakeven-mode-toggle .mode-toggle-button[data-breakeven-mode="pro"].is-active {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.45), rgba(14, 165, 233, 0.45));
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.4);
}

.segmented-toggle {
    display: inline-flex;
    padding: 0.25rem;
    background: rgba(17, 24, 39, 0.85);
    border-radius: 9999px;
    gap: 0.25rem;
    border: 1px solid rgba(75, 85, 99, 0.55);
}

.segmented-toggle-button {
    border: none;
    background: transparent;
    color: #d1d5db;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1.2rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.segmented-toggle-button:not(.is-active):hover {
    color: #f9fafb;
    background: rgba(99, 102, 241, 0.08);
}

.segmented-toggle-button.is-active {
    color: #f8fafc;
    background: rgba(99, 102, 241, 0.82);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.65);
    transform: translateY(-1px);
}

.segmented-toggle-button[data-toggle-theme="teal"].is-active {
    background: rgba(16, 185, 129, 0.8);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.6);
}

.link-button {
    border: none;
    background: none;
    color: #60a5fa;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.link-button:hover {
    color: #93c5fd;
}

.chip-button {
    border-radius: 9999px;
    border: 1px solid rgba(156, 163, 175, 0.4);
    background: rgba(31, 41, 55, 0.6);
    color: #e5e7eb;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.chip-button:hover,
.chip-button:focus-visible {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    outline: none;
}

.input-field--condensed {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    min-width: 4.5rem;
}

.range-field {
    width: 100%;
    cursor: pointer;
    accent-color: #a855f7;
}

.stacked-radio-group {
    display: grid;
    gap: 0.5rem;
}

.stacked-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(31, 41, 55, 0.6);
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(75, 85, 99, 0.5);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.stacked-radio-option:hover,
.stacked-radio-option:focus-within {
    border-color: rgba(96, 165, 250, 0.6);
    background: rgba(30, 64, 175, 0.35);
}

.stacked-radio-option input[type="radio"] {
    margin-top: 0.35rem;
    accent-color: #60a5fa;
}

.stacked-radio-option .option-title {
    display: block;
    font-weight: 600;
    color: #f9fafb;
    font-size: 0.9rem;
}

.stacked-radio-option .option-hint {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
}

.collapsible-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
}

.collapsible-summary::-webkit-details-marker {
    display: none;
}

[data-collapsible-section] {
    border-radius: 1rem;
    border: 1px solid rgba(75, 85, 99, 0.4);
    background: rgba(17, 24, 39, 0.75);
}

[data-collapsible-section] + [data-collapsible-section] {
    margin-top: 1.5rem;
}

.section-card details[open] > .collapsible-summary {
    border-bottom: 1px solid rgba(55, 65, 81, 0.6);
}

.range-field:focus-visible,
.chip-button:focus-visible,
.stacked-radio-option:focus-visible,
.mode-toggle-button:focus-visible,
.segmented-toggle-button:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.65);
    outline-offset: 2px;
}

.breakeven-pro-sections.hidden {
    display: none;
}

.breakeven-mode-toggle + p strong {
    color: #e0f2fe;
}

.actual-premium-container {
    display: none;
}

.actual-premium-container.is-visible {
    display: block;
}

.regreek-toggle-card {
    border-radius: 0.75rem;
    border: 1px solid rgba(75, 85, 99, 0.55);
    background: rgba(17, 24, 39, 0.55);
    padding: 1.25rem;
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.regreek-toggle-card:hover {
    border-color: rgba(59, 130, 246, 0.55);
}

.regreek-toggle-card[data-regreek-active="true"] {
    border-color: rgba(56, 189, 248, 0.6);
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.3), rgba(13, 148, 136, 0.2));
    box-shadow: 0 12px 24px rgba(13, 148, 136, 0.18);
}

.regreek-toggle-card:focus-within {
    border-color: rgba(129, 140, 248, 0.75);
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25);
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    width: 3.3rem;
    height: 1.7rem;
    border-radius: 9999px;
    border: 1px solid rgba(75, 85, 99, 0.7);
    background: linear-gradient(135deg, rgba(55, 65, 81, 0.85), rgba(17, 24, 39, 0.9));
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgba(55, 65, 81, 0.85), rgba(17, 24, 39, 0.9));
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.toggle-thumb {
    position: absolute;
    top: 0.18rem;
    left: 0.2rem;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 9999px;
    background: #111827;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: transform 0.25s ease, background 0.25s ease;
}

.toggle-switch input:focus-visible + .toggle-track {
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5);
}

.toggle-switch input:checked + .toggle-track {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.65), rgba(59, 130, 246, 0.65));
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.25);
}

.toggle-switch input:checked + .toggle-track + .toggle-thumb {
    transform: translateX(1.6rem);
    background: #f9fafb;
}

.language-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.12rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(17, 24, 39, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 10px 28px -18px rgba(99, 102, 241, 0.6);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.language-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 42px -22px rgba(59, 130, 246, 0.45);
}

.language-toggle input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.language-track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    border-radius: 9999px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    border: none;
    min-width: 9.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.02em;
}

.language-option {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0.55rem 0.95rem;
    transition: color 0.25s ease;
}

.language-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.language-label--short {
    display: none;
    text-transform: uppercase;
}

.language-active {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.6), rgba(16, 185, 129, 0.6));
    box-shadow: 0 20px 38px -22px rgba(16, 185, 129, 0.5);
    backdrop-filter: blur(8px);
    border-radius: inherit;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.language-toggle input:checked + .language-track .language-active {
    transform: translateX(100%);
}

.language-toggle input:not(:checked) + .language-track .language-option--en,
.language-toggle input:checked + .language-track .language-option--es {
    color: #f9fafb;
}

.language-toggle input:focus-visible + .language-track {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.45);
}

.language-toggle--compact .language-track {
    min-width: 8.8rem;
    font-size: 0.7rem;
}

.language-toggle--compact .language-option {
    padding: 0.45rem 0.75rem;
}

@media (max-width: 380px) {
    .language-toggle--compact .language-track {
        min-width: 8.2rem;
        font-size: 0.66rem;
    }

    .language-toggle--compact .language-option {
        padding: 0.4rem 0.65rem;
    }
}

@media (max-width: 1350px) {
    .language-track {
        min-width: 7rem;
    }

    .language-toggle--compact .language-track {
        min-width: 6.2rem;
    }

    .language-label--full {
        display: none;
    }

    .language-label--short {
        display: inline-flex;
    }
}

.lockable-field[data-locked="false"] .lock-overlay {
    display: none;
}

.lockable-field[data-locked="true"] .lock-overlay {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.lockable-field[data-locked="true"]:hover .lock-overlay {
    opacity: 1;
}

.lockable-field[data-locked="true"] input {
    cursor: not-allowed;
}

/* --- Result Tiles & Badges --- */
.result-tile {
    padding: 1.1rem 1.25rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(71, 85, 105, 0.4);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.55), rgba(15, 23, 42, 0.85));
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
    text-align: center;
}

.result-tile-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.result-tile-value {
    margin-top: 0.3rem;
    font-size: 1.9rem;
    font-weight: 700;
    color: #c7d2fe;
}

.result-tile-description {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #94a3b8;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-badge svg {
    width: 1rem;
    height: 1rem;
}

/* IV Rank status pills */
.iv-rank-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.iv-rank-status__dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 9999px;
    display: inline-block;
}

.iv-rank-status__label {
    line-height: 1.25;
}

.iv-rank-status--low {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.35);
}

.iv-rank-status--low .iv-rank-status__dot {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.iv-rank-status--neutral {
    color: #fef08a;
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid rgba(252, 211, 77, 0.35);
}

.iv-rank-status--neutral .iv-rank-status__dot {
    background: linear-gradient(135deg, #facc15, #eab308);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.25);
}

.iv-rank-status--high {
    color: #fecdd3;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.iv-rank-status--high .iv-rank-status__dot {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

/* --- Marketing card backgrounds --- */
.showcase-card__bg {
    --showcase-card-photo: none;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: -1;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.showcase-card__bg--growth {
    --showcase-card-photo: url('../images/compound-card-bg.webp');
    background-image:
        radial-gradient(circle at 12% 20%, rgba(99, 102, 241, 0.45), transparent 58%),
        radial-gradient(circle at 82% 86%, rgba(34, 211, 238, 0.3), transparent 60%),
        linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(56, 189, 248, 0.05)),
        var(--showcase-card-photo);
}

.showcase-card__bg--diversify {
    --showcase-card-photo: url('../images/dca-card-bg.webp');
    background-image:
        radial-gradient(circle at 18% 78%, rgba(244, 114, 182, 0.4), transparent 60%),
        radial-gradient(circle at 82% 12%, rgba(129, 140, 248, 0.25), transparent 58%),
        linear-gradient(155deg, rgba(217, 70, 239, 0.08), rgba(56, 189, 248, 0.04)),
        var(--showcase-card-photo);
}

.showcase-card__bg--investor {
    --showcase-card-photo: url('../images/capital-gains-card-bg.webp');
    background-image:
        radial-gradient(circle at 18% 18%, rgba(52, 211, 153, 0.4), transparent 58%),
        radial-gradient(circle at 88% 72%, rgba(45, 212, 191, 0.3), transparent 58%),
        linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(30, 64, 175, 0.04)),
        var(--showcase-card-photo);
}

.showcase-card__bg--planning {
    --showcase-card-photo: url('../images/options-card-bg.webp');
    background-image:
        radial-gradient(circle at 14% 70%, rgba(129, 140, 248, 0.38), transparent 60%),
        radial-gradient(circle at 76% 18%, rgba(248, 113, 113, 0.24), transparent 58%),
        linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(79, 70, 229, 0.05)),
        var(--showcase-card-photo);
}

@supports (background-image: image-set(url('../images/compound-card-bg.webp') 1x)) {
    .showcase-card__bg--growth {
        --showcase-card-photo: image-set(
            url('../images/compound-card-bg.webp') 1x,
            url('../images/compound-card-bg@2x.webp') 2x
        );
    }

    .showcase-card__bg--diversify {
        --showcase-card-photo: image-set(
            url('../images/dca-card-bg.webp') 1x,
            url('../images/dca-card-bg@2x.webp') 2x
        );
    }

    .showcase-card__bg--investor {
        --showcase-card-photo: image-set(
            url('../images/capital-gains-card-bg.webp') 1x,
            url('../images/capital-gains-card-bg@2x.webp') 2x
        );
    }

    .showcase-card__bg--planning {
        --showcase-card-photo: image-set(
            url('../images/options-card-bg.webp') 1x,
            url('../images/options-card-bg@2x.webp') 2x
        );
    }
}

.showcase-card__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0.12;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.group:hover .showcase-card__bg::after {
    opacity: 0.3;
}

.group:hover .showcase-card__bg {
    transform: scale(1.02);
}

/* --- Ghost Back Button (Matches Home/Contact) --- */
.back-link-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;          /* Gap between arrow and text */
    color: #94a3b8;       /* Muted Gray (Slate-400) */
    text-decoration: none;
    font-size: 0.875rem;  /* 14px */
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.back-link-ghost:hover {
    color: #818cf8;       /* Indigo-400 (Bright Blue) on hover */
    transform: translateX(-4px); /* Professional slide-left animation */
}

.back-link-ghost svg {
    stroke-width: 2.5;    /* Thicker, cleaner lines like the other pages */
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}