/* The Income Goal mobile pattern, using each calculator's existing validated result. */
.calculator-mobile-dock,
.calculator-back-to-top { display:none; }

@media screen and (max-width:900px) {
  .calculator-mobile-dock:not([hidden]) {
    position:fixed; inset:auto 0 0; z-index:50; display:block;
    padding:var(--th-space-4) max(var(--th-space-4),env(safe-area-inset-right)) max(var(--th-space-4),env(safe-area-inset-bottom)) max(var(--th-space-4),env(safe-area-inset-left));
    border:0; border-radius:var(--th-radius-card) var(--th-radius-card) 0 0;
    background:linear-gradient(180deg,var(--th-color-surface) 25%,color-mix(in srgb,var(--th-color-violet-soft) 45%,var(--th-color-surface)));
    box-shadow:var(--th-shadow-floating); color:var(--th-color-ink);
    font-family:var(--th-font-interface); overflow-wrap:anywhere;
  }
  .calculator-mobile-dock::before {
    content:""; position:absolute; inset:0 0 auto; height:3px;
    border-radius:var(--th-radius-card) var(--th-radius-card) 0 0;
    background:var(--th-gradient-accent-horizontal);
  }
  .calculator-mobile-label {
    display:block; margin:0 0 var(--th-space-1); color:var(--th-color-text-muted);
    font-size:12px; font-weight:500; line-height:1.4;
  }
  .calculator-mobile-total {
    display:block; color:var(--th-color-violet-strong); font-size:24px; font-weight:600;
    line-height:1.2; font-variant-numeric:tabular-nums;
  }
  :where(.calculator-mobile-dock[data-outcome=loss]) .calculator-mobile-total { color:var(--th-color-danger); }
  .calculator-mobile-note {
    margin:var(--th-space-2) 0 0; color:var(--th-color-text-muted);
    font-size:13px; font-weight:400; line-height:1.5;
  }
  .calculator-mobile-note:empty { display:none; }
  .calculator-mobile-note.is-pending { color:var(--th-color-warning); }
  .calculator-mobile-print {
    width:100%; min-height:var(--th-control-height-prominent);
    gap:var(--th-space-2); margin-top:var(--th-space-3); white-space:normal;
  }
  .calculator-mobile-print svg { flex:none; width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
  .calculator-mobile-print:focus-visible { outline:2px solid var(--th-color-violet); outline-offset:3px; box-shadow:var(--th-focus-ring); }
  body.has-calculator-mobile-result .startup-main { padding-bottom:calc(var(--th-space-12) + var(--calculator-mobile-dock-height,0px)); }
  .startup-main :is(input,select,textarea,button,a,summary) { scroll-margin-block:120px calc(var(--calculator-mobile-dock-height,0px) + var(--th-space-4)); }

  .calculator-back-to-top {
    position:fixed; inset-inline-end:calc(var(--th-space-4) + env(safe-area-inset-right,0px));
    bottom:calc(var(--th-space-4) + env(safe-area-inset-bottom,0px)); z-index:51;
    display:grid; place-items:center; width:var(--th-control-height-prominent); height:var(--th-control-height-prominent);
    padding:0; border:2px solid var(--th-color-surface); border-radius:var(--th-radius-pill);
    background:var(--th-gradient-action-primary); color:var(--th-color-surface); box-shadow:var(--th-shadow-control);
    cursor:pointer; touch-action:manipulation; opacity:0; visibility:hidden; pointer-events:none;
  }
  .calculator-back-to-top.is-visible { opacity:1; visibility:visible; pointer-events:auto; }
  .calculator-back-to-top.in-header {
    top:var(--calculator-header-top,var(--th-space-2)); bottom:auto;
    inset-inline-end:var(--calculator-header-right,64px); z-index:5001; box-shadow:none;
  }
  .calculator-back-to-top svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
  .calculator-back-to-top:focus-visible { outline:2px solid var(--th-color-violet-strong); outline-offset:2px; }
}
@media (hover:hover) { .calculator-back-to-top:hover { background:var(--th-gradient-action-primary-hover); } }
@media (prefers-reduced-motion:no-preference) { .calculator-back-to-top { transition:opacity 150ms ease; } }
.menu-open .calculator-mobile-dock,
.menu-open .calculator-back-to-top,
.th-embed .calculator-mobile-dock,
.th-embed .calculator-back-to-top { display:none; }
@media (forced-colors:active) {
  .calculator-mobile-dock:not([hidden]) { background:Canvas; color:CanvasText; border:1px solid CanvasText; }
  .calculator-mobile-dock::before { display:none; }
  .calculator-mobile-total,.calculator-mobile-label,.calculator-mobile-note,.calculator-mobile-note.is-pending { color:CanvasText; }
  .calculator-back-to-top { background:ButtonFace; color:ButtonText; border-color:ButtonText; }
  .calculator-back-to-top:focus-visible,.calculator-mobile-print:focus-visible { outline-color:Highlight; }
}
@media print {
  .calculator-mobile-dock,.calculator-back-to-top { display:none!important; }
  body.has-calculator-mobile-result .startup-main { padding-bottom:0; }
}
