:root {
  --price-mobile-bar-cookie-space: 72px;
  --price-mobile-bar-edge-gap: 12px;
  --price-mobile-bar-max-width: 520px;
}

.calculator-mobile-bar {
  display: none;
}

.calculator-mobile-bar[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  #calculator {
    padding-bottom: 132px;
  }

  .calculator-mobile-bar {
    position: fixed;
    right: max(var(--price-mobile-bar-edge-gap), env(safe-area-inset-right, 0px));
    bottom: max(var(--price-mobile-bar-edge-gap), env(safe-area-inset-bottom, 0px));
    z-index: 80;
    display: grid;
    width: min(
      var(--price-mobile-bar-max-width),
      calc(
        100% - var(--price-mobile-bar-cookie-space) - var(--price-mobile-bar-edge-gap) -
          env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
      )
    );
    min-width: 0;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    overflow: visible;
    padding: 10px;
    border: 1px solid #fed7aa;
    border-radius: 14px;
    background: var(--landing-color-surface-glass);
    box-shadow: 0 16px 28px var(--landing-color-shadow-elevated);
    backdrop-filter: blur(6px);
  }

  .site-menu-open .calculator-mobile-bar {
    display: none;
  }

  .calculator-mobile-bar-text {
    display: grid;
    min-width: 0;
  }

  .calculator-mobile-bar-text small {
    overflow: hidden;
    color: #64748b;
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calculator-mobile-bar-total {
    overflow: hidden;
    color: #c2410c;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calculator-mobile-bar-btn {
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: #f97316;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
  }

  .calculator-mobile-bar-close {
    position: absolute;
    top: -32px;
    right: -6px;
    z-index: 1;
    display: inline-grid;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--landing-color-border);
    border-radius: 9999px;
    background: var(--landing-color-surface);
    box-shadow: var(--landing-shadow-control);
    color: var(--landing-color-text-body);
    cursor: pointer;
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    touch-action: manipulation;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
      box-shadow 0.18s ease;
  }

  @media (hover: hover) {
    .calculator-mobile-bar-close:hover {
      border-color: var(--landing-color-control-border);
      background: var(--landing-color-surface-muted);
      color: var(--landing-color-text-heading);
    }
  }

  .calculator-mobile-bar-close:active {
    background: var(--landing-color-surface-warm);
  }

  .calculator-mobile-bar-close:focus-visible {
    outline: 2px solid var(--landing-color-focus);
    outline-offset: 2px;
  }
}

@media (max-width: 360px) {
  .calculator-mobile-bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 79px);
    gap: 6px;
    padding: 8px;
  }

  .calculator-mobile-bar-text small {
    font-size: 10px;
  }

  .calculator-mobile-bar-total {
    font-size: 18px;
  }

  .calculator-mobile-bar-btn {
    width: 79px;
    padding-inline: 8px;
    font-size: 12px;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

}
